v2

package
v0.0.0-...-5d1547a Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: MIT, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeAptosSignedTxnBcs = "application/x.aptos.signed_transaction+bcs"

ContentTypeAptosSignedTxnBcs header for sending BCS transaction payloads

View Source
const ContentTypeAptosViewFunctionBcs = "application/x.aptos.view_function+bcs"

ContentTypeAptosViewFunctionBcs header for sending BCS view function payloads

Variables

View Source
var AccountFour = types.AccountFour

AccountFour represents the 0x4 address

View Source
var AccountOne = types.AccountOne

AccountOne represents the 0x1 address

View Source
var AccountTen = types.AccountTen

AccountTen represents the 0xA address

View Source
var AccountThree = types.AccountThree

AccountThree represents the 0x3 address

View Source
var AccountTwo = types.AccountTwo

AccountTwo represents the 0x2 address

View Source
var AccountZero = types.AccountZero

AccountZero represents the 0x0 address

View Source
var AptosCoinTypeTag = TypeTag{&StructTag{
	Address: AccountOne,
	Module:  "aptos_coin",
	Name:    "AptosCoin",
}}

AptosCoinTypeTag is the TypeTag for 0x1::aptos_coin::AptosCoin

View Source
var DevnetConfig = NetworkConfig{
	Name:    "devnet",
	ChainId: 135,
}
View Source
var LocalnetConfig = NetworkConfig{
	Name:    "localnet",
	ChainId: 4,
}
View Source
var MainnetConfig = NetworkConfig{
	Name:    "mainnet",
	ChainId: 1,
}
View Source
var NamedNetworks map[string]NetworkConfig

NamedNetworks Map from network name to NetworkConfig

View Source
var TestnetConfig = NetworkConfig{
	Name:    "testnet",
	ChainId: 2,
}
View Source
var TransactionPrefix *[]byte

TransactionPrefix is a cached hash prefix for taking transaction hashes

Functions

func ConvertArg

func ConvertArg(typeArg TypeTag, arg any, generics []TypeTag, options ...any) ([]byte, error)

func ConvertToBool

func ConvertToBool(arg any) (bool, error)

func ConvertToOption

func ConvertToOption(typeParam TypeTag, arg any, generics []TypeTag, options ...any) ([]byte, error)

func ConvertToU128

func ConvertToU128(arg any) (*big.Int, error)

TODO: Check bounds of bigints

func ConvertToU16

func ConvertToU16(arg any) (uint16, error)

func ConvertToU256

func ConvertToU256(arg any) (*big.Int, error)

TODO: Check bounds of bigints

func ConvertToU32

func ConvertToU32(arg any) (uint32, error)

func ConvertToU64

func ConvertToU64(arg any) (uint64, error)

func ConvertToU8

func ConvertToU8(arg any) (uint8, error)

func ConvertToVector

func ConvertToVector(vectorTag VectorTag, arg any, generics []TypeTag, options ...any) ([]byte, error)

func ConvertToVectorU8

func ConvertToVectorU8(arg any, options ...any) ([]byte, error)

ConvertToVectorU8 returns the BCS encoded version of the bytes

func ParseHex

func ParseHex(hexStr string) ([]byte, error)

ParseHex Convenience function to deal with 0x at the beginning of hex strings

func RawTransactionPrehash

func RawTransactionPrehash() []byte

RawTransactionPrehash Return the sha3-256 prehash for RawTransaction Do not write to the []byte returned

func RawTransactionPrehashEndless

func RawTransactionPrehashEndless() []byte

func RawTransactionWithDataPrehash

func RawTransactionWithDataPrehash() []byte

RawTransactionWithDataPrehash Return the sha3-256 prehash for RawTransactionWithData Do not write to the []byte returned

func RawTransactionWithDataPrehashEndless

func RawTransactionWithDataPrehashEndless() []byte

func Sha3256Hash

func Sha3256Hash(bytes [][]byte) (output []byte)

Sha3256Hash takes a hash of the given sets of bytes

func ToU128OrU256

func ToU128OrU256(val string) (num *big.Int, err error)

ToU128OrU256 TODO: move somewhere more useful

func ToU64

func ToU64(val string) (uint64, error)

ToU64 TODO: Move somewhere more useful

Types

type Account

type Account = types.Account

Account is a wrapper for a signer, handling the AccountAddress and signing

func NewAccountFromSigner

func NewAccountFromSigner(signer crypto.Signer, authKey ...crypto.AuthenticationKey) (*Account, error)

NewAccountFromSigner creates an account from a Signer, which is most commonly a private key

func NewEd25519Account

func NewEd25519Account() (*Account, error)

NewEd25519Account creates a legacy Ed25519 account, this is most commonly used in wallets

func NewEd25519SingleSenderAccount

func NewEd25519SingleSenderAccount() (*Account, error)

NewEd25519SingleSenderAccount creates a single signer Ed25519 account

type AccountAddress

type AccountAddress = types.AccountAddress

AccountAddress is a 32 byte address on the Aptos blockchain It can represent an Object, an Account, and much more.

func ConvertToAddress

func ConvertToAddress(arg any) (*AccountAddress, error)

type AddressTag

type AddressTag struct{}

AddressTag represents the address type in Move

func (*AddressTag) GetType

func (xt *AddressTag) GetType() TypeTagVariant

func (*AddressTag) MarshalBCS

func (xt *AddressTag) MarshalBCS(_ *bcs.Serializer)

func (*AddressTag) String

func (xt *AddressTag) String() string

