UNPKG

@ledgerhq/coin-ton

Version:
52 lines 1.49 kB
import { isTokenAccount } from "@ledgerhq/coin-framework/account/index"; import { TOKEN_TRANSFER_MAX_FEE } from "./constants"; function getDeviceTransactionConfig(input) { const fields = []; const tokenTransfer = Boolean(input.account && isTokenAccount(input.account)); fields.push({ type: "address", label: "To", address: input.transaction.recipient, }); if (tokenTransfer) { fields.push({ type: "text", label: "Jetton units", value: input.transaction.amount.toString(), }); fields.push({ type: "text", label: "Amount", value: TOKEN_TRANSFER_MAX_FEE, }); } else { if (input.transaction.useAllAmount) { fields.push({ type: "text", label: "Amount", value: "ALL YOUR TONs", }); } else { fields.push({ type: "amount", label: "Amount", }); } fields.push({ type: "fees", label: "Fee", }); } if (!input.transaction.comment.isEncrypted && input.transaction.comment.text) { fields.push({ type: "text", label: "Comment", value: input.transaction.comment.text, }); } return fields; } export default getDeviceTransactionConfig; //# sourceMappingURL=deviceTransactionConfig.js.map