How to use the @ledgerhq/live-common/lib/account.getAccountPlaceholderName 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-mobile / src / libcore / index.js View on Github external
core.coreAddress.toString(coreFreshAddress),
    core.coreAddress.getDerivationPath(coreFreshAddress),
  ]);
  const freshAddress = {
    str: freshAddressStr,
    path: `${accountPath}/${freshAddressPath}`,
  };

  const name =
    coreOperations.length === 0
      ? getNewAccountPlaceholderName({
          currency,
          index: accountIndex,
          derivationMode,
        })
      : getAccountPlaceholderName({
          currency,
          index: accountIndex,
          derivationMode,
        });

  // retrieve xpub
  const { value: xpub } = await core.coreAccount.getRestoreKey(coreAccount);

  const id = encodeAccountId({
    type: "libcore",
    version: "1",
    currencyId: currency.id,
    xpubOrAddress: xpub,
    derivationMode,
  });
github LedgerHQ / ledger-live-desktop / src / bridge / EthereumJSBridge.js View on Github external
if (shouldSkipEmpty) {
            return {}
          }
          // NB for legacy addresses maybe we will continue at least for the first 10 addresses
          return { complete: true }
        }

        const account: $Exact = {
          type: 'Account',
          id: accountId,
          seedIdentifier: freshAddress,
          freshAddress,
          freshAddressPath,
          freshAddresses: [{ address: freshAddress, derivationPath: freshAddressPath }],
          derivationMode,
          name: getAccountPlaceholderName({ currency, index, derivationMode }),
          balance,
          blockHeight: currentBlock.height,
          index,
          currency,
          operations: [],
          pendingOperations: [],
          unit: currency.units[0],
          lastSyncDate: new Date(),
        }
        for (let i = 0; i < 50; i++) {
          const last = txs[txs.length - 1]
          if (!last) break
          const { block } = last
          if (!block) break
          const next = await api.getTransactions(account.freshAddress, block.hash)
          if (next.txs.length === 0) break
github LedgerHQ / ledger-live-mobile / src / bridge / EthereumJSBridge.js View on Github external
}

          if (shouldSkipEmpty) {
            return {};
          }
          // NB for legacy addresses maybe we will continue at least for the first 10 addresses
          return { complete: true };
        }

        const account: $Exact = {
          id: accountId,
          seedIdentifier: freshAddress,
          freshAddress,
          freshAddressPath,
          derivationMode,
          name: getAccountPlaceholderName({ currency, index, derivationMode }),
          balance,
          blockHeight: currentBlock.height,
          index,
          currency,
          operations: [],
          pendingOperations: [],
          unit: currency.units[0],
          lastSyncDate: new Date(),
        };
        for (let i = 0; i < 50; i++) {
          const api = apiForCurrency(account.currency);
          const last = txs[txs.length - 1];
          if (!last) break;
          const { block } = last;
          if (!block) break;
          const next = await api.getTransactions(
github LedgerHQ / ledger-live-desktop / src / helpers / libcore.js View on Github external
}))

  if (addresses.length === 0) {
    throw new NoAddressesFound()
  }

  const { str: freshAddress, path: freshAddressPath } = addresses[0]

  ops.sort((a, b) => b.getDate() - a.getDate())

  const operations = ops.map(op => buildOperationRaw({ core, op, xpub }))

  const name =
    operations.length === 0
      ? getNewAccountPlaceholderName({ currency, index: accountIndex, derivationMode })
      : getAccountPlaceholderName({
          currency,
          index: accountIndex,
          derivationMode,
        })

  const rawAccount: AccountRaw = {
    id: encodeAccountId({
      type: 'libcore',
      version: '1',
      currencyId: currency.id,
      xpubOrAddress: xpub,
      derivationMode,
    }),
    seedIdentifier,
    derivationMode,
    xpub,
github LedgerHQ / ledger-live-mobile / src / bridge / RippleJSBridge.js View on Github external
!balance.isNaN() && balance.isFinite(),
                `Ripple: invalid balance=${balance.toString()} for address ${address}`,
              );

              const transactions = await api.getTransactions(address, {
                minLedgerVersion,
                maxLedgerVersion,
                types: ["payment"],
              });
              if (finished) return;

              const account: $Exact = {
                id: accountId,
                seedIdentifier: freshAddress,
                derivationMode,
                name: getAccountPlaceholderName({
                  currency,
                  index,
                  derivationMode,
                }),
                freshAddress,
                freshAddressPath,
                balance,
                blockHeight: maxLedgerVersion,
                index,
                currency,
                operations: [],
                pendingOperations: [],
                unit: currency.units[0],
                lastSyncDate: new Date(),
              };
              account.operations = transactions
github LedgerHQ / ledger-live-common / tools / src / demos / derivations / index.js View on Github external
render() {
    const { currency, derivationMode, index } = this.props;
    const { address, path, error } = this.state;

    return (
      <div style="{{">
        <strong style="{{">
          {getAccountPlaceholderName({ currency, derivationMode, index })}
        </strong>
        {error ? (
          <code style="{{">
            {String(error.message || error)}
            <button>verify</button>
          </code>
        ) : path ? (
          <span>
            <code style="{{">
              {`${path}: ${address}`}
            </code>
            <button>verify</button>
          </span>
        ) : null}
      </div>
    );