func (*AddressTag) UnmarshalBCS

func (xt *AddressTag) UnmarshalBCS(_ *bcs.Deserializer)

type BoolTag

type BoolTag struct{}

BoolTag represents the bool type in Move

func (*BoolTag) GetType

func (xt *BoolTag) GetType() TypeTagVariant

func (*BoolTag) MarshalBCS

func (xt *BoolTag) MarshalBCS(_ *bcs.Serializer)

func (*BoolTag) String

func (xt *BoolTag) String() string

func (*BoolTag) UnmarshalBCS

func (xt *BoolTag) UnmarshalBCS(_ *bcs.Deserializer)

type ChainIdOption

type ChainIdOption uint8

ChainIdOption is an option to APTTransferTransaction

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a facade over the multiple types of underlying clients, as the user doesn't actually care where the data comes from. It will be then handled underneath

func NewClient

func NewClient(config NetworkConfig) (client *Client, err error)

NewClient Creates a new client with a specific network config that can be extended in the future

type CompatibilityMode

type CompatibilityMode bool

CompatibilityMode enables compatibility with the TS SDK in behavior This includes "0x00" as an None option And string interpreted as bytes instead of hex

type Ed25519TransactionAuthenticator

type Ed25519TransactionAuthenticator struct {
	Sender *crypto.AccountAuthenticator
}

Ed25519TransactionAuthenticator for legacy ED25519 accounts Implements TransactionAuthenticatorImpl, bcs.Struct

func (*Ed25519TransactionAuthenticator) MarshalBCS

func (ea *Ed25519TransactionAuthenticator) MarshalBCS(ser *bcs.Serializer)

func (*Ed25519TransactionAuthenticator) UnmarshalBCS

func (ea *Ed25519TransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*Ed25519TransactionAuthenticator) Verify

func (ea *Ed25519TransactionAuthenticator) Verify(msg []byte) bool

type EntryFunction

type EntryFunction struct {
	Module   ModuleId
	Function string
	ArgTypes []TypeTag
	Args     [][]byte
}

EntryFunction call a single published entry function arguments are ordered BCS encoded bytes

func CoinBatchTransferPayload

func CoinBatchTransferPayload(coinType *TypeTag, dests []AccountAddress, amounts []uint64) (payload *EntryFunction, err error)

CoinBatchTransferPayload builds an EntryFunction payload for transferring coins to multiple receivers

Args:

  • coinType is the type of coin to transfer. If none is provided, it will transfer 0x1::aptos_coin:AptosCoin
  • dests are the destination [AccountAddress]s
  • amounts are the amount of coins to transfer per destination

func CoinTransferPayload

func CoinTransferPayload(coinType *TypeTag, dest AccountAddress, amount uint64) (payload *EntryFunction, err error)

CoinTransferPayload builds an EntryFunction payload for transferring coins

Args:

  • coinType is the type of coin to transfer. If none is provided, it will transfer 0x1::aptos_coin:AptosCoin
  • dest is the destination AccountAddress
  • amount is the amount of coins to transfer

func EntryFunctionFromAbi

func EntryFunctionFromAbi(abi any, moduleAddress AccountAddress, moduleName string, functionName string, typeArgs []any, args []any, options ...any) (*EntryFunction, error)

func (*EntryFunction) ExecutableType

func (sf *EntryFunction) ExecutableType() TransactionExecutableVariant

func (*EntryFunction) MarshalBCS

func (sf *EntryFunction) MarshalBCS(ser *bcs.Serializer)

func (*EntryFunction) PayloadType

func (sf *EntryFunction) PayloadType() TransactionPayloadVariant

func (*EntryFunction) UnmarshalBCS

func (sf *EntryFunction) UnmarshalBCS(des *bcs.Deserializer)

type ExpirationSeconds

type ExpirationSeconds int64

ExpirationSeconds is an option to APTTransferTransaction

type FeePayerTransactionAuthenticator

type FeePayerTransactionAuthenticator struct {
	Sender                   *crypto.AccountAuthenticator
	SecondarySignerAddresses []AccountAddress
	SecondarySigners         []crypto.AccountAuthenticator
	FeePayer                 *AccountAddress
	FeePayerAuthenticator    *crypto.AccountAuthenticator
}

func (*FeePayerTransactionAuthenticator) MarshalBCS

func (ea *FeePayerTransactionAuthenticator) MarshalBCS(ser *bcs.Serializer)

func (*FeePayerTransactionAuthenticator) UnmarshalBCS

func (ea *FeePayerTransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*FeePayerTransactionAuthenticator) Verify

func (ea *FeePayerTransactionAuthenticator) Verify(msg []byte) bool

type FungibleAssetClient

type FungibleAssetClient struct {
	// contains filtered or unexported fields
}

FungibleAssetClient This is an example client around a single fungible asset

func NewFungibleAssetClient

func NewFungibleAssetClient(client *Client, metadataAddress AccountAddress) (faClient *FungibleAssetClient, err error)

NewFungibleAssetClient verifies the address exists when creating the client TODO: Add lookup of other metadata information such as symbol, supply, etc

func (*FungibleAssetClient) BuildTransferPrimaryStore

func (client *FungibleAssetClient) BuildTransferPrimaryStore(senderAddress AccountAddress, receiverAddress AccountAddress, amount uint64, options ...any) (txn *RawTransaction, err error)

func (*FungibleAssetClient) SimulateTransferPrimaryStore

