Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update getTransactionReceipt return type #4872

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ Returns
- ``cumulativeGasUsed`` - ``Number``: The total amount of gas used when this transaction was executed in the block.
- ``gasUsed`` - ``Number``: The amount of gas used by this specific transaction alone.
- ``logs`` - ``Array``: Array of log objects, which this transaction generated.
- ``effectiveGasPrice`` - ``Number``: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).
- ``effectiveGasPrice`` - ``String``: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).

-------
Example
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-core-helpers/src/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var outputTransactionReceiptFormatter = function (receipt) {
}

if (receipt.effectiveGasPrice) {
receipt.effectiveGasPrice = utils.hexToNumber(receipt.effectiveGasPrice)
receipt.effectiveGasPrice = outputBigNumberFormatter(receipt.effectiveGasPrice)
}
if (receipt.contractAddress) {
receipt.contractAddress = utils.toChecksumAddress(receipt.contractAddress);
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export interface TransactionReceipt {
contractAddress?: string;
cumulativeGasUsed: number;
gasUsed: number;
effectiveGasPrice: number;
effectiveGasPrice: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be breaking change in 1.x

logs: Log[];
logsBloom: string;
events?: {
Expand Down
2 changes: 1 addition & 1 deletion test/eth.getTransactionReceipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var formattedTxResult = {
"contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address
"cumulativeGasUsed": 520464,
"gasUsed": 520464,
"effectiveGasPrice": 10000000000000,
"effectiveGasPrice": '10000000000000',
"logs": [{
id: "log_2b801386",
transactionIndex: 1000,
Expand Down