@ledgerhq/coin-ton 0.15.0-nightly.7 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +24 -79
- package/lib/__tests__/fixtures/api.fixtures.d.ts +4 -0
- package/lib/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/api.fixtures.js +37 -0
- package/lib/__tests__/fixtures/api.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts +32 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/common.fixtures.js +176 -0
- package/lib/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts +14 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.js +213 -0
- package/lib/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib/__tests__/unit/api.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/api.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/api.unit.test.js +77 -0
- package/lib/__tests__/unit/api.unit.test.js.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.js +37 -0
- package/lib/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/createTransaction.unit.test.js +25 -0
- package/lib/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +111 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +30 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js +120 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.js +54 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib/__tests__/unit/logic.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/logic.unit.test.js +18 -0
- package/lib/__tests__/unit/logic.unit.test.js.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js +109 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/signOperation.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/signOperation.unit.test.js +72 -0
- package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib/__tests__/unit/txn.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/txn.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/txn.unit.test.js +298 -0
- package/lib/__tests__/unit/txn.unit.test.js.map +1 -0
- package/lib/__tests__/unit/utils.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/utils.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/utils.unit.test.js +211 -0
- package/lib/__tests__/unit/utils.unit.test.js.map +1 -0
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +0 -44
- package/lib/transaction.js.map +1 -1
- package/lib/transaction.unit.test.d.ts +2 -0
- package/lib/transaction.unit.test.d.ts.map +1 -0
- package/lib/transaction.unit.test.js +600 -0
- package/lib/transaction.unit.test.js.map +1 -0
- package/lib/types.d.ts +2 -40
- package/lib/types.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts +4 -0
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/api.fixtures.js +34 -0
- package/lib-es/__tests__/fixtures/api.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts +32 -0
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/common.fixtures.js +170 -0
- package/lib-es/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts +14 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js +207 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib-es/__tests__/unit/api.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/api.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/api.unit.test.js +52 -0
- package/lib-es/__tests__/unit/api.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js +32 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.js +20 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +106 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +25 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +115 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +49 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/logic.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/logic.unit.test.js +16 -0
- package/lib-es/__tests__/unit/logic.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +81 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.js +67 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/txn.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/txn.unit.test.js +293 -0
- package/lib-es/__tests__/unit/txn.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/utils.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/utils.unit.test.js +186 -0
- package/lib-es/__tests__/unit/utils.unit.test.js.map +1 -0
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +0 -44
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/transaction.unit.test.d.ts +2 -0
- package/lib-es/transaction.unit.test.d.ts.map +1 -0
- package/lib-es/transaction.unit.test.js +595 -0
- package/lib-es/transaction.unit.test.js.map +1 -0
- package/lib-es/types.d.ts +2 -40
- package/lib-es/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/transaction.ts +0 -44
- package/src/transaction.unit.test.ts +8 -71
- package/src/types.ts +2 -52
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
30
|
+
const api_1 = require("../../bridge/bridgeHelpers/api");
|
|
31
|
+
const config_1 = require("../../config");
|
|
32
|
+
const prepareTransaction_1 = __importDefault(require("../../prepareTransaction"));
|
|
33
|
+
const api_fixtures_1 = __importStar(require("../fixtures/api.fixtures"));
|
|
34
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
35
|
+
jest.mock("../../bridge/bridgeHelpers/api");
|
|
36
|
+
describe("prepareTransaction", () => {
|
|
37
|
+
beforeAll(() => {
|
|
38
|
+
const fetchAccountInfoMock = jest.mocked(api_1.fetchAccountInfo);
|
|
39
|
+
fetchAccountInfoMock.mockReturnValue(Promise.resolve(common_fixtures_1.accountInfo));
|
|
40
|
+
const fetchEstimateFeeMock = jest.mocked(api_1.estimateFee);
|
|
41
|
+
fetchEstimateFeeMock.mockReturnValue(Promise.resolve(common_fixtures_1.fees));
|
|
42
|
+
(0, config_1.setCoinConfig)(() => ({
|
|
43
|
+
status: {
|
|
44
|
+
type: "active",
|
|
45
|
+
},
|
|
46
|
+
infra: {
|
|
47
|
+
API_TON_ENDPOINT: api_fixtures_1.API_TON_ENDPOINT,
|
|
48
|
+
KNOWN_JETTONS: [],
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
api_fixtures_1.default.listen();
|
|
52
|
+
});
|
|
53
|
+
afterAll(() => {
|
|
54
|
+
api_fixtures_1.default.close();
|
|
55
|
+
});
|
|
56
|
+
describe("Ton Transaction", () => {
|
|
57
|
+
it("should return the transaction with the updated amount and fees", async () => {
|
|
58
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, common_fixtures_1.transaction);
|
|
59
|
+
expect(transaction).toEqual({
|
|
60
|
+
...common_fixtures_1.transaction,
|
|
61
|
+
fees: common_fixtures_1.totalFees,
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
it("should preserve the reference when no change is detected on the transaction", async () => {
|
|
65
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, { ...common_fixtures_1.transaction });
|
|
66
|
+
const transaction2 = await (0, prepareTransaction_1.default)(common_fixtures_1.account, transaction);
|
|
67
|
+
expect(transaction).toBe(transaction2);
|
|
68
|
+
});
|
|
69
|
+
it("should create a coin transaction using the spendableBalance in the account", async () => {
|
|
70
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, {
|
|
71
|
+
...common_fixtures_1.transaction,
|
|
72
|
+
useAllAmount: true,
|
|
73
|
+
});
|
|
74
|
+
expect(transaction).toEqual({
|
|
75
|
+
...common_fixtures_1.transaction,
|
|
76
|
+
useAllAmount: true,
|
|
77
|
+
fees: common_fixtures_1.totalFees,
|
|
78
|
+
amount: common_fixtures_1.account.spendableBalance.minus(common_fixtures_1.totalFees),
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe("Jetton Transaction", () => {
|
|
83
|
+
it("should return the transaction with the updated amount and fees", async () => {
|
|
84
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, common_fixtures_1.jettonTransaction);
|
|
85
|
+
expect(transaction).toEqual({
|
|
86
|
+
...common_fixtures_1.jettonTransaction,
|
|
87
|
+
fees: (0, bignumber_js_1.default)("100000000"),
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
it("should preserve the reference when no change is detected on the transaction", async () => {
|
|
91
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, { ...common_fixtures_1.jettonTransaction });
|
|
92
|
+
const transaction2 = await (0, prepareTransaction_1.default)(common_fixtures_1.account, transaction);
|
|
93
|
+
expect(transaction).toBe(transaction2);
|
|
94
|
+
});
|
|
95
|
+
it("should create a coin transaction using the spendableBalance in the account", async () => {
|
|
96
|
+
const transaction = await (0, prepareTransaction_1.default)(common_fixtures_1.account, {
|
|
97
|
+
...common_fixtures_1.jettonTransaction,
|
|
98
|
+
useAllAmount: true,
|
|
99
|
+
});
|
|
100
|
+
expect(transaction).toEqual({
|
|
101
|
+
...common_fixtures_1.jettonTransaction,
|
|
102
|
+
useAllAmount: true,
|
|
103
|
+
fees: (0, bignumber_js_1.default)("100000000"),
|
|
104
|
+
amount: common_fixtures_1.account.subAccounts?.[0].spendableBalance,
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=prepareTransaction.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareTransaction.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/prepareTransaction.unit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,wDAA+E;AAC/E,yCAA6C;AAC7C,kFAA0D;AAC1D,yEAAwE;AACxE,iEAOqC;AAErC,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC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AC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;YAC1F,MAAM,WAAW,GAAG,MAAM,IAAA,4BAAkB,EAAC,yBAAO,EAAE;gBACpD,GAAG,mCAAiB;gBACpB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;YAEH,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;gBAC1B,GAAG,mCAAiB;gBACpB,YAAY,EAAE,IAAI;gBAClB,IAAI,EAAE,IAAA,sBAAS,EAAC,WAAW,CAAC;gBAC5B,MAAM,EAAE,yBAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB;aAClD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signOperation.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/signOperation.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const core_1 = require("@ton/core");
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const api_1 = require("../../bridge/bridgeHelpers/api");
|
|
9
|
+
const signOperation_1 = require("../../signOperation");
|
|
10
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
11
|
+
jest.mock("../../bridge/bridgeHelpers/api");
|
|
12
|
+
const spySignTransaction = jest.fn().mockImplementation(async () => Promise.resolve((0, core_1.beginCell)()
|
|
13
|
+
.store((0, core_1.storeMessage)({
|
|
14
|
+
info: {
|
|
15
|
+
type: "external-in",
|
|
16
|
+
dest: core_1.Address.parse("EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"),
|
|
17
|
+
importFee: BigInt(0),
|
|
18
|
+
},
|
|
19
|
+
body: new core_1.Cell(),
|
|
20
|
+
}))
|
|
21
|
+
.endCell()));
|
|
22
|
+
const mockSignerContext = (_, fn) => {
|
|
23
|
+
return fn({
|
|
24
|
+
signTransaction: spySignTransaction,
|
|
25
|
+
getAddress: jest.fn(),
|
|
26
|
+
validateAddress: jest.fn(),
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
describe("signOperation", () => {
|
|
30
|
+
beforeAll(() => {
|
|
31
|
+
const fetchAccountInfoMock = jest.mocked(api_1.fetchAccountInfo);
|
|
32
|
+
fetchAccountInfoMock.mockReturnValue(Promise.resolve(common_fixtures_1.accountInfo));
|
|
33
|
+
});
|
|
34
|
+
it("should return an optimistic operation and a signed hash returned by the app bindings", done => {
|
|
35
|
+
const signOperation = (0, signOperation_1.buildSignOperation)(mockSignerContext);
|
|
36
|
+
const signOpObservable = signOperation({
|
|
37
|
+
account: common_fixtures_1.account,
|
|
38
|
+
transaction: { ...common_fixtures_1.transaction, fees: common_fixtures_1.totalFees },
|
|
39
|
+
deviceId: "",
|
|
40
|
+
});
|
|
41
|
+
signOpObservable.subscribe(obs => {
|
|
42
|
+
if (obs.type === "signed") {
|
|
43
|
+
const { signedOperation: { signature, operation }, } = obs;
|
|
44
|
+
const { amount } = common_fixtures_1.transaction;
|
|
45
|
+
expect(operation).toEqual({
|
|
46
|
+
id: "",
|
|
47
|
+
hash: "",
|
|
48
|
+
type: "OUT",
|
|
49
|
+
value: new bignumber_js_1.default(amount).plus(common_fixtures_1.totalFees),
|
|
50
|
+
fee: common_fixtures_1.totalFees,
|
|
51
|
+
blockHash: null,
|
|
52
|
+
blockHeight: null,
|
|
53
|
+
senders: [common_fixtures_1.account.freshAddress],
|
|
54
|
+
recipients: [common_fixtures_1.transaction.recipient],
|
|
55
|
+
accountId: common_fixtures_1.account.id,
|
|
56
|
+
date: expect.any(Date),
|
|
57
|
+
extra: {
|
|
58
|
+
comment: {
|
|
59
|
+
isEncrypted: false,
|
|
60
|
+
text: "",
|
|
61
|
+
},
|
|
62
|
+
explorerHash: "",
|
|
63
|
+
lt: "",
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
expect(signature).toBe("te6cckEBAQEASAAAi4gB5u+NPAnKfR1MYfspXMxuPEc0/C8N9jmU1gWKEgWontgEQA83fGngTlPo6mMP2UrmY3HiOafheG+xzKawLFCQLUT2wCDSMh+F");
|
|
67
|
+
done();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=signOperation.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signOperation.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/signOperation.unit.test.ts"],"names":[],"mappings":";;;;;AACA,oCAAmE;AACnE,gEAAqC;AACrC,wDAAkE;AAClE,uDAAyD;AAEzD,iEAA2F;AAE3F,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAE5C,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE,CACjE,OAAO,CAAC,OAAO,CACb,IAAA,gBAAS,GAAE;KACR,KAAK,CACJ,IAAA,mBAAY,EAAC;IACX,IAAI,EAAE;QACJ,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,cAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC;QACvE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;KACrB;IACD,IAAI,EAAE,IAAI,WAAI,EAAE;CACjB,CAAC,CACH;KACA,OAAO,EAAE,CACb,CACF,CAAC;AAEF,MAAM,iBAAiB,GAA6B,CAClD,CAAS,EACT,EAAqC,EACrC,EAAE;IACF,OAAO,EAAE,CAAC;QACR,eAAe,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,CAAC,YAAY,CAAC;oBAC/B,UAAU,EAAE,CAAC,6BAAW,CAAC,SAAS,CAAC;oBACnC,SAAS,EAAE,yBAAO,CAAC,EAAE;oBACrB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;oBACtB,KAAK,EAAE;wBACL,OAAO,EAAE;4BACP,WAAW,EAAE,KAAK;4BAClB,IAAI,EAAE,EAAE;yBACT;wBACD,YAAY,EAAE,EAAE;wBAChB,EAAE,EAAE,EAAE;qBACP;iBACF,CAAC,CAAC;gBACH,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CACpB,sHAAsH,CACvH,CAAC;gBACF,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txn.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/txn.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const operation_1 = require("@ledgerhq/coin-framework/lib/operation");
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
// eslint-disable-next-line no-restricted-imports
|
|
9
|
+
const core_1 = require("@ton/core");
|
|
10
|
+
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
11
|
+
const txn_1 = require("../../bridge/bridgeHelpers/txn");
|
|
12
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
13
|
+
describe("Transaction functions", () => {
|
|
14
|
+
describe("mapTxToOps", () => {
|
|
15
|
+
it("should map an IN failed ton transaction without total_fees to a ledger operation", async () => {
|
|
16
|
+
const { now, lt, hash, in_msg, total_fees, mc_block_seqno } = common_fixtures_1.tonTransactionResponse.transactions[0];
|
|
17
|
+
const finalOperation = (0, flatMap_1.default)(common_fixtures_1.tonTransactionResponse.transactions, (0, txn_1.mapTxToOps)(common_fixtures_1.mockAccountId, common_fixtures_1.mockAddress, common_fixtures_1.tonTransactionResponse.address_book));
|
|
18
|
+
expect(finalOperation).toEqual([
|
|
19
|
+
{
|
|
20
|
+
accountId: common_fixtures_1.mockAccountId,
|
|
21
|
+
blockHash: null,
|
|
22
|
+
blockHeight: mc_block_seqno,
|
|
23
|
+
date: new Date(now * 1000), // now is defined in seconds
|
|
24
|
+
extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
|
|
25
|
+
fee: (0, bignumber_js_1.default)(total_fees),
|
|
26
|
+
hasFailed: true,
|
|
27
|
+
hash: in_msg?.hash,
|
|
28
|
+
id: (0, operation_1.encodeOperationId)(common_fixtures_1.mockAccountId, in_msg?.hash ?? "", "IN"),
|
|
29
|
+
recipients: [in_msg?.destination],
|
|
30
|
+
senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
|
|
31
|
+
type: "IN",
|
|
32
|
+
value: (0, bignumber_js_1.default)(in_msg?.value ?? 0),
|
|
33
|
+
subOperations: undefined,
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
});
|
|
37
|
+
it("should map an IN ton transaction with total_fees to a ledger operation", async () => {
|
|
38
|
+
const transactions = [{ ...common_fixtures_1.tonTransactionResponse.transactions[0], total_fees: "15" }];
|
|
39
|
+
const { now, lt, hash, in_msg, total_fees, mc_block_seqno } = transactions[0];
|
|
40
|
+
const finalOperation = (0, flatMap_1.default)(transactions, (0, txn_1.mapTxToOps)(common_fixtures_1.mockAccountId, common_fixtures_1.mockAddress, common_fixtures_1.tonTransactionResponse.address_book));
|
|
41
|
+
expect(finalOperation).toEqual([
|
|
42
|
+
{
|
|
43
|
+
accountId: common_fixtures_1.mockAccountId,
|
|
44
|
+
blockHash: null,
|
|
45
|
+
blockHeight: mc_block_seqno,
|
|
46
|
+
date: new Date(now * 1000), // now is defined in seconds
|
|
47
|
+
extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
|
|
48
|
+
fee: (0, bignumber_js_1.default)(total_fees),
|
|
49
|
+
hasFailed: true,
|
|
50
|
+
hash: in_msg?.hash,
|
|
51
|
+
id: (0, operation_1.encodeOperationId)(common_fixtures_1.mockAccountId, in_msg?.hash ?? "", "IN"),
|
|
52
|
+
recipients: [in_msg?.destination],
|
|
53
|
+
senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
|
|
54
|
+
type: "IN",
|
|
55
|
+
value: (0, bignumber_js_1.default)(in_msg?.value ?? 0),
|
|
56
|
+
subOperations: [
|
|
57
|
+
{
|
|
58
|
+
id: (0, operation_1.encodeOperationId)(common_fixtures_1.mockAccountId, in_msg?.hash ?? "", "NONE"),
|
|
59
|
+
hash: in_msg?.hash,
|
|
60
|
+
type: "NONE",
|
|
61
|
+
value: (0, bignumber_js_1.default)(total_fees),
|
|
62
|
+
fee: (0, bignumber_js_1.default)(0),
|
|
63
|
+
blockHeight: mc_block_seqno,
|
|
64
|
+
blockHash: null,
|
|
65
|
+
hasFailed: true,
|
|
66
|
+
accountId: common_fixtures_1.mockAccountId,
|
|
67
|
+
senders: [common_fixtures_1.mockAddress],
|
|
68
|
+
recipients: [],
|
|
69
|
+
date: new Date(now * 1000),
|
|
70
|
+
extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
it("should map a failed OUT ton transaction to a ledger operation", async () => {
|
|
77
|
+
// The IN transaction will be used as OUT transaction and it will be adjusted
|
|
78
|
+
const transactions = [
|
|
79
|
+
{
|
|
80
|
+
...common_fixtures_1.tonTransactionResponse.transactions[0],
|
|
81
|
+
in_msg: null,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
if (common_fixtures_1.tonTransactionResponse.transactions[0].in_msg) {
|
|
85
|
+
transactions[0].out_msgs = [
|
|
86
|
+
{ ...common_fixtures_1.tonTransactionResponse.transactions[0].in_msg, source: transactions[0].account },
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
const { now, lt, hash, out_msgs, total_fees, mc_block_seqno } = transactions[0];
|
|
90
|
+
const finalOperation = (0, flatMap_1.default)(transactions, (0, txn_1.mapTxToOps)(common_fixtures_1.mockAccountId, common_fixtures_1.mockAddress, common_fixtures_1.tonTransactionResponse.address_book));
|
|
91
|
+
expect(finalOperation).toEqual([
|
|
92
|
+
{
|
|
93
|
+
id: (0, operation_1.encodeOperationId)(common_fixtures_1.mockAccountId, hash, "OUT"),
|
|
94
|
+
hash: out_msgs?.[0].hash,
|
|
95
|
+
type: "OUT",
|
|
96
|
+
value: (0, bignumber_js_1.default)(out_msgs?.[0].value ?? 0),
|
|
97
|
+
fee: (0, bignumber_js_1.default)(total_fees),
|
|
98
|
+
blockHeight: mc_block_seqno,
|
|
99
|
+
blockHash: null,
|
|
100
|
+
hasFailed: true,
|
|
101
|
+
accountId: common_fixtures_1.mockAccountId,
|
|
102
|
+
senders: [transactions[0].account],
|
|
103
|
+
recipients: ["EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"],
|
|
104
|
+
date: new Date(now * 1000), // now is defined in seconds
|
|
105
|
+
extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
|
|
106
|
+
},
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("mapJettonToOps", () => {
|
|
111
|
+
it("should map an IN ton transaction without total_fees to a ledger operation", async () => {
|
|
112
|
+
const { transaction_hash, amount, transaction_now, transaction_lt } = common_fixtures_1.jettonTransferResponse.jetton_transfers[0];
|
|
113
|
+
const finalOperation = (0, flatMap_1.default)(common_fixtures_1.jettonTransferResponse.jetton_transfers, (0, txn_1.mapJettonTxToOps)(common_fixtures_1.mockAccountId, common_fixtures_1.mockAddress, common_fixtures_1.tonTransactionResponse.address_book));
|
|
114
|
+
const tokenByCurrencyAddress = `${common_fixtures_1.mockAccountId}+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not`;
|
|
115
|
+
expect(finalOperation).toEqual([
|
|
116
|
+
{
|
|
117
|
+
id: (0, operation_1.encodeOperationId)(tokenByCurrencyAddress, transaction_hash, "IN"),
|
|
118
|
+
hash: transaction_hash,
|
|
119
|
+
type: "IN",
|
|
120
|
+
value: (0, bignumber_js_1.default)(amount),
|
|
121
|
+
fee: (0, bignumber_js_1.default)(0),
|
|
122
|
+
blockHeight: 1,
|
|
123
|
+
blockHash: null,
|
|
124
|
+
hasFailed: false,
|
|
125
|
+
accountId: tokenByCurrencyAddress,
|
|
126
|
+
senders: ["EQDnqcVSV4S9m2Y9gLAQrDerQktKSx2I1uhs6r5o_H8VT9G-"],
|
|
127
|
+
recipients: [common_fixtures_1.mockAddress],
|
|
128
|
+
date: new Date(transaction_now * 1000), // now is defined in seconds
|
|
129
|
+
extra: {
|
|
130
|
+
comment: { isEncrypted: false, text: "" },
|
|
131
|
+
explorerHash: transaction_hash,
|
|
132
|
+
lt: transaction_lt,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
]);
|
|
136
|
+
});
|
|
137
|
+
it("should map an OUT jetton transaction to a ledger operation", async () => {
|
|
138
|
+
// The IN jetton transaction will be used as OUT transaction and it will be adjusted
|
|
139
|
+
const jettonTransfers = [
|
|
140
|
+
{
|
|
141
|
+
...common_fixtures_1.jettonTransferResponse.jetton_transfers[0],
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
jettonTransfers[0].source = jettonTransfers[0].destination;
|
|
145
|
+
jettonTransfers[0].destination = common_fixtures_1.jettonTransferResponse.jetton_transfers[0].source;
|
|
146
|
+
const { transaction_hash, amount, transaction_now, transaction_lt } = jettonTransfers[0];
|
|
147
|
+
const finalOperation = (0, flatMap_1.default)(jettonTransfers, (0, txn_1.mapJettonTxToOps)(common_fixtures_1.mockAccountId, common_fixtures_1.mockAddress, common_fixtures_1.tonTransactionResponse.address_book));
|
|
148
|
+
const tokenByCurrencyAddress = `${common_fixtures_1.mockAccountId}+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not`;
|
|
149
|
+
expect(finalOperation).toEqual([
|
|
150
|
+
{
|
|
151
|
+
id: (0, operation_1.encodeOperationId)(tokenByCurrencyAddress, transaction_hash, "OUT"),
|
|
152
|
+
hash: transaction_hash,
|
|
153
|
+
type: "OUT",
|
|
154
|
+
value: (0, bignumber_js_1.default)(amount),
|
|
155
|
+
fee: (0, bignumber_js_1.default)(0),
|
|
156
|
+
blockHeight: 1,
|
|
157
|
+
blockHash: null,
|
|
158
|
+
hasFailed: false,
|
|
159
|
+
accountId: tokenByCurrencyAddress,
|
|
160
|
+
recipients: ["EQDnqcVSV4S9m2Y9gLAQrDerQktKSx2I1uhs6r5o_H8VT9G-"],
|
|
161
|
+
senders: [common_fixtures_1.mockAddress],
|
|
162
|
+
date: new Date(transaction_now * 1000), // now is defined in seconds
|
|
163
|
+
extra: {
|
|
164
|
+
comment: { isEncrypted: false, text: "" },
|
|
165
|
+
explorerHash: transaction_hash,
|
|
166
|
+
lt: transaction_lt,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
describe("TON Payload Processing Functions", () => {
|
|
174
|
+
describe("dataToSlice", () => {
|
|
175
|
+
it("should convert base64 string to Slice when it's a valid BOC", () => {
|
|
176
|
+
// Create a Cell from a string and convert to BOC
|
|
177
|
+
const cell = new core_1.Builder().storeUint(123, 32).endCell();
|
|
178
|
+
const bocBase64 = cell.toBoc().toString("base64");
|
|
179
|
+
const result = (0, txn_1.dataToSlice)(bocBase64);
|
|
180
|
+
expect(result).toBeInstanceOf(core_1.Slice);
|
|
181
|
+
expect(result?.loadUint(32)).toBe(123);
|
|
182
|
+
});
|
|
183
|
+
it("should fallback to BitString when the data is not a valid BOC", () => {
|
|
184
|
+
const invalidBocBase64 = "aW52YWxpZCB0b24gZGF0YQ=="; // "invalid ton data"
|
|
185
|
+
const result = (0, txn_1.dataToSlice)(invalidBocBase64);
|
|
186
|
+
expect(result).toBeInstanceOf(core_1.Slice);
|
|
187
|
+
});
|
|
188
|
+
it("should return undefined for non-string input", () => {
|
|
189
|
+
// @ts-expect-error - Testing invalid input
|
|
190
|
+
const result = (0, txn_1.dataToSlice)(null);
|
|
191
|
+
expect(result).toBeUndefined();
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
describe("loadSnakeBytes", () => {
|
|
195
|
+
it("should load bytes from a simple slice without refs", () => {
|
|
196
|
+
const cell = new core_1.Builder().storeBuffer(Buffer.from("Slice", "utf-8")).endCell();
|
|
197
|
+
const slice = cell.beginParse();
|
|
198
|
+
const result = (0, txn_1.loadSnakeBytes)(slice);
|
|
199
|
+
expect(result.toString("utf-8")).toBe("Slice");
|
|
200
|
+
});
|
|
201
|
+
it("should load bytes from a slice with refs (snake structure)", () => {
|
|
202
|
+
// Create a chain of cells (snake structure)
|
|
203
|
+
const cell2 = new core_1.Builder().storeBuffer(Buffer.from(" Data", "utf-8")).endCell();
|
|
204
|
+
const cell1 = new core_1.Builder()
|
|
205
|
+
.storeBuffer(Buffer.from("Slice", "utf-8"))
|
|
206
|
+
.storeRef(cell2)
|
|
207
|
+
.endCell();
|
|
208
|
+
const slice = cell1.beginParse();
|
|
209
|
+
const result = (0, txn_1.loadSnakeBytes)(slice);
|
|
210
|
+
expect(result.toString("utf-8")).toBe("Slice Data");
|
|
211
|
+
});
|
|
212
|
+
it("should handle empty slice", () => {
|
|
213
|
+
const cell = new core_1.Builder().endCell();
|
|
214
|
+
const slice = cell.beginParse();
|
|
215
|
+
const result = (0, txn_1.loadSnakeBytes)(slice);
|
|
216
|
+
expect(result.length).toBe(0);
|
|
217
|
+
});
|
|
218
|
+
it("should handle slice with multiple refs in chain", () => {
|
|
219
|
+
// Create a longer chain of cells (snake structure)
|
|
220
|
+
const cell3 = new core_1.Builder().storeBuffer(Buffer.from("Part3", "utf-8")).endCell();
|
|
221
|
+
const cell2 = new core_1.Builder()
|
|
222
|
+
.storeBuffer(Buffer.from("Part2", "utf-8"))
|
|
223
|
+
.storeRef(cell3)
|
|
224
|
+
.endCell();
|
|
225
|
+
const cell1 = new core_1.Builder()
|
|
226
|
+
.storeBuffer(Buffer.from("Part1", "utf-8"))
|
|
227
|
+
.storeRef(cell2)
|
|
228
|
+
.endCell();
|
|
229
|
+
const slice = cell1.beginParse();
|
|
230
|
+
const result = (0, txn_1.loadSnakeBytes)(slice);
|
|
231
|
+
expect(result.toString("utf-8")).toBe("Part1Part2Part3");
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
describe("decodeForwardPayload", () => {
|
|
235
|
+
it("should return empty string for null payload", () => {
|
|
236
|
+
const result = (0, txn_1.decodeForwardPayload)(null);
|
|
237
|
+
expect(result).toBe("");
|
|
238
|
+
});
|
|
239
|
+
it("should decode a valid payload with opcode 0 containing text", () => {
|
|
240
|
+
// Create a cell with opcode 0 followed by a text string
|
|
241
|
+
const cell = new core_1.Builder()
|
|
242
|
+
.storeUint(0, 32) // opcode 0
|
|
243
|
+
.storeBuffer(Buffer.from("This is the comment", "utf-8"))
|
|
244
|
+
.endCell();
|
|
245
|
+
const bocBase64 = cell.toBoc().toString("base64");
|
|
246
|
+
const result = (0, txn_1.decodeForwardPayload)(bocBase64);
|
|
247
|
+
expect(result).toBe("This is the comment");
|
|
248
|
+
});
|
|
249
|
+
it("should return empty string for payloads with non-zero opcode", () => {
|
|
250
|
+
// Create a cell with opcode 1 followed by some data
|
|
251
|
+
const cell = new core_1.Builder()
|
|
252
|
+
.storeUint(1, 32) // non-zero opcode
|
|
253
|
+
.storeBuffer(Buffer.from("Should be ignored", "utf-8"))
|
|
254
|
+
.endCell();
|
|
255
|
+
const bocBase64 = cell.toBoc().toString("base64");
|
|
256
|
+
const result = (0, txn_1.decodeForwardPayload)(bocBase64);
|
|
257
|
+
expect(result).toBe("");
|
|
258
|
+
});
|
|
259
|
+
it("should handle payload with unicode characters", () => {
|
|
260
|
+
// Create a cell with opcode 0 followed by a text with unicode
|
|
261
|
+
const cell = new core_1.Builder()
|
|
262
|
+
.storeUint(0, 32) // opcode 0
|
|
263
|
+
.storeBuffer(Buffer.from("Unicode: 你好, мир, 🚀", "utf-8"))
|
|
264
|
+
.endCell();
|
|
265
|
+
const bocBase64 = cell.toBoc().toString("base64");
|
|
266
|
+
const result = (0, txn_1.decodeForwardPayload)(bocBase64);
|
|
267
|
+
expect(result).toBe("Unicode: 你好, мир, 🚀");
|
|
268
|
+
});
|
|
269
|
+
it("should handle snake format payloads correctly", () => {
|
|
270
|
+
// Create a chain of cells with opcode 0 followed by a long message
|
|
271
|
+
const cell2 = new core_1.Builder()
|
|
272
|
+
.storeBuffer(Buffer.from(" would need multiple cells to store.", "utf-8"))
|
|
273
|
+
.endCell();
|
|
274
|
+
const cell1 = new core_1.Builder()
|
|
275
|
+
.storeUint(0, 32) // opcode 0
|
|
276
|
+
.storeBuffer(Buffer.from("This is a very long message that", "utf-8"))
|
|
277
|
+
.storeRef(cell2)
|
|
278
|
+
.endCell();
|
|
279
|
+
const bocBase64 = cell1.toBoc().toString("base64");
|
|
280
|
+
const result = (0, txn_1.decodeForwardPayload)(bocBase64);
|
|
281
|
+
expect(result).toBe("This is a very long message that would need multiple cells to store.");
|
|
282
|
+
});
|
|
283
|
+
it("should handle invalid payloads gracefully by returning empty string", () => {
|
|
284
|
+
// Create an invalid base64 string
|
|
285
|
+
const invalidBase64 = "!@#$%^&*()";
|
|
286
|
+
const result = (0, txn_1.decodeForwardPayload)(invalidBase64);
|
|
287
|
+
expect(result).toBe("");
|
|
288
|
+
});
|
|
289
|
+
it("should handle valid base64 but invalid BOC payloads", () => {
|
|
290
|
+
// Valid base64 but not a valid BOC
|
|
291
|
+
const validBase64NotBoc = "aW52YWxpZCB0b24gZGF0YQ=="; // "invalid ton data" in base64
|
|
292
|
+
const result = (0, txn_1.decodeForwardPayload)(validBase64NotBoc);
|
|
293
|
+
// Should return empty string as it's not a valid Cell
|
|
294
|
+
expect(result).toBe("");
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
//# sourceMappingURL=txn.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txn.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/txn.unit.test.ts"],"names":[],"mappings":";;;;;AAAA,sEAA2E;AAC3E,gEAAqC;AACrC,iDAAiD;AACjD,oCAA2C;AAC3C,6DAAqC;AAErC,wDAMwC;AACxC,iEAKqC;AAErC,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,kFAAkF,EAAE,KAAK,IAAI,EAAE;YAChG,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GACzD,wCAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAEzC,MAAM,cAAc,GAAG,IAAA,iBAAO,EAC5B,wCAAsB,CAAC,YAAY,EACnC,IAAA,gBAAU,EAAC,+BAAa,EAAE,6BAAW,EAAE,wCAAsB,CAAC,YAAY,CAAC,CAC5E,CAAC;YAEF,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;gBAC7B;oBACE,SAAS,EAAE,+BAAa;oBACxB,SAAS,EAAE,IAAI;oBACf,WAAW,EAAE,cAAc;oBAC3B,IAAI,EAAE,IAAI,IAAI,CAAC,GAA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