aptos

package
v0.0.0-...-1a43537 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGasLimit = 10000

Variables

Functions

func CheckError

func CheckError(err error) errors.Status

func DecodeHex

func DecodeHex(h string) ([]byte, error)

func NewAddressBuilder

func NewAddressBuilder(asset *xc.ChainBaseConfig) (xc.AddressBuilder, error)

NewAddressBuilder creates a new Template AddressBuilder

func ValidateAddress

func ValidateAddress(cfg *xc.ChainBaseConfig, address xc.Address) error

Types

type AddressBuilder

type AddressBuilder struct {
}

AddressBuilder for Template

func (AddressBuilder) GetAddressFromPublicKey

func (ab AddressBuilder) GetAddressFromPublicKey(publicKeyBytes []byte) (xc.Address, error)

GetAddressFromPublicKey returns an Address given a public key

type Client

type Client struct {
	Asset       *xc.ChainConfig
	AptosClient *aptosclient.RestClient
}

Client for Aptos

func NewClient

func NewClient(cfgI *xc.ChainConfig) (*Client, error)

NewClient returns a new Aptos Client

func NewClientFrom

func NewClientFrom(asset *xc.ChainConfig, client *aptosclient.RestClient) *Client

Enable constructing multiple clients without dialing aptos endpoint multiple times

func (*Client) EstimateGas

func (client *Client) EstimateGas(ctx context.Context, ledgerInfo *aptostypes.LedgerInfo) (xc.AmountBlockchain, error)

func (*Client) FetchBalance

func (client *Client) FetchBalance(ctx context.Context, args *xclient.BalanceArgs) (xc.AmountBlockchain, error)

FetchBalance fetches balance for an Aptos address

func (*Client) FetchBlock

func (client *Client) FetchBlock(ctx context.Context, args *xclient.BlockArgs) (*txinfo.BlockWithTransactions, error)

func (*Client) FetchDecimals

func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*Client) FetchLegacyTxInfo

func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (txinfo.LegacyTxInfo, error)

FetchLegacyTxInfo returns tx info for a Aptos tx

func (*Client) FetchLegacyTxInput

func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

FetchLegacyTxInput returns tx input for a Aptos tx

func (*Client) FetchNativeBalance

func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

FetchNativeBalance fetches the native asset balance for an Aptos address

func (*Client) FetchTransferInput

func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

func (*Client) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, args *txinfo.Args) (txinfo.TxInfo, error)

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, tx xctypes.SubmitTxReq) error

SubmitTx submits a Aptos tx

type FungibleAssetMetadata

type FungibleAssetMetadata struct {
	Decimals   int    `json:"decimals"`
	IconUri    string `json:"icon_uri"`
	Name       string `json:"name"`
	ProjectUri string `json:"project_uri"`
	Symbol     string `json:"symbol"`
}

type GasSchedule

type GasSchedule struct {
	Entries []GasScheduleEntry `json:"entries"`
}

func (*GasSchedule) Get

func (gasSchedule *GasSchedule) Get(key string) (uint64, error)

type GasScheduleEntry

type GasScheduleEntry struct {
	Key string `json:"key"`
	Val string `json:"val"`
}

type Tx

type Tx struct {
	Input *tx_input.TxInput
	// contains filtered or unexported fields
}

func (Tx) Hash

func (tx Tx) Hash() xc.TxHash

Hash returns the tx hash or id

func (Tx) Serialize

func (tx Tx) Serialize() ([]byte, error)

func (*Tx) SetSignatures

func (tx *Tx) SetSignatures(signatures ...*xc.SignatureResponse) error

SetSignatures adds a signature to Tx

func (Tx) Sighashes

func (tx Tx) Sighashes() ([]*xc.SignatureRequest, error)

Sighashes returns the tx payload to sign, aka sighash

type TxBuilder

type TxBuilder struct {
	Asset *xc.ChainBaseConfig
}

TxBuilder for Template

func NewTxBuilder

func NewTxBuilder(asset *xc.ChainBaseConfig) (TxBuilder, error)

NewTxBuilder creates a new Template TxBuilder

func (TxBuilder) NewNativeTransfer

func (txBuilder TxBuilder) NewNativeTransfer(feePayer xc.Address, from xc.Address, to xc.Address, amount xc.AmountBlockchain, input *tx_input.TxInput) (xc.Tx, error)

NewNativeTransfer creates a new transfer for a native asset

func (*TxBuilder) NewTokenTransfer

func (txb *TxBuilder) NewTokenTransfer(feePayer xc.Address, from xc.Address, to xc.Address, amount xc.AmountBlockchain, contract xc.ContractAddress, input *tx_input.TxInput) (xc.Tx, error)

NewTokenTransfer creates a new transfer for a token asset

func (TxBuilder) SupportsFeePayer

func (txBuilder TxBuilder) SupportsFeePayer() xcbuilder.FeePayerType

func (TxBuilder) SupportsMemo

func (txBuilder TxBuilder) SupportsMemo() xc.MemoSupport

func (TxBuilder) Transfer

func (txBuilder TxBuilder) Transfer(args xcbuilder.TransferArgs, input xc.TxInput) (xc.Tx, error)

Transfer creates a new transfer for an Asset, either native or token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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