tx

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// ProtoBlobTxTypeID is included in each encoded BlobTx to help prevent
	// decoding binaries that are not actually BlobTxs.
	ProtoBlobTxTypeID = "BLOB"
)
View Source
const (
	// ProtoIndexWrapperTypeID is included in each encoded IndexWrapper to help prevent
	// decoding binaries that are not actually IndexWrappers.
	ProtoIndexWrapperTypeID = "INDX"
)

Variables

This section is empty.

Functions

func MarshalBlobTx

func MarshalBlobTx(tx []byte, blobs ...*share.Blob) ([]byte, error)

MarshalBlobTx creates a BlobTx using a normal transaction and some number of blobs.

NOTE: Any checks on the blobs or the transaction must be performed in the application

func MarshalIndexWrapper

func MarshalIndexWrapper(tx []byte, shareIndexes ...uint32) ([]byte, error)

MarshalIndexWrapper creates a wrapped Tx that includes the original transaction and the share index of the start of its blob.

NOTE: must be unwrapped to be a viable sdk.Tx

func NewIndexWrapper

func NewIndexWrapper(tx []byte, shareIndexes ...uint32) *v1.IndexWrapper

NewIndexWrapper creates a new IndexWrapper transaction.

func UnmarshalIndexWrapper

func UnmarshalIndexWrapper(tx []byte) (*v1.IndexWrapper, bool)

UnmarshalIndexWrapper attempts to unmarshal the provided transaction into an IndexWrapper transaction. It returns true if the provided transaction is an IndexWrapper transaction. An IndexWrapper transaction is a transaction that contains a MsgPayForBlob that has been wrapped with a share index.

NOTE: protobuf sometimes does not throw an error if the transaction passed is not a IndexWrapper, since the protobuf definition for MsgPayForBlob is kept in the app, we cannot perform further checks without creating an import cycle.

Types

type BlobTx

type BlobTx struct {
	Tx    []byte
	Blobs []*share.Blob
}

func UnmarshalBlobTx

func UnmarshalBlobTx(tx []byte) (*BlobTx, bool, error)

UnmarshalBlobTx attempts to unmarshal a transaction into blob transaction. It returns a boolean If the bytes are of type BlobTx and an error if there is a problem with decoding

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL