UNPKG

@ledgerhq/live-common

Version:
62 lines 2.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const bignumber_js_1 = __importDefault(require("bignumber.js")); const walletApiAdapter_1 = __importDefault(require("./walletApiAdapter")); describe("getWalletAPITransactionSignFlowInfos", () => { describe("should properly get infos for Cosmos platform tx", () => { it("without fees provided", () => { const cosmosPlatformTx = { family: "cosmos", amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", mode: "send", }; const expectedLiveTx = { ...cosmosPlatformTx, fees: null, gas: null, useAllAmount: false, networkInfo: null, memo: null, sourceValidator: null, validators: [], }; const { canEditFees, hasFeesProvided, liveTx } = walletApiAdapter_1.default.getWalletAPITransactionSignFlowInfos({ walletApiTransaction: cosmosPlatformTx, account: {}, }); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(false); expect(liveTx).toEqual(expectedLiveTx); }); it("with fees provided", () => { const cosmosPlatformTx = { family: "cosmos", amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", fees: new bignumber_js_1.default(300), mode: "send", }; const expectedLiveTx = { ...cosmosPlatformTx, gas: null, useAllAmount: false, networkInfo: null, memo: null, sourceValidator: null, validators: [], }; const { canEditFees, hasFeesProvided, liveTx } = walletApiAdapter_1.default.getWalletAPITransactionSignFlowInfos({ walletApiTransaction: cosmosPlatformTx, account: {}, }); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(true); expect(liveTx).toEqual(expectedLiveTx); }); }); }); //# sourceMappingURL=walletApiAdapter.test.js.map