UNPKG

@ledgerhq/coin-tron

Version:
65 lines 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const account_1 = require("@ledgerhq/coin-framework/account"); function getDeviceTransactionConfig({ transaction: { votes, resource, mode, recipient }, account, parentAccount, status: { amount }, }) { const mainAccount = (0, account_1.getMainAccount)(account, parentAccount); const fields = []; if (resource) { fields.push({ type: "tron.resource", label: "Resource", value: resource.slice(0, 1).toUpperCase() + resource.slice(1).toLowerCase(), }); } if (votes && votes.length > 0) { // NB in future if we unify UI with other coin, we could converge to a "votes" top level fields.push({ type: "tron.votes", label: "Votes", }); } if (!amount.isZero()) { fields.push({ type: "amount", label: "Amount", }); } if (mode === "freeze") { fields.push({ type: "address", label: "Freeze To", address: mainAccount.freshAddress, }); } if (mode === "unfreeze" || mode === "legacyUnfreeze") { fields.push({ type: "address", label: "Unfreeze To", address: mainAccount.freshAddress, }); } if (mode === "withdrawExpireUnfreeze") { fields.push({ type: "address", label: "Withdraw unfrozen to", address: mainAccount.freshAddress, }); } if (mode === "unDelegateResource") { fields.push({ type: "address", label: "Undelegate from", address: recipient, }); } if (mode !== "send") { fields.push({ type: "address", label: "From Address", address: mainAccount.freshAddress, }); } return fields; } exports.default = getDeviceTransactionConfig; //# sourceMappingURL=deviceTransactionConfig.js.map