How to use the @ledgerhq/live-common/lib/account.getAccountUnit 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-desktop / src / components / modals / Send / steps / StepSummary.js View on Github external
render() {
    const { account, parentAccount, transaction, status } = this.props
    if (!account) return null
    const mainAccount = getMainAccount(account, parentAccount)
    if (!mainAccount || !transaction) return null
    const { estimatedFees, amount, totalSpent, warnings } = status
    const feeTooHigh = warnings.feeTooHigh
    const currency = getAccountCurrency(account)
    const feesUnit = getAccountUnit(mainAccount)
    const unit = getAccountUnit(account)

    return (
      
        
        
          
            
              
              <div>
                
                
                  <div style="{{"></div></div>
github LedgerHQ / ledger-live-desktop / src / components / AssetPage / index.js View on Github external
render() {
    const { t, accounts, counterValue, range, countervalueFirst, theme } = this.props
    const parentAccount =
      accounts[0].type !== 'Account' ? this.lookupParentAccount(accounts[0].parentId) : null
    const currency = getAccountCurrency(accounts[0])
    const unit = getAccountUnit(accounts[0])
    const color = getCurrencyColor(currency, theme.colors.palette.background.paper)

    return (
github LedgerHQ / ledger-live-mobile / src / components / OperationRow.js View on Github external
render() {
    const {
      operation,
      account,
      parentAccount,
      multipleAccounts,
      isLast,
    } = this.props;
    const amount = getOperationAmountNumber(operation);
    const valueColor = amount.isNegative() ? colors.darkBlue : colors.green;
    const currency = getAccountCurrency(account);
    const unit = getAccountUnit(account);

    const text = ;

    const isOptimistic = operation.blockHeight === null;
    const spinner = (
github LedgerHQ / ledger-live-desktop / src / components / OperationsList / Operation.js View on Github external
render() {
    const { account, parentAccount, t, operation, withAccount, text } = this.props
    const isOptimistic = operation.blockHeight === null
    const currency = getAccountCurrency(account)
    const unit = getAccountUnit(account)
    return (
      
        
        
        {withAccount &amp;&amp; }
        
        
      
    )
  }
}
github LedgerHQ / ledger-live-common / cli / src / accountFormatters.js View on Github external
const isSignificantAccount = acc =>
  acc.balance.gt(10 ** (getAccountUnit(acc).magnitude - 6));
github LedgerHQ / ledger-live-mobile / src / screens / OperationDetails / Content.js View on Github external
render() {
    const { account, parentAccount, operation, currencySettings } = this.props;
    const mainAccount = getMainAccount(account, parentAccount);
    const unit = getAccountUnit(account);
    const parentUnit = getAccountUnit(mainAccount);
    const currency = getAccountCurrency(account);
    const parentCurrency = getAccountCurrency(mainAccount);
    const amount = getOperationAmountNumber(operation);
    const isNegative = amount.isNegative();
    const valueColor = isNegative ? colors.smoke : colors.green;
    const confirmations = operation.blockHeight
      ? mainAccount.blockHeight - operation.blockHeight
      : 0;
    const uniqueSenders = uniq(operation.senders);
    const uniqueRecipients = uniq(operation.recipients);
    const { extra } = operation;
    const { hasFailed } = operation;
    const subOperations = operation.subOperations || [];
    const internalOperations = operation.internalOperations || [];

    const isConfirmed = confirmations >= currencySettings.confirmationsNb;
github LedgerHQ / ledger-live-mobile / src / components / SubAccountRow.js View on Github external
render() {
    const { account, onSubAccountPress } = this.props;

    const currency = getAccountCurrency(account);
    const name = getAccountName(account);
    const unit = getAccountUnit(account);

    return (
       onSubAccountPress(account)}
      &gt;
github LedgerHQ / ledger-live-desktop / src / components / RequestAmount / index.js View on Github external
render() {
    const {
      disabled,
      value,
      account,
      rightCurrency,
      getCounterValue,
      validTransactionError,
    } = this.props
    const right = getCounterValue(value) || BigNumber(0)
    const rightUnit = rightCurrency.units[0]
    const defaultUnit = getAccountUnit(account)
    return (
      
        
          {defaultUnit.code}}
          /&gt;
          {'='}
github LedgerHQ / ledger-live-desktop / src / components / TransactionConfirm / index.js View on Github external
const TransactionConfirm = ({ t, device, account, parentAccount, transaction, status }: Props) =&gt; {
  const mainAccount = getMainAccount(account, parentAccount)
  const isBlue = device &amp;&amp; device.modelId === 'blue'
  const { estimatedFees, amount } = status
  const unit = getAccountUnit(account)
  const feesUnit = getAccountUnit(mainAccount)

  const r = transactionConfirmFieldsPerFamily[mainAccount.currency.family]
  const Pre = r &amp;&amp; r.pre
  const Post = r &amp;&amp; r.post

  const recipientWording = t(`TransactionConfirm.recipientWording.${transaction.mode || 'send'}`)

  return (
    
      {!device ? null : (