Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Merged
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
3 changes: 2 additions & 1 deletion packages/web3-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ Documentation:

### Changed

- defaultTransactionType is now type 0x2 instead of 0x0 (#6282)
- defaultTransactionType is now type 0x2 instead of 0x0 (#6282)
- Allows formatter to parse large base fee (#6456)
2 changes: 1 addition & 1 deletion packages/web3-core/src/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export const outputBlockFormatter = (block: BlockInput): BlockOutput => {
}

if (block.baseFeePerGas) {
modifiedBlock.baseFeePerGas = hexToNumber(block.baseFeePerGas);
modifiedBlock.baseFeePerGas = outputBigIntegerFormatter(block.baseFeePerGas);
}

return modifiedBlock;
Expand Down
3 changes: 2 additions & 1 deletion packages/web3-core/test/unit/formatters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,13 @@ describe('formatters', () => {
});

it('should convert "baseFeePerGas" from hex to number', () => {
jest.spyOn(formatters, 'outputBigIntegerFormatter').mockReturnValue(123);
const result = outputBlockFormatter({
...validBlock,
baseFeePerGas: 'baseFeePerGas',
} as any);

expect(utils.hexToNumber).toHaveBeenCalledWith('baseFeePerGas');
expect(outputBigIntegerFormatter).toHaveBeenCalledWith('baseFeePerGas');
expect(result).toEqual(expect.objectContaining({ baseFeePerGas: hexToNumberResult }));
});
});
Expand Down