Documentation
¶
Overview ¶
Package txs is a generated GoMock package.
Index ¶
- Constants
- Variables
- func IsSortedAndUniqueOperations(ops []*Operation, c codec.Manager) bool
- func SortOperations(ops []*Operation, c codec.Manager)
- func SortOperationsWithSigners(ops []*Operation, signers [][]*secp256k1.PrivateKey, codec codec.Manager)
- type BaseTx
- type CreateAssetTx
- type ExportTx
- type ImportTx
- type InitialState
- type MockUnsignedTx
- func (m *MockUnsignedTx) Bytes() []byte
- func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
- func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
- func (m *MockUnsignedTx) InputIDs() set.Set[ids.ID]
- func (m *MockUnsignedTx) InputUTXOs() []*avax.UTXOID
- func (m *MockUnsignedTx) NumCredentials() int
- func (m *MockUnsignedTx) SetBytes(arg0 []byte)
- func (m *MockUnsignedTx) Visit(arg0 Visitor) error
- type MockUnsignedTxMockRecorder
- func (mr *MockUnsignedTxMockRecorder) Bytes() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InputUTXOs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) NumCredentials() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) SetBytes(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) Visit(arg0 interface{}) *gomock.Call
- type Operation
- type OperationTx
- type Parser
- type Tx
- func (t *Tx) Bytes() []byte
- func (t *Tx) ID() ids.ID
- func (t *Tx) Initialize(c codec.Manager) error
- func (t *Tx) SetBytes(unsignedBytes, signedBytes []byte)
- func (t *Tx) SignNFTFx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
- func (t *Tx) SignPropertyFx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
- func (t *Tx) SignSECP256K1Fx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
- func (t *Tx) UTXOs() []*avax.UTXO
- type UnsignedTx
- type Visitor
Constants ¶
const CodecVersion = 0
CodecVersion is the current default codec version
Variables ¶
var (
ErrNilInitialState = errors.New("nil initial state is not valid")
ErrNilFxOutput = errors.New("nil feature extension output is not valid")
ErrOutputsNotSorted = errors.New("outputs not sorted")
ErrUnknownFx = errors.New("unknown feature extension")
)
var (
ErrNilOperation = errors.New("nil operation is not valid")
ErrNilFxOperation = errors.New("nil fx operation is not valid")
ErrNotSortedAndUniqueUTXOIDs = errors.New("utxo IDs not sorted and unique")
)
Functions ¶
func IsSortedAndUniqueOperations ¶
func IsSortedAndUniqueOperations(ops []*Operation, c codec.Manager) bool
func SortOperations ¶
func SortOperations(ops []*Operation, c codec.Manager)
func SortOperationsWithSigners ¶
func SortOperationsWithSigners(ops []*Operation, signers [][]*secp256k1.PrivateKey, codec codec.Manager)
Types ¶
type BaseTx ¶
type BaseTx struct {
avax.BaseTx `serialize:"true"`
// contains filtered or unexported fields
}
BaseTx is the basis of all transactions.
type CreateAssetTx ¶
type CreateAssetTx struct {
BaseTx `serialize:"true"`
Name string `serialize:"true" json:"name"`
Symbol string `serialize:"true" json:"symbol"`
Denomination byte `serialize:"true" json:"denomination"`
States []*InitialState `serialize:"true" json:"initialStates"`
}
CreateAssetTx is a transaction that creates a new asset.
func (*CreateAssetTx) InitialStates ¶
func (t *CreateAssetTx) InitialStates() []*InitialState
InitialStates track which virtual machines, and the initial state of these machines, this asset uses. The returned array should not be modified.
type ExportTx ¶
type ExportTx struct {
BaseTx `serialize:"true"`
// Which chain to send the funds to
DestinationChain ids.ID `serialize:"true" json:"destinationChain"`
// The outputs this transaction is sending to the other chain
ExportedOuts []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"`
}
ExportTx is a transaction that exports an asset to another blockchain.
type ImportTx ¶
type ImportTx struct {
BaseTx `serialize:"true"`
// Which chain to consume the funds from
SourceChain ids.ID `serialize:"true" json:"sourceChain"`
// The inputs to this transaction
ImportedIns []*avax.TransferableInput `serialize:"true" json:"importedInputs"`
}
ImportTx is a transaction that imports an asset from another blockchain.
func (*ImportTx) InputUTXOs ¶
func (t *ImportTx) InputUTXOs() []*avax.UTXOID
InputUTXOs track which UTXOs this transaction is consuming.
func (*ImportTx) NumCredentials ¶
func (t *ImportTx) NumCredentials() int
NumCredentials returns the number of expected credentials
type InitialState ¶
type InitialState struct {
FxIndex uint32 `serialize:"true" json:"fxIndex"`
FxID ids.ID `serialize:"false" json:"fxID"`
Outs []verify.State `serialize:"true" json:"outputs"`
}
type MockUnsignedTx ¶ added in v1.9.12
type MockUnsignedTx struct {
// contains filtered or unexported fields
}
MockUnsignedTx is a mock of UnsignedTx interface.
func NewMockUnsignedTx ¶ added in v1.9.12
func NewMockUnsignedTx(ctrl *gomock.Controller) *MockUnsignedTx
NewMockUnsignedTx creates a new mock instance.
func (*MockUnsignedTx) Bytes ¶ added in v1.9.12
func (m *MockUnsignedTx) Bytes() []byte
Bytes mocks base method.
func (*MockUnsignedTx) EXPECT ¶ added in v1.9.12
func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUnsignedTx) InitCtx ¶ added in v1.9.12
func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
InitCtx mocks base method.
func (*MockUnsignedTx) InputIDs ¶ added in v1.9.12
func (m *MockUnsignedTx) InputIDs() set.Set[ids.ID]
InputIDs mocks base method.
func (*MockUnsignedTx) InputUTXOs ¶ added in v1.9.12
func (m *MockUnsignedTx) InputUTXOs() []*avax.UTXOID
InputUTXOs mocks base method.
func (*MockUnsignedTx) NumCredentials ¶ added in v1.9.12
func (m *MockUnsignedTx) NumCredentials() int
NumCredentials mocks base method.
type MockUnsignedTxMockRecorder ¶ added in v1.9.12
type MockUnsignedTxMockRecorder struct {
// contains filtered or unexported fields
}
MockUnsignedTxMockRecorder is the mock recorder for MockUnsignedTx.
func (*MockUnsignedTxMockRecorder) Bytes ¶ added in v1.9.12
func (mr *MockUnsignedTxMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockUnsignedTxMockRecorder) InitCtx ¶ added in v1.9.12
func (mr *MockUnsignedTxMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
InitCtx indicates an expected call of InitCtx.
func (*MockUnsignedTxMockRecorder) InputIDs ¶ added in v1.9.12
func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
InputIDs indicates an expected call of InputIDs.
func (*MockUnsignedTxMockRecorder) InputUTXOs ¶ added in v1.9.12
func (mr *MockUnsignedTxMockRecorder) InputUTXOs() *gomock.Call
InputUTXOs indicates an expected call of InputUTXOs.
func (*MockUnsignedTxMockRecorder) NumCredentials ¶ added in v1.9.12
func (mr *MockUnsignedTxMockRecorder) NumCredentials() *gomock.Call
NumCredentials indicates an expected call of NumCredentials.
type Operation ¶
type Operation struct {
avax.Asset `serialize:"true"`
UTXOIDs []*avax.UTXOID `serialize:"true" json:"inputIDs"`
FxID ids.ID `serialize:"false" json:"fxID"`
Op fxs.FxOperation `serialize:"true" json:"operation"`
}
type OperationTx ¶
type OperationTx struct {
BaseTx `serialize:"true"`
Ops []*Operation `serialize:"true" json:"operations"`
}
OperationTx is a transaction with no credentials.
func (*OperationTx) InputUTXOs ¶
func (t *OperationTx) InputUTXOs() []*avax.UTXOID
func (*OperationTx) NumCredentials ¶
func (t *OperationTx) NumCredentials() int
NumCredentials returns the number of expected credentials
func (*OperationTx) Operations ¶
func (t *OperationTx) Operations() []*Operation
Operations track which ops this transaction is performing. The returned array should not be modified.
type Parser ¶
type Parser interface {
Codec() codec.Manager
GenesisCodec() codec.Manager
CodecRegistry() codec.Registry
GenesisCodecRegistry() codec.Registry
ParseTx(bytes []byte) (*Tx, error)
ParseGenesisTx(bytes []byte) (*Tx, error)
InitializeTx(tx *Tx) error
InitializeGenesisTx(tx *Tx) error
}
func NewCustomParser ¶
func NewCustomParser(
typeToFxIndex map[reflect.Type]int,
clock *mockable.Clock,
log logging.Logger,
fxs []fxs.Fx,
) (Parser, error)
type Tx ¶
type Tx struct {
Unsigned UnsignedTx `serialize:"true" json:"unsignedTx"`
Creds []*fxs.FxCredential `serialize:"true" json:"credentials"` // The credentials of this transaction
TxID ids.ID `json:"id"`
// contains filtered or unexported fields
}
Tx is the core operation that can be performed. The tx uses the UTXO model. Specifically, a txs inputs will consume previous txs outputs. A tx will be valid if the inputs have the authority to consume the outputs they are attempting to consume and the inputs consume sufficient state to produce the outputs.
func (*Tx) Bytes ¶ added in v1.7.14
func (t *Tx) Bytes() []byte
Bytes returns the binary representation of this tx
func (*Tx) Initialize ¶ added in v1.7.14
func (t *Tx) Initialize(c codec.Manager) error
func (*Tx) SignNFTFx ¶
func (t *Tx) SignNFTFx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
func (*Tx) SignPropertyFx ¶
func (t *Tx) SignPropertyFx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
func (*Tx) SignSECP256K1Fx ¶
func (t *Tx) SignSECP256K1Fx(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
type UnsignedTx ¶
type UnsignedTx interface {
snow.ContextInitializable
SetBytes(unsignedBytes []byte)
Bytes() []byte
InputIDs() set.Set[ids.ID]
NumCredentials() int
// TODO: deprecate after x-chain linearization
InputUTXOs() []*avax.UTXOID
// Visit calls [visitor] with this transaction's concrete type
Visit(visitor Visitor) error
}