func (client *FungibleAssetClient) SimulateTransferPrimaryStore(publicKey []byte, fromAddress AccountAddress, receiverAddress AccountAddress, amount uint64, options ...any) (signedTxn *SignedTransaction, err error)

func (*FungibleAssetClient) Transfer

func (client *FungibleAssetClient) Transfer(sender *Account, senderStore AccountAddress, receiverStore AccountAddress, amount uint64) (signedTxn *SignedTransaction, err error)

func (*FungibleAssetClient) TransferPrimaryStore

func (client *FungibleAssetClient) TransferPrimaryStore(sender *Account, receiverAddress AccountAddress, amount uint64, options ...any) (signedTxn *SignedTransaction, err error)

type GasUnitPrice

type GasUnitPrice uint64

GasUnitPrice is an option to APTTransferTransaction

type GenericTag

type GenericTag struct {
	Num uint64
}

GenericTag represents a generic of a type in Move

func (*GenericTag) GetType

func (xt *GenericTag) GetType() TypeTagVariant

func (*GenericTag) MarshalBCS

func (xt *GenericTag) MarshalBCS(_ *bcs.Serializer)

TODO: Do we need a proper serialization here

func (*GenericTag) String

func (xt *GenericTag) String() string

func (*GenericTag) UnmarshalBCS

func (xt *GenericTag) UnmarshalBCS(_ *bcs.Deserializer)

type InputEntryFunctionData

type InputEntryFunctionData struct {
	Function string
	ArgTypes []string
	Args     []string
}

type MaxGasAmount

type MaxGasAmount uint64

MaxGasAmount is an option to APTTransferTransaction

type ModuleBundle

type ModuleBundle struct{}

ModuleBundle is long deprecated and no longer used, but exist as an enum position in TransactionPayload

func (*ModuleBundle) MarshalBCS

func (txn *ModuleBundle) MarshalBCS(ser *bcs.Serializer)

func (*ModuleBundle) PayloadType

func (txn *ModuleBundle) PayloadType() TransactionPayloadVariant

func (*ModuleBundle) UnmarshalBCS

func (txn *ModuleBundle) UnmarshalBCS(des *bcs.Deserializer)

type ModuleId

type ModuleId struct {
	Address AccountAddress
	Name    string
}

ModuleId the identifier for a module e.g. 0x1::coin

func (*ModuleId) MarshalBCS

func (mod *ModuleId) MarshalBCS(bcs *bcs.Serializer)

func (*ModuleId) UnmarshalBCS

func (mod *ModuleId) UnmarshalBCS(bcs *bcs.Deserializer)

type MultiAgentRawTransactionWithData

type MultiAgentRawTransactionWithData struct {
	RawTxn           *RawTransaction
	SecondarySigners []AccountAddress
}

func (*MultiAgentRawTransactionWithData) MarshalBCS

func (txn *MultiAgentRawTransactionWithData) MarshalBCS(ser *bcs.Serializer)

func (*MultiAgentRawTransactionWithData) UnmarshalBCS

func (txn *MultiAgentRawTransactionWithData) UnmarshalBCS(des *bcs.Deserializer)

type MultiAgentTransactionAuthenticator

type MultiAgentTransactionAuthenticator struct {
	Sender                   *crypto.AccountAuthenticator
	SecondarySignerAddresses []AccountAddress
	SecondarySigners         []crypto.AccountAuthenticator
}

func (*MultiAgentTransactionAuthenticator) MarshalBCS

func (ea *MultiAgentTransactionAuthenticator) MarshalBCS(ser *bcs.Serializer)

func (*MultiAgentTransactionAuthenticator) UnmarshalBCS

func (ea *MultiAgentTransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*MultiAgentTransactionAuthenticator) Verify

func (ea *MultiAgentTransactionAuthenticator) Verify(msg []byte) bool

type MultiAgentWithFeePayerRawTransactionWithData

type MultiAgentWithFeePayerRawTransactionWithData struct {
	RawTxn           *RawTransaction
	SecondarySigners []AccountAddress
	FeePayer         *AccountAddress
}

func (*MultiAgentWithFeePayerRawTransactionWithData) MarshalBCS

func (*MultiAgentWithFeePayerRawTransactionWithData) UnmarshalBCS

type MultiEd25519TransactionAuthenticator

type MultiEd25519TransactionAuthenticator struct {
	Sender *crypto.AccountAuthenticator
}

func (*MultiEd25519TransactionAuthenticator) MarshalBCS

func (*MultiEd25519TransactionAuthenticator) UnmarshalBCS

func (ea *MultiEd25519TransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*MultiEd25519TransactionAuthenticator) Verify

type Multisig

type Multisig struct {
	MultisigAddress AccountAddress
	Payload         *MultisigTransactionPayload // Optional
}

Multisig is an on-chain multisig transaction, that calls an entry function associated

func (*Multisig) MarshalBCS

func (sf *Multisig) MarshalBCS(ser *bcs.Serializer)

func (*Multisig) PayloadType

func (sf *Multisig) PayloadType() TransactionPayloadVariant

func (*Multisig) UnmarshalBCS

func (sf *Multisig) UnmarshalBCS(des *bcs.Deserializer)

type MultisigTransactionImpl

type MultisigTransactionImpl interface {
	bcs.Struct
}

type MultisigTransactionPayload

type MultisigTransactionPayload struct {
	Variant MultisigTransactionPayloadVariant
	Payload MultisigTransactionImpl
}

MultisigTransactionPayload is an enum allowing for multiple types of transactions to be called via multisig

Note this does not implement TransactionPayloadImpl

