Transaction Builder
By default, all transactions initiated using the SDK perform every step of the process for a transaction; From preparing and building the transaction all the way to waiting until it has been mined, and the data is available to be read from the blockchain.
To gain more granular control over the transaction process, all Contract objects come with a Prepare function that returns a Transaction object, which can be used to build, fine-tune, and execute the transaction.
Usage
Please be advised that in most cases you do not need to use these functions, as the SDK will handle the transaction process for you. However, if you need more granular control over the transaction process, these functions can be used to fine-tune the transaction.
Static Methods
WaitForTransactionResult
Waits for a transaction to be mined, returning a transaction receipt.
Transaction Methods
SetMaxPriorityFeePerGas
Set the maximum priority fee per gas for the transaction (EIP-1559)
SetMaxFeePerGas
Set the maximum fee per gas for the transaction (EIP-1559)
SetData
Override the data for the transaction.
SetValue
Set the value for the transaction.
SetFrom
Override the sender address for the transaction.
SetGasLimit
Set the gas limit for the transaction. Good if you want to avoid pre-estimation/simulation.
SetTo
Override the to address for the transaction.
SetType
Override the transaction type for the transaction. This will most likely be inferred automatically.
SetGasPrice
Set the gas price for the transaction (Legacy Transaction Type).
SetChainId
Override the chain id for the transaction. This will most likely be inferred automatically.
SetNonce
Override the nonce for the transaction. This will most likely be inferred automatically.
SetArgs
Override the arguments for the transaction. This may affect calldata.
GetGasPrice
Get the gas price.
EstimateGasLimit
Estimate the gas limit for the transaction.
EstimateGasCosts
Roughly estimates the gas costs for this transaction.
EstimateAndSetGasLimitAsync
Estimate the gas limit for the transaction and set it.
Simulate
Attempts to simulate the transaction to find out if it will succeed in its current state.
Sign
Signs the transaction asynchronously, if the wallet supports it. Useful for smart wallet user op delayed broadcasting through thirdweb Engine. Otherwise not recommended.
Send
Sends the transaction without waiting for it to be mined. Returns a transaction hash instead of the typical transaction receipt object.
SendAndWaitForTransactionResult
Sends the transaction and waits for it to be mined, returning a transaction receipt.