UNPKG

@ledgerhq/coin-stacks

Version:
30 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAccountInfo = void 0; const index_1 = require("@ledgerhq/coin-framework/account/index"); const token_1 = require("./token"); const getAccountInfo = ({ account, parentAccount, transaction, }) => { const mainAccount = (0, index_1.getMainAccount)(account, parentAccount); const isTokenType = (0, index_1.isTokenAccount)(account); if (transaction && !transaction.subAccountId) { transaction.subAccountId = isTokenType ? account.id : null; } let tokenAccountTxn = false; let subAccount; if (isTokenType) { tokenAccountTxn = true; subAccount = account; } if (transaction?.subAccountId && !subAccount) { tokenAccountTxn = true; subAccount = (0, token_1.getSubAccount)(mainAccount, transaction) ?? null; } return { mainAccount, subAccount, isTokenType, tokenAccountTxn, }; }; exports.getAccountInfo = getAccountInfo; //# sourceMappingURL=account.js.map