UNPKG

@ledgerhq/live-common

Version:
43 lines 1.84 kB
import btc from "./platformAdapter"; import { FAMILIES } from "@ledgerhq/live-app-sdk"; import BigNumber from "bignumber.js"; describe("getPlatformTransactionSignFlowInfos", () => { describe("should properly get infos for BTC platform tx", () => { test("without fees provided", () => { const btcPlatformTx = { family: FAMILIES.BITCOIN, amount: new BigNumber(100000), recipient: "0xABCDEF", }; const expectedLiveTx = { family: btcPlatformTx.family, amount: btcPlatformTx.amount, recipient: btcPlatformTx.recipient, }; const { canEditFees, hasFeesProvided, liveTx } = btc.getPlatformTransactionSignFlowInfos(btcPlatformTx); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(false); expect(liveTx).toEqual(expectedLiveTx); }); test("with fees provided", () => { const btcPlatformTx = { family: FAMILIES.BITCOIN, amount: new BigNumber(100000), recipient: "0xABCDEF", feePerByte: new BigNumber(300), }; const expectedLiveTx = { family: btcPlatformTx.family, amount: btcPlatformTx.amount, recipient: btcPlatformTx.recipient, feePerByte: btcPlatformTx.feePerByte, feesStrategy: null, }; const { canEditFees, hasFeesProvided, liveTx } = btc.getPlatformTransactionSignFlowInfos(btcPlatformTx); expect(canEditFees).toBe(true); expect(hasFeesProvided).toBe(true); expect(liveTx).toEqual(expectedLiveTx); }); }); }); //# sourceMappingURL=platformAdapter.test.js.map