How to use the unchained-bitcoin.NETWORKS.MAINNET function in unchained-bitcoin

To help you get started, we’ve selected a few unchained-bitcoin 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 unchained-capital / unchained-wallets / src / trezor.js View on Github external
messages() {
    const messages = super.messages();

    const bip32PathSegments = (this.bip32Path || '').split('/');
    if (bip32PathSegments.length < 4) { // m, 45', 0', 0', ...
      messages[PENDING].push({level: ERROR, text: "BIP32 path must be at least depth 3.", code: "trezor.bip32_path.minimum"});
    } else {
      const coinPath = bip32PathSegments[2];
      if (this.network === NETWORKS.MAINNET) {
        if (! coinPath.match(/^0'/)) {
          messages[ACTIVE].push({level: WARNING, text: "On Trezor model T the screen may display a 'Confirm path' warning message.", code: "trezor.bip32_path.mismatch"});
        }
      }
      if (this.network === NETWORKS.TESTNET) {
        if (! coinPath.match(/^1'/)) {
          messages[ACTIVE].push({level: WARNING, text: "On Trezor model T the screen may display a 'Confirm path' warning message.'", code: "trezor.bip32_path.mismatch"});
        }
      }
    }

    messages[ACTIVE].push({level: INFO, text: "Confirm in the Trezor Connect window that you want to 'Export public key'.  You may be prompted to enter your PIN.", code: "trezor.popup.export_hdnode"});

    return messages;
  }