@kompose-app/klaytn-provider-engine
v1.0.0
Published
A JavaScript library for composing Klaytn provider objects using middleware modules
Downloads
9
Readme
Klaytn ProviderEngine
Klaytn ProviderEngine is a tool for composing your own klaytn providers.
Originally created for MetaMask and Ethereum, but forked by Kompose for Klaytn usage.
Composable
Built to be modular - works via a stack of 'sub-providers' which are like normal web3 providers but only handle a subset of rpc methods.
The subproviders can emit new rpc requests in order to handle their own; e.g. klay_call
may trigger klay_getAccountBalance
, klay_getCode
, and others.
The provider engine also handles caching of rpc request results.
const ProviderEngine = require('@kompose-app/klaytn-provider-engine')
// cache layer
engine.addProvider(new CacheSubprovider())
// filters
engine.addProvider(new FilterSubprovider())
// pending nonce
engine.addProvider(new NonceSubprovider())
// vm
engine.addProvider(new VmSubprovider())
When importing in webpack:
import * as Web3ProviderEngine from 'web3-provider-engine';
License
MIT