aptos

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountAddressLength = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAPTBalanceReply

type AccountAPTBalanceReply struct {
	Value uint64
}

type AccountAPTBalanceRequest

type AccountAPTBalanceRequest struct {
	Address AccountAddress
}

type AccountAddress

type AccountAddress [AccountAddressLength]byte

type AccountTransactionsReply

type AccountTransactionsReply struct {
	Transactions []*Transaction
}

type AccountTransactionsRequest

type AccountTransactionsRequest struct {
	Address AccountAddress
	Start   *uint64 // Starting version number; nil for most recent
	Limit   *uint64 // Number of transactions to return; nil for default (~100)
}

type AddressTag

type AddressTag struct{}

AddressTag represents an account address type.

func (AddressTag) TypeTagKind

func (AddressTag) TypeTagKind() TypeTagKind

type BoolTag

type BoolTag struct{}

BoolTag represents a boolean type.

func (BoolTag) TypeTagKind

func (BoolTag) TypeTagKind() TypeTagKind

type Client

type Client interface {
	// AccountAPTBalance returns the native APT coin balance (in octas) for the given account address.
	AccountAPTBalance(ctx context.Context, req AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error)
	// View executes a Move view function (read-only) and returns the raw result.
	View(ctx context.Context, req ViewRequest) (*ViewReply, error)
	// TransactionByHash looks up a transaction (pending or committed) by its hash.
	TransactionByHash(ctx context.Context, req TransactionByHashRequest) (*TransactionByHashReply, error)
	// AccountTransactions returns committed transactions associated with an account.
	AccountTransactions(ctx context.Context, req AccountTransactionsRequest) (*AccountTransactionsReply, error)
}

Client wraps the Aptos RPC client methods used for reading on-chain state.

type GasConfig

type GasConfig struct {
	MaxGasAmount uint64 // Maximum gas units willing to pay
	GasUnitPrice uint64 // Price per gas unit in octas
}

GasConfig represents gas configuration for a transaction

type GenericTag

type GenericTag struct {
	Index uint16
}

GenericTag represents a generic type parameter (e.g., T in a generic function).

func (GenericTag) TypeTagKind

func (GenericTag) TypeTagKind() TypeTagKind

type ModuleID

type ModuleID struct {
	Address AccountAddress
	Name    string
}

ModuleID identifies a Move module.

type SignerTag

type SignerTag struct{}

SignerTag represents a signer type.

func (SignerTag) TypeTagKind

func (SignerTag) TypeTagKind() TypeTagKind

type StructTag

type StructTag struct {
	Address    AccountAddress
	Module     string
	Name       string
	TypeParams []TypeTag
}

StructTag represents a struct type with full type information.

func (StructTag) TypeTagKind

func (StructTag) TypeTagKind() TypeTagKind

type SubmitTransactionReply

type SubmitTransactionReply struct {
	TxStatus         TransactionStatus
	TxHash           string
	TxIdempotencyKey string
}

type SubmitTransactionRequest

type SubmitTransactionRequest struct {
	ReceiverModuleID ModuleID // This can potentially be removed if the EncodedPayload is of type EntryFunction which has all the details
	EncodedPayload   []byte
	GasConfig        *GasConfig
}

type Transaction

type Transaction struct {
	Type    TransactionVariant
	Hash    string
	Version *uint64 // nil for pending transactions
	Success *bool   // nil for pending/genesis transactions
	Data    []byte  // Raw transaction data
}

Transaction represents any transaction type (pending or committed)

type TransactionByHashReply

type TransactionByHashReply struct {
	Transaction *Transaction
}

TransactionByHashReply represents the response from TransactionByHash

type TransactionByHashRequest

type TransactionByHashRequest struct {
	Hash string // Transaction hash (hex string with 0x prefix)
}

TransactionByHashRequest represents a request to get a transaction by hash

type TransactionStatus