func (*MultisigTransactionPayload) MarshalBCS

func (sf *MultisigTransactionPayload) MarshalBCS(ser *bcs.Serializer)

func (*MultisigTransactionPayload) UnmarshalBCS

func (sf *MultisigTransactionPayload) UnmarshalBCS(des *bcs.Deserializer)

type MultisigTransactionPayloadVariant

type MultisigTransactionPayloadVariant uint32
const (
	MultisigTransactionPayloadVariantEntryFunction MultisigTransactionPayloadVariant = 0
)

type NetworkConfig

type NetworkConfig struct {
	Name       string
	ChainId    uint8
	NodeUrl    string
	IndexerUrl string
	FaucetUrl  string
}

NetworkConfig a configuration for the Client and which network to use. Use one of the preconfigured LocalnetConfig, DevnetConfig, TestnetConfig, or MainnetConfig unless you have your own full node

type NodeClient

type NodeClient struct {
	// contains filtered or unexported fields
}

func NewNodeClient

func NewNodeClient(rpcUrl string, chainId uint8) (*NodeClient, error)

func NewNodeClientWithHttpClient

func NewNodeClientWithHttpClient(rpcUrl string, chainId uint8, client *http.Client) (*NodeClient, error)

func (*NodeClient) BuildTransaction

func (rc *NodeClient) BuildTransaction(sender AccountAddress, payload TransactionPayload, options ...any) (rawTxn *RawTransaction, err error)

BuildTransaction builds a raw transaction for signing Accepts options: MaxGasAmount, GasUnitPrice, ExpirationSeconds, SequenceNumber, ChainIdOption

type RawTransaction

type RawTransaction struct {
	Sender         AccountAddress
	SequenceNumber uint64
	Payload        TransactionPayload
	MaxGasAmount   uint64
	GasUnitPrice   uint64

	// ExpirationTimestampSeconds is seconds since Unix epoch
	ExpirationTimestampSeconds uint64

	ChainId uint8
}

RawTransaction representation of a transaction's parts prior to signing Implements crypto.MessageSigner, crypto.Signer, bcs.Struct

func (*RawTransaction) MarshalBCS

func (txn *RawTransaction) MarshalBCS(ser *bcs.Serializer)

func (*RawTransaction) Sign

func (txn *RawTransaction) Sign(signer crypto.Signer) (authenticator *crypto.AccountAuthenticator, err error)

func (*RawTransaction) SignedTransaction

func (txn *RawTransaction) SignedTransaction(sender crypto.Signer) (*SignedTransaction, error)

func (*RawTransaction) SignedTransactionWithAuthenticator

func (txn *RawTransaction) SignedTransactionWithAuthenticator(auth *crypto.AccountAuthenticator) (*SignedTransaction, error)

SignedTransactionWithAuthenticator signs the sender only signed transaction

func (*RawTransaction) SigningMessage

func (txn *RawTransaction) SigningMessage() (message []byte, err error)

SigningMessage generates the bytes needed to be signed by a signer

func (*RawTransaction) String

func (txn *RawTransaction) String() string

String returns a JSON formatted string representation of the RawTransaction

func (*RawTransaction) UnmarshalBCS

func (txn *RawTransaction) UnmarshalBCS(des *bcs.Deserializer)

type RawTransactionImpl

type RawTransactionImpl interface {
	bcs.Struct

	// SigningMessage creates a raw signing message for the transaction
	// Note that this should only be used externally if signing transactions outside the SDK.  Otherwise, use Sign.
	SigningMessage() (message []byte, err error)

	// Sign signs a transaction and returns the associated AccountAuthenticator, it will underneath sign the SigningMessage
	Sign(signer crypto.Signer) (*crypto.AccountAuthenticator, error)
}

type RawTransactionWithData

type RawTransactionWithData struct {
	Variant RawTransactionWithDataVariant
	Inner   RawTransactionWithDataImpl
}

func (*RawTransactionWithData) MarshalBCS

func (txn *RawTransactionWithData) MarshalBCS(ser *bcs.Serializer)

func (*RawTransactionWithData) MarshalTypeScriptBCS

func (txn *RawTransactionWithData) MarshalTypeScriptBCS(ser *bcs.Serializer)

MarshalTypeScriptBCS converts to RawTransactionWithData to the TypeScript type MultiAgentTransaction

func (*RawTransactionWithData) SetFeePayer

func (txn *RawTransactionWithData) SetFeePayer(
	feePayer AccountAddress,
) bool

func (*RawTransactionWithData) Sign

func (txn *RawTransactionWithData) Sign(signer crypto.Signer) (authenticator *crypto.AccountAuthenticator, err error)

func (*RawTransactionWithData) SigningMessage

func (txn *RawTransactionWithData) SigningMessage() (message []byte, err error)

func (*RawTransactionWithData) String

func (txn *RawTransactionWithData) String() string

String returns a JSON formatted string representation of the RawTransactionWithData

func (*RawTransactionWithData) ToFeePayerSignedTransaction

func (txn *RawTransactionWithData) ToFeePayerSignedTransaction(
	sender *crypto.AccountAuthenticator,
	feePayerAuthenticator *crypto.AccountAuthenticator,
	additionalSigners []crypto.AccountAuthenticator,
) (*SignedTransaction, bool)

func (*RawTransactionWithData) ToMultiAgentSignedTransaction

func (txn *RawTransactionWithData) ToMultiAgentSignedTransaction(
	sender *crypto.AccountAuthenticator,
	additionalSigners []crypto.AccountAuthenticator,
) (*SignedTransaction, bool)

