0.3.9 • Published 4 years ago

@catalyst-net-js/truffle-provider v0.3.9

Weekly downloads
37
License
MIT
Repository
github
Last release
4 years ago

Catalyst-js/truffle-provider

HD Wallet-enabled Web3 provider for Catalyst. Use it to sign transactions for addresses derived from a 12 or 24 word mnemonic.

Discord Twitter Follow

Status: Active development. This repository is being actively worked on, mostly in feature branches.

Install

npm install @catalyst-net-js/truffle-provider

Usage

truffle-config.js

const { HDWalletProvider } = require("@catalyst-net-js/truffle-provider");

const mnemonic = "mountains supernatural bird ...";

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    },
    catalyst: {
      // must be a thunk, otherwise truffle commands may hang in CI
      provider: () =>
        new HDWalletProvider(mnemonic, <catalyst-node-endpoint>",
      network_id: '1',
    }
  }
};

By 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.

Parameters:

ParameterTypeDefaultRequiredDescription
mnemonic`string`nullx12 word mnemonic which addresses are created from.
providerstring\|objectnullxURI or catalyst client to send all other non-transaction-related Web3 requests
address_indexnumber0 If specified, will tell the provider to manage the address at the index specified
num_addressesnumber1 If specified, will create number addresses when instantiated
shareNoncebooleantrue If false, a new WalletProvider will track its own nonce-state
wallet_hdpathstring"m/44'/42069'/0'/0/" If specified, will tell the wallet engine what derivation path should use to derive addresses.

License

MIT