aptosclient

package
v0.0.0-...-c246823 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 25

Documentation

Index

Constants

View Source
const (
	VERSIONNONE = ""
	VERSION1    = "v1"
)

Variables

This section is empty.

Functions

func FaucetFundAccount

func FaucetFundAccount(address string, amount uint64, faucetUrl string) (hashs []string, err error)

*

  • This creates an account if it does not exist and mints the specified amount of
  • coins into that account
  • @param address Hex-encoded 16 bytes Aptos account address wich mints tokens
  • @param amount Amount of tokens to mint
  • @param faucetUrl default https://faucet.devnet.aptoslabs.com
  • @returns Hashes of submitted transactions

Types

type RestClient

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

func Dial

func Dial(ctx context.Context, rpcUrl string) (client *RestClient, err error)

func DialWithClient

func DialWithClient(ctx context.Context, rpcUrl string, c *http.Client) (client *RestClient, err error)

func (*RestClient) AptosBalanceOf

func (c *RestClient) AptosBalanceOf(address string) (balance *big.Int, err error)

func (*RestClient) BalanceOf

func (c *RestClient) BalanceOf(address string, coinTag string) (balance *big.Int, err error)

func (*RestClient) ChainId

func (c *RestClient) ChainId() int

func (*RestClient) CreateTransactionSigningMessage

func (c *RestClient) CreateTransactionSigningMessage(transaction *aptostypes.Transaction) (message []byte, err error)

func (*RestClient) EstimateGasPrice

func (c *RestClient) EstimateGasPrice() (price uint64, err error)

func (*RestClient) GetAccount

func (c *RestClient) GetAccount(address string) (res *aptostypes.AccountCoreData, err error)

func (*RestClient) GetAccountModule

func (c *RestClient) GetAccountModule(address, moduleName string, version uint64) (res *aptostypes.MoveModule, err error)

func (*RestClient) GetAccountModules

func (c *RestClient) GetAccountModules(address string, version uint64) (res []aptostypes.MoveModule, err error)

func (*RestClient) GetAccountResource

func (c *RestClient) GetAccountResource(address string, resourceType string, version uint64) (res *aptostypes.AccountResource, err error)

func (*RestClient) GetAccountResourceHandle404

func (c *RestClient) GetAccountResourceHandle404(address, resourceType string, version uint64) (res *aptostypes.AccountResource, err error)

Variation of `GetAccountResource`: when specified resource is not found (error with code 404), this will return `nil` result and `nil` error

func (*RestClient) GetAccountResources

func (c *RestClient) GetAccountResources(address string, version uint64) (res []aptostypes.AccountResource, err error)

func (*RestClient) GetAccountTransactions

func (c *RestClient) GetAccountTransactions(account string, start, limit uint64) (res []aptostypes.Transaction, err error)

func (*RestClient) GetBlockByHeight

func (c *RestClient) GetBlockByHeight(height string, with_transactions bool) (block *aptostypes.Block, err error)

func (*RestClient) GetBlockByVersion

func (c *RestClient) GetBlockByVersion(version string, with_transactions bool) (block *aptostypes.Block, err error)

func (*RestClient) GetCoinInfo

func (c *RestClient) GetCoinInfo(coinType string) (aptostypes.CoinInfo, error)

func (*RestClient) GetEventsByCreationNumber

func (c *RestClient) GetEventsByCreationNumber(address string, creationNumber string, start, limit uint64) (res []aptostypes.Event, err error)

func (*RestClient) GetEventsByEventHandle

func (c *RestClient) GetEventsByEventHandle(address, eventHandle, field string, start, limit uint64) (res []aptostypes.Event, err error)

func (*RestClient) GetTableItem

func (c *RestClient) GetTableItem(out interface{}, handle string, body TableItemRequest, ledgerVersion string) (err error)

*

  • Get table item
  • Get a table item at a specific ledger version from the table identified by {table_handle}
  • in the path and the "key" (TableItemRequest) provided in the request body. *
  • This is a POST endpoint because the "key" for requesting a specific
  • table item (TableItemRequest) could be quite complex, as each of its
  • fields could themselves be composed of other structs. This makes it
  • impractical to express using query params, meaning GET isn't an option. *
  • The Aptos nodes prune account state history, via a configurable time window.
  • If the requested ledger version has been pruned, the server responds with a 410.
  • @param out the result of the query will be called json.Unmarshal
  • @param tableHandle Table handle hex encoded 32-byte string
  • @param requestBody
  • @param ledgerVersion Ledger version to get state of account
  • If not provided, it will be the latest version *
  • @throws ApiError

func (*RestClient) GetTransactionByHash

func (c *RestClient) GetTransactionByHash(txHash string) (res *aptostypes.Transaction, err error)

func (*RestClient) GetTransactionByVersion

func (c *RestClient) GetTransactionByVersion(txVersion string) (res *aptostypes.Transaction, err error)

func (*RestClient) GetTransactions

func (c *RestClient) GetTransactions(start, limit uint64) (res []aptostypes.Transaction, err error)

func (*RestClient) GetVersion

func (c *RestClient) GetVersion() string

func (*RestClient) GetVersionedRpcUrl

func (c *RestClient) GetVersionedRpcUrl() string

func (*RestClient) IsAccountHasResource

func (c *RestClient) IsAccountHasResource(address string, resourceType string, version uint64) (bool, error)

func (*RestClient) LedgerInfo

func (c *RestClient) LedgerInfo() (res *aptostypes.LedgerInfo, err error)

func (*RestClient) RawQuery

func (c *RestClient) RawQuery(urlWithoutVersion string, params map[string]string) (data []byte, err error)

func (*RestClient) SetVersion

func (c *RestClient) SetVersion(version string)

func (*RestClient) SimulateSignedBCSTransaction

func (c *RestClient) SimulateSignedBCSTransaction(signedTxn []byte) (res []*aptostypes.Transaction, err error)

*

  • Submits a signed transaction to the the endpoint that takes BCS payload
  • @param signedTxn A BCS transaction representation
  • @returns Transaction that is accepted and submitted to mempool

func (*RestClient) SimulateTransaction

func (c *RestClient) SimulateTransaction(transaction *aptostypes.Transaction, senderPublicKey string) (res []*aptostypes.Transaction, err error)

func (*RestClient) SubmitSignedBCSTransaction

func (c *RestClient) SubmitSignedBCSTransaction(signedTxn []byte) (res *aptostypes.Transaction, err error)

*

  • Submits a signed transaction to the the endpoint that takes BCS payload
  • @param signedTxn A BCS transaction representation
  • @returns Transaction that is accepted and submitted to mempool

func (*RestClient) SubmitTransaction

func (c *RestClient) SubmitTransaction(transaction *aptostypes.Transaction) (res *aptostypes.Transaction, err error)

type TableItemRequest

type TableItemRequest struct {
	KeyType   string `json:"key_type"`
	ValueType string `json:"value_type"`
	Key       any    `json:"key"`
}

Jump to

Keyboard shortcuts

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