How to use the @ledgerhq/hw-app-btc.default function in @ledgerhq/hw-app-btc

To help you get started, weā€™ve selected a few @ledgerhq/hw-app-btc 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 LedgerHQ / ledger-live-desktop / alix.js View on Github external
waitForDevices(async device => {
  // const accounts = await scanAccountsOnDevice({
  //   devicePath: device.path,
  //   currencyId: 'bitcoin_testnet',
  // })
  // console.log(accounts)
  try {
    console.log(`> Creating transport`)
    const transport = await CommNodeHid.open(device.path)

    // transport.setDebugMode(true)

    console.log(`> Instanciate BTC app`)
    const hwApp = new Btc(transport)

    console.log(`> Get currency`)
    const currency = await getCurrency('bitcoin_testnet')

    console.log(`> Create wallet`)
    const wallet = CREATE ? await createWallet('khalil', currency) : await getWallet('khalil')

    console.log(`> Create account`)
    const account = CREATE ? await createAccount(wallet, hwApp) : await wallet.getAccount(0)

    console.log(`> Sync account`)
    if (CREATE) {
      await syncAccount(account)
    }

    console.log(`> Create transaction`)
github LedgerHQ / ledger-live-desktop / alix.js View on Github external
async function scanAccountsOnDevice(props) {
  try {
    const { devicePath, currencyId } = props
    console.log(`get or create wallet`)
    const wallet = await getOrCreateWallet(currencyId)
    console.log(`open device`)
    const transport = await CommNodeHid.open(devicePath)
    console.log(`create app`)
    const hwApp = new Btc(transport)
    console.log(`scan account`)
    const accounts = await scanNextAccount(wallet, hwApp)
    console.log(accounts)
    return []
  } catch (err) {
    console.log(err)
  }
}
github unchained-capital / unchained-wallets / src / ledger.js View on Github external
async run() {
    const transport = await TransportU2F.create();
    const ledgerbtc = new LedgerBtc(transport);
    const result = await ledgerbtc.getWalletPublicKey(this.bip32Path, {verify: true});
    return result;
  }
}
github unchained-capital / unchained-wallets / src / ledger.js View on Github external
async run() {
    const transport = await TransportU2F.create();
    transport.setExchangeTimeout(20000*this.outputs.length)
    const ledgerbtc = new LedgerBtc(transport);

    return signMultisigSpendLedger(this.bip32Paths[0], this.inputs, this.outputs, isTestnet(this.network), ledgerbtc)
  }

@ledgerhq/hw-app-btc

Ledger Hardware Wallet Bitcoin Application API

MIT
Latest version published 19 days ago

Package Health Score

87 / 100
Full package analysis

Popular @ledgerhq/hw-app-btc functions