How to use the @colony/purser-core/defaults.CHAIN_IDS.HOMESTEAD 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-ledger / index.js View on Github external
export const open = async (
  argumentObject: WalletArgumentsType = {},
): Promise => {
  /*
   * 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)
   */
github JoinColony / purser / modules / node_modules / @colony / purser-software / index.js View on Github external
export const open = async (
  argumentObject: WalletArgumentsType = {},
): Promise => {
  /*
   * Validate the trasaction's object input
   */
  userInputValidator({
    firstArgument: argumentObject,
    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 =
github JoinColony / purser / modules / node_modules / @colony / purser-trezor / index.js View on Github external
export const open = async (
  argumentObject: WalletArgumentsType = {},
): Promise => {
  /*
   * 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)
   */