func (*RawTransactionWithData) UnmarshalBCS

func (txn *RawTransactionWithData) UnmarshalBCS(des *bcs.Deserializer)

func (*RawTransactionWithData) UnmarshalTypeScriptBCS

func (txn *RawTransactionWithData) UnmarshalTypeScriptBCS(des *bcs.Deserializer)

UnmarshalTypeScriptBCS converts to RawTransactionWithData from the TypeScript type MultiAgentTransaction

type RawTransactionWithDataImpl

type RawTransactionWithDataImpl interface {
	bcs.Struct
}

type RawTransactionWithDataVariant

type RawTransactionWithDataVariant uint32
const (
	MultiAgentRawTransactionWithDataVariant             RawTransactionWithDataVariant = 0
	MultiAgentWithFeePayerRawTransactionWithDataVariant RawTransactionWithDataVariant = 1
)

type ReferenceTag

type ReferenceTag struct {
	TypeParam TypeTag
}

ReferenceTag represents a reference of a type in Move

func (*ReferenceTag) GetType

func (xt *ReferenceTag) GetType() TypeTagVariant

func (*ReferenceTag) MarshalBCS

func (xt *ReferenceTag) MarshalBCS(_ *bcs.Serializer)

TODO: Do we need a proper serialization here

func (*ReferenceTag) String

func (xt *ReferenceTag) String() string

func (*ReferenceTag) UnmarshalBCS

func (xt *ReferenceTag) UnmarshalBCS(_ *bcs.Deserializer)

type Script

type Script struct {
	Code     []byte           // The compiled script bytes
	ArgTypes []TypeTag        // The types of the arguments
	Args     []ScriptArgument // The arguments
}

Script A Move script as compiled code as a transaction

func (*Script) ExecutableType

func (s *Script) ExecutableType() TransactionExecutableVariant

func (*Script) MarshalBCS

func (s *Script) MarshalBCS(ser *bcs.Serializer)

func (*Script) PayloadType

func (s *Script) PayloadType() TransactionPayloadVariant

func (*Script) UnmarshalBCS

func (s *Script) UnmarshalBCS(des *bcs.Deserializer)

type ScriptArgument

type ScriptArgument struct {
	Variant ScriptArgumentVariant // The type of the argument
	Value   any                   // The value of the argument
}

ScriptArgument a Move script argument, which encodes its type with it

func (*ScriptArgument) MarshalBCS

func (sa *ScriptArgument) MarshalBCS(ser *bcs.Serializer)

func (*ScriptArgument) UnmarshalBCS

func (sa *ScriptArgument) UnmarshalBCS(des *bcs.Deserializer)

type ScriptArgumentVariant

type ScriptArgumentVariant uint32

ScriptArgumentVariant the type of the script argument. If there isn't a value here, it is not supported.

Note that the only vector supported is vector<u8>

const (
	ScriptArgumentU8         ScriptArgumentVariant = 0 // u8 type argument
	ScriptArgumentU64        ScriptArgumentVariant = 1 // u64 type argument
	ScriptArgumentU128       ScriptArgumentVariant = 2 // u128 type argument
	ScriptArgumentAddress    ScriptArgumentVariant = 3 // address type argument
	ScriptArgumentU8Vector   ScriptArgumentVariant = 4 // vector<u8> type argument
	ScriptArgumentBool       ScriptArgumentVariant = 5 // bool type argument
	ScriptArgumentU16        ScriptArgumentVariant = 6 // u16 type argument
	ScriptArgumentU32        ScriptArgumentVariant = 7 //	u32 type argument
	ScriptArgumentU256       ScriptArgumentVariant = 8 //	u256 type argument
	ScriptArgumentSerialized ScriptArgumentVariant = 9 //	u256 type argument
)

type SequenceNumber

type SequenceNumber uint64

SequenceNumber is an option to APTTransferTransaction

type SignedTransaction

type SignedTransaction struct {
	Transaction   *RawTransaction           // The transaction here is always a [RawTransaction], the rest of the information is in the authenticator
	Authenticator *TransactionAuthenticator // The authenticator for a transaction (can't be be a standalone [crypto.AccountAuthenticator])
}

SignedTransaction a raw transaction plus its authenticator for a fully verifiable message

func (*SignedTransaction) Hash

func (txn *SignedTransaction) Hash() (string, error)

Hash takes the hash of the SignedTransaction

Note: At the moment, this assumes that the transaction is a UserTransaction

func (*SignedTransaction) MarshalBCS

func (txn *SignedTransaction) MarshalBCS(ser *bcs.Serializer)

func (*SignedTransaction) UnmarshalBCS

func (txn *SignedTransaction) UnmarshalBCS(des *bcs.Deserializer)

func (*SignedTransaction) Verify

func (txn *SignedTransaction) Verify() error

Verify checks a signed transaction's signature

type SignedTransactionVariant

type SignedTransactionVariant uint8

SignedTransactionVariant is the variant for a signed transaction

const UserTransactionVariant SignedTransactionVariant = 0

UserTransactionVariant is the variant for a transaction submitted by a user. For now, we don't support any others, because they can't be submitted.

type SignerTag

type SignerTag struct{}

SignerTag represents the signer type in Move

func (*SignerTag) GetType

func (xt *SignerTag) GetType() TypeTagVariant

func (*SignerTag) MarshalBCS

func (xt *SignerTag) MarshalBCS(_ *bcs.Serializer)

func (*SignerTag) String

func (xt *SignerTag) String() string

