How to use the @shapeshiftoss/hdwallet-core.bip32ToAddressNList function in @shapeshiftoss/hdwallet-core

To help you get started, we’ve selected a few @shapeshiftoss/hdwallet-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 shapeshift / hdwallet / integration / src / ethereum / ethereum.ts View on Github external
test('ethSignMessage()', async () => {
      if (!wallet) return
      if (isLedger(wallet)) return // FIXME: Expected failure
      let res = await wallet.ethSignMessage({
        addressNList: bip32ToAddressNList("m/44'/60'/0'/0/0"),
        message: 'Hello World'
      })
      expect(res.address).toEqual('0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8')
      expect(res.signature).toEqual('0x29f7212ecc1c76cea81174af267b67506f754ea8c73f144afa900a0d85b24b21319621aeb062903e856352f38305710190869c3ce5a1425d65ef4fa558d0fc251b')
    }, TIMEOUT)
github shapeshift / hdwallet / integration / src / bitcoin / bitcoin.ts View on Github external
test('btcSignMessage()', async () => {
      if (!wallet) return
      let res = await wallet.btcSignMessage({
        addressNList: bip32ToAddressNList("m/44'/0'/0'/0/0"),
        coin: 'Bitcoin',
        scriptType: BTCInputScriptType.SpendAddress,
        message: "Hello World"
      })

      // not implemented on portis
      if(isPortis(wallet)) {
        expect(res).toEqual(undefined)
        return
      }

      expect(res).toEqual({
        address: "1FH6ehAd5ZFXCM1cLGzHxK1s4dGdq1JusM",
        signature: "20a037c911044cd6c851b6508317d8892067b0b62074b2cf1c0df9abd4aa053a3c243ffdc37f64d7af2c857128eafc81947c380995596615e5dcc313a15f512cdd",
      })
    }, TIMEOUT)
github shapeshift / hdwallet / integration / src / wallets / keepkey.ts View on Github external
it('can describe Bitcoin Change Addresses', () => {
    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/0'/7'/1/5"),
      coin: 'Bitcoin',
      scriptType: BTCInputScriptType.SpendAddress
    })).toEqual({
      verbose: "Bitcoin Account #7, Change Address #5 (Legacy)",
      coin: 'Bitcoin',
      isKnown: true,
      scriptType: BTCInputScriptType.SpendAddress,
      accountIdx: 7,
      addressIdx: 5,
      wholeAccount: false,
      isChange: true,
      isPrefork: false,
    })
  })
github shapeshift / hdwallet / integration / src / wallets / ledger.ts View on Github external
isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/0'/7'/1/5"),
      coin: 'BitcoinCash',
      scriptType: BTCInputScriptType.SpendAddress
    })).toEqual({
      verbose: "m/44'/0'/7'/1/5",
      coin: 'BitcoinCash',
      scriptType: BTCInputScriptType.SpendAddress,
      isKnown: false
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #0",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 0,
      wholeAccount: true,
      isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/3'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #3",
      coin: 'Ethereum',
github shapeshift / hdwallet / integration / src / wallets / trezor.ts View on Github external
isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/0'/7'/1/5"),
      coin: 'BitcoinCash',
      scriptType: BTCInputScriptType.SpendAddress
    })).toEqual({
      verbose: "m/44'/0'/7'/1/5",
      coin: 'BitcoinCash',
      scriptType: BTCInputScriptType.SpendAddress,
      isKnown: false
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #0",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 0,
      wholeAccount: true,
      isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/3'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "m/44'/60'/3'/0/0",
      coin: 'Ethereum',
github shapeshift / hdwallet / integration / src / wallets / keepkey.ts View on Github external
await new Promise(async (resolve) => {
      wallet.btcGetAddress({
        coin: "Bitcoin",
        addressNList: bip32ToAddressNList("m/44'/0'/0'/0/0"),
        showDisplay: true
      })
      .then((address) => { addrs.push(address) })

      wallet.btcGetAddress({
        coin: "Bitcoin",
        addressNList: bip32ToAddressNList("m/44'/0'/0'/0/1"),
        showDisplay: true
      })
      .then((address) => { addrs.push(address) })

      wallet.btcGetAddress({
        coin: "Bitcoin",
        addressNList: bip32ToAddressNList("m/44'/0'/0'/0/2"),
        showDisplay: true
      })
github shapeshift / hdwallet / integration / src / wallets / trezor.ts View on Github external
})

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #0",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 0,
      wholeAccount: true,
      isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/3'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "m/44'/60'/3'/0/0",
      coin: 'Ethereum',
      isKnown: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/0/3"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #3",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 3,
      wholeAccount: true,
github shapeshift / hdwallet / integration / src / bitcoin / bitcoin.ts View on Github external
], async (args) => {
        let mode = args[0] as string
        let coin = args[1] as Coin
        let path = args[2] as string
        let scriptType = args[3] as BTCInputScriptType
        let expected = args[4] as string

        if (!await wallet.btcSupportsCoin(coin)) return
        expect(await info.btcSupportsCoin(coin)).toBeTruthy()
        if (!await wallet.btcSupportsScriptType(coin, scriptType)) return
        expect(await info.btcSupportsScriptType(coin, scriptType)).toBeTruthy()
        let res = await wallet.btcGetAddress({
          addressNList: bip32ToAddressNList(path),
          coin: coin,
          showDisplay: mode === 'Show',
          scriptType: scriptType,
          address: expected,
        })
        expect(res).toEqual(expected)
      })
    }, TIMEOUT)
github shapeshift / hdwallet / examples / sandbox / index.ts View on Github external
$btcSign.on('click', async (e) => {
  e.preventDefault()
  if (!wallet) { $btcResults.val("No wallet?"); return}
  if (supportsBTC(wallet)) {
    let res = await wallet.btcSignMessage({
      addressNList: bip32ToAddressNList("m/44'/0'/0'/0/0"),
      coin: 'Bitcoin',
      scriptType: BTCInputScriptType.SpendAddress,
      message: "Hello World"
    })
    $btcResults.val(res.address + ' ' + res.signature)
  } else {
    let label = await wallet.getLabel()
    $btcResults.val(label + " does not support BTC")
  }
})
github shapeshift / hdwallet / integration / src / wallets / ledger.ts View on Github external
})

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #0",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 0,
      wholeAccount: true,
      isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/3'/0/0"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #3",
      coin: 'Ethereum',
      isKnown: true,
      accountIdx: 3,
      wholeAccount: true,
      isPrefork: false,
    })

    expect(wallet.info.describePath({
      path: bip32ToAddressNList("m/44'/60'/0'/42"),
      coin: 'Ethereum'
    })).toEqual({
      verbose: "Ethereum Account #42",
      coin: 'Ethereum',