Table of Contents

Class TransactionClient

Namespace
Aptos
Assembly
Aptos.dll
public class TransactionClient
Inheritance
TransactionClient
Inherited Members

Constructors

TransactionClient(AptosClient)

public TransactionClient(AptosClient client)

Parameters

client AptosClient

Methods

Build(Account, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?)

public Task<SimpleTransaction> Build(Account sender, GenerateEntryFunctionPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)

Parameters

sender Account
data GenerateEntryFunctionPayloadData
withFeePayer bool
options TransactionBuilder.GenerateTransactionOptions

Returns

Task<SimpleTransaction>

Build(AccountAddress, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?)

public Task<SimpleTransaction> Build(AccountAddress sender, GenerateEntryFunctionPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)

Parameters

sender AccountAddress
data GenerateEntryFunctionPayloadData
withFeePayer bool
options TransactionBuilder.GenerateTransactionOptions

Returns

Task<SimpleTransaction>

Build(AccountAddress, GenerateEntryFunctionPayloadData, List<AccountAddress>, bool, GenerateTransactionOptions?)

public Task<MultiAgentTransaction> Build(AccountAddress sender, GenerateEntryFunctionPayloadData data, List<AccountAddress> secondarySignerAddresses, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)

Parameters

sender AccountAddress
data GenerateEntryFunctionPayloadData
secondarySignerAddresses List<AccountAddress>
withFeePayer bool
options TransactionBuilder.GenerateTransactionOptions

Returns

Task<MultiAgentTransaction>

Build(AccountAddress, GenerateScriptPayloadData, bool, GenerateTransactionOptions?)

public Task<SimpleTransaction> Build(AccountAddress sender, GenerateScriptPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)

Parameters

sender AccountAddress
data GenerateScriptPayloadData
withFeePayer bool
options TransactionBuilder.GenerateTransactionOptions

Returns

Task<SimpleTransaction>

Build(string, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?)

public Task<SimpleTransaction> Build(string sender, GenerateEntryFunctionPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)

Parameters

sender string
data GenerateEntryFunctionPayloadData
withFeePayer bool
options TransactionBuilder.GenerateTransactionOptions

Returns

Task<SimpleTransaction>

GetTransactionByHash(string)

Gets a transaction data by hash.

public Task<TransactionResponse> GetTransactionByHash(string hash)

Parameters

hash string

The hash of the transaction.

Returns

Task<TransactionResponse>

The transaction data.

GetTransactionByVersion(string)

Gets a transaction data by version.

public Task<TransactionResponse> GetTransactionByVersion(string version)

Parameters

version string

The version of the transaction.

Returns

Task<TransactionResponse>

The transaction data.

GetTransactions(int?, int?)

Gets a paginated list of transactions.

public Task<TransactionResponse[]> GetTransactions(int? start = null, int? limit = null)

Parameters

start int?

The start index of the transactions to return.

limit int?

The limit of the transactions to return.

Returns

Task<TransactionResponse[]>

A list of transactions.

LongWaitForTransaction(string)

Waits for a transaction to be committed. Its recommended to use WaitForTransaction(PendingTransactionResponse, WaitForTransactionOptions?) instead.

public Task<TransactionResponse> LongWaitForTransaction(string hash)

Parameters

hash string

The hash of the transaction to wait for.

Returns

Task<TransactionResponse>

The transaction response.

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.

SignAsFeePayer(Account, AnyRawTransaction)

Helper method to sign a transaction as a FeePayer with an account. The FeePayerAddress will be set to the signer's address.

public AccountAuthenticator SignAsFeePayer(Account signer, AnyRawTransaction transaction)

Parameters

signer Account

The fee payer account to sign the transaction with.

transaction AnyRawTransaction

The transaction to sign.

Returns

AccountAuthenticator

The authenticator with the signed transaction and public key.

Exceptions

ArgumentException

If the transaction is not a FeePayer transaction.

SignTransaction(Account, AnyRawTransaction)

Helper method to sign a transaction with an account.

public AccountAuthenticator SignTransaction(Account signer, AnyRawTransaction transaction)

Parameters

signer Account

The account to sign the transaction with.

transaction AnyRawTransaction

The transaction to sign.

Returns

AccountAuthenticator

The authenticator with the signed transaction and public key.

Simulate(SimulateTransactionData)

Simulates a transaction without submitting it to the blockchain.

public Task<List<PendingTransactionResponse>> Simulate(SimulateTransactionData data)

Parameters

data SimulateTransactionData

The transaction data to simulate.

Returns

Task<List<PendingTransactionResponse>>

The simulated transaction responses.

SubmitTransaction(SubmitTransactionData)

Submits a transaction to the blockchain.

public Task<PendingTransactionResponse> SubmitTransaction(SubmitTransactionData data)

Parameters

data SubmitTransactionData

The transaction data to submit.

Returns

Task<PendingTransactionResponse>

The pending transaction response.

WaitForIndexer(long?, string)

public void WaitForIndexer(long? minimumLedgerVersion, string processorType)

Parameters

minimumLedgerVersion long?
processorType string

WaitForTransaction(Hex, WaitForTransactionOptions?)

public Task<CommittedTransactionResponse> WaitForTransaction(Hex hash, TransactionClient.WaitForTransactionOptions? options = null)

Parameters

hash Hex
options TransactionClient.WaitForTransactionOptions

Returns

Task<CommittedTransactionResponse>

WaitForTransaction(PendingTransactionResponse, WaitForTransactionOptions?)

Waits for a transaction to be committed using polling.

public Task<CommittedTransactionResponse> WaitForTransaction(PendingTransactionResponse pendingTransaction, TransactionClient.WaitForTransactionOptions? options = null)

Parameters

pendingTransaction PendingTransactionResponse

The pending transaction to wait for.

options TransactionClient.WaitForTransactionOptions

The options for waiting for the transaction.

Returns

Task<CommittedTransactionResponse>

The transaction response.

WaitForTransaction(string, WaitForTransactionOptions?)

public Task<CommittedTransactionResponse> WaitForTransaction(string hash, TransactionClient.WaitForTransactionOptions? options = null)

Parameters

hash string
options TransactionClient.WaitForTransactionOptions

Returns

Task<CommittedTransactionResponse>