UNPKG

@ledgerhq/coin-tron

Version:
63 lines 1.95 kB
import { getMainAccount } from "@ledgerhq/ledger-wallet-framework/account"; async function getDeviceTransactionConfig({ transaction: { votes, resource, mode, recipient }, account, parentAccount, status: { amount }, }) { const mainAccount = 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; } export default getDeviceTransactionConfig; //# sourceMappingURL=deviceTransactionConfig.js.map