How to use the @ledgerhq/errors.CurrencyNotSupported function in @ledgerhq/errors

To help you get started, we’ve selected a few @ledgerhq/errors 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 / src / account / support.js View on Github external
export function checkAccountSupported(account: Account): ?Error {
  if (!getAllDerivationModes().includes(account.derivationMode)) {
    return new AccountNotSupported(
      "derivation not supported " + account.derivationMode,
      { reason: account.derivationMode }
    );
  }

  if (!isCurrencySupported(account.currency)) {
    return new CurrencyNotSupported("currency not supported", {
      currencyName: account.currency.name
    });
  }
}
github LedgerHQ / ledger-live-common / src / families / tron / bridge / js.js View on Github external
const createTransaction = a => {
  throw new CurrencyNotSupported("tron currency not supported", {
    currencyName: a.currency.name
  });
};
github LedgerHQ / ledger-live-common / src / families / neo / bridge / js.js View on Github external
const createTransaction = a => {
  throw new CurrencyNotSupported("neo currency not supported", {
    currencyName: a.currency.name
  });
};
github LedgerHQ / ledger-live-common / src / families / tron / bridge / js.js View on Github external
const getTransactionStatus = a =>
  Promise.reject(
    new CurrencyNotSupported("tron currency not supported", {
      currencyName: a.currency.name
    })
  );
github LedgerHQ / ledger-live-common / src / families / neo / bridge / js.js View on Github external
const getTransactionStatus = a =>
  Promise.reject(
    new CurrencyNotSupported("neo currency not supported", {
      currencyName: a.currency.name
    })
  );
github LedgerHQ / ledger-live-desktop / src / bridge / index.js View on Github external
const mainAccount = account.type === 'Account' ? account : parentAccount
  if (!mainAccount) throw new Error('an account expected')
  const supportedError = checkAccountSupported(mainAccount)
  if (supportedError) {
    throw supportedError
  }
  const { type } = decodeAccountId(mainAccount.id)
  if (type === 'mock') return mockAccountBridge
  if (type === 'libcore') return LibcoreBridge.accountBridge
  switch (mainAccount.currency.family) {
    case 'ripple':
      return RippleJSBridge.accountBridge
    case 'ethereum':
      return EthereumJSBridge.accountBridge
    default:
      throw new CurrencyNotSupported('currency not supported', {
        currencyName: mainAccount.currency.name,
      })
  }
}