@trufflesuite/eth-json-rpc-infura

Fork of https://github.com/MetaMask/eth-json-rpc-infura

Usage no npm install needed!

<script type="module">
  import trufflesuiteEthJsonRpcInfura from 'https://cdn.skypack.dev/@trufflesuite/eth-json-rpc-infura';
</script>

README

eth-json-rpc-infura

json-rpc-engine middleware for infura's REST endpoints.

usage as provider

const createInfuraProvider = require('eth-json-rpc-infura/src/createProvider')
const Ethjs = require('ethjs')

const provider = createInfuraProvider({ network: 'mainnet' })
const eth = new Ethjs(provider)

usage as middleware

const createInfuraMiddleware = require('eth-json-rpc-infura')
const RpcEngine = require('json-rpc-engine')

const engine = new RpcEngine()
engine.push(createInfuraMiddleware({ network: 'ropsten' }))