This is a web3.js 4.x
plugin for interacting with Pyth Network Ethereum contracts.
yarn add web3.js-pythnet-plugin
When adding the web3
package to your project, make sure to use version 4.x
:
npm i -S web3@4.0.3
yarn add web3@4.0.3
NOTE
If 4.x was already released, you are good to just useweb3
without appending anything to it.
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:
"dependencies": {
"web3": "4.0.3"
}
After importing PythNetworkPlugin
from web3.js-pythnet-plugin
and Web3
from web3
, register an instance of PythNetworkPlugin
with an instance of Web3
like so:
import { PythNetworkPlugin } from '@chainsafe/web3-plugin-chainlink';
import { Web3 } from 'web3';
const web3 = new Web3('YOUR_PROVIDER_URL');
const plugin = new PythNetworkPlugin({ type: 'stable', contract: 'Arbitrum' });
web3.registerPlugin(plugin);
More information about registering web3.js plugins can be found here.
Warning
Not fully documented