How to use the @ledgerhq/ledger-core.signTransaction function in @ledgerhq/ledger-core

To help you get started, we’ve selected a few @ledgerhq/ledger-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 LedgerHQ / ledger-live-desktop / alix.js View on Github external
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`)
    const transaction = await createTransaction(wallet, account)
    const signedTransaction = await signTransaction(hwApp, transaction)

    await account.asBitcoinLikeAccount().broadcastRawTransaction(signedTransaction)
    // console.log(signedTransaction);

    process.exit(0)
    // console.log(account.getIndex());
    // console.log(account.isSynchronizing());
  } catch (err) {
    console.log(err.message)
    process.exit(1)
  }
})