{"_id":"@dune-network/hdwallet-provider","_rev":"1-9b6a6bb32e9d5ac208a3a8c856ac6852","name":"@dune-network/hdwallet-provider","dist-tags":{"latest":"1.1.0-dune.2"},"versions":{"1.1.0-dune.2":{"name":"@dune-network/hdwallet-provider","description":"HD Wallet-enabled Web3 provider","license":"MIT","author":{"name":"Tim Coulter","email":"tim@trufflesuite.com"},"homepage":"https://github.com/dune-network/truffle/tree/master/packages/hdwallet-provider#readme","repository":{"type":"git","url":"https://github.com/dune-network/truffle/tree/master/packages/hdwallet-provider"},"bugs":{"url":"https://github.com/dune-network/truffle/issues"},"version":"1.1.0-dune.2","main":"dist/index.js","scripts":{"build":"tsc","prepare":"yarn build","test":"yarn build && mocha --exit -r ts-node/register test/**/*.test.ts"},"types":"dist/index.d.ts","dependencies":{"any-promise":"^1.3.0","bindings":"^1.5.0","bip39":"^2.4.2","ethereum-protocol":"^1.0.1","ethereumjs-tx":"^1.0.0","ethereumjs-util":"^6.1.0","ethereumjs-wallet":"^0.6.3","source-map-support":"^0.5.16","web3":"1.2.1","web3-provider-engine":"git+https://github.com/trufflesuite/provider-engine.git#web3-one"},"devDependencies":{"@types/bip39":"^2.4.2","@types/ethereum-protocol":"^1.0.0","@types/ethereumjs-tx":"^1.0.1","@types/ethereumjs-util":"^5.2.0","@types/mocha":"^5.2.7","@types/web3":"^1.0.20","@types/web3-provider-engine":"^14.0.0","ganache-core":"2.10.2","mocha":"6.2.0","ts-node":"^8.4.1","typescript":"^3.6.3"},"keywords":["etheruem","hd","mnemonic","provider","wallet"],"publishConfig":{"access":"public"},"gitHead":"d3a50d40c573fbcfaa49794cba9716eabb4d7d75","_id":"@dune-network/hdwallet-provider@1.1.0-dune.2","_nodeVersion":"9.11.2","_npmVersion":"lerna/3.19.0/node@v9.11.2+x64 (linux)","dist":{"integrity":"sha512-zBAAKpO2JabcFGD4802zSmfp1Pz3My+pG+L9VSishH4xTbzFzKrHP+kwtB23Wv3mMFV4y6TaAX69fYH1vPM70A==","shasum":"3b5ab2eef95ead036f377c07d81978df8c2c4af5","tarball":"https://registry.npmjs.org/@dune-network/hdwallet-provider/-/hdwallet-provider-1.1.0-dune.2.tgz","fileCount":6,"unpackedSize":22349,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelbfaCRA9TVsSAnZWagAAlAkQAJcBpUTcgcexjXueHqnN\nA0aJtZyPa7e1IYcmEDlgh5PHMrmu/7EDD7+eWSmItoWhilWTs2OYWS2KC3M+\nZ4wF0KThEp6ijYjZ6IdCLEUYRHTbjfk7iti785VT1lSaYeZFPyDP1Lq0jUvc\nkEECV9thz50I5QQFA289hgy7l9yNR58IhrBFJX/VLA+p4l3ELSg9Xtee6Qe9\n91MEhbw+ob0m2EGi1DkShln9mfKIoU66spyaRM22ETSNsrYcPa8viy+xE2IE\nmE5U3WVeGC+1wsqKhaEDUErd2QXBmsCYUHCj0KGgSdjabUg7ZoseqOsyoFz+\nzQ0hMjToVmSl4z0QOoVnU2t5kHXk6IeqNwq+vpN11HWfFG6pDn/3hwtd0Xa5\nhvjcLi/nfT9HG+I//247KE5vvAP4nhtsgjp5rmq+lT+wigDbYkYv9ENjiqbv\nDtyi27jpUzv17X8fY7RmbVWHuHricHwj0Q2BFHThNuUcGs3mr7TnihIkiJN9\nHevE4wF9BBd1Fu2qX5qmtPs7AJJT/9fudebIE/1gn3ZIgSt8XHuyfmceTZ0N\nQ8KZb5POJ+jKzuyyke1hRQW3UApXSUz4cgEXl4z9aWiE+iA2VHX0TYPvBUCL\nXnIc+CVREuBVTqqzEIGGjJWiSVjVSyyaaTmTTK9F5w1fu4LK4MNJobqSFUu5\nwemM\r\n=K/6i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID6IQj15OuOJ2vJktEf6t4hOQrxJV8G2NRhNS57udD/hAiEA4j2iTDgwtVUWAWEFFwuQZi/Svsf9JrB6aqbhi6cIkAo="}]},"maintainers":[{"name":"lefessan","email":"fabrice.le_fessant@origin-labs.com"}],"_npmUser":{"name":"lefessan","email":"fabrice.le_fessant@origin-labs.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hdwallet-provider_1.1.0-dune.2_1586870233756_0.1832920671070457"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-14T13:17:13.410Z","1.1.0-dune.2":"2020-04-14T13:17:13.894Z","modified":"2022-04-05T06:08:33.507Z"},"maintainers":[{"name":"lefessan","email":"fabrice.le_fessant@origin-labs.com"}],"description":"HD Wallet-enabled Web3 provider","homepage":"https://github.com/dune-network/truffle/tree/master/packages/hdwallet-provider#readme","keywords":["etheruem","hd","mnemonic","provider","wallet"],"repository":{"type":"git","url":"https://github.com/dune-network/truffle/tree/master/packages/hdwallet-provider"},"author":{"name":"Tim Coulter","email":"tim@trufflesuite.com"},"bugs":{"url":"https://github.com/dune-network/truffle/issues"},"license":"MIT","readme":"# @dune-network/hdwallet-provider\nHD Wallet-enabled Web3 provider. Use it to sign transactions for addresses derived from a 12 or 24 word mnemonic.\n\n## Install\n\n```\n$ npm install @dune-network/hdwallet-provider\n```\n\n## Requirements\n```\nNode >= 7.6\nWeb3 ^1.2.0\n```\n\n## General Usage\n\nYou can use this provider wherever a Web3 provider is needed, not just in Truffle. For Truffle-specific usage, see next section.\n\n```javascript\nconst HDWalletProvider = require(\"@dune-network/hdwallet-provider\");\nconst Web3 = require(\"web3\");\nconst mnemonic = \"mountains supernatural bird...\"; // 12 word mnemonic\nlet provider = new HDWalletProvider(mnemonic, \"http://localhost:8545\");\n\n// Or, alternatively pass in a zero-based address index.\nprovider = new HDWalletProvider(mnemonic, \"http://localhost:8545\", 5);\n\n// Or, use your own hierarchical derivation path\nprovider = new HDWalletProvider(mnemonic, \"http://localhost:8545\", 5, 1, true, \"m/44'/137'/0'/0/\");\n\n\n// HDWalletProvider is compatible with Web3. Use it at Web3 constructor, just like any other Web3 Provider\nconst web3 = new Web3(provider);\n\n// Or, if web3 is alreay initialized, you can call the 'setProvider' on web3, web3.eth, web3.shh and/or web3.bzz\nweb3.setProvider(provider)\n\n// ...\n// Write your code here.\n// ...\n\n// At termination, `provider.engine.stop()' should be called to finish the process elegantly.\nprovider.engine.stop();\n```\n\nBy default, the `HDWalletProvider` will use the address of the first address that's generated from the mnemonic. If you pass in a specific index, it'll use that address instead.\n\nParameters:\n\n| Parameter | Type | Default | Required | Description |\n| ------ | ---- | ------- | ----------- | ----------- |\n| `mnemonic` | *`string*` | null | [x] | 12 word mnemonic which addresses are created from. |\n| `provider` | `string\\|object` | `null` | [x] | URI or Ethereum client to send all other non-transaction-related Web3 requests |\n| `address_index` | `number` | `0` | [ ] | If specified, will tell the provider to manage the address at the index specified |\n| `num_addresses` | `number` | `1` | [ ] | If specified, will create `number` addresses when instantiated |\n| `shareNonce` | `boolean` | `true` | [ ] | If false, a new WalletProvider will track its own nonce-state |\n| `wallet_hdpath` | `string` | `\"m/44'/60'/0'/0/\"` | [ ] | If specified, will tell the wallet engine what derivation path should use to derive addresses. |\n\n\n### Private Keys\n\nInstead of a mnemonic, you can alternatively provide a private key or array of private keys as the first parameter. When providing an array, `address_index` and `num_addresses` are fully supported.\n\n```javascript\nconst HDWalletProvider = require(\"@dune-network/hdwallet-provider\");\n//load single private key as string\nlet provider = new HDWalletProvider(\"3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580\", \"http://localhost:8545\");\n\n// Or, pass an array of private keys, and optionally use a certain subset of addresses\nconst privateKeys = [\n  \"3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580\",\n  \"9549f39decea7b7504e15572b2c6a72766df0281cea22bd1a3bc87166b1ca290\",\n];\nprovider = new HDWalletProvider(privateKeys, \"http://localhost:8545\", 0, 2); //start at address_index 0 and load both addresses\n```\n**NOTE: This is just an example. NEVER hard code production/mainnet private keys in your code or commit them to git. They should always be loaded from environment variables or a secure secret management system.**\n\n## Truffle Usage\n\nYou can easily use this within a Truffle configuration. For instance:\n\ntruffle-config.js\n```javascript\nconst HDWalletProvider = require(\"@dune-network/hdwallet-provider\");\n\nconst mnemonic = \"mountains supernatural bird ...\";\n\nmodule.exports = {\n  networks: {\n    development: {\n      host: \"localhost\",\n      port: 8545,\n      network_id: \"*\" // Match any network id\n    },\n    ropsten: {\n      // must be a thunk, otherwise truffle commands may hang in CI\n      provider: () =>\n        new HDWalletProvider(mnemonic, \"https://ropsten.infura.io/v3/YOUR-PROJECT-ID\",\n            0, 1, true, \"m/44'/1'/0'/0/\"\n        ),\n      network_id: '3',\n    }\n  }\n};\n```\n","readmeFilename":"README.md"}