Aptos

class Aptos(val config: AptosConfig = AptosConfig(), graceFull: Boolean = Application.graceFull) : Account, Coin, General, Transaction, Staking, DigitalAsset, Faucet, Ans

Aptos is the main entry point to the SDK's APIs. Instantiate to access all functionalities.

Parameters

config

AptosConfig to optionally configure the SDK.

Constructors

Link copied to clipboard
constructor(config: AptosConfig = AptosConfig(), graceFull: Boolean = Application.graceFull)

Properties

Link copied to clipboard
open override val buildTransaction: Build

Builds a transaction to be submitted to the chain

Link copied to clipboard
open override val config: AptosConfig
Link copied to clipboard
open override val simulateTransaction: Simulate

Simulate transaction before signing

Link copied to clipboard
open override val submitTransaction: Submit

Submits a transaction to the chain

Functions

Link copied to clipboard
open suspend override fun addDigitalAssetPropertyTransaction(creator: Account, propertyKey: String, propertyType: PropertyType, propertyValue: PropertyValue, digitalAssetAddress: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Add a property to a digital asset

Link copied to clipboard
open suspend override fun burnDigitalAssetTransaction(creator: Account, digitalAssetAddress: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Burn a digital asset by its creator

Link copied to clipboard
open suspend override fun createCollectionTransaction(creator: Account, name: String, description: String, uri: String, collectionOptions: CreateCollectionOptions, options: InputGenerateTransactionOptions): SimpleTransaction

Creates a new collection within the specified account.

Link copied to clipboard
open suspend override fun freezeDigitalAssetTransferTransaction(creator: Account, digitalAssetAddress: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Freeze digital asset transfer ability

Link copied to clipboard
open suspend override fun fundAccount(accountAddress: AccountAddressInput, amount: Long, options: WaitForTransactionOptions): Option<TransactionResponse>

This creates an account if it does not exist and mints the specified amount of coins into that account

Link copied to clipboard
open suspend override fun getAccountAPTAmount(accountAddress: AccountAddressInput, minimumLedgerVersion: Long?): Option<Long>

Queries the account's APT amount

Link copied to clipboard
open suspend override fun getAccountCoinAmount(accountAddress: AccountAddressInput, coinType: MoveValue.MoveStructId, minimumLedgerVersion: Long?): Option<Long>

Queries the account's coin amount by the coin type

Link copied to clipboard
open suspend override fun getAccountCoinsCount(accountAddress: AccountAddressInput, minimumLedgerVersion: Long?): Option<Int>

Queries the current count of an account's coins aggregated

Link copied to clipboard
open suspend override fun getAccountCoinsData(accountAddress: AccountAddressInput, minimumLedgerVersion: Long?): Option<AccountCoinsData>

Queries an account's coins data

Link copied to clipboard
open suspend override fun getAccountInfo(accountAddress: AccountAddressInput, params: LedgerVersionQueryParam.() -> Unit): Option<AccountData>

Queries the current state for an Aptos account given its account address

Link copied to clipboard
open suspend override fun getAccountModule(accountAddress: AccountAddressInput, moduleName: String, param: LedgerVersionQueryParam.() -> Unit): Option<MoveModuleBytecode>

Queries for a specific account module given account address and module name

Link copied to clipboard

Queries for all modules in an account given an account address

Link copied to clipboard
inline suspend fun <T> Account.getAccountResource(accountAddress: AccountAddressInput, resourceName: String, param: LedgerVersionQueryParam.() -> Unit = {}): Option<T>

Queries a specific account resource given an account address and resource name

Link copied to clipboard
open suspend override fun getAccountResources(accountAddress: AccountAddressInput, params: SpecificPaginationQueryParams.() -> Unit): Option<List<Option<List<MoveResource>>>>

Queries all account resources given an account address

Link copied to clipboard
open suspend override fun getAccountTransactions(accountAddress: AccountAddressInput, params: PaginationQueryParams.() -> Unit): Option<List<Option<List<TransactionResponse>>>>

Queries account transactions given an account address

Link copied to clipboard
open suspend override fun getAccountTransactionsCount(accountAddress: AccountAddressInput, minimumLedgerVersion: Long?): Option<Long>

Queries the current count of transactions submitted by an account

Link copied to clipboard
open suspend override fun getBlockByHeight(ledgerHeight: Long): Option<Block>

Queries for block by height

Link copied to clipboard
open suspend override fun getBlockByVersion(ledgerVersion: Long): Option<Block>

Queries for block by transaction version

Link copied to clipboard
open suspend override fun getChainId(): Option<Long>

Queries for the chain id

Link copied to clipboard

Queries top user transactions

Link copied to clipboard
open suspend override fun getCollectionData(creatorAddress: AccountAddressInput, collectionName: String, minimumLedgerVersion: Long?, tokenStandard: TokenStandard?): Option<CollectionData?>

Queries data of a specific collection by the collection creator address and the collection name.

Link copied to clipboard
open suspend override fun getCollectionDataByCollectionId(collectionId: String, minimumLedgerVersion: Long?): Option<CollectionData?>

Queries data of a specific collection by the collection ID.

Link copied to clipboard
open suspend override fun getExpiration(name: String): Option<Long>

Retrieve the expiration time of a domain name or subdomain name from the contract.

Link copied to clipboard
open suspend override fun getGasPriceEstimation(): GasEstimation

Gives an estimate of the gas unit price required to get a transaction on chain in a reasonable amount of time. For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}

Link copied to clipboard
open suspend override fun getIndexerLastSuccessVersion(): Option<Long>

Queries for the last successful indexer version

Link copied to clipboard
open suspend override fun getLedgerInfo(): Option<LedgerInfo>

Queries for the Aptos ledger info

Link copied to clipboard
open suspend override fun getNumberOfDelegators(poolAddress: AccountAddressInput, minimumLedgerVersion: Long?): Option<NumberOfDelegators>

Queries current number of delegators in a pool. Throws an error if the pool is not found.

Link copied to clipboard
open suspend override fun getOwnerAddress(name: String): Option<AccountAddress>

Retrieve the owner address of a domain name or subdomain name from the contract.

Link copied to clipboard
open suspend override fun getPrimaryName(address: AccountAddressInput): Option<String>

Retrieve the primary name for an account. An account can have multiple names that target it, but only a single name that is primary. An account also may not have a primary name.

Link copied to clipboard
open suspend override fun getProcessorStatus(processorType: ProcessorType): Option<ProcessorStatus>

Query the processor status for a specific processor type.

Link copied to clipboard
inline suspend fun <T> General.getTableItem(handle: String, data: TableItemRequest, param: LedgerVersionQueryParam? = null): T
Link copied to clipboard
open suspend override fun getTargetAddress(name: String): Option<AccountAddress>

Retrieve the target address of a domain or subdomain name. This is the address the name points to for use on chain. Note, the target address can point to addresses that are not the owner of the name

Link copied to clipboard
open suspend override fun getTokenData(offset: Int?, limit: Int?): Option<TokenData?>
Link copied to clipboard
open suspend override fun getTransactionByHash(transactionHash: String): Option<TransactionResponse>

Queries on-chain transaction by transaction hash. This function will return pending transactions.

Link copied to clipboard
open suspend override fun getTransactionByVersion(ledgerVersion: Long): Option<TransactionResponse>

Queries on-chain transaction by version. This function will not return pending transactions.

Link copied to clipboard
open suspend override fun getTransactions(options: PaginationArgs?): Option<List<Option<List<TransactionResponse>>>>

Queries on-chain transactions. This function will not return pending transactions. For that, use getTransactionsByHash.

Link copied to clipboard

Returns the current graceFull setting.

Link copied to clipboard
open suspend override fun isPendingTransaction(transactionHash: HexInput): Boolean

Defines if specified transaction is currently in pending state

Link copied to clipboard
open suspend override fun mintDigitalAssetTransaction(creator: Account, collection: String, name: String, description: String, uri: String, propertyKeys: List<String>?, propertyTypes: List<String>?, propertyValues: List<String>?, options: InputGenerateTransactionOptions): SimpleTransaction

Create a transaction to mint a digital asset into the creators account within an existing collection.

Link copied to clipboard
open suspend override fun mintSoulBoundTransaction(account: Account, collection: String, name: String, description: String, uri: String, recipient: AccountAddressInput, propertyKeys: List<String>, propertyTypes: List<String>, propertyValues: List<String>, options: InputGenerateTransactionOptions): SimpleTransaction

Mint a soul bound digital asset.

Link copied to clipboard
open suspend override fun publishPackageTransaction(account: AccountAddressInput, metadataBytes: HexInput, moduleBytecode: List<HexInput>, options: InputGenerateTransactionOptions): SimpleTransaction

Generates a transaction to publish a move package to chain.

Link copied to clipboard
inline suspend fun <T> General.queryIndexer(query: GraphqlQuery): Option<T>

A generic function for retrieving data from Aptos Indexer.

Link copied to clipboard
open suspend override fun removeDigitalAssetPropertyTransaction(creator: Account, propertyKey: String, digitalAssetAddress: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Remove a property from a digital asset

Link copied to clipboard
open suspend override fun setDigitalAssetDescriptionTransaction(creator: Account, digitalAssetAddress: AccountAddressInput, description: String, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Set the digital asset description

Link copied to clipboard
open suspend override fun setDigitalAssetNameTransaction(creator: Account, digitalAssetAddress: AccountAddressInput, name: String, digitalAssetType: MoveStructId): SimpleTransaction

Set the digital asset name

Link copied to clipboard
open suspend override fun setDigitalAssetURITransaction(creator: Account, digitalAssetAddress: AccountAddressInput, uri: String, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Set the digital asset URI

Link copied to clipboard

Sets the target address of a domain or subdomain name. This is the address the name points to for use on chain. Note, the target address can point to addresses that are not the owner of the name

Link copied to clipboard
open override fun sign(signer: Account, transaction: AnyRawTransaction): AccountAuthenticator

Sign a transaction that can later be submitted to chain

Link copied to clipboard
open suspend override fun signAndSubmitAsFeePayer(feePayer: Account, senderAuthenticator: AccountAuthenticator, transaction: AnyRawTransaction): Option<PendingTransactionResponse>

Sign and submit a single signer transaction as the fee payer to chain given an authenticator by the sender of the transaction.

Link copied to clipboard
open suspend override fun signAndSubmitTransaction(signer: Account, transaction: AnyRawTransaction): Option<PendingTransactionResponse>

Sign and submit a single signer transaction to chain

Link copied to clipboard
open override fun signAsFeePayer(signer: Account, transaction: AnyRawTransaction): AccountAuthenticator

Sign a transaction as a fee payer that can later be submitted to chain

Link copied to clipboard
open suspend override fun transferCoinTransaction(from: AccountAddressInput, to: AccountAddressInput, amount: ULong, coinType: String, withFeePayer: Boolean, options: InputGenerateTransactionOptions): SimpleTransaction

Generates a Transaction that can be simulated and/or signed and submitted to the chain.

Link copied to clipboard
open suspend override fun transferDigitalAssetTransaction(sender: Account, digitalAssetAddress: AccountAddressInput, recipient: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Transfer a digital asset (non-fungible digital asset) ownership.

Link copied to clipboard
open suspend override fun unfreezeDigitalAssetTransferTransaction(creator: Account, digitalAssetAddress: AccountAddressInput, digitalAssetType: MoveStructId, options: InputGenerateTransactionOptions): SimpleTransaction

Unfreeze digital asset transfer ability

Link copied to clipboard
inline suspend fun <T : List<MoveValue>> General.view(payload: InputViewFunctionData, bcs: Boolean = true, ledgerVersion: LedgerVersionArg? = null): Option<T>

Queries for a Move view function

Link copied to clipboard
open suspend override fun waitForTransaction(transactionHash: HexInput, options: WaitForTransactionOptions): Option<TransactionResponse>