Skip to content

Commit d59f013

Browse files
Merge pull request #26 from ChainSafe/25-update-dependencies-and-fix-tests-for-web3js-v401-rc2
Update dependencies and fix tests for web3.js v4.0.1-rc.2
2 parents 6b39da6 + b33f374 commit d59f013

File tree

9 files changed

+690
-524
lines changed

9 files changed

+690
-524
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
node:
16-
- 14
1716
- 16
17+
- 18
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v3
@@ -43,8 +43,8 @@ jobs:
4343
strategy:
4444
matrix:
4545
node:
46-
- 14
4746
- 16
47+
- 18
4848
steps:
4949
- uses: actions/download-artifact@v3
5050
with:
@@ -60,10 +60,10 @@ jobs:
6060
steps:
6161
- uses: actions/download-artifact@v3
6262
with:
63-
name: chainlink-plugin-14.js.tar.gz
63+
name: chainlink-plugin-18.js.tar.gz
6464
path: /tmp
6565
- run: corepack enable
66-
- run: tar -xf /tmp/chainlink-plugin-14.js.tar.gz -C ./
66+
- run: tar -xf /tmp/chainlink-plugin-18.js.tar.gz -C ./
6767
- run: yarn lint
6868
unit:
6969
name: Unit Tests
@@ -72,8 +72,8 @@ jobs:
7272
strategy:
7373
matrix:
7474
node:
75-
- 14
7675
- 16
76+
- 18
7777
steps:
7878
- uses: actions/download-artifact@v3
7979
with:
@@ -118,6 +118,7 @@ jobs:
118118
matrix:
119119
node:
120120
- 16
121+
- 18
121122
steps:
122123
- uses: actions/download-artifact@v3
123124
with:

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Web3.js Chainlink Plugin
22

33
![ES Version](https://img.shields.io/badge/ES-2020-yellow)
4-
![Node Version](https://img.shields.io/badge/node-14.x-green)
4+
![Node Version](https://img.shields.io/badge/node-18.x-green)
55
[![NPM Package][npm-image]][npm-url]
66

77
This is a [web3.js](https://github.com/web3/web3.js) `4.x` plugin for interacting with Chainlink Ethereum contracts.
@@ -21,16 +21,19 @@ yarn add @chainsafe/web3.js-chainlink-plugin
2121

2222
### Installing Version `4.x` of `web3`
2323

24-
When adding version `4.x` of the `web3` package to your project, make sure to use the `@alpha` tag to install the correct version like so:
24+
When adding the `web3` package to your project, make sure to use version `4.x`. You can append `@4.0.1-rc.2` tag to install RC2 of version 4:
2525

26-
- `npm i -S web3@alpha`
27-
- `yarn add web3@alpha`
26+
- `npm i -S web3@4.0.1-rc.2`
27+
- `yarn add web3@4.0.1-rc.2`
2828

29-
To verify you have the correct `web3` version installed, after adding the package to your project (the above commands), look at the versions listed in your project's `package.json` under the `dependencies` section, it should contain something similiar to:
29+
> **_NOTE_**
30+
> If 4.x was already released, you are good to just use `web3` without appending anything to it.
31+
32+
To verify you have the correct `web3` version installed, after adding the package to your project (the above commands), look at the versions listed in your project's `package.json` under the `dependencies` section, it should contain version 4.x similar to:
3033

3134
```json
3235
"dependencies": {
33-
"web3": "4.0.1-rc.1"
36+
"web3": "4.0.1-rc.2"
3437
}
3538
```
3639

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@
6868
"ts-loader": "^9.4.1",
6969
"ts-node": "^10.9.1",
7070
"typescript": "^4.7.4",
71-
"web3": "4.0.1-rc.1",
72-
"web3-core": "4.0.1-rc.1",
73-
"web3-eth": "4.0.1-rc.1",
71+
"web3": "4.0.1-rc.2",
72+
"web3-core": "4.0.1-rc.2",
73+
"web3-eth": "4.0.1-rc.2",
7474
"webpack": "^5.75.0",
7575
"webpack-cli": "^5.0.1"
7676
},
7777
"peerDependencies": {
78-
"web3-core": ">= 4.0.1-rc.1 < 5",
79-
"web3-eth": ">= 4.0.1-rc.1 < 5",
80-
"web3-eth-abi": ">= 4.0.1-rc.1 < 5",
81-
"web3-eth-contract": ">= 4.0.1-rc.1 < 5",
82-
"web3-types": ">= 1.0.0-rc.1 < 5",
83-
"web3-validator": ">= 1.0.0-rc.1 < 5"
78+
"web3-core": ">= 4.0.1-rc.2 < 5",
79+
"web3-eth": ">= 4.0.1-rc.2 < 5",
80+
"web3-eth-abi": ">= 4.0.1-rc.2 < 5",
81+
"web3-eth-contract": ">= 4.0.1-rc.2 < 5",
82+
"web3-types": ">= 1.0.0-rc.2 < 5",
83+
"web3-validator": ">= 1.0.0-rc.2 < 5"
8484
}
8585
}

test/black_box/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"devDependencies": {
1414
"jest": "^28.1.3",
1515
"ts-jest": "^28.0.7",
16-
"web3": "^4.0.1-rc.1",
17-
"web3-core": "^4.0.1-rc.1",
18-
"web3-eth": "^4.0.1-rc.1"
16+
"web3": "^4.0.1-rc.2",
17+
"web3-core": "^4.0.1-rc.2",
18+
"web3-eth": "^4.0.1-rc.2"
1919
}
2020
}

test/black_box/test/chainlink_plugin.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { Web3 } from 'web3';
2-
import { Web3Context } from 'web3-core';
3-
import { Web3Eth } from 'web3-eth';
1+
import { core, Web3, Web3Eth } from 'web3';
42

53
// https://github.com/ChainSafe/web3.js-plugin-chainlink/issues/15
64
// @ts-ignore
75
import { ChainlinkPlugin, MainnetPriceFeeds } from '@chainsafe/web3.js-chainlink-plugin';
86

97
describe('ChainlinkPlugin Tests', () => {
108
it('should register ChainlinkPlugin plugin on Web3Context instance', () => {
11-
const web3Context = new Web3Context('http://127.0.0.1:8545');
9+
const web3Context = new core.Web3Context('http://127.0.0.1:8545');
1210
web3Context.registerPlugin(new ChainlinkPlugin());
1311
expect(web3Context.chainlink).toBeDefined();
1412
});
@@ -63,7 +61,14 @@ describe('ChainlinkPlugin Tests', () => {
6361
);
6462
expect(requestManagerSendSpy).toHaveBeenCalledWith({
6563
method: 'eth_call',
66-
params: [{ input: '0xfeaf968c', to: MainnetPriceFeeds.LinkEth }, 'latest'],
64+
params: [
65+
{
66+
data: '0xfeaf968c',
67+
input: '0xfeaf968c',
68+
to: MainnetPriceFeeds.LinkEth,
69+
},
70+
'latest',
71+
],
6772
});
6873
});
6974
});

0 commit comments

Comments
 (0)