type TransactionStatus int
const (
	// Transaction processing failed due to a network issue, RPC issue, or other fatal error
	TxFatal TransactionStatus = iota
	// Transaction was sent successfully to the chain but the smart contract execution reverted
	TxReverted
	// Transaction was sent successfully to the chain, smart contract executed successfully and mined into a block.
	TxSuccess
)

type TransactionVariant

type TransactionVariant string

TransactionVariant represents the type of transaction

const (
	TransactionVariantPending         TransactionVariant = "pending_transaction"
	TransactionVariantUser            TransactionVariant = "user_transaction"
	TransactionVariantGenesis         TransactionVariant = "genesis_transaction"
	TransactionVariantBlockMetadata   TransactionVariant = "block_metadata_transaction"
	TransactionVariantBlockEpilogue   TransactionVariant = "block_epilogue_transaction"
	TransactionVariantStateCheckpoint TransactionVariant = "state_checkpoint_transaction"
	TransactionVariantValidator       TransactionVariant = "validator_transaction"
	TransactionVariantUnknown         TransactionVariant = "unknown"
)

type TypeTag

type TypeTag struct {
	Value TypeTagImpl
}

TypeTag is a wrapper around a TypeTagImpl for serialization/deserialization. This represents Move type arguments like u64, address, vector<u8>, etc.

type TypeTagImpl

type TypeTagImpl interface {
	// TypeTagKind returns the type discriminator for this type tag.
	TypeTagKind() TypeTagKind
}

TypeTagImpl is the interface for all type tag implementations. Different type tags represent different Move types.

type TypeTagKind

type TypeTagKind uint8

TypeTagKind is an enum for different type tag variants.

const (
	TypeTagBool TypeTagKind = iota
	TypeTagU8
	TypeTagU16
	TypeTagU32
	TypeTagU64
	TypeTagU128
	TypeTagU256
	TypeTagAddress
	TypeTagSigner
	TypeTagVector
	TypeTagStruct
	TypeTagGeneric
)

type U8Tag

type U8Tag struct{}

U8Tag represents an unsigned 8-bit integer type.

func (U8Tag) TypeTagKind

func (U8Tag) TypeTagKind() TypeTagKind

type U16Tag

type U16Tag struct{}

U16Tag represents an unsigned 16-bit integer type.

func (U16Tag) TypeTagKind

func (U16Tag) TypeTagKind() TypeTagKind

type U32Tag

type U32Tag struct{}

U32Tag represents an unsigned 32-bit integer type.

func (U32Tag) TypeTagKind

func (U32Tag) TypeTagKind() TypeTagKind

type U64Tag

type U64Tag struct{}

U64Tag represents an unsigned 64-bit integer type.

func (U64Tag) TypeTagKind

func (U64Tag) TypeTagKind() TypeTagKind

type U128Tag

type U128Tag struct{}

U128Tag represents an unsigned 128-bit integer type.

func (U128Tag) TypeTagKind

func (U128Tag) TypeTagKind() TypeTagKind

type U256Tag

type U256Tag struct{}

U256Tag represents an unsigned 256-bit integer type.

func (U256Tag) TypeTagKind

func (U256Tag) TypeTagKind() TypeTagKind

type VectorTag

type VectorTag struct {
	ElementType TypeTag
}

VectorTag represents a vector type with an element type.

func (VectorTag) TypeTagKind

func (VectorTag) TypeTagKind() TypeTagKind

type ViewPayload

type ViewPayload struct {
	Module   ModuleID
	Function string
	ArgTypes []TypeTag
	Args     [][]byte // Arguments encoded in BCS
}

ViewPayload represents the payload for a view function call.

type ViewReply

type ViewReply struct {
	Data []byte // this is marshaled JSON because the aptos rpc client returns JSON
}

type ViewRequest

type ViewRequest struct {
	Payload *ViewPayload
}

Jump to

Keyboard shortcuts

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