func (*SignerTag) UnmarshalBCS

func (xt *SignerTag) UnmarshalBCS(_ *bcs.Deserializer)

type SingleSenderTransactionAuthenticator

type SingleSenderTransactionAuthenticator struct {
	Sender *crypto.AccountAuthenticator
}

func (*SingleSenderTransactionAuthenticator) MarshalBCS

func (*SingleSenderTransactionAuthenticator) UnmarshalBCS

func (ea *SingleSenderTransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*SingleSenderTransactionAuthenticator) Verify

type StructTag

type StructTag struct {
	Address    AccountAddress // Address is the address of the module
	Module     string         // Module is the name of the module
	Name       string         // Name is the name of the struct
	TypeParams []TypeTag      // TypeParams are the TypeTags of the type parameters
}

StructTag represents an on-chain struct of the form address::module::name<T1,T2,...> and each T is a TypeTag

func NewObjectTag

func NewObjectTag(inner TypeTagImpl) *StructTag

NewObjectTag creates a 0x1::object::Object TypeTag based on an inner type

func NewOptionTag

func NewOptionTag(inner TypeTagImpl) *StructTag

NewOptionTag creates a 0x1::option::Option TypeTag based on an inner type

func NewStringTag

func NewStringTag() *StructTag

NewStringTag creates a TypeTag for 0x1::string::String

func (*StructTag) GetType

func (xt *StructTag) GetType() TypeTagVariant

func (*StructTag) MarshalBCS

func (xt *StructTag) MarshalBCS(ser *bcs.Serializer)

func (*StructTag) String

func (xt *StructTag) String() string

String outputs to the form address::module::name<type1, type2> e.g. 0x1::string::String or 0x42::my_mod::MultiType<u8,0x1::string::String>

func (*StructTag) UnmarshalBCS

func (xt *StructTag) UnmarshalBCS(des *bcs.Deserializer)

type TransactionAuthenticator

type TransactionAuthenticator struct {
	Variant TransactionAuthenticatorVariant
	Auth    TransactionAuthenticatorImpl
}

TransactionAuthenticator is used for authorizing a transaction. This differs from crypto.AccountAuthenticator because it handles constructs like FeePayer and MultiAgent. Some keys can't stand on their own as TransactionAuthenticators. Implements TransactionAuthenticatorImpl, bcs.Struct

func NewTransactionAuthenticator

func NewTransactionAuthenticator(auth *crypto.AccountAuthenticator) (*TransactionAuthenticator, error)

func (*TransactionAuthenticator) MarshalBCS

func (ea *TransactionAuthenticator) MarshalBCS(ser *bcs.Serializer)

func (*TransactionAuthenticator) UnmarshalBCS

func (ea *TransactionAuthenticator) UnmarshalBCS(des *bcs.Deserializer)

func (*TransactionAuthenticator) Verify

func (ea *TransactionAuthenticator) Verify(msg []byte) bool

type TransactionAuthenticatorImpl

type TransactionAuthenticatorImpl interface {
	bcs.Struct
	// Verify Return true if this AccountAuthenticator approves
	Verify(data []byte) bool
}

type TransactionAuthenticatorVariant

type TransactionAuthenticatorVariant uint8
const (
	TransactionAuthenticatorEd25519      TransactionAuthenticatorVariant = 0
	TransactionAuthenticatorMultiEd25519 TransactionAuthenticatorVariant = 1
	TransactionAuthenticatorMultiAgent   TransactionAuthenticatorVariant = 2
	TransactionAuthenticatorFeePayer     TransactionAuthenticatorVariant = 3
	TransactionAuthenticatorSingleSender TransactionAuthenticatorVariant = 4
)

type TransactionExecutable

type TransactionExecutable struct {
	Inner TransactionExecutableImpl
}

func (*TransactionExecutable) MarshalBCS

func (txn *TransactionExecutable) MarshalBCS(ser *bcs.Serializer)

func (*TransactionExecutable) UnmarshalBCS

func (txn *TransactionExecutable) UnmarshalBCS(des *bcs.Deserializer)

type TransactionExecutableEmpty

type TransactionExecutableEmpty struct{}

func (*TransactionExecutableEmpty) ExecutableType

func (*TransactionExecutableEmpty) MarshalBCS

func (txn *TransactionExecutableEmpty) MarshalBCS(*bcs.Serializer)

func (*TransactionExecutableEmpty) UnmarshalBCS

func (txn *TransactionExecutableEmpty) UnmarshalBCS(*bcs.Deserializer)

type TransactionExecutableImpl

type TransactionExecutableImpl interface {
	bcs.Struct

	ExecutableType() TransactionExecutableVariant
}

type TransactionExecutableVariant

type TransactionExecutableVariant uint32
const (
	TransactionExecutableVariantScript        TransactionExecutableVariant = 0
	TransactionExecutableVariantEntryFunction TransactionExecutableVariant = 1
	TransactionExecutableVariantEmpty         TransactionExecutableVariant = 2
)

type TransactionExtraConfig

type TransactionExtraConfig struct {
	Inner TransactionExtraConfigImpl
}

func (*TransactionExtraConfig) MarshalBCS

func (txn *TransactionExtraConfig) MarshalBCS(ser *bcs.Serializer)

func (*TransactionExtraConfig) UnmarshalBCS

func (txn *TransactionExtraConfig) UnmarshalBCS(des *bcs.Deserializer)

type TransactionExtraConfigImpl

type TransactionExtraConfigImpl interface {
	bcs.Struct

	ConfigType() TransactionExtraConfigVariant
}

