Skip to content

Commit

Permalink
Merge branch '4.x' into ok/6746-Web3.js-Adapter-for-Wagmi-Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
avkos committed Feb 15, 2024
2 parents 718b2cc + e774646 commit b32102d
Show file tree
Hide file tree
Showing 21 changed files with 384 additions and 224 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2335,4 +2335,22 @@ If there are any bugs, improvements, optimizations or any new feature proposal f

- Fixed an issue with detecting Uint8Array (#6486)

## [4.5.0]

### Added

#### web3-utils

- Adds missing exported type `AbiItem` from 1.x to v4 for compatabiltiy (#6678)

#### web3-types

- Adds missing exported type `AbiItem` from 1.x to v4 for compatabiltiy (#6678)

### Changed

#### web3

- Dependencies updated

## [Unreleased]
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ exports[`Web3Context getContextObject should return correct context object 1`] =
},
"registeredSubscriptions": {},
"requestManager": Web3RequestManager {
"_emitter": EventEmitter {
"_emitter": {
"_events": {
"BEFORE_PROVIDER_CHANGE": [Function],
"PROVIDER_CHANGED": [Function],
},
"_eventsCount": 2,
"_maxListeners": undefined,
Symbol(kCapture): false,
Symbol(shapeMode): false,
},
"_provider": HttpProvider {
"clientUrl": "http://test/abc",
Expand All @@ -59,14 +60,15 @@ exports[`Web3Context getContextObject should return correct context object 1`] =
"_subscriptions": Map {},
"registeredSubscriptions": {},
"requestManager": Web3RequestManager {
"_emitter": EventEmitter {
"_emitter": {
"_events": {
"BEFORE_PROVIDER_CHANGE": [Function],
"PROVIDER_CHANGED": [Function],
},
"_eventsCount": 2,
"_maxListeners": undefined,
Symbol(kCapture): false,
Symbol(shapeMode): false,
},
"_provider": HttpProvider {
"clientUrl": "http://test/abc",
Expand Down
20 changes: 20 additions & 0 deletions packages/web3-core/test/unit/web3_context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ describe('Web3Context', () => {
it('should return correct context object', () => {
const context = new Context1('http://test/abc');

// The following is because a specific property is different in node 18 than it is in node 20 and 21
// So the problematic property is removed from the object and then added to ensure its presence and its location
// And the snapshot is updated to reflect the change.
// Once node 18 is no longer supported, this can be removed. And the snapshot need to be updated then.

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const symbolForShapeMode = Object.getOwnPropertySymbols(
(context.getContextObject().requestManager as any)._emitter,
).find(s => s.description === 'shapeMode');
if (symbolForShapeMode) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete (context.getContextObject().requestManager as any)._emitter[symbolForShapeMode];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(context.getContextObject().requestManager as any)._emitter = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...(context.getContextObject().requestManager as any)._emitter,
[Symbol.for('shapeMode')]: false,
};

expect(context.getContextObject()).toMatchSnapshot();
});
});
Expand Down
4 changes: 4 additions & 0 deletions packages/web3-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,7 @@ Documentation:
- Catch `TransactionPollingTimeoutError` was added to send transaction events (#6623)

## [Unreleased]

### Added

- Added `eth.getMaxPriorityFeePerGas` method (#6748)
12 changes: 12 additions & 0 deletions packages/web3-eth/src/rpc_method_wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ export async function getGasPrice<ReturnFormat extends DataFormat>(
return format({ format: 'uint' }, response as Numbers, returnFormat);
}

/**
* View additional documentations here: {@link Web3Eth.getMaxPriorityFeePerGas}
* @param web3Context ({@link Web3Context}) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.
*/
export async function getMaxPriorityFeePerGas<ReturnFormat extends DataFormat>(
web3Context: Web3Context<EthExecutionAPI>,
returnFormat: ReturnFormat,
) {
const response = await ethRpcMethods.getMaxPriorityFeePerGas(web3Context.requestManager);

return format({ format: 'uint' }, response as Numbers, returnFormat);
}
/**
* View additional documentations here: {@link Web3Eth.getBlockNumber}
* @param web3Context ({@link Web3Context}) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.
Expand Down
Loading

1 comment on commit b32102d

@github-actions
Copy link

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: b32102d Previous: 6c075db Ratio
processingTx 9365 ops/sec (±4.51%) 9301 ops/sec (±4.81%) 0.99
processingContractDeploy 40546 ops/sec (±7.63%) 39129 ops/sec (±7.62%) 0.97
processingContractMethodSend 20189 ops/sec (±7.37%) 19443 ops/sec (±5.19%) 0.96
processingContractMethodCall 40145 ops/sec (±6.17%) 38971 ops/sec (±6.34%) 0.97
abiEncode 48160 ops/sec (±6.30%) 44252 ops/sec (±6.92%) 0.92
abiDecode 31596 ops/sec (±8.77%) 30419 ops/sec (±8.89%) 0.96
sign 1629 ops/sec (±3.39%) 1656 ops/sec (±4.08%) 1.02
verify 383 ops/sec (±0.59%) 373 ops/sec (±0.78%) 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.