UNPKG

@ledgerhq/coin-tezos

Version:
98 lines 3.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.acceptTransaction = void 0; const specs_1 = require("@ledgerhq/coin-framework/bot/specs"); exports.acceptTransaction = (0, specs_1.deviceActionFlow)({ steps: [ { title: "Review", button: specs_1.SpeculosButton.RIGHT, }, { title: "Withdraw", button: specs_1.SpeculosButton.RIGHT, }, { title: "Custom Delegate", button: specs_1.SpeculosButton.RIGHT, }, { // device sometimes know the text of a given delegator, we're not validating the actual text title: "Delegate", button: specs_1.SpeculosButton.RIGHT, }, { title: "Delegate Name", button: specs_1.SpeculosButton.RIGHT, }, { title: "Operation (0)", button: specs_1.SpeculosButton.RIGHT, }, { title: "Operation (1)", button: specs_1.SpeculosButton.RIGHT, }, { title: "Confirm", button: specs_1.SpeculosButton.RIGHT, expectedValue: ({ transaction }) => { return transaction.mode === "send" ? "Transaction" : "Delegation"; }, }, { title: "Amount", button: specs_1.SpeculosButton.RIGHT, expectedValue: ({ account, transaction }) => (0, specs_1.formatDeviceAmount)(account.currency, transaction.amount, { postfixCode: true, }), }, /** * when revealing, fee are print twice on nano side. * we ignore the assertion failure because we can't know if it's the first or second fee * status.estimatedFees is the total fees, so we can't use it */ { title: "Fee", button: specs_1.SpeculosButton.RIGHT, ignoreAssertionFailure: true, expectedValue: ({ account, status }) => (0, specs_1.formatDeviceAmount)(account.currency, status.estimatedFees, { postfixCode: true, }), }, { title: "Source", button: specs_1.SpeculosButton.RIGHT, expectedValue: ({ account }) => account.freshAddress, }, { title: "Destination", button: specs_1.SpeculosButton.RIGHT, expectedValue: ({ transaction }) => transaction.recipient, }, { title: "Public key", button: specs_1.SpeculosButton.RIGHT, }, { title: "Storage limit", button: specs_1.SpeculosButton.RIGHT, expectedValue: ({ transaction }, prevSteps) => { if (prevSteps.some(step => step.title === "Operation (0)" && step.value === "Reveal") && !prevSteps.some(step => step.title === "Operation (1)")) { return "0"; } return transaction.storageLimit?.toString() || ""; }, }, { title: "Reject", button: specs_1.SpeculosButton.RIGHT, }, { title: "Accept", button: specs_1.SpeculosButton.BOTH, }, ], }); //# sourceMappingURL=bot-deviceActions.js.map