-
I'm struggling to understand the difference between the transaction response and transaction receipt, especially in the code below: const transactionResponse = await contract.store("333");
const transactionReceipt = await transactionResponse.wait(1);` I understand the first line, but what is the second line for? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Firstly, refer this for context: #1218 Ans.: Put simply, think of A technical description below: TransactionResponse, inherits Transaction object (elaborated below)A TransactionResponse includes all properties of a Transaction as well as several properties that are useful once it has been mined. TransactionA generic object to represent a transaction. transaction.hash ⇒ string< DataHexString< 32 > > transaction.to ⇒ string< Address > transaction.from ⇒ string< Address > transaction.nonce ⇒ number transaction.gasLimit ⇒ BigNumber transaction.gasPrice ⇒ null | BigNumber For EIP-1559 transactions, this will be null. transaction.maxFeePerGas ⇒ BigNumber For transactions that are not EIP-1559 transactions, this will be null. transaction.maxPriorityFeePerGas ⇒ BigNumber For transactions that are not EIP-1559 transactions, this will be null. transaction.data ⇒ BytesLike transaction.value ⇒ BigNumber transaction.chainId ⇒ number For example, if a transaction was made on ropsten with an account also used on homestead, it would be possible for a transaction signed on ropsten to be executed on homestead, which is likely unintended. There are situations where replay may be desired, however these are very rare and it is almost always recommended to specify the chain ID. transaction.r ⇒ string< DataHexString< 32 > > transaction.s ⇒ string< DataHexString< 32 > > transaction.v ⇒ number |
Beta Was this translation helpful? Give feedback.
Firstly, refer this for context: #1218
Ans.: Put simply, think of
transactionReceipt
as a variable which has all the details (hash, to, nonce, gasLimit etc.) of the transaction. The naming here is not compulsory, you can name it xyz too. It is just thattransactionReceipt
is a descriptive and relevant name for it.A technical description below:
TransactionResponse, inherits Transaction object (elaborated below)
A TransactionResponse includes all properties of a Transaction as well as several properties that are useful once it has been mined.
Transaction
A generic object to represent a transaction.
transaction.hash ⇒ string< DataHexString< 32 > >
The transaction hash, which can be used as …