@ledgerhq/coin-internet_computer
Version:
Ledger Internet Computer integration
55 lines • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.acceptTransaction = void 0;
const specs_1 = require("@ledgerhq/coin-framework/bot/specs");
const utils_1 = require("../common-logic/utils");
const ignoreSpaces = (s) => s.replace(/ /g, "");
exports.acceptTransaction = (0, specs_1.deviceActionFlow)({
steps: [
{
title: "Transaction type",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: () => {
return (0, utils_1.methodToString)(0);
},
},
{
title: "From account",
button: specs_1.SpeculosButton.RIGHT,
stepValueTransform: ignoreSpaces,
expectedValue: ({ account }) => account.freshAddress,
},
{
title: "To account",
button: specs_1.SpeculosButton.RIGHT,
stepValueTransform: ignoreSpaces,
expectedValue: ({ transaction }) => transaction.recipient,
},
{
title: "Amount (ICP)",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ status, account }) => (0, specs_1.formatDeviceAmount)(account.currency, status.amount, {
hideCode: true,
showAllDigits: false,
}),
},
{
title: "Maximum fee (ICP)",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ status, account }) => (0, specs_1.formatDeviceAmount)(account.currency, status.estimatedFees, {
hideCode: true,
showAllDigits: false,
}),
},
{
title: "Memo",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ transaction }) => transaction.memo ?? "0",
},
{
title: "APPROVE",
button: specs_1.SpeculosButton.BOTH,
},
],
});
//# sourceMappingURL=speculos-deviceActions.js.map