How to use the @colony/purser-core/defaults.PATH.CHANGE 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-software / class.js View on Github external
get: async () =>
            derivationPathSerializer({
              change: PATH.CHANGE,
              addressIndex: PATH.INDEX,
            }),
        },
github JoinColony / purser / modules / node_modules / @colony / purser-software / index.js View on Github external
requiredEither: REQUIRED_PROPS_SOFTWARE.OPEN_WALLET,
  });
  const {
    password,
    privateKey,
    mnemonic,
    keystore,
    chainId = CHAIN_IDS.HOMESTEAD,
  } = argumentObject;
  let extractedPrivateKey: string;
  /*
   * @TODO Re-add use ability to control derivation path
   * When opening the wallet. But only if this proves to be a needed feature.
   */
  const derivationPath: string = derivationPathSerializer({
    change: PATH.CHANGE,
    addressIndex: PATH.INDEX,
  });
  try {
    /*
     * @TODO Detect if existing but not valid keystore, and warn the user
     */
    if (keystore && isSecretStorageWallet(keystore) && password) {
      const keystoreWallet: Object =
        /*
         * Prettier suggests changes that would always result in eslint
         * breaking. This must be one of the edge cases of prettier.
         *
         * Nevertheless, by inserting this comment, it works :)
         */
        await EthersWallet.fromEncryptedJson(keystore, password);
      /*
github JoinColony / purser / modules / node_modules / @colony / purser-trezor / index.js View on Github external
* 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(),
  });
  /*
   * We need to catch the cancelled error since it's part of a normal user workflow
   */
  try {
    /*
     * Get the harware wallet's public key and chain code, to use for deriving
     * the rest of the accounts