aptos

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error) xc.ClientError

func NewAddressBuilder

func NewAddressBuilder(asset xc.ITask) (xc.AddressBuilder, error)

NewAddressBuilder creates a new Template AddressBuilder

func NewSigner

func NewSigner(asset xc.ITask) (xc.Signer, error)

NewSigner creates a new Aptos Signer

func NewTxBuilder

func NewTxBuilder(asset xc.ITask) (xc.TxBuilder, error)

NewTxBuilder creates a new Template TxBuilder

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

func (AddressBuilder) GetAllPossibleAddressesFromPublicKey

func (ab AddressBuilder) GetAllPossibleAddressesFromPublicKey(publicKeyBytes []byte) ([]xc.PossibleAddress, error)

GetAllPossibleAddressesFromPublicKey returns all PossubleAddress(es) given a public key

type Client

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

Client for Aptos

func NewClient

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

NewClient returns a new Aptos Client

func (*Client) FetchBalance

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

FetchBalance fetches balance for an Aptos address

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) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, txHash xc.TxHash) (xc.TxInfo, error)

FetchTxInfo returns tx info for a Aptos tx

func (*Client) FetchTxInput

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

FetchTxInput returns tx input for a Aptos tx

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, txInput xc.Tx) error

SubmitTx submits a Aptos tx

type Signer

type Signer struct {
}

Signer for Aptos

func (Signer) ImportPrivateKey

func (signer Signer) ImportPrivateKey(privateKey string) (xc.PrivateKey, error)

ImportPrivateKey imports an Aptos private key

func (Signer) Sign

func (signer Signer) Sign(privateKey xc.PrivateKey, data xc.TxDataToSign) (xc.TxSignature, error)

Sign an Aptos tx

type Tx

type Tx struct {
}

Tx for Template

func (Tx) AddSignatures

func (tx Tx) AddSignatures(...xc.TxSignature) error

AddSignatures adds a signature to Tx

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) Sighashes

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

Sighashes returns the tx payload to sign, aka sighash

type TxBuilder

type TxBuilder struct {
	Asset *xc.AssetConfig
}

TxBuilder for Template

func (TxBuilder) NewNativeTransfer

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

NewNativeTransfer creates a new transfer for a native asset

func (TxBuilder) NewTokenTransfer

func (txBuilder TxBuilder) NewTokenTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)

NewTokenTransfer creates a new transfer for a token asset

func (TxBuilder) NewTransfer

func (txBuilder TxBuilder) NewTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)

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

type TxInput

type TxInput struct {
	xc.TxInputEnvelope
}

TxInput for Aptos

func NewTxInput

func NewTxInput() *TxInput

NewTxInput returns a new Aptos TxInput

Jump to

Keyboard shortcuts

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