UNPKG

@ledgerhq/live-common

Version:
17 lines 878 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAccountTuplesForCurrency = getAccountTuplesForCurrency; const helpers_1 = require("@ledgerhq/ledger-wallet-framework/account/helpers"); function getAccountTuplesForCurrency(currency, allAccounts) { const isToken = currency.type === "TokenCurrency"; const targetCurrencyId = isToken ? currency.parentCurrency.id : currency.id; return allAccounts .filter(account => account.currency.id === targetCurrencyId) .map(account => { const subAccount = isToken ? account.subAccounts?.find((subAcc) => subAcc.type === "TokenAccount" && subAcc.token.id === currency.id) || (0, helpers_1.makeEmptyTokenAccount)(account, currency) : null; return { account, subAccount }; }); } //# sourceMappingURL=getAccountTuplesForCurrency.js.map