How to use the @colony/purser-core/defaults.PATH.COIN_MAINNET function in @colony/purser-core

To help you get started, we’ve selected a few @colony/purser-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JoinColony / purser / modules / node_modules / @colony / purser-trezor / index.js View on Github external
* Validate the trasaction's object input
   */
  userInputValidator({
    firstArgument: argumentObject,
  });
  const { addressCount, chainId = CHAIN_IDS.HOMESTEAD } = argumentObject;
  /*
   * @TODO Reduce code repetition
   * By moving this inside a helper. This same patter will be used on the
   * ledger wallet as well.
   *
   * If we're on a testnet set the coin type id to `1`
   * This will be used in the derivation path
   */
  const coinType: number =
    chainId === CHAIN_IDS.HOMESTEAD ? PATH.COIN_MAINNET : PATH.COIN_TESTNET;
  /*
   * Get to root derivation path based on the coin type.
   *
   * Based on this, we will then derive all the needed address indexes
   * (inside the class constructor)
   */
  const rootDerivationPath: string = derivationPathSerializer({
    change: PATH.CHANGE,
    coinType,
  });
  /*
   * Modify the default payload to overwrite the path with the new
   * coin type id derivation
   */
  const modifiedPayloadObject: Object = Object.assign({}, PAYLOAD_XPUB, {
    path: fromString(rootDerivationPath, true).toPathArray(),
github JoinColony / purser / modules / node_modules / @colony / purser-ledger / index.js View on Github external
* Validate the trasaction's object input
   */
  userInputValidator({
    firstArgument: argumentObject,
  });
  const { addressCount, chainId = CHAIN_IDS.HOMESTEAD } = argumentObject;
  /*
   * @TODO Reduce code repetition
   * By moving this inside a helper. This same patter will be used on the
   * trezor wallet as well.
   *
   * If we're on a testnet set the coin type id to `1`
   * This will be used in the derivation path
   */
  const coinType: number =
    chainId === CHAIN_IDS.HOMESTEAD ? PATH.COIN_MAINNET : PATH.COIN_TESTNET;
  /*
   * Get to root derivation path based on the coin type.
   *
   * Based on this, we will then derive all the needed address indexes
   * (inside the class constructor)
   */
  const rootDerivationPath: string = derivationPathSerializer({
    coinType,
  });
  try {
    const ledger: LedgerInstanceType = await ledgerConnection();
    /*
     * Get the harware wallet's root public key and chain code, to use
     * for deriving the rest of the accounts
     */
    const { publicKey, chainCode } = await ledger.getAddress(