Creates an instance of the aTokensClient.
The AptosProvider instance to interact with the Aptos blockchain.
Optional
signer: Ed25519AccountOptional Ed25519Account instance used for signing transactions.
Retrieves the metadata of a specific asset for a given owner and symbol.
The symbol of the asset.
A promise that resolves to the account address containing the asset metadata.
Retrieves the balance of a specific token for a given account.
The address of the account whose token balance is being queried.
The address of the token's metadata.
A promise that resolves to the balance of the token as a bigint.
Builds a transaction for the specified user, function, and arguments.
The account address of the user initiating the transaction.
The identifier of the Move function to be called.
An array of arguments for the entry function.
A promise that resolves to a SimpleTransaction object.
Calls a view method on the Aptos blockchain.
The identifier of the function to call.
The arguments to pass to the function.
Optional generic type arguments for the function (e.g. ["0x1::aptos_coin::AptosCoin"]
).
Retrieves the number of decimals for a given token.
The address of the token metadata.
A promise that resolves to the number of decimals as a bigint.
Funds an account with a specified amount.
The address of the account to be funded.
The amount to fund the account with, in bigint.
A promise that resolves to a UserTransactionResponse.
Retrieves the Aptos balance of a specified account.
The Ed25519 account object.
The address of the account to retrieve the balance for.
Optional
versionToWaitFor: bigint(Optional) The specific version to wait for before retrieving the balance.
A promise that resolves to the balance of the account in bigint.
Retrieves the decimal precision of a token.
The address of the Move function to call.
The account address containing the token metadata.
A promise that resolves to the decimal precision of the token as a bigint.
Retrieves events associated with a specific account.
The address of the account to retrieve events for.
The maximum number of events to retrieve.
A promise that resolves to an array of event objects, each containing:
account_address
: The address of the account.creation_number
: The creation number of the event.data
: The data associated with the event.event_index
: The index of the event.sequence_number
: The sequence number of the event.transaction_block_height
: The block height of the transaction.transaction_version
: The version of the transaction.type
: The type of the event.indexed_type
: The indexed type of the event.Retrieves the metadata address for a given coin.
The Move function identifier to call.
The name of the coin for which to retrieve the metadata address.
A promise that resolves to the account address containing the metadata.
Retrieves the metadata of an AToken by its symbol for a given account owner.
The symbol of the AToken.
A promise that resolves to the account address containing the metadata.
Retrieves the previous index for a given user and metadata address.
The account address of the user.
The account address of the metadata.
A promise that resolves to the previous index as a bigint.
Retrieves the reserve treasury address for a given metadata address.
The account address of the metadata.
A promise that resolves to the account address of the reserve treasury.
Retrieves the scaled user balance and total supply for a given user and token metadata address.
The account address of the user whose balance is being queried.
The account address of the token metadata.
A promise that resolves to an object containing the scaled user balance and the total supply.
Retrieves the current Ed25519Account signer.
The current signer.
Retrieves the token account address associated with the given metadata address.
The address of the metadata account.
A promise that resolves to the token account address.
Retrieves the token address for a given owner and token symbol.
A promise that resolves to the account address of the token.
Retrieves the events associated with a given transaction hash.
The hash of the transaction to retrieve events for.
A promise that resolves to an array of objects containing the event data.
Retrieves the underlying asset address for a given metadata address.
The address of the metadata account.
A promise that resolves to the underlying asset address.
Retrieves the name of the token associated with the given metadata address.
The address of the account metadata.
A promise that resolves to the name of the token as a string.
Rescues tokens from the contract and sends them to a specified address.
The address of the token to be rescued.
The address to which the rescued tokens will be sent.
The amount of tokens to be rescued.
The address of the metadata associated with the token.
A promise that resolves to the response of the committed transaction.
Retrieves the scaled balance of a specific account for a given token.
The address of the account whose scaled balance is being queried.
The address of the token's metadata.
A promise that resolves to the scaled balance of the specified account as a bigint.
Retrieves the scaled total supply of a token.
The address of the token's metadata.
A promise that resolves to the scaled total supply of the token as a bigint.
Sends a transaction and awaits the response.
The ID of the Move function to be called.
An array of arguments for the entry function.
A promise that resolves to the committed transaction response.
Sets the signer for the client.
The Ed25519 account to be used as the signer.
Retrieves the symbol of the AToken associated with the given metadata address.
The address of the account metadata.
A promise that resolves to the symbol of the AToken as a string.
Retrieves the total supply of a token given its metadata address.
The address of the token's metadata.
A promise that resolves to the total supply of the token as a bigint.
Sets the signer to the module signer and returns the current instance.
The current instance with the module signer set.
Sets the signer for the current instance using the provided Ed25519 account.
The Ed25519 account to be used as the signer.
The current instance with the signer set.
Static
buildCreates an instance of ATokensClient using the default signer from the provided AptosProvider.
The AptosProvider instance to use for creating the ATokensClient.
A new instance of ATokensClient.
The
ATokensClient
class provides methods to interact with AToken contracts on the Aptos blockchain. It extends theAptosContractWrapperBaseClass
and includes functionalities for creating tokens, retrieving metadata, and managing token balances.Remarks
This client is designed to work with the AToken contracts and provides a high-level API for common operations. The client can be instantiated in two ways:
Example
Param: provider
The AptosProvider instance used to interact with the Aptos blockchain.
Param: signer
Optional Ed25519Account signer for transaction signing.