{"bugs":{"url":"https://github.com/BitskiCo/provider-engine/issues"},"dist":{"shasum":"d14526050425538cdb1be521ec4c860bcd81361c","tarball":"https://registry.npmjs.org/@bitski/provider-engine/-/provider-engine-0.7.0-beta.0.tgz","fileCount":214,"integrity":"sha512-y1Toz688Iqswxh7+X/a0bYcXpj2rFxOzuOAHnBlpqgSGNNturfzBXR4T/wE7ld45iXHEZb3+trf2FL7DkosAXA==","signatures":[{"sig":"MEUCIQCxL9WInK0b0h8SBm6iiTfGzT0ma+t2ZSOE1FTr8aU+JAIgIeQazECAONOeiAFtQMJwQPwu6v6BNfhSGh6xF4UBLmk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":282428,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfY5G4CRA9TVsSAnZWagAAepEP/RCHrC1AO2ryQ9lAZXbj\njh4Su/9kEClnAkc63wr4CeGHY3rVLHUaXfaLLbLen2wv6IINIdG50ukS+scC\nulJeme11gUmJ15lwVC3dqAcmXrUFjMnbj8eVlTc1kQETl0AHf6gAnJ0mjxBD\n2GXTr8E5RtPal+HxOTnnJddQ4+98fCB5K48b8tCJO3T1O7uute1lKXI51u+d\ntYhjPgU8FAYkfWwG75jvzYCAWhpdZUyg51wonbbGKSRjllO9xjfu/z6UrWug\nmU7C8stcHUDWhaCgmZVDuwdMahB8AYsomqU/E7WOpJ1bTR95h4xjGQWs9+Xq\nT54rbFZMvghBB2fjD8LVCgp/A3VqFzIr5aQDriQIA0V1akpIlXUySNgMRhM8\n/UqFFd3T7DFHzjO2GpheJt1+NBJA0J6xP8INwTSw7H2+N6J3xaT5nXNlIYl2\nOkxLyqPPWEMZF1+VdeToCPEglwYn5HALHz3HYP5bI37veKZZYSzsd9aaIG4O\nBPPoVUx12c6qhHeNt1jVlzVIDyskhOpRIFlC6FB7VPDfSwJDfsgDWtanzFtH\nzz8dIw0Xhw3SawZqfyQdX/SZ498+v49vwKtGggnUa+b3CMQqrBcEukUolgb7\njirLczZDO9u+9Obt8cEDe+0NIarqfw3k5qJQcHrlnyi87VM19ltX8mW1LLdO\n32az\r\n=/LVw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/commonjs/index.js","name":"@bitski/provider-engine","types":"dist/modules/index.d.ts","author":"","module":"dist/modules/index.js","readme":"# Bitski ProviderEngine\n\nBitski's ProviderEngine is a refactored version of Metamask's original provider engine library. This is the base of the Bitski Javascript SDKs (both browser and node).\n\n### Installation\n\n`npm install @bitski/provider-engine`\n\n### Differences from original package\n\n- Written in Typescript\n- Standard ES6 modules, designed for the browser first\n- Designed to be extended with a properly exported Subprovider interface\n- Base class implements new EthereumProvider standard\n- Compatible with latest versions of web3.js\n- Heavier dependencies removed to keep base package light (primarily all dependencies that rely on elliptic)\n- Many small bug fixes and improvements\n\n### To Do\n\n- Reimplement HookedWalletSubprovider as a separate package\n- Reimplement VmSubprovider as a separate package\n- Reimplement NonceTracker as a separate package\n- Improve test coverage\n\n---\n\n### Composable\n\nBuilt to be modular - works via a stack of 'sub-providers' which are like normal web3 providers but only handle a subset of rpc methods.\n\nThe subproviders can emit new rpc requests in order to handle their own;  e.g. `eth_call` may trigger `eth_getAccountBalance`, `eth_getCode`, and others.\nThe provider engine also handles caching of rpc request results.\n\n```js\nimport {\n  default as ProviderEngine,\n  BlockCacheSubprovider,\n  FixtureSubprovider,\n  FilterSubprovider,\n  FetchSubprovider\n} from '@bitski/provider-engine';\n\nconst engine = new ProviderEngine();\nconst web3 = new Web3(engine);\n\n// static results\nengine.addProvider(new FixtureSubprovider({\n  web3_clientVersion: 'ProviderEngine/v0.0.0/javascript',\n  net_listening: true,\n  eth_hashrate: '0x00',\n  eth_mining: false,\n  eth_syncing: true,\n}));\n\n// cache layer\nengine.addProvider(new BlockCacheSubprovider());\n\n// filters\nengine.addProvider(new FilterSubprovider());\n\n// data source\nengine.addProvider(new FetchSubprovider({\n  rpcUrl: 'https://testrpc.metamask.io/',\n}));\n\n// log new blocks\nengine.on('block', (block) => {\n  console.log('================================')\n  console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex'))\n  console.log('================================')\n});\n\n// network connectivity error\nengine.on('error', (err) => {\n  // report connectivity errors\n  console.error(err.stack);\n});\n\n// start polling for blocks\nengine.start();\n```\n\n\n### Writing your own Subprovider\n\nIt's easy to extend the functionality of this module by writing your own Subprovider instance.\n\nSee [src/subprovider.ts](/src/subprovider.ts) for the full interface.\n\n```typescript\nimport { Subprovider } from '@bitski/provider-engine';\n\nexport default class MySubprovider extends Subprovider {\n\n  // Only requirement is to implement handleRequest\n  public handleRequest(payload, next, end) {\n    // The payload includes the original JSON RPC request\n    if (payload.method === 'eth_helloWorld') {\n      // Call end() to handle the request in this subprovider\n      end('hello world!');\n    } else {\n      // Call next() to fall-through to the next request in the stack\n      next();\n    }\n  }\n\n}\n```\n\n### Acknowlegements\n\nA special thanks to the folks at Metamask who conceived and wrote the original library.\n","gitHead":"bfbf085570809e8002b9ce83f2e261592291573d","license":"MIT","scripts":{"lint":"eslint --ignore-path .gitignore --fix .","test":"ts-node node_modules/tape/bin/tape test/index.ts","build":"tsc && tsc -p tsconfig.module.json","prepublish":"npm run build"},"_npmUser":{"name":"jatescher","email":"jatescher@gmail.com"},"homepage":"https://github.com/BitskiCo/provider-engine#readme","repository":{"url":"git+https://github.com/BitskiCo/provider-engine.git","type":"git"},"_npmVersion":"6.14.6","description":"Bitski's ProviderEngine is a refactored version of Metamask's original provider engine library. This is the base of the Bitski Javascript SDKs (both browser and node).","directories":{},"maintainers":[{"name":"jatescher","email":"jatescher@gmail.com"},{"name":"pat2man","email":"pat2man@gmail.com"}],"_nodeVersion":"12.18.3","dependencies":{"async":"3.2.0","bn.js":"^4.11.8","clone":"^2.0.0","xtend":"^4.0.2","ethjs-util":"^0.1.6","cross-fetch":"^3.0.6","json-rpc-error":"^2.0.0","eth-block-tracker":"^4.4.2","promise-to-callback":"^1.0.0","eth-json-rpc-filters":"^4.1.1","json-stable-stringify":"^1.0.1","eth-json-rpc-middleware":"^4.1.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tape":"^4.4.0","eslint":"^7.9.0","ts-node":"^8.1.0","babelify":"^10.0.0","browserify":"^16.5.0","typescript":"^3.4.5","@babel/core":"^7.5.5","@types/node":"^12.0.2","@types/events":"^3.0.0","@babel/preset-env":"^7.5.5","@typescript-eslint/parser":"^4.1.1","@typescript-eslint/eslint-plugin":"^4.1.1"},"_npmOperationalInternal":{"tmp":"tmp/provider-engine_0.7.0-beta.0_1600360888069_0.9723614782882268","host":"s3://npm-registry-packages"},"_id":"@bitski/provider-engine@0.7.0-beta.0","version":"0.7.0-beta.0"}