Optional
config: Partial<OpenAPIConfig>Readonly
nodeGenerates a raw transaction out of a transaction payload
A raw transaction object
Optional
extraArgs: OptionalTransactionArgsHelper for generating, signing, and submitting a transaction.
The transaction response from the API.
AptosAccount of transaction sender.
Transaction payload.
Optional
extraArgs: OptionalTransactionArgsExtra args for building the transaction payload.
Helper for generating, submitting, and waiting for a transaction, and then
checking whether it was committed successfully. Under the hood this is just
generateSignSubmitTransaction
and then waitForTransactionWithResult
, see
those for information about the return / error semantics of this function.
Optional
extraArgs: OptionalTransactionArgs & { Generates an entry function transaction request that can be submitted to produce a raw transaction that can be signed, which upon being signed can be submitted to the blockchain This function fetches the remote ABI and uses it to serialized the data, therefore users don't need to handle serialization by themselves.
A raw transaction object
Hex-encoded 32 byte Aptos account address of transaction sender
Entry function transaction payload type
Optional
options: Partial<SubmitTransactionRequest>Options allow to overwrite default transaction options.
Queries an Aptos account by address
Core account resource, used for identifying account and transaction execution
An example of the returned account
{
sequence_number: "1",
authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69"
}
Hex-encoded 32 byte Aptos account address
Queries an account coin data
GetAccountCoinsDataQuery response type
Owner address
Optional
options: PaginationArgsQueries module associated with given account by module name
Note: In order to get all account resources, this function may call the API multiple times as it paginates.
Specified module.
Module is represented by MoveModule interface. It contains module bytecode
and abi
,
which JSON representation of a module
Hex-encoded 32 byte Aptos account address
The name of the module
Optional
query: { Optional
ledgerSpecifies ledger version of transactions. By default latest version will be used
Queries modules associated with given account
Note: In order to get all account modules, this function may call the API multiple times as it paginates.
Account modules array for a specific ledger version.
Module is represented by MoveModule interface. It contains module bytecode
and abi
,
which is JSON representation of a module
Hex-encoded 32 byte Aptos account address
Optional
query: { Optional
ledgerSpecifies ledger version of transactions. By default latest version will be used
Queries an Aptos account's NFTs by owner address
GetAccountCurrentTokensQuery response type
Hex-encoded 32 byte Aptos account address
Optional
options: PaginationArgsQueries resource associated with given account by resource type
Account resource of specified type and ledger version
An example of an account resource
{
type: "0x1::aptos_coin::AptosCoin",
data: { value: 6 }
}
Hex-encoded 32 byte Aptos account address
String representation of an on-chain Move struct type
Optional
query: { Optional
ledgerSpecifies ledger version of transactions. By default latest version will be used
Queries all resources associated with given account
Account resources for a specific ledger version
Hex-encoded 32 byte Aptos account address
Optional
query: { Optional
ledgerSpecifies ledger version of transactions. By default latest version will be used
Gets the count of tokens owned by an account
AccountTokensCountQuery response type
Owner address
Queries transactions sent by given account
An array of on-chain transactions, sent by account
Hex-encoded 32 byte Aptos account address
Optional
query: PaginationArgsOptional pagination object
Gets the count of transactions submitted by an account
GetAccountTransactionsCountQuery response type
Queries an account transactions data
GetAccountTransactionsDataQuery response type
Optional
options: PaginationArgsGet block by block transaction version
Block
Ledger version to lookup block information for
Optional
withTransactions: booleanIf set to true, include all transactions in the block
Queries a collection address.
the collection address
the collection creator address
the collection name
Optional
extraArgs: { Optional
tokenQueries data of a specific collection by the collection creator address and the collection name.
if, for some reason, a creator account has 2 collections with the same name in v1 and v2,
can pass an optional tokenStandard
parameter to query a specific standard
GetCollectionDataQuery response type
the collection creator address
the collection name
Optional
extraArgs: { Optional
options?: PaginationArgsOptional
tokenQueries for all collections that an account has tokens for.
GetCollectionsWithOwnedTokensQuery response type
the account address that owns the tokens
Optional
extraArgs: { Optional
options?: PaginationArgsOptional
tokenQueries delegated staking activities
GetDelegatedStakingActivitiesQuery response type
Delegator address
Pool address
Event types are globally identifiable by an account address
and
monotonically increasing creation_number
, one per event type emitted
to the given account. This API returns events corresponding to that
that event type.
Array of events assotiated with the given account and creation number.
Hex-encoded 32 byte Aptos account, with or without a 0x
prefix,
for which events are queried. This refers to the account that events were emitted
to, not the account hosting the move module that emits that event type.
Creation number corresponding to the event type.
Optional
query: PaginationArgsThis API uses the given account address
, eventHandle
, and fieldName
to build a key that can globally identify an event types. It then uses this
key to return events emitted to the given account matching that event type.
Array of events
Hex-encoded 32 byte Aptos account, with or without a 0x
prefix,
for which events are queried. This refers to the account that events were emitted
to, not the account hosting the move module that emits that event type.
String representation of an on-chain Move struct type.
(e.g. 0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>
)
The field name of the EventHandle in the struct
Optional
query: PaginationArgsOptional query object
Queries the latest ledger information
Latest ledger information
Example of returned data
{
chain_id: 15,
epoch: 6,
ledgerVersion: "2235883",
ledger_timestamp:"1654580922321826"
}
Queries current number of delegators in a pool
GetNumberOfDelegatorsQuery response type
Queries account's current owned tokens. This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc. If you want to get only the token from a specific standrd, you can pass an optional tokenStandard param
An example of how to pass a specific token standard
{
tokenStandard:"v2"
}
GetOwnedTokensQuery response type
The token owner address we want to get the tokens for
Optional
extraArgs: { Optional
options?: PaginationArgsOptional
tokenGets a table item for a table identified by the handle and the key for the item. Key and value types need to be passed in to help with key serialization and value deserialization.
Table item value rendered in JSON
A pointer to where that table is stored
Object, that describes table item
Optional
query: { Optional
ledgerQueries all tokens of a specific collection that an account owns by the collection address
GetTokenOwnedFromCollectionQuery response type
owner address that owns the tokens
the collection address
Optional
extraArgs: { Optional
options?: PaginationArgsOptional
tokenQueries all tokens of a specific collection that an account owns by the collection name and collection creator address
GetTokenOwnedFromCollectionQuery response type
owner address that owns the tokens
the collection name
the collection creator address
Optional
extraArgs: { Optional
options?: PaginationArgsOptional
tokenTransaction from mempool (pending) or on-chain (committed) transaction
Transaction hash should be hex-encoded bytes string with 0x prefix.
On-chain transaction. Only on-chain transactions have versions, so this function cannot be used to query pending transactions.
Transaction version is an uint64 number.
Queries on-chain transactions. This function will not return pending
transactions. For that, use getTransactionsByHash
.
Array of on-chain transactions
Optional
query: PaginationArgsOptional pagination object
Lookup the original address by the current derived address
original address
Publishes a move package. packageMetadata
and modules
can be generated with command
aptos move compile --save-metadata [ --included-artifacts=<...> ]
.
Transaction hash
package metadata bytes
bytecodes of modules
Optional
extraArgs: OptionalTransactionArgsRotate an account's auth key. After rotation, only the new private key can be used to sign txns for the account. WARNING: You must create a new instance of AptosAccount after using this function.
PendingTransaction
Account of which the auth key will be rotated
New private key
Optional
extraArgs: OptionalTransactionArgsExtra args for building the transaction payload.
Helper for signing and submitting a transaction.
The transaction response from the API.
AptosAccount of transaction sender.
A generated Raw transaction payload.
Converts a transaction request produced by generateTransaction
into a properly
signed transaction, which can then be submitted to the blockchain
A transaction, signed with sender account
AptosAccount of transaction sender
A raw transaction generated by generateTransaction
method
Generates and submits a transaction to the transaction simulation endpoint. For this we generate a transaction with a fake signature.
The BCS encoded signed transaction, which you should then provide
The sender or sender's public key. When private key is available, AptosAccount
instance
can be used to send the transaction for simulation. If private key is not available, sender's public key can be
used to send the transaction for simulation.
The raw transaction to be simulated, likely created
by calling the generateTransaction
function.
Optional
query: { Optional
estimateIf set to true, the gas unit price in the transaction will be ignored and the estimated value will be used.
Optional
estimateIf set to true, the max gas value in the transaction will be ignored and the maximum possible gas will be used.
If set to true, the transaction will use a higher price than the original estimate.
Submits the BCS serialization of a signed transaction to the simulation endpoint.
Simulation result in the form of UserTransaction.
The output of generateBCSSimulation
.
Optional
query: { Optional
estimateOptional
estimateOptional
estimateSubmits a signed transaction to the endpoint that takes BCS payload
Transaction that is accepted and submitted to mempool
A BCS transaction representation
Submits a signed transaction to the transaction endpoint.
Transaction that is accepted and submitted to mempool
A transaction, signed by signTransaction
method
Defines if specified transaction is currently in pending state
true
if transaction is in pending state and false
otherwise
A hash of transaction
To create a transaction hash:
Call for a move view function
MoveValue[]
Transaction payload
Optional
ledger_version: stringThis function works the same as waitForTransactionWithResult
except it
doesn't return the transaction in those cases, it returns nothing. For
more information, see the documentation for waitForTransactionWithResult
.
Optional
extraArgs: { Optional
checkOptional
timeoutWait for a transaction to move past pending state.
There are 4 possible outcomes:
In case 1, this function resolves with the transaction response returned by the API.
In case 2, the function will throw an ApiError, likely with an HTTP status code indicating some problem with the request (e.g. 400).
In case 3, if checkSuccess
is false (the default), this function returns
the transaction response just like in case 1, in which the success
field
will be false. If checkSuccess
is true, it will instead throw a
FailedTransactionError.
In case 4, this function throws a WaitForTransactionError.
See above.
const rawTransaction = await this.generateRawTransaction(sender.address(), payload, extraArgs);
const bcsTxn = AptosClient.generateBCSTransaction(sender, rawTransaction);
const pendingTransaction = await this.submitSignedBCSTransaction(bcsTxn);
const transasction = await this.aptosClient.waitForTransactionWithResult(pendingTransaction.hash);
The hash of a transaction previously submitted to the blockchain.
Optional
extraArgs: { Optional
checkSee above. Defaults to false.
Optional
timeoutTimeout in seconds. Defaults to 20 seconds.
Generated using TypeDoc
Builds a Provider class with an aptos client configured to connect to an Aptos node and indexer client configured to connect to Aptos Indexer.
It creates AptosClient and IndexerClient instances based on the network or custom endpoints provided.
This class holds both AptosClient and IndexerClient classes's methods and properties so we can instantiate the Provider class and use it to query full node and/or Indexer.
Example
An example of how to use this class
Param
enum of type Network - MAINNET | TESTNET | DEVENET or custom endpoints of type CustomEndpoints
Param
AptosClient config arg - additional configuration options for the generated Axios client.