UNPKG

@ledgerhq/live-common

Version:
51 lines 2.1 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 XRP platform tx", () => { it("without fees provided", () => { const xrpPlatformTx = { family: "ripple", amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", tag: 1, }; const expectedLiveTx = { ...xrpPlatformTx, family: "xrp", }; const { canEditFees, hasFeesProvided, liveTx } = walletApiAdapter_1.default.getWalletAPITransactionSignFlowInfos({ walletApiTransaction: xrpPlatformTx, account: {}, }); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(false); expect(liveTx).toEqual(expectedLiveTx); }); it("with fees provided", () => { const xrpPlatformTx = { family: "ripple", amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", fee: new bignumber_js_1.default(300), tag: 1, }; const expectedLiveTx = { ...xrpPlatformTx, family: "xrp", }; const { canEditFees, hasFeesProvided, liveTx } = walletApiAdapter_1.default.getWalletAPITransactionSignFlowInfos({ walletApiTransaction: xrpPlatformTx, account: {}, }); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(true); expect(liveTx).toEqual(expectedLiveTx); }); }); }); //# sourceMappingURL=walletApiAdapter.test.js.map