Skip to content

Commit

Permalink
Merge branch '4.x' into issue-sarthak-6860
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevcs authored Mar 11, 2024
2 parents 171e346 + d254316 commit cff8317
Show file tree
Hide file tree
Showing 55 changed files with 339 additions and 321 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:
steps:
- uses: actions/setup-node@v4
with:
architecture: x64
node-version: ${{ matrix.node }}
- uses: actions/cache/restore@v3
with:
Expand Down
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2353,4 +2353,34 @@ If there are any bugs, improvements, optimizations or any new feature proposal f

- Dependencies updated

## [4.6.0]

### Added

#### web3

- Added EIP-6963 utility function `requestEIP6963Providers` for multi provider discovery

#### web3-eth

- Added `eth.getMaxPriorityFeePerGas` method (#6748)

#### web3-eth-ens

- Added function `setAddress` in ENS and Resolver classes (#5956)

#### web3-rpc-methods

- Added `getMaxPriorityFeePerGas` method (#6748)

#### web3-types

- Type `FeeData` to be filled by `await web3.eth.calculateFeeData()` to be used with EIP-1559 transactions (#6795)

### Fixed

#### web3-utils

- replaced our eventEmitter to EventEmitter3 to support react native builds (#6253)

## [Unreleased]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_label: web3.eth.Contract

### Receipt Status

The `receipt.status` will now be be an `unsigned integer` instead of `boolean` value to comply with the specification.
The `receipt.status` will now be an `unsigned integer` instead of `boolean` value to comply with the specification.

```ts
// in 1.x
Expand Down
14 changes: 7 additions & 7 deletions packages/web3-core/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
},
verbose: false,
collectCoverage: false,
coverageReporters: ['json'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,27 @@ exports[`Web3Context getContextObject should return correct context object 1`] =
"requestManager": Web3RequestManager {
"_emitter": {
"_events": {
"BEFORE_PROVIDER_CHANGE": [Function],
"PROVIDER_CHANGED": [Function],
"BEFORE_PROVIDER_CHANGE": EE {
"context": EventEmitter {
"_events": [Circular],
"_eventsCount": 2,
"maxListeners": 9007199254740991,
},
"fn": [Function],
"once": false,
},
"PROVIDER_CHANGED": EE {
"context": EventEmitter {
"_events": [Circular],
"_eventsCount": 2,
"maxListeners": 9007199254740991,
},
"fn": [Function],
"once": false,
},
},
"_eventsCount": 2,
"_maxListeners": undefined,
Symbol(kCapture): false,
"maxListeners": 9007199254740991,
Symbol(shapeMode): false,
},
"_provider": HttpProvider {
Expand All @@ -62,12 +77,27 @@ exports[`Web3Context getContextObject should return correct context object 1`] =
"requestManager": Web3RequestManager {
"_emitter": {
"_events": {
"BEFORE_PROVIDER_CHANGE": [Function],
"PROVIDER_CHANGED": [Function],
"BEFORE_PROVIDER_CHANGE": EE {
"context": EventEmitter {
"_events": [Circular],
"_eventsCount": 2,
"maxListeners": 9007199254740991,
},
"fn": [Function],
"once": false,
},
"PROVIDER_CHANGED": EE {
"context": EventEmitter {
"_events": [Circular],
"_eventsCount": 2,
"maxListeners": 9007199254740991,
},
"fn": [Function],
"once": false,
},
},
"_eventsCount": 2,
"_maxListeners": undefined,
Symbol(kCapture): false,
"maxListeners": 9007199254740991,
Symbol(shapeMode): false,
},
"_provider": HttpProvider {
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-abi/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth-accounts/test/unit/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import {
import { TransactionFactory } from '../../src/tx/transactionFactory';
import { TxData } from '../../src/tx/types';

jest.setTimeout(25000);

describe('accounts', () => {
describe('create', () => {
describe('valid cases', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/web3-eth-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"eslint-config-base-web3": "0.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"flatted": "^3.3.1",
"jest": "^29.7.0",
"jest-extended": "^3.0.1",
"prettier": "^2.7.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-contract/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
5 changes: 3 additions & 2 deletions packages/web3-eth-contract/test/unit/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Web3ContractError } from 'web3-errors';
import { Web3Context , Web3ConfigEvent } from 'web3-core';
import { Web3ValidatorError } from 'web3-validator';
import { AbiItem } from 'web3-utils';
import { stringify } from 'flatted';
import {Abi} from '../fixtures/AbiItem'
import { Contract } from '../../src';
import { sampleStorageContractABI } from '../fixtures/storage';
Expand Down Expand Up @@ -755,7 +756,7 @@ describe('Contract', () => {

const clonnedContract = contract.clone();

expect(JSON.stringify(contract)).toStrictEqual(JSON.stringify(clonnedContract));
expect(stringify(contract)).toStrictEqual(stringify(clonnedContract));

contract.options.jsonInterface = GreeterAbi;
});
Expand All @@ -764,7 +765,7 @@ describe('Contract', () => {
const contract = new Contract(sampleStorageContractABI);

const clonnedContract = contract.clone();
expect(JSON.stringify(contract)).toStrictEqual(JSON.stringify(clonnedContract));
expect(stringify(contract)).toStrictEqual(stringify(clonnedContract));
});

it('should be able to update the jsonInterface', () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/web3-eth-ens/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ Documentation:

- Dependencies updated

## [Unreleased]
## [4.1.0]

### Added

- Added function `setAddress` in ENS and Resolver classes (#5956)
- Added function `setAddress` in ENS and Resolver classes (#5956)

## [Unreleased]
16 changes: 8 additions & 8 deletions packages/web3-eth-ens/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web3-eth-ens",
"version": "4.0.8",
"version": "4.1.0",
"description": "This package has ENS functions for interacting with Ethereum Name Service.",
"main": "./lib/commonjs/index.js",
"module": "./lib/esm/index.js",
Expand Down Expand Up @@ -59,13 +59,13 @@
},
"dependencies": {
"@adraffy/ens-normalize": "^1.8.8",
"web3-core": "^4.3.0",
"web3-errors": "^1.1.3",
"web3-eth": "^4.3.1",
"web3-eth-contract": "^4.1.2",
"web3-core": "^4.3.2",
"web3-errors": "^1.1.4",
"web3-eth": "^4.5.0",
"web3-eth-contract": "^4.2.0",
"web3-net": "^4.0.7",
"web3-types": "^1.3.0",
"web3-utils": "^4.0.7",
"web3-validator": "^2.0.3"
"web3-types": "^1.5.0",
"web3-utils": "^4.2.1",
"web3-validator": "^2.0.4"
}
}
1 change: 1 addition & 0 deletions packages/web3-eth-ens/test/integration/resolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { ENSRegistryBytecode } from '../fixtures/ens/bytecode/ENSRegistryBytecod
import { NameWrapperBytecode } from '../fixtures/ens/bytecode/NameWrapperBytecode';
import { PublicResolverBytecode } from '../fixtures/ens/bytecode/PublicResolverBytecode';

jest.setTimeout(25000);
describe('ens', () => {
let registry: Contract<typeof ENSRegistryAbi>;
let resolver: Contract<typeof PublicResolverAbi>;
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-personal/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
4 changes: 3 additions & 1 deletion packages/web3-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ Documentation:

- Catch `TransactionPollingTimeoutError` was added to send transaction events (#6623)

## [Unreleased]
## [4.5.0]

### Added

- Added `eth.getMaxPriorityFeePerGas` method (#6748)

## [Unreleased]
8 changes: 4 additions & 4 deletions packages/web3-eth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web3-eth",
"version": "4.4.0",
"version": "4.5.0",
"description": "Web3 module to interact with the Ethereum blockchain and smart contracts.",
"main": "./lib/commonjs/index.js",
"module": "./lib/esm/index.js",
Expand Down Expand Up @@ -69,9 +69,9 @@
"web3-eth-accounts": "^4.1.1",
"web3-net": "^4.0.7",
"web3-providers-ws": "^4.0.7",
"web3-rpc-methods": "^1.1.4",
"web3-types": "^1.3.1",
"web3-utils": "^4.1.1",
"web3-rpc-methods": "^1.2.0",
"web3-types": "^1.5.0",
"web3-utils": "^4.2.1",
"web3-validator": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/web3-eth/test/e2e/e2e_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* @NOTE This Util method is kept seperate from shared system_test_utils.ts file because
* @NOTE This Util method is kept separate from shared system_test_utils.ts file because
* of it's import of .secrets.json. For this method to exist in shared system_test_utils.ts
* file, the import path would be ../.secrets.json which doesn't resolve when the file is
* copied over to each package's test directory. Because web3 package is the only package
Expand Down
32 changes: 20 additions & 12 deletions packages/web3-eth/test/unit/format_transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
numbersAsNumberTransaction,
bytesAsUint8ArrayTransaction,
} from '../fixtures/format_transaction';
import { objectBigintToString } from '../fixtures/system_test_utils';

const transactionsDataForNumberTypes: Record<FMT_NUMBER, Record<string, unknown>> = {
[FMT_NUMBER.BIGINT]: numbersAsBigIntTransaction,
Expand Down Expand Up @@ -59,14 +60,16 @@ describe('formatTransaction', () => {
delete expectedFormattedTransaction.data;

expect(
formatTransaction(
transactionsDataForNumberTypes[sourceType as FMT_NUMBER],
{
...DEFAULT_RETURN_FORMAT,
number: destinationType as FMT_NUMBER,
},
objectBigintToString(
formatTransaction(
transactionsDataForNumberTypes[sourceType as FMT_NUMBER],
{
...DEFAULT_RETURN_FORMAT,
number: destinationType as FMT_NUMBER,
},
),
),
).toStrictEqual(expectedFormattedTransaction);
).toStrictEqual(objectBigintToString(expectedFormattedTransaction));
});
}
}
Expand All @@ -85,11 +88,16 @@ describe('formatTransaction', () => {
delete expectedFormattedTransaction.data;

expect(
formatTransaction(transactionsDataForByteTypes[sourceType as FMT_BYTES], {
...DEFAULT_RETURN_FORMAT,
bytes: destinationType as FMT_BYTES,
}),
).toStrictEqual(expectedFormattedTransaction);
objectBigintToString(
formatTransaction(
transactionsDataForByteTypes[sourceType as FMT_BYTES],
{
...DEFAULT_RETURN_FORMAT,
bytes: destinationType as FMT_BYTES,
},
),
),
).toStrictEqual(objectBigintToString(expectedFormattedTransaction));
});
}
}
Expand Down
Loading

0 comments on commit cff8317

Please sign in to comment.