Class AptosClient
- Namespace
- Aptos
- Assembly
- Aptos.dll
Creates an instance of the AptosClient with a given AptosConfig. This client is used to interface with the Aptos blockchain and perform various operations such as querying the blockchain, submitting transactions, and interacting with the Aptos network.
public class AptosClient
- Inheritance
-
AptosClient
- Inherited Members
Remarks
By default, the client will use Devnet as the network configuration.
Constructors
AptosClient(AptosConfig?)
Creates an instance of the AptosClient with a given AptosConfig. This client is used to interface with the Aptos blockchain and perform various operations such as querying the blockchain, submitting transactions, and interacting with the Aptos network.
public AptosClient(AptosConfig? config = null)
Parameters
configAptosConfig
Remarks
By default, the client will use Devnet as the network configuration.
AptosClient(NetworkConfig)
Creates an instance of the AptosClient with a given AptosConfig. This client is used to interface with the Aptos blockchain and perform various operations such as querying the blockchain, submitting transactions, and interacting with the Aptos network.
public AptosClient(NetworkConfig networkConfig)
Parameters
networkConfigNetworkConfig
Remarks
By default, the client will use Devnet as the network configuration.
Fields
Account
public readonly AccountClient Account
Field Value
Ans
public readonly ANSClient Ans
Field Value
Block
public readonly BlockClient Block
Field Value
Config
public readonly AptosConfig Config
Field Value
Contract
public readonly ContractClient Contract
Field Value
DigitalAsset
public readonly DigitalAssetClient DigitalAsset
Field Value
Faucet
public readonly FaucetClient Faucet
Field Value
FungibleAsset
public readonly FungibleAssetClient FungibleAsset
Field Value
Gas
public readonly GasClient Gas
Field Value
Indexer
public readonly IndexerClient Indexer
Field Value
Keyless
public readonly KeylessClient Keyless
Field Value
Table
public readonly TableClient Table
Field Value
Transaction
public readonly TransactionClient Transaction
Field Value
Methods
FundAccount(AccountAddress, ulong)
Funds an account with the given amount of coins using the faucet. If the network is not supported by the faucet, an exception will be thrown.
public Task<UserTransactionResponse> FundAccount(AccountAddress address, ulong amount)
Parameters
addressAccountAddressThe address of the account to fund.
amountulongThe amount of APT coins to fund.
Returns
- Task<UserTransactionResponse>
The transaction response of the funded account.
Exceptions
- FaucetException
Unable to fund the account.
- Exception
If the response from the faucet is not in the expected format.
FundAccount(string, ulong)
public Task<UserTransactionResponse> FundAccount(string address, ulong amount)
Parameters
Returns
GetFaucet<Res>(GetAptosRequest)
public Task<AptosResponse<Res>> GetFaucet<Res>(GetAptosRequest request) where Res : class
Parameters
requestGetAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
GetFullNodeWithPagination<Res>(GetAptosRequest)
public Task<List<Res>> GetFullNodeWithPagination<Res>(GetAptosRequest request) where Res : class
Parameters
requestGetAptosRequest
Returns
Type Parameters
Res
GetFullNode<Res>(GetAptosRequest)
public Task<AptosResponse<Res>> GetFullNode<Res>(GetAptosRequest request) where Res : class
Parameters
requestGetAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
GetLedgerInfo()
Gets the ledger information of the blockchain.
public Task<LedgerInfo> GetLedgerInfo()
Returns
- Task<LedgerInfo>
The ledger information of the blockchain.
GetModule(AccountAddress, string, ulong?)
Gets the Move module of the given address and module name.
The function will be cached every time it is called with the same parameters to avoid unnecessary network requests.
public Task<MoveModuleBytecode> GetModule(AccountAddress address, string moduleName, ulong? ledgerVersion = null)
Parameters
addressAccountAddressThe address of the account.
moduleNamestringThe name of the module.
ledgerVersionulong?The ledger version to use for the module call.
Returns
- Task<MoveModuleBytecode>
The Move bytecode and ABI.
GetModule(string, string, ulong?)
Gets the Move module of the given address and module name.
The function will be cached every time it is called with the same parameters to avoid unnecessary network requests.
public Task<MoveModuleBytecode> GetModule(string address, string moduleName, ulong? ledgerVersion = null)
Parameters
addressstringThe address of the account.
moduleNamestringThe name of the module.
ledgerVersionulong?The ledger version to use for the module call.
Returns
- Task<MoveModuleBytecode>
The Move bytecode and ABI.
GetResource(AccountAddress, string, ulong?)
public Task<MoveResource> GetResource(AccountAddress address, string resourceType, ulong? ledgerVersion = null)
Parameters
addressAccountAddressresourceTypestringledgerVersionulong?
Returns
GetResource(string, string, ulong?)
public Task<MoveResource> GetResource(string address, string resourceType, ulong? ledgerVersion = null)
Parameters
Returns
GetResources(AccountAddress, int?, int?)
Gets a paginated list of resources of the given address.
public Task<List<MoveResource>> GetResources(AccountAddress address, int? start = null, int? limit = null)
Parameters
addressAccountAddressThe address of the account.
startint?The start index of the resources to return.
limitint?The limit of the resources to return.
Returns
- Task<List<MoveResource>>
The resources of the given address.
GetResources(string, int?, int?)
Gets a paginated list of resources of the given address.
public Task<List<MoveResource>> GetResources(string address, int? start = null, int? limit = null)
Parameters
addressstringThe address of the account.
startint?The start index of the resources to return.
limitint?The limit of the resources to return.
Returns
- Task<List<MoveResource>>
The resources of the given address.
Get<Res>(ApiType, GetAptosRequest)
public Task<AptosResponse<Res>> Get<Res>(ApiType type, GetAptosRequest request) where Res : class
Parameters
typeApiTyperequestGetAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
PostFaucet<Res>(PostAptosRequest)
public Task<AptosResponse<Res>> PostFaucet<Res>(PostAptosRequest request) where Res : class
Parameters
requestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
PostFullNode<Res>(PostAptosRequest)
public Task<AptosResponse<Res>> PostFullNode<Res>(PostAptosRequest request) where Res : class
Parameters
requestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
PostIndexer<Res>(PostAptosRequest)
public Task<AptosResponse<Res>> PostIndexer<Res>(PostAptosRequest request) where Res : class
Parameters
requestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
PostPepper<Res>(PostAptosRequest)
public Task<AptosResponse<Res>> PostPepper<Res>(PostAptosRequest request) where Res : class
Parameters
requestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
PostProver<Res>(PostAptosRequest)
public Task<AptosResponse<Res>> PostProver<Res>(PostAptosRequest request) where Res : class
Parameters
requestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
Post<Res>(ApiType, PostAptosRequest)
public Task<AptosResponse<Res>> Post<Res>(ApiType type, PostAptosRequest request) where Res : class
Parameters
typeApiTyperequestPostAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
Request<Res>(ApiType, AptosRequest)
public Task<AptosResponse<Res>> Request<Res>(ApiType type, AptosRequest request) where Res : class
Parameters
typeApiTyperequestAptosRequest
Returns
- Task<AptosResponse<Res>>
Type Parameters
Res
SignAndSubmitTransaction(Account, AnyRawTransaction, AccountAuthenticator?, List<AccountAuthenticator>?)
Signs and submits a transaction to the blockchain. You can build a transaction payload by using the Build(AccountAddress, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?) method.
public Task<PendingTransactionResponse> SignAndSubmitTransaction(Account signer, AnyRawTransaction transaction, AccountAuthenticator? feePayerAuthenticator = null, List<AccountAuthenticator>? additionalSignersAuthenticators = null)
Parameters
signerAccountThe account to sign the transaction with.
transactionAnyRawTransactionThe transaction to sign and submit.
feePayerAuthenticatorAccountAuthenticatorIf the transaction has a fee payer, you can provide an authenticator for it here.
additionalSignersAuthenticatorsList<AccountAuthenticator>If the transaction has additional signers, you can provide authenticators for them here.
Returns
- Task<PendingTransactionResponse>
The pending transaction response.
View(GenerateViewFunctionPayloadData, ulong?)
Calls the Move view function with the given payload and returns the result.
public Task<List<object>> View(GenerateViewFunctionPayloadData data, ulong? ledgerVersion = null)
Parameters
dataGenerateViewFunctionPayloadDataThe payload of the view function to call.
ledgerVersionulong?The ledger version to use for the view function call.
Returns
View<T>(GenerateViewFunctionPayloadData, ulong?)
Calls the Move view function with the given payload and returns the result.
public Task<T> View<T>(GenerateViewFunctionPayloadData data, ulong? ledgerVersion = null) where T : class
Parameters
dataGenerateViewFunctionPayloadDataThe payload of the view function to call.
ledgerVersionulong?The ledger version to use for the view function call.
Returns
- Task<T>
An instance of the specified type T representing the result of the view function.
Type Parameters
TThe type of the result of the view function.