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
Accountdata
GenerateEntryFunctionPayloadDatawithFeePayer
booloptions
TransactionBuilder.GenerateTransactionOptions
Returns
Build(AccountAddress, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?)
public Task<SimpleTransaction> Build(AccountAddress sender, GenerateEntryFunctionPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)
Parameters
sender
AccountAddressdata
GenerateEntryFunctionPayloadDatawithFeePayer
booloptions
TransactionBuilder.GenerateTransactionOptions
Returns
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
AccountAddressdata
GenerateEntryFunctionPayloadDatasecondarySignerAddresses
List<AccountAddress>withFeePayer
booloptions
TransactionBuilder.GenerateTransactionOptions
Returns
Build(AccountAddress, GenerateScriptPayloadData, bool, GenerateTransactionOptions?)
public Task<SimpleTransaction> Build(AccountAddress sender, GenerateScriptPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)
Parameters
sender
AccountAddressdata
GenerateScriptPayloadDatawithFeePayer
booloptions
TransactionBuilder.GenerateTransactionOptions
Returns
Build(string, GenerateEntryFunctionPayloadData, bool, GenerateTransactionOptions?)
public Task<SimpleTransaction> Build(string sender, GenerateEntryFunctionPayloadData data, bool withFeePayer = false, TransactionBuilder.GenerateTransactionOptions? options = null)
Parameters
sender
stringdata
GenerateEntryFunctionPayloadDatawithFeePayer
booloptions
TransactionBuilder.GenerateTransactionOptions
Returns
GetTransactionByHash(string)
Gets a transaction data by hash.
public Task<TransactionResponse> GetTransactionByHash(string hash)
Parameters
hash
stringThe 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
stringThe 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
stringThe 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
AccountThe account to sign the transaction with.
transaction
AnyRawTransactionThe transaction to sign and submit.
feePayerAuthenticator
AccountAuthenticatorIf 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
AccountThe fee payer account to sign the transaction with.
transaction
AnyRawTransactionThe 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
AccountThe account to sign the transaction with.
transaction
AnyRawTransactionThe 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
SimulateTransactionDataThe 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
SubmitTransactionDataThe transaction data to submit.
Returns
- Task<PendingTransactionResponse>
The pending transaction response.
WaitForIndexer(long?, string)
public void WaitForIndexer(long? minimumLedgerVersion, string processorType)
Parameters
WaitForTransaction(Hex, WaitForTransactionOptions?)
public Task<CommittedTransactionResponse> WaitForTransaction(Hex hash, TransactionClient.WaitForTransactionOptions? options = null)
Parameters
hash
Hexoptions
TransactionClient.WaitForTransactionOptions
Returns
WaitForTransaction(PendingTransactionResponse, WaitForTransactionOptions?)
Waits for a transaction to be committed using polling.
public Task<CommittedTransactionResponse> WaitForTransaction(PendingTransactionResponse pendingTransaction, TransactionClient.WaitForTransactionOptions? options = null)
Parameters
pendingTransaction
PendingTransactionResponseThe pending transaction to wait for.
options
TransactionClient.WaitForTransactionOptionsThe 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
stringoptions
TransactionClient.WaitForTransactionOptions