@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
46 lines • 1.73 kB
JavaScript
import BigNumber from "bignumber.js";
import xrp from "./walletApiAdapter";
describe("getWalletAPITransactionSignFlowInfos", () => {
describe("should properly get infos for XRP platform tx", () => {
it("without fees provided", () => {
const xrpPlatformTx = {
family: "ripple",
amount: new BigNumber(100000),
recipient: "0xABCDEF",
tag: 1,
};
const expectedLiveTx = {
...xrpPlatformTx,
family: "xrp",
};
const { canEditFees, hasFeesProvided, liveTx } = xrp.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(100000),
recipient: "0xABCDEF",
fee: new BigNumber(300),
tag: 1,
};
const expectedLiveTx = {
...xrpPlatformTx,
family: "xrp",
};
const { canEditFees, hasFeesProvided, liveTx } = xrp.getWalletAPITransactionSignFlowInfos({
walletApiTransaction: xrpPlatformTx,
account: {},
});
expect(canEditFees).toBe(true);
expect(hasFeesProvided).toBe(true);
expect(liveTx).toEqual(expectedLiveTx);
});
});
});
//# sourceMappingURL=walletApiAdapter.test.js.map