{"bugs":{"url":"https://github.com/BitskiCo/provider-engine/issues"},"dist":{"shasum":"026b8aba897274ea85bf97b4c9b3205994d19efd","tarball":"https://registry.npmjs.org/@bitski/provider-engine/-/provider-engine-0.7.0-beta.1.tgz","fileCount":214,"integrity":"sha512-nBHjSXuKvAnS02uBZvbBvMaxzJhXZhoz4BAxSQh3YnrgCeOgVM1g7Qp3OGL10iR9Q0kWgaHnhsERII0yjMrfug==","signatures":[{"sig":"MEQCIBIWBP0vydE9P1B+rDrd9tGnUDM68BAdVZ7XZwGwwzsMAiBxTeVzjMdHAQWxLT4KBcj5FT0WUG8aY0TAkuYBfHzSIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":282435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfY6q+CRA9TVsSAnZWagAAX2gP/3YW3cj04Gm9yynDnS4R\nOIHAixVDR7bBJ178eKSOtyauhYUTaYWpTbtuy18ApSyu319Kl4oYPSFcMlkG\nfjzOm0gpGHGYVg3q92dZ1qq+JlL+ENY67Xudg2wqLVV6zq72xx7E3M08UqMS\n3DnSiwjsJQw9kBbafBRFnK3T86bPhVbYvp4MaUwwdvew347OtU8lm1Pkvk9o\nNO06aTmZvbutHdaY5B06F1wZv/BT5PnaSuLo17EojtNAWl3I8OmBZL1EbRzK\n8VwqI+/0fFPaBf2YNJZEqnQMEqUvZghP2ONVYmqALUiwFjrrv6sLg0ym/Sk0\noSbRR+pHs/IEjiz52zbptWMwsqrl4titVPtm74RUM64VyxfPF7kfjWcunjHQ\nEYShyU1iSdttan8WL+7d2kSZibRmFRighncAQ8Aq036kvRkpFpy6t1AJyki2\nKeAcIpXM9wxjjVwv7IkuJM4LXbzGY2vvKDUwtJhygYzaONMLbIZr/YueCPw1\n0HhG4fFYCwBfpNDy/TIpGMEgcBqmyMVnYN4WEHge7dg0QTnd+FaWo2dW0AOv\nw+5uzNT+sEjS/QAcwl8+AIte9s5F+p/NvpgJDU5Esy+3lA/wUYKH/JIQLBzZ\nMofR03bpMSxrpxmm6ubbLewSFsO59kiWUeyrPVDEshQ5YUyx/qWqy65kk86V\nNM68\r\n=vI7K\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":"290406c9b2dd7c10357de849648d38521b182a41","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.1_1600367294320_0.4316352346084633","host":"s3://npm-registry-packages"},"_id":"@bitski/provider-engine@0.7.0-beta.1","version":"0.7.0-beta.1"}