type TransactionExtraConfigV1

type TransactionExtraConfigV1 struct {
	MultisigAddress       *AccountAddress // Optional
	ReplayProtectionNonce *uint64         // Optional
}

func (*TransactionExtraConfigV1) ConfigType

func (*TransactionExtraConfigV1) MarshalBCS

func (txn *TransactionExtraConfigV1) MarshalBCS(ser *bcs.Serializer)

func (*TransactionExtraConfigV1) UnmarshalBCS

func (txn *TransactionExtraConfigV1) UnmarshalBCS(des *bcs.Deserializer)

type TransactionExtraConfigVariant

type TransactionExtraConfigVariant uint32
const (
	TransactionExtraConfigVariantV1 TransactionExtraConfigVariant = 0
)

type TransactionInnerPayload

type TransactionInnerPayload struct {
	Payload TransactionInnerPayloadImpl
}

func (*TransactionInnerPayload) MarshalBCS

func (txn *TransactionInnerPayload) MarshalBCS(ser *bcs.Serializer)

func (*TransactionInnerPayload) PayloadType

func (*TransactionInnerPayload) UnmarshalBCS

func (txn *TransactionInnerPayload) UnmarshalBCS(des *bcs.Deserializer)

type TransactionInnerPayloadImpl

type TransactionInnerPayloadImpl interface {
	bcs.Struct

	InnerPayloadType() TransactionInnerPayloadVariant
}

type TransactionInnerPayloadV1

type TransactionInnerPayloadV1 struct {
	Executable  TransactionExecutable
	ExtraConfig TransactionExtraConfig
}

func (*TransactionInnerPayloadV1) InnerPayloadType

func (*TransactionInnerPayloadV1) MarshalBCS

func (txn *TransactionInnerPayloadV1) MarshalBCS(ser *bcs.Serializer)

func (*TransactionInnerPayloadV1) UnmarshalBCS

func (txn *TransactionInnerPayloadV1) UnmarshalBCS(des *bcs.Deserializer)

type TransactionInnerPayloadVariant

type TransactionInnerPayloadVariant uint32
const (
	TransactionInnerPayloadVariantV1 TransactionInnerPayloadVariant = 0
)

type TransactionPayload

type TransactionPayload struct {
	Payload TransactionPayloadImpl
}

TransactionPayload the actual instructions of which functions to call on chain

func (*TransactionPayload) MarshalBCS

func (txn *TransactionPayload) MarshalBCS(ser *bcs.Serializer)

func (*TransactionPayload) UnmarshalBCS

func (txn *TransactionPayload) UnmarshalBCS(des *bcs.Deserializer)

type TransactionPayloadImpl

type TransactionPayloadImpl interface {
	bcs.Struct
	PayloadType() TransactionPayloadVariant // This is specifically to ensure that wrong types don't end up here
}

type TransactionPayloadVariant

type TransactionPayloadVariant uint32
const (
	TransactionPayloadVariantScript        TransactionPayloadVariant = 0
	TransactionPayloadVariantModuleBundle  TransactionPayloadVariant = 1 // Deprecated
	TransactionPayloadVariantEntryFunction TransactionPayloadVariant = 2
	TransactionPayloadVariantMultisig      TransactionPayloadVariant = 3
	TransactionPayloadVariantPayload       TransactionPayloadVariant = 4
)

type TransactionSigner

type TransactionSigner interface {
	crypto.Signer

	// AccountAddress returns the address of the signer, this may differ from the AuthKey derived from the inner signer
	AccountAddress() AccountAddress
}

TransactionSigner is a generic interface for a way to sign transactions. The default implementation is Account

Note that AccountAddress is needed to be the correct on-chain value for proper signing. This may differ from the AuthKey provided by the crypto.Signer

type TypeTag

type TypeTag struct {
	Value TypeTagImpl
}

TypeTag is a wrapper around a TypeTagImpl e.g. BoolTag or U8Tag for the purpose of serialization and deserialization Implements:

func ConvertTypeTag

func ConvertTypeTag(typeArg any) (*TypeTag, error)

func NewTypeTag

func NewTypeTag(inner TypeTagImpl) TypeTag

NewTypeTag wraps a TypeTagImpl in a TypeTag

func ParseTypeTag

func ParseTypeTag(inputStr string) (*TypeTag, error)

func ParseTypeTagInner

func ParseTypeTagInner(input string, types []TypeTag) (*TypeTag, error)

func (*TypeTag) MarshalBCS

func (tt *TypeTag) MarshalBCS(ser *bcs.Serializer)

MarshalBCS serializes the TypeTag to bytes

Implements:

func (*TypeTag) String

func (tt *TypeTag) String() string

String gives the canonical TypeTag string value used in Move

func (*TypeTag) UnmarshalBCS

func (tt *TypeTag) UnmarshalBCS(des *bcs.Deserializer)

UnmarshalBCS deserializes the TypeTag from bytes

Implements:

type TypeTagImpl

type TypeTagImpl interface {
	bcs.Struct
	// GetType returns the TypeTagVariant for this [TypeTag]
	GetType() TypeTagVariant
	// String returns the canonical Move string representation of this [TypeTag]
	String() string
}

TypeTagImpl is an interface describing all the different types of TypeTag. Unfortunately because of how serialization works, a wrapper TypeTag struct is needed to handle the differentiation between types

type TypeTagVariant

type TypeTagVariant uint32

TypeTagVariant is an enum representing the different types of TypeTag

const (
	TypeTagBool      TypeTagVariant = 0   // Represents the bool type in Move BoolTag
	TypeTagU8        TypeTagVariant = 1   // Represents the u8 type in Move U8Tag
	TypeTagU64       TypeTagVariant = 2   // Represents the u64 type in Move U64Tag
	TypeTagU128      TypeTagVariant = 3   // Represents the u128 type in Move U128Tag
	TypeTagAddress   TypeTagVariant = 4   // Represents the address type in Move AddressTag
	TypeTagSigner    TypeTagVariant = 5   // Represents the signer type in Move SignerTag
	TypeTagVector    TypeTagVariant = 6   // Represents the vector type in Move VectorTag
	TypeTagStruct    TypeTagVariant = 7   // Represents the struct type in Move StructTag
	TypeTagU16       TypeTagVariant = 8   // Represents the u16 type in Move U16Tag
	TypeTagU32       TypeTagVariant = 9   // Represents the u32 type in Move U32Tag
	TypeTagU256      TypeTagVariant = 10  // Represents the u256 type in Move U256Tag
	TypeTagGeneric   TypeTagVariant = 254 // Represents a generic type in Move GenericTag
	TypeTagReference TypeTagVariant = 255 // Represents the reference type in Move ReferenceTag
)

type U128Tag

type U128Tag struct{}

U128Tag represents the u128 type in Move

func (*U128Tag) GetType

func (xt *U128Tag) GetType() TypeTagVariant

func (*U128Tag) MarshalBCS

func (xt *U128Tag) MarshalBCS(_ *bcs.Serializer)

func (*U128Tag) String

func (xt *U128Tag) String() string

func (*U128Tag) UnmarshalBCS

func (xt *U128Tag) UnmarshalBCS(_ *bcs.Deserializer)

type U16Tag

type U16Tag struct{}

U16Tag represents the u16 type in Move

func (*U16Tag) GetType

func (xt *U16Tag) GetType() TypeTagVariant

func (*U16Tag) MarshalBCS

func (xt *U16Tag) MarshalBCS(_ *bcs.Serializer)

func (*U16Tag) String

func (xt *U16Tag) String() string

func (*U16Tag) UnmarshalBCS

func (xt *U16Tag) UnmarshalBCS(_ *bcs.Deserializer)

type U256Tag

type U256Tag struct{}

U256Tag represents the u256 type in Move

func (*U256Tag) GetType

func (xt *U256Tag) GetType() TypeTagVariant

func (*U256Tag) MarshalBCS

func (xt *U256Tag) MarshalBCS(_ *bcs.Serializer)

func (*U256Tag) String

func (xt *U256Tag) String() string

func (*U256Tag) UnmarshalBCS

func (xt *U256Tag) UnmarshalBCS(_ *bcs.Deserializer)

type U32Tag

type U32Tag struct{}

U32Tag represents the u32 type in Move

func (*U32Tag) GetType

func (xt *U32Tag) GetType() TypeTagVariant

func (*U32Tag) MarshalBCS

func (xt *U32Tag) MarshalBCS(_ *bcs.Serializer)

func (*U32Tag) String

func (xt *U32Tag) String() string

func (*U32Tag) UnmarshalBCS

func (xt *U32Tag) UnmarshalBCS(_ *bcs.Deserializer)

type U64Tag

type U64Tag struct{}

U64Tag represents the u64 type in Move

func (*U64Tag) GetType

func (xt *U64Tag) GetType() TypeTagVariant

func (*U64Tag) MarshalBCS

func (xt *U64Tag) MarshalBCS(_ *bcs.Serializer)

func (*U64Tag) String

func (xt *U64Tag) String() string

func (*U64Tag) UnmarshalBCS

func (xt *U64Tag) UnmarshalBCS(_ *bcs.Deserializer)

type U8Tag

type U8Tag struct{}

U8Tag represents the u8 type in Move

func (*U8Tag) GetType

func (xt *U8Tag) GetType() TypeTagVariant

func (*U8Tag) MarshalBCS

func (xt *U8Tag) MarshalBCS(_ *bcs.Serializer)

func (*U8Tag) String

func (xt *U8Tag) String() string

func (*U8Tag) UnmarshalBCS

func (xt *U8Tag) UnmarshalBCS(_ *bcs.Deserializer)

type VectorTag

type VectorTag struct {
	TypeParam TypeTag // TypeParam is the type of the elements in the vector
}

VectorTag represents the vector<T> type in Move, where T is another TypeTag

func NewVectorTag

func NewVectorTag(inner TypeTagImpl) *VectorTag

NewVectorTag creates a TypeTag for vector<inner>

func (*VectorTag) GetType

func (xt *VectorTag) GetType() TypeTagVariant

func (*VectorTag) MarshalBCS

func (xt *VectorTag) MarshalBCS(ser *bcs.Serializer)

func (*VectorTag) String

func (xt *VectorTag) String() string

func (*VectorTag) UnmarshalBCS

func (xt *VectorTag) UnmarshalBCS(des *bcs.Deserializer)

type ViewPayload

type ViewPayload struct {
	Module   ModuleId
	Function string
	ArgTypes []TypeTag
	Args     [][]byte
}

func (*ViewPayload) MarshalBCS

func (vp *ViewPayload) MarshalBCS(serializer *bcs.Serializer)

Directories

Path Synopsis
internal
types
Package types is an internal package that contains the types used in the Aptos Go SDK.
Package types is an internal package that contains the types used in the Aptos Go SDK.

Jump to

Keyboard shortcuts

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