How to use the @ledgerhq/live-common/lib/account.fromAccountRaw function in @ledgerhq/live-common

To help you get started, we’ve selected a few @ledgerhq/live-common 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-common / cli / src / __tests__ / bridges.js View on Github external
test("succeed", async () => {
          const account = await getSynced();
          expect(fromAccountRaw(toAccountRaw(account))).toBeDefined();
        });
github LedgerHQ / ledger-live-common / cli / src / __tests__ / bridges.js View on Github external
implementations.forEach(impl => {
        const account = fromAccountRaw({
          ...accountData.raw,
          id: encodeAccountId({
            ...decodeAccountId(accountData.raw.id),
            type: impl
          })
        });
        accountsRelated.push({
          currencyData,
          accountData,
          account,
          impl
        });
      })
    );
github LedgerHQ / ledger-live-desktop / src / bridge / proxy.js View on Github external
> = createCommand('AccountPrepareTransaction', o => {
  const account = fromAccountRaw(o.account)
  const transaction = fromTransactionRaw(o.transaction)
  const bridge = bridgeImpl.getAccountBridge(account, null)
  return from(bridge.prepareTransaction(account, transaction).then(toTransactionRaw))
})
github LedgerHQ / ledger-live-desktop / src / bridge / proxy.js View on Github external
> = createCommand('AccountSignAndBroadcast', o => {
  const account = fromAccountRaw(o.account)
  const transaction = fromTransactionRaw(o.transaction)
  const bridge = bridgeImpl.getAccountBridge(account, null)
  return bridge
    .signAndBroadcast(account, transaction, o.deviceId)
    .pipe(map(toSignAndBroadcastEventRaw))
})
github LedgerHQ / ledger-live-desktop / src / bridge / proxy.js View on Github external
> = createCommand('AccountStartSync', o => {
  const account = fromAccountRaw(o.account)
  const bridge = bridgeImpl.getAccountBridge(account, null)
  return bridge.startSync(account, o.observation).pipe(map(f => toAccountRaw(f(account))))
})
github LedgerHQ / ledger-live-desktop / src / commands / libcoreSyncAccount.js View on Github external
const cmd: Command = createCommand('libcoreSyncAccount', rawAccount => {
  const account = fromAccountRaw(rawAccount)
  return syncAccount(account)
    .pipe(reduce((acc, updater: Account => Account) => updater(acc), account))
    .pipe(map(account => toAccountRaw(account)))
})
github LedgerHQ / ledger-live-desktop / src / commands / libcoreGetFees.js View on Github external
const cmd: Command = createCommand('libcoreGetFees', ({ accountRaw, transaction }) =>
  from(
    getFeesForTransaction({
      account: fromAccountRaw(accountRaw),
      transaction,
    }).then(fees => fees.toString()),
  ),
)
github LedgerHQ / ledger-live-common / cli / src / scan.js View on Github external
      appjsondata.data.accounts.map(a => fromAccountRaw(a.data))
    ).pipe(
github LedgerHQ / ledger-live-desktop / src / bridge / proxy.js View on Github external
> = createCommand('AccountGetTransactionStatus', o => {
  const account = fromAccountRaw(o.account)
  const transaction = fromTransactionRaw(o.transaction)
  const bridge = bridgeImpl.getAccountBridge(account, null)
  return from(
    bridge
      .getTransactionStatus(account, transaction)
      .then((raw: TransactionStatus) => toTransactionStatusRaw(raw)),
  )
})
github LedgerHQ / ledger-live-desktop / src / components / DevToolsPage / AccountImporter.js View on Github external
scan = async () => {
    this.setState({ status: 'scanning' })
    const { importableAccounts } = this.state
    try {
      for (let i = 0; i < importableAccounts.length; i++) {
        const a = importableAccounts[i]
        const scanPayload = {
          seedIdentifier: `dev_${a.xpub}`,
          currencyId: a.currency.id,
          xpub: a.xpub,
          derivationMode: a.derivationMode,
        }
        const rawAccount = await scanFromXPUB.send(scanPayload).toPromise()
        const account = fromAccountRaw(rawAccount)
        await this.import({
          ...account,
          name: a.name,
        })
        this.removeImportableAccount(a)
      }
      this.reset()
    } catch (error) {
      this.setState({ status: 'error', error })
    }
  }