-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fields to receipts and tests, more refactoring
- add effective_gas_price and type to transaction receipt object - add tests for calculating effective_gas_price and checking type in txn receipts - update README.md example displaying the new fields
- Loading branch information
Showing
16 changed files
with
359 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def extract_transaction_type(transaction): | ||
return ( | ||
'0x2' if 'max_fee_per_gas' in transaction | ||
else '0x1' if 'max_fee_per_gas' not in transaction and 'access_list' in transaction | ||
else '0x0' # legacy transactions being '0x0' taken from current geth version v1.10.10 | ||
) | ||
|
||
|
||
def calculate_effective_gas_price(transaction, block): | ||
return ( | ||
min( | ||
transaction['max_fee_per_gas'], | ||
transaction['max_priority_fee_per_gas'] + block['base_fee_per_gas'] | ||
) | ||
if 'max_fee_per_gas' in transaction | ||
else transaction['gas_price'] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.