Skip to content

Documentation / js-sdk-core / populateTransactionRequest

Function: populateTransactionRequest()

populateTransactionRequest(address, txRequest, provider): Promise<PreparedTransactionRequest>

This method takes the UnsignedTransactionRequestWithChainId provided by the app and ensures that the following parameters are set, or at least defaulted by Privy; from, chainId, nonce, gasLimit, type, gasPrice OR maxFeePerGas. These values must be set before sending the transaction to the network.

This method will NOT throw an error if the user does not have sufficient funds to cover gas costs - that must be explicitly checked elsewhere with getAndCheckBalance.

Parameters

address: string

{string} wallet address sending the transaction

txRequest: UnsignedTransactionRequestWithChainId

{UnsignedTransactionRequestWithChainId} the transaction request from the app

provider: StaticJsonRpcProvider

{StaticJsonRpcProvider} a provider connected to the chain of the transaction

Returns

Promise<PreparedTransactionRequest>

the transaction request with the necessary defaults set