@lifi/rpc-wrapper
v0.0.28
Published
LI.FI rpc-wrapper
Downloads
1,224
Maintainers
Readme
The rpc wrapper is a wrapper around evm based rpc. It allows you as an developer not to handle retrying, logging and performance monitoring of your rpcs.
Getting started
The package is available as an NPM package
You can install the package by running
> yarn add @lifi/rpc-wrapper
or if you use npm
> npm install @lifi/rpc-wrapper
Since the RPCProvider extends the ethersproject Fallbackprovider you can easily swap out your rpc handling with the RPCProvider.
// specify your rpc providers for your specific chain
const myRpcProviders = ['https://rpc1.com', 'https://rpc2.com']
// initialize the rpc provider
const provider = new RPCProvider(myRpcProviders)
const blockNumber = provider.getBlockNumber()
console.log('This is a block number ', blockNumber)
Contributing
Awesome! Please read more about contributing to the repo here
Development
Running tests
Test your code with Jest framework:
yarn test
Build
Build production (distribution) files in your dist folder:
yarn build
If you want to test how your changes affect please use
> yarn link
Then in your project, do
> yarn link @lifi/rpc-wrapper