@ledgerhq/coin-ton
Version:
80 lines • 2.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateDeviceActionFlow = void 0;
const specs_1 = require("@ledgerhq/coin-framework/bot/specs");
const constants_1 = require("./constants");
const generateDeviceActionFlow = (scenario) => {
const data = {
steps: [
{
title: "Review",
button: specs_1.SpeculosButton.RIGHT,
},
],
};
if (scenario === "token-transfer") {
data.steps = data.steps.concat([
{
title: "Transfer jetton",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Jetton wallet (1/2)",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Jetton wallet (2/2)",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Amount",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: () => `TON ${constants_1.TOKEN_TRANSFER_MAX_FEE}`,
},
{
title: "Jetton units",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ transaction }) => transaction.amount.toString(),
},
{
title: "Send jetton to (1/2)",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Send jetton to (2/2)",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Approve",
button: specs_1.SpeculosButton.BOTH,
},
]);
}
else {
data.steps = data.steps.concat([
{
title: "To",
button: specs_1.SpeculosButton.RIGHT,
},
{
title: "Amount",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ account, transaction }) => transaction.useAllAmount
? "ALL YOUR TONs"
: (0, specs_1.formatDeviceAmount)(account.currency, transaction.amount),
},
{
title: "Comment",
button: specs_1.SpeculosButton.RIGHT,
expectedValue: ({ transaction }) => transaction.comment.text,
},
{
title: "Approve",
button: specs_1.SpeculosButton.BOTH,
},
]);
}
return (0, specs_1.deviceActionFlow)(data);
};
exports.generateDeviceActionFlow = generateDeviceActionFlow;
//# sourceMappingURL=speculos-deviceActions.js.map