Table of Contents

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

config AptosConfig

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

networkConfig NetworkConfig

Remarks

By default, the client will use Devnet as the network configuration.

Fields

Account

public readonly AccountClient Account

Field Value

AccountClient

Ans

public readonly ANSClient Ans

Field Value

ANSClient

Block

public readonly BlockClient Block

Field Value

BlockClient

Config

public readonly AptosConfig Config

Field Value

AptosConfig

Contract

public readonly ContractClient Contract

Field Value

ContractClient

DigitalAsset

public readonly DigitalAssetClient DigitalAsset

Field Value

DigitalAssetClient

Faucet

public readonly FaucetClient Faucet

Field Value

FaucetClient

FungibleAsset

public readonly FungibleAssetClient FungibleAsset

Field Value

FungibleAssetClient

Gas

public readonly GasClient Gas

Field Value

GasClient

Indexer

public readonly IndexerClient Indexer

Field Value

IndexerClient

Keyless

public readonly KeylessClient Keyless

Field Value

KeylessClient

Table

public readonly TableClient Table

Field Value

TableClient

Transaction

public readonly TransactionClient Transaction

Field Value

TransactionClient

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

address AccountAddress

The address of the account to fund.

amount ulong

The 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

address string
amount ulong

Returns

Task<UserTransactionResponse>

GetFaucet<Res>(GetAptosRequest)

public Task<AptosResponse<Res>> GetFaucet<Res>(GetAptosRequest request) where Res : class

Parameters

request GetAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

GetFullNodeWithPagination<Res>(GetAptosRequest)

public Task<List<Res>> GetFullNodeWithPagination<Res>(GetAptosRequest request) where Res : class

Parameters

request GetAptosRequest

Returns

Task<List<Res>>

Type Parameters

Res

GetFullNode<Res>(GetAptosRequest)

public Task<AptosResponse<Res>> GetFullNode<Res>(GetAptosRequest request) where Res : class

Parameters

request GetAptosRequest

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

address AccountAddress

The address of the account.

moduleName string

The name of the module.

ledgerVersion ulong?

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

address string

The address of the account.

moduleName string

The name of the module.

ledgerVersion ulong?

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

address AccountAddress
resourceType string
ledgerVersion ulong?

Returns

Task<MoveResource>

GetResource(string, string, ulong?)

public Task<MoveResource> GetResource(string address, string resourceType, ulong? ledgerVersion = null)

Parameters

address string
resourceType string
ledgerVersion ulong?

Returns

Task<MoveResource>

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

address AccountAddress

The address of the account.

start int?

The start index of the resources to return.

limit int?

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

address string

The address of the account.

start int?

The start index of the resources to return.

limit int?

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

type ApiType
request GetAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

PostFaucet<Res>(PostAptosRequest)

public Task<AptosResponse<Res>> PostFaucet<Res>(PostAptosRequest request) where Res : class

Parameters

request PostAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

PostFullNode<Res>(PostAptosRequest)

public Task<AptosResponse<Res>> PostFullNode<Res>(PostAptosRequest request) where Res : class

Parameters

request PostAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

PostIndexer<Res>(PostAptosRequest)

public Task<AptosResponse<Res>> PostIndexer<Res>(PostAptosRequest request) where Res : class

Parameters

request PostAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

PostPepper<Res>(PostAptosRequest)

public Task<AptosResponse<Res>> PostPepper<Res>(PostAptosRequest request) where Res : class

Parameters

request PostAptosRequest

Returns

Task<AptosResponse<Res>>

Type Parameters

Res

PostProver<Res>(PostAptosRequest)

public Task<AptosResponse<Res>> PostProver<Res>(PostAptosRequest request) where Res : class

Parameters

request PostAptosRequest

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

type ApiType
request PostAptosRequest

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

type ApiType
request AptosRequest

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

signer Account

The account to sign the transaction with.

transaction AnyRawTransaction

The transaction to sign and submit.

feePayerAuthenticator AccountAuthenticator

If the transaction has a fee payer, you can provide an authenticator for it here.

additionalSignersAuthenticators List<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

data GenerateViewFunctionPayloadData

The payload of the view function to call.

ledgerVersion ulong?

The ledger version to use for the view function call.

Returns

Task<List<object>>

An array of Move values representing the result of the view function.

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

data GenerateViewFunctionPayloadData

The payload of the view function to call.

ledgerVersion ulong?

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

T

The type of the result of the view function.