{"dist":{"shasum":"19486aed4b014ec5d7687fac4eef2042db8b338c","tarball":"https://registry.npmjs.org/web3-providers/-/web3-providers-2.0.0-alpha.1.tgz","fileCount":6,"integrity":"sha512-X7hDkLKVN1U5aWeNQeErev494VSgt4gHJpHTgXn2rxrdJYUf7+6e6Al7yvRHlDxoTzhycX+j11HQC+CZlA+uhQ==","signatures":[{"sig":"MEUCIQCp5+mSeTDsoto09W4JYfoV+Z+5wKKK6+TiZKcgeTrf2AIgQVK4KjgUw2IB1LAFJdyjsfy7fpfqljS4+1yhAFZvqFU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":158256,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdSdRCCRA9TVsSAnZWagAAJwcQAIdzlXjx/74JbUuSGtAA\nBXuDL0sw6uhZviG7sAxQU2Yqh4DrRsMLrZZvdHiKeIKp2sbIB5bFiqmf+fni\niDHZl2ZW8XJ+ZS/3gGi+f9/Cjsb1fo9P+BfurA6NyU7R7GlMAVG3WjrO3+Gp\neQH4bSogt6d9VinmmeoY7vqEwyUhzlzox7BRH8VXwaiRUHkbCJPIcI8EHWaX\nyOb6mL085J1IdXNpfXwJrvtLpfT82xiLyemdQwYxsxrb7PzEAoFVS/3ahmTf\ns04V1nIQM5+FJiWpnuCHqbjQddzidFmKfo5ciENBhqFuqaRSNlk3CZ5QJXTN\neoW59O6akx1sqEYJJzlzc3lyPMO1EoOW97YqQ0Uy7Bi9tTlO/UmV6ZpdRIUn\nAnskf3X9QsASVAA5oH+hInjPfzYzlrk98R+dxQKX1zRJQUu/U94g81N5uZyX\nB7K7J5TyjJDr2YBffuL4aUymO6QehhkAEDdD0bid5RjNw3DrKM7+kwRX/OQf\nO3/+Wps6Kgh23GYtqKghDOb8l/cJuVUnchIb88PpIRfitNtCuotqEfy+60oq\nFocsgl0Jw2EBzQfHVvS+icrHN/bokPTB92P8hxTNWKFo5DsdEeoG47xpW4dG\nKNNv3p8oQUBemyKCC24LjzGDDZg5luDGb/F/oYyzYVtS8KoxiE/mIsvI1j7O\nH2s8\r\n=kAVT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/web3-providers.cjs.js","name":"web3-providers","types":"types/index.d.ts","module":"dist/web3-providers.esm.js","readme":"# web3-providers\n\nThis is a sub module of [web3.js][repo]\n\n## Installation\n\n```bash\nnpm install web3-providers\n```\n\n## Usage Examples\n\n#### HttpProvider\nYou can pass with the options object the timeout and all known HTTP headers. \n\n```js \nimport {HttpProvider} from 'web3-providers';\n\nconst options = {\n    timeout: 20000,\n    headers: [\n        {\n            name: 'Access-Control-Allow-Origin', value: '*'\n        },\n        ...\n    ]\n};\n\nconst httpProvider = new HttpProvider('http://localhost:8545', options); \n```\n\n#### WebsocketProvider\n\nInstead of setting a authorization header you could also define the credentials over the URL with:\n```ws://username:password@localhost:8546```\n\n```js \nimport {WebsocketProvider} from 'web3-providers';\nconst credentials = Buffer.from('username:password').toString('base64')\nconst options = { \n    timeout: 30000, \n    headers: {\n        authorization: `Basic ${credentials}`\n    }\n};\n \nconst websocketProvider = new WebsocketProvider('ws://localhost:8546', options);\n```\n\n#### IpcProvider\n```js \nimport {IpcProvider} from 'web3-providers';\nimport net from 'net';\n\nconst ipcProvider = new IpcProvider('/Users/me/Library/Ethereum/geth.ipc', net);\n```\n\n#### BatchRequest\nThe BatchRequest provides the possibility to send JSON-RPC requests as batch.\nPlease read the [documentation][docs] for more.\n\n```js \nimport {ProviderResolver, BatchRequest} 'web3-providers';\n\nconst provider = new ProviderResolver().resolve('ws://localhost:8546');\nconst batchRequest = new BatchRequest(provider);\n\nbatchRequest.add(web3.eth.getBalance.request(\n    '0x0000000000000000000000000000000000000000',\n    'latest',\n    callback\n));\n\nawait batchRequest.execute();\n```\n\n#### ProviderDetector\nChecks if an provider is given from the environment (Mist, MetaMask) and returns the provider.\n\n```js\nimport {ProviderDetector} from 'web3-providers';\n\nconst givenProvider = ProviderDetector.detect();\n```\n\n#### ProviderResolver\nThe ProviderResolver resolves an url or an given provider object to the correct provider class. \nBecause of the resolves does web3 has internally just one provider interface and we have no direct dependency to third party providers.\n\n```js \nimport {ProviderResolver} 'web3-providers';\n\nconst socketProviderAdapter = new ProviderResolver().resolve('ws://localhost:8546');\n```\n\n## Types \n\nAll the typescript typings are placed in the types folder. \n\n[docs]: http://web3js.readthedocs.io/en/1.0/\n[repo]: https://github.com/ethereum/web3.js\n","browser":"dist/web3-providers.umd.js","engines":{"node":">=8.0.0"},"gitHead":"cb266cc298150f4eb1c8cdac4f41551dd8819a81","license":"LGPL-3.0","scripts":{"dev":"rollup -c -w","test":"jest","build":"rollup -c","dtslint":"dtslint types --onlyTestTsNext"},"_npmUser":{"name":"nivida","email":"samuel@ethereum.org"},"namespace":"ethereum","repository":{"url":"https://github.com/ethereum/web3.js/tree/1.0/packages/web3-providers","type":"git"},"_npmVersion":"6.9.0","description":"Web3 module to handle requests to external providers.","directories":{},"maintainers":[{"name":"nivida","email":"samuel@ethereum.org"}],"_nodeVersion":"10.16.0","dependencies":{"lodash":"^4.17.11","url-parse":"1.4.4","web3-core":"2.0.0-alpha.1","websocket":"github:web3-js/WebSocket-Node#polyfill/globalThis","web3-utils":"2.0.0-alpha.1","@types/node":"^10.12.18","xhr2-cookies":"1.1.0","eventemitter3":"3.1.0","@babel/runtime":"^7.3.1","web3-core-method":"2.0.0-alpha.1","web3-core-helpers":"2.0.0-alpha.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"dtslint":"0.4.2","definitelytyped-header-parser":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/web3-providers_2.0.0-alpha.1_1565119554096_0.11543228263169292","host":"s3://npm-registry-packages"},"_id":"web3-providers@2.0.0-alpha.1","version":"2.0.0-alpha.1"}