@ledgerhq/coin-ton 0.15.0 → 0.15.1-nightly.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.
Files changed (149) hide show
  1. package/.unimportedrc.json +2 -1
  2. package/CHANGELOG.md +9 -0
  3. package/lib/{__tests__/integration/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +2 -2
  4. package/lib/test/bridge.dataset.d.ts.map +1 -0
  5. package/lib/{__tests__/integration/bridge.integration.test.js → test/bridge.dataset.js} +4 -4
  6. package/lib/test/bridge.dataset.js.map +1 -0
  7. package/lib/transaction.d.ts.map +1 -1
  8. package/lib/transaction.js +44 -0
  9. package/lib/transaction.js.map +1 -1
  10. package/lib/types.d.ts +40 -2
  11. package/lib/types.d.ts.map +1 -1
  12. package/lib-es/{__tests__/integration/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +2 -2
  13. package/lib-es/test/bridge.dataset.d.ts.map +1 -0
  14. package/lib-es/{__tests__/integration/bridge.integration.test.js → test/bridge.dataset.js} +4 -4
  15. package/lib-es/test/bridge.dataset.js.map +1 -0
  16. package/lib-es/transaction.d.ts.map +1 -1
  17. package/lib-es/transaction.js +44 -0
  18. package/lib-es/transaction.js.map +1 -1
  19. package/lib-es/types.d.ts +40 -2
  20. package/lib-es/types.d.ts.map +1 -1
  21. package/package.json +8 -8
  22. package/src/{__tests__/integration/bridge.integration.test.ts → test/bridge.dataset.ts} +4 -4
  23. package/src/transaction.ts +44 -0
  24. package/src/transaction.unit.test.ts +71 -8
  25. package/src/types.ts +52 -2
  26. package/lib/__tests__/fixtures/api.fixtures.d.ts +0 -4
  27. package/lib/__tests__/fixtures/api.fixtures.d.ts.map +0 -1
  28. package/lib/__tests__/fixtures/api.fixtures.js +0 -37
  29. package/lib/__tests__/fixtures/api.fixtures.js.map +0 -1
  30. package/lib/__tests__/fixtures/common.fixtures.d.ts +0 -32
  31. package/lib/__tests__/fixtures/common.fixtures.d.ts.map +0 -1
  32. package/lib/__tests__/fixtures/common.fixtures.js +0 -176
  33. package/lib/__tests__/fixtures/common.fixtures.js.map +0 -1
  34. package/lib/__tests__/integration/bridge.integration.test.d.ts.map +0 -1
  35. package/lib/__tests__/integration/bridge.integration.test.js.map +0 -1
  36. package/lib/__tests__/unit/api.unit.test.d.ts +0 -2
  37. package/lib/__tests__/unit/api.unit.test.d.ts.map +0 -1
  38. package/lib/__tests__/unit/api.unit.test.js +0 -77
  39. package/lib/__tests__/unit/api.unit.test.js.map +0 -1
  40. package/lib/__tests__/unit/broadcast.unit.test.d.ts +0 -2
  41. package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +0 -1
  42. package/lib/__tests__/unit/broadcast.unit.test.js +0 -37
  43. package/lib/__tests__/unit/broadcast.unit.test.js.map +0 -1
  44. package/lib/__tests__/unit/createTransaction.unit.test.d.ts +0 -2
  45. package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +0 -1
  46. package/lib/__tests__/unit/createTransaction.unit.test.js +0 -25
  47. package/lib/__tests__/unit/createTransaction.unit.test.js.map +0 -1
  48. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +0 -2
  49. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +0 -1
  50. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +0 -111
  51. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +0 -1
  52. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +0 -2
  53. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +0 -1
  54. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +0 -30
  55. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +0 -1
  56. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +0 -2
  57. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +0 -1
  58. package/lib/__tests__/unit/getTransactionStatus.unit.test.js +0 -120
  59. package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +0 -1
  60. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +0 -2
  61. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +0 -1
  62. package/lib/__tests__/unit/hw-getAddress.unit.test.js +0 -54
  63. package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +0 -1
  64. package/lib/__tests__/unit/logic.unit.test.d.ts +0 -2
  65. package/lib/__tests__/unit/logic.unit.test.d.ts.map +0 -1
  66. package/lib/__tests__/unit/logic.unit.test.js +0 -18
  67. package/lib/__tests__/unit/logic.unit.test.js.map +0 -1
  68. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +0 -2
  69. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +0 -1
  70. package/lib/__tests__/unit/prepareTransaction.unit.test.js +0 -109
  71. package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +0 -1
  72. package/lib/__tests__/unit/signOperation.unit.test.d.ts +0 -2
  73. package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +0 -1
  74. package/lib/__tests__/unit/signOperation.unit.test.js +0 -72
  75. package/lib/__tests__/unit/signOperation.unit.test.js.map +0 -1
  76. package/lib/__tests__/unit/txn.unit.test.d.ts +0 -2
  77. package/lib/__tests__/unit/txn.unit.test.d.ts.map +0 -1
  78. package/lib/__tests__/unit/txn.unit.test.js +0 -298
  79. package/lib/__tests__/unit/txn.unit.test.js.map +0 -1
  80. package/lib/__tests__/unit/utils.unit.test.d.ts +0 -2
  81. package/lib/__tests__/unit/utils.unit.test.d.ts.map +0 -1
  82. package/lib/__tests__/unit/utils.unit.test.js +0 -211
  83. package/lib/__tests__/unit/utils.unit.test.js.map +0 -1
  84. package/lib/transaction.unit.test.d.ts +0 -2
  85. package/lib/transaction.unit.test.d.ts.map +0 -1
  86. package/lib/transaction.unit.test.js +0 -600
  87. package/lib/transaction.unit.test.js.map +0 -1
  88. package/lib-es/__tests__/fixtures/api.fixtures.d.ts +0 -4
  89. package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +0 -1
  90. package/lib-es/__tests__/fixtures/api.fixtures.js +0 -34
  91. package/lib-es/__tests__/fixtures/api.fixtures.js.map +0 -1
  92. package/lib-es/__tests__/fixtures/common.fixtures.d.ts +0 -32
  93. package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +0 -1
  94. package/lib-es/__tests__/fixtures/common.fixtures.js +0 -170
  95. package/lib-es/__tests__/fixtures/common.fixtures.js.map +0 -1
  96. package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +0 -1
  97. package/lib-es/__tests__/integration/bridge.integration.test.js.map +0 -1
  98. package/lib-es/__tests__/unit/api.unit.test.d.ts +0 -2
  99. package/lib-es/__tests__/unit/api.unit.test.d.ts.map +0 -1
  100. package/lib-es/__tests__/unit/api.unit.test.js +0 -52
  101. package/lib-es/__tests__/unit/api.unit.test.js.map +0 -1
  102. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +0 -2
  103. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +0 -1
  104. package/lib-es/__tests__/unit/broadcast.unit.test.js +0 -32
  105. package/lib-es/__tests__/unit/broadcast.unit.test.js.map +0 -1
  106. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +0 -2
  107. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +0 -1
  108. package/lib-es/__tests__/unit/createTransaction.unit.test.js +0 -20
  109. package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +0 -1
  110. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +0 -2
  111. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +0 -1
  112. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +0 -106
  113. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +0 -1
  114. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +0 -2
  115. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +0 -1
  116. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +0 -25
  117. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +0 -1
  118. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +0 -2
  119. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +0 -1
  120. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +0 -115
  121. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +0 -1
  122. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +0 -2
  123. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +0 -1
  124. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +0 -49
  125. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +0 -1
  126. package/lib-es/__tests__/unit/logic.unit.test.d.ts +0 -2
  127. package/lib-es/__tests__/unit/logic.unit.test.d.ts.map +0 -1
  128. package/lib-es/__tests__/unit/logic.unit.test.js +0 -16
  129. package/lib-es/__tests__/unit/logic.unit.test.js.map +0 -1
  130. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +0 -2
  131. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +0 -1
  132. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +0 -81
  133. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +0 -1
  134. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +0 -2
  135. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +0 -1
  136. package/lib-es/__tests__/unit/signOperation.unit.test.js +0 -67
  137. package/lib-es/__tests__/unit/signOperation.unit.test.js.map +0 -1
  138. package/lib-es/__tests__/unit/txn.unit.test.d.ts +0 -2
  139. package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +0 -1
  140. package/lib-es/__tests__/unit/txn.unit.test.js +0 -293
  141. package/lib-es/__tests__/unit/txn.unit.test.js.map +0 -1
  142. package/lib-es/__tests__/unit/utils.unit.test.d.ts +0 -2
  143. package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +0 -1
  144. package/lib-es/__tests__/unit/utils.unit.test.js +0 -186
  145. package/lib-es/__tests__/unit/utils.unit.test.js.map +0 -1
  146. package/lib-es/transaction.unit.test.d.ts +0 -2
  147. package/lib-es/transaction.unit.test.d.ts.map +0 -1
  148. package/lib-es/transaction.unit.test.js +0 -595
  149. package/lib-es/transaction.unit.test.js.map +0 -1
@@ -1,293 +0,0 @@
1
- import { encodeOperationId } from "@ledgerhq/coin-framework/lib/operation";
2
- import BigNumber from "bignumber.js";
3
- // eslint-disable-next-line no-restricted-imports
4
- import { Builder, Slice } from "@ton/core";
5
- import flatMap from "lodash/flatMap";
6
- import { dataToSlice, decodeForwardPayload, loadSnakeBytes, mapJettonTxToOps, mapTxToOps, } from "../../bridge/bridgeHelpers/txn";
7
- import { jettonTransferResponse, mockAccountId, mockAddress, tonTransactionResponse, } from "../fixtures/common.fixtures";
8
- describe("Transaction functions", () => {
9
- describe("mapTxToOps", () => {
10
- it("should map an IN failed ton transaction without total_fees to a ledger operation", async () => {
11
- const { now, lt, hash, in_msg, total_fees, mc_block_seqno } = tonTransactionResponse.transactions[0];
12
- const finalOperation = flatMap(tonTransactionResponse.transactions, mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book));
13
- expect(finalOperation).toEqual([
14
- {
15
- accountId: mockAccountId,
16
- blockHash: null,
17
- blockHeight: mc_block_seqno,
18
- date: new Date(now * 1000), // now is defined in seconds
19
- extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
20
- fee: BigNumber(total_fees),
21
- hasFailed: true,
22
- hash: in_msg?.hash,
23
- id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "IN"),
24
- recipients: [in_msg?.destination],
25
- senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
26
- type: "IN",
27
- value: BigNumber(in_msg?.value ?? 0),
28
- subOperations: undefined,
29
- },
30
- ]);
31
- });
32
- it("should map an IN ton transaction with total_fees to a ledger operation", async () => {
33
- const transactions = [{ ...tonTransactionResponse.transactions[0], total_fees: "15" }];
34
- const { now, lt, hash, in_msg, total_fees, mc_block_seqno } = transactions[0];
35
- const finalOperation = flatMap(transactions, mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book));
36
- expect(finalOperation).toEqual([
37
- {
38
- accountId: mockAccountId,
39
- blockHash: null,
40
- blockHeight: mc_block_seqno,
41
- date: new Date(now * 1000), // now is defined in seconds
42
- extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
43
- fee: BigNumber(total_fees),
44
- hasFailed: true,
45
- hash: in_msg?.hash,
46
- id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "IN"),
47
- recipients: [in_msg?.destination],
48
- senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
49
- type: "IN",
50
- value: BigNumber(in_msg?.value ?? 0),
51
- subOperations: [
52
- {
53
- id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "NONE"),
54
- hash: in_msg?.hash,
55
- type: "NONE",
56
- value: BigNumber(total_fees),
57
- fee: BigNumber(0),
58
- blockHeight: mc_block_seqno,
59
- blockHash: null,
60
- hasFailed: true,
61
- accountId: mockAccountId,
62
- senders: [mockAddress],
63
- recipients: [],
64
- date: new Date(now * 1000),
65
- extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
66
- },
67
- ],
68
- },
69
- ]);
70
- });
71
- it("should map a failed OUT ton transaction to a ledger operation", async () => {
72
- // The IN transaction will be used as OUT transaction and it will be adjusted
73
- const transactions = [
74
- {
75
- ...tonTransactionResponse.transactions[0],
76
- in_msg: null,
77
- },
78
- ];
79
- if (tonTransactionResponse.transactions[0].in_msg) {
80
- transactions[0].out_msgs = [
81
- { ...tonTransactionResponse.transactions[0].in_msg, source: transactions[0].account },
82
- ];
83
- }
84
- const { now, lt, hash, out_msgs, total_fees, mc_block_seqno } = transactions[0];
85
- const finalOperation = flatMap(transactions, mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book));
86
- expect(finalOperation).toEqual([
87
- {
88
- id: encodeOperationId(mockAccountId, hash, "OUT"),
89
- hash: out_msgs?.[0].hash,
90
- type: "OUT",
91
- value: BigNumber(out_msgs?.[0].value ?? 0),
92
- fee: BigNumber(total_fees),
93
- blockHeight: mc_block_seqno,
94
- blockHash: null,
95
- hasFailed: true,
96
- accountId: mockAccountId,
97
- senders: [transactions[0].account],
98
- recipients: ["EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"],
99
- date: new Date(now * 1000), // now is defined in seconds
100
- extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
101
- },
102
- ]);
103
- });
104
- });
105
- describe("mapJettonToOps", () => {
106
- it("should map an IN ton transaction without total_fees to a ledger operation", async () => {
107
- const { transaction_hash, amount, transaction_now, transaction_lt } = jettonTransferResponse.jetton_transfers[0];
108
- const finalOperation = flatMap(jettonTransferResponse.jetton_transfers, mapJettonTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book));
109
- const tokenByCurrencyAddress = `${mockAccountId}+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not`;
110
- expect(finalOperation).toEqual([
111
- {
112
- id: encodeOperationId(tokenByCurrencyAddress, transaction_hash, "IN"),
113
- hash: transaction_hash,
114
- type: "IN",
115
- value: BigNumber(amount),
116
- fee: BigNumber(0),
117
- blockHeight: 1,
118
- blockHash: null,
119
- hasFailed: false,
120
- accountId: tokenByCurrencyAddress,
121
- senders: ["EQDnqcVSV4S9m2Y9gLAQrDerQktKSx2I1uhs6r5o_H8VT9G-"],
122
- recipients: [mockAddress],
123
- date: new Date(transaction_now * 1000), // now is defined in seconds
124
- extra: {
125
- comment: { isEncrypted: false, text: "" },
126
- explorerHash: transaction_hash,
127
- lt: transaction_lt,
128
- },
129
- },
130
- ]);
131
- });
132
- it("should map an OUT jetton transaction to a ledger operation", async () => {
133
- // The IN jetton transaction will be used as OUT transaction and it will be adjusted
134
- const jettonTransfers = [
135
- {
136
- ...jettonTransferResponse.jetton_transfers[0],
137
- },
138
- ];
139
- jettonTransfers[0].source = jettonTransfers[0].destination;
140
- jettonTransfers[0].destination = jettonTransferResponse.jetton_transfers[0].source;
141
- const { transaction_hash, amount, transaction_now, transaction_lt } = jettonTransfers[0];
142
- const finalOperation = flatMap(jettonTransfers, mapJettonTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book));
143
- const tokenByCurrencyAddress = `${mockAccountId}+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not`;
144
- expect(finalOperation).toEqual([
145
- {
146
- id: encodeOperationId(tokenByCurrencyAddress, transaction_hash, "OUT"),
147
- hash: transaction_hash,
148
- type: "OUT",
149
- value: BigNumber(amount),
150
- fee: BigNumber(0),
151
- blockHeight: 1,
152
- blockHash: null,
153
- hasFailed: false,
154
- accountId: tokenByCurrencyAddress,
155
- recipients: ["EQDnqcVSV4S9m2Y9gLAQrDerQktKSx2I1uhs6r5o_H8VT9G-"],
156
- senders: [mockAddress],
157
- date: new Date(transaction_now * 1000), // now is defined in seconds
158
- extra: {
159
- comment: { isEncrypted: false, text: "" },
160
- explorerHash: transaction_hash,
161
- lt: transaction_lt,
162
- },
163
- },
164
- ]);
165
- });
166
- });
167
- });
168
- describe("TON Payload Processing Functions", () => {
169
- describe("dataToSlice", () => {
170
- it("should convert base64 string to Slice when it's a valid BOC", () => {
171
- // Create a Cell from a string and convert to BOC
172
- const cell = new Builder().storeUint(123, 32).endCell();
173
- const bocBase64 = cell.toBoc().toString("base64");
174
- const result = dataToSlice(bocBase64);
175
- expect(result).toBeInstanceOf(Slice);
176
- expect(result?.loadUint(32)).toBe(123);
177
- });
178
- it("should fallback to BitString when the data is not a valid BOC", () => {
179
- const invalidBocBase64 = "aW52YWxpZCB0b24gZGF0YQ=="; // "invalid ton data"
180
- const result = dataToSlice(invalidBocBase64);
181
- expect(result).toBeInstanceOf(Slice);
182
- });
183
- it("should return undefined for non-string input", () => {
184
- // @ts-expect-error - Testing invalid input
185
- const result = dataToSlice(null);
186
- expect(result).toBeUndefined();
187
- });
188
- });
189
- describe("loadSnakeBytes", () => {
190
- it("should load bytes from a simple slice without refs", () => {
191
- const cell = new Builder().storeBuffer(Buffer.from("Slice", "utf-8")).endCell();
192
- const slice = cell.beginParse();
193
- const result = loadSnakeBytes(slice);
194
- expect(result.toString("utf-8")).toBe("Slice");
195
- });
196
- it("should load bytes from a slice with refs (snake structure)", () => {
197
- // Create a chain of cells (snake structure)
198
- const cell2 = new Builder().storeBuffer(Buffer.from(" Data", "utf-8")).endCell();
199
- const cell1 = new Builder()
200
- .storeBuffer(Buffer.from("Slice", "utf-8"))
201
- .storeRef(cell2)
202
- .endCell();
203
- const slice = cell1.beginParse();
204
- const result = loadSnakeBytes(slice);
205
- expect(result.toString("utf-8")).toBe("Slice Data");
206
- });
207
- it("should handle empty slice", () => {
208
- const cell = new Builder().endCell();
209
- const slice = cell.beginParse();
210
- const result = loadSnakeBytes(slice);
211
- expect(result.length).toBe(0);
212
- });
213
- it("should handle slice with multiple refs in chain", () => {
214
- // Create a longer chain of cells (snake structure)
215
- const cell3 = new Builder().storeBuffer(Buffer.from("Part3", "utf-8")).endCell();
216
- const cell2 = new Builder()
217
- .storeBuffer(Buffer.from("Part2", "utf-8"))
218
- .storeRef(cell3)
219
- .endCell();
220
- const cell1 = new Builder()
221
- .storeBuffer(Buffer.from("Part1", "utf-8"))
222
- .storeRef(cell2)
223
- .endCell();
224
- const slice = cell1.beginParse();
225
- const result = loadSnakeBytes(slice);
226
- expect(result.toString("utf-8")).toBe("Part1Part2Part3");
227
- });
228
- });
229
- describe("decodeForwardPayload", () => {
230
- it("should return empty string for null payload", () => {
231
- const result = decodeForwardPayload(null);
232
- expect(result).toBe("");
233
- });
234
- it("should decode a valid payload with opcode 0 containing text", () => {
235
- // Create a cell with opcode 0 followed by a text string
236
- const cell = new Builder()
237
- .storeUint(0, 32) // opcode 0
238
- .storeBuffer(Buffer.from("This is the comment", "utf-8"))
239
- .endCell();
240
- const bocBase64 = cell.toBoc().toString("base64");
241
- const result = decodeForwardPayload(bocBase64);
242
- expect(result).toBe("This is the comment");
243
- });
244
- it("should return empty string for payloads with non-zero opcode", () => {
245
- // Create a cell with opcode 1 followed by some data
246
- const cell = new Builder()
247
- .storeUint(1, 32) // non-zero opcode
248
- .storeBuffer(Buffer.from("Should be ignored", "utf-8"))
249
- .endCell();
250
- const bocBase64 = cell.toBoc().toString("base64");
251
- const result = decodeForwardPayload(bocBase64);
252
- expect(result).toBe("");
253
- });
254
- it("should handle payload with unicode characters", () => {
255
- // Create a cell with opcode 0 followed by a text with unicode
256
- const cell = new Builder()
257
- .storeUint(0, 32) // opcode 0
258
- .storeBuffer(Buffer.from("Unicode: 你好, мир, 🚀", "utf-8"))
259
- .endCell();
260
- const bocBase64 = cell.toBoc().toString("base64");
261
- const result = decodeForwardPayload(bocBase64);
262
- expect(result).toBe("Unicode: 你好, мир, 🚀");
263
- });
264
- it("should handle snake format payloads correctly", () => {
265
- // Create a chain of cells with opcode 0 followed by a long message
266
- const cell2 = new Builder()
267
- .storeBuffer(Buffer.from(" would need multiple cells to store.", "utf-8"))
268
- .endCell();
269
- const cell1 = new Builder()
270
- .storeUint(0, 32) // opcode 0
271
- .storeBuffer(Buffer.from("This is a very long message that", "utf-8"))
272
- .storeRef(cell2)
273
- .endCell();
274
- const bocBase64 = cell1.toBoc().toString("base64");
275
- const result = decodeForwardPayload(bocBase64);
276
- expect(result).toBe("This is a very long message that would need multiple cells to store.");
277
- });
278
- it("should handle invalid payloads gracefully by returning empty string", () => {
279
- // Create an invalid base64 string
280
- const invalidBase64 = "!@#$%^&*()";
281
- const result = decodeForwardPayload(invalidBase64);
282
- expect(result).toBe("");
283
- });
284
- it("should handle valid base64 but invalid BOC payloads", () => {
285
- // Valid base64 but not a valid BOC
286
- const validBase64NotBoc = "aW52YWxpZCB0b24gZGF0YQ=="; // "invalid ton data" in base64
287
- const result = decodeForwardPayload(validBase64NotBoc);
288
- // Should return empty string as it's not a valid Cell
289
- expect(result).toBe("");
290
- });
291
- });
292
- });
293
- //# sourceMappingURL=txn.unit.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"txn.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/txn.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,iDAAiD;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,UAAU,GACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;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,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAEzC,MAAM,cAAc,GAAG,OAAO,CAC5B,sBAAsB,CAAC,YAAY,EACnC,UAAU,CAAC,aAAa,EAAE,WAAW,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAC5E,CAAC;YAEF,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;gBAC7B;o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AC,CAAC,CAAC;QAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;YAC7E,kCAAkC;YAClC,MAAM,aAAa,GAAG,YAAY,CAAC;YAEnC,MAAM,MAAM,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;YAEnD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,mCAAmC;YACnC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,CAAC,+BAA+B;YAErF,MAAM,MAAM,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;YAEvD,sDAAsD;YACtD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.unit.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/utils.unit.test.ts"],"names":[],"mappings":""}
@@ -1,186 +0,0 @@
1
- import { Address, toNano } from "@ton/core";
2
- import { setCoinConfig } from "../../config";
3
- import { TOKEN_TRANSFER_FORWARD_AMOUNT, TOKEN_TRANSFER_MAX_FEE, TOKEN_TRANSFER_QUERY_ID, } from "../../constants";
4
- import { addressesAreEqual, buildTonTransaction, commentIsValid, getLedgerTonPath, getTransferExpirationTime, isAddressValid, } from "../../utils";
5
- import mockServer, { API_TON_ENDPOINT } from "../fixtures/api.fixtures";
6
- import { account, transaction as baseTransaction, jettonTransaction, } from "../fixtures/common.fixtures";
7
- describe("TON addresses", () => {
8
- const addr = {
9
- raw: "0:074c7194d64e8218f2cfaab8e79b34201adbed0f8fa7f2773e604dd39969b5ff",
10
- rawWrong: "0:074c7194d64e8218f2cfaab8e79b34201adbed0f8fa7f2773e604dd39969b5f",
11
- bounceUrl: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4-n8nc-YE3TmWm1_1JZ",
12
- bounceNoUrl: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/1JZ",
13
- bounceWrong: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/1J",
14
- noBounceUrl: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4-n8nc-YE3TmWm1_w-c",
15
- noBounceNoUrl: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/w+c",
16
- noBounceWrong: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/w+",
17
- diff: "UQBjrXgZbYDCpxLKpgMnBe985kYDfUeriuYUafbuKgdBpWuJ",
18
- };
19
- test("Check if addresses are valid", () => {
20
- expect(isAddressValid(addr.raw)).toBe(true);
21
- expect(isAddressValid(addr.bounceUrl)).toBe(true);
22
- expect(isAddressValid(addr.bounceNoUrl)).toBe(true);
23
- expect(isAddressValid(addr.noBounceUrl)).toBe(true);
24
- expect(isAddressValid(addr.noBounceNoUrl)).toBe(true);
25
- expect(isAddressValid(addr.rawWrong)).toBe(false);
26
- expect(isAddressValid(addr.bounceWrong)).toBe(false);
27
- expect(isAddressValid(addr.noBounceWrong)).toBe(false);
28
- expect(isAddressValid(addr.diff)).toBe(true);
29
- });
30
- test("Compare addresses", () => {
31
- expect(addressesAreEqual(addr.raw, addr.bounceUrl)).toBe(true);
32
- expect(addressesAreEqual(addr.raw, addr.noBounceUrl)).toBe(true);
33
- expect(addressesAreEqual(addr.bounceUrl, addr.noBounceUrl)).toBe(true);
34
- expect(addressesAreEqual(addr.rawWrong, addr.noBounceUrl)).toBe(false);
35
- expect(addressesAreEqual(addr.noBounceNoUrl, addr.diff)).toBe(false);
36
- });
37
- });
38
- test("TON Comments are valid", () => {
39
- const msg = (e, m) => ({ isEncrypted: e, text: m });
40
- expect(commentIsValid(msg(false, ""))).toBe(true);
41
- expect(commentIsValid(msg(false, "Hello world!"))).toBe(true);
42
- expect(commentIsValid(msg(false, " 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"))).toBe(true);
43
- expect(commentIsValid(msg(false, " 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 "))).toBe(false);
44
- expect(commentIsValid(msg(false, "😀"))).toBe(false);
45
- expect(commentIsValid(msg(true, ""))).toBe(false);
46
- });
47
- describe("TON transfers", () => {
48
- const commentPayload = {
49
- type: "comment",
50
- text: "",
51
- };
52
- const transferPayload = {
53
- type: "jetton-transfer",
54
- queryId: null,
55
- amount: BigInt(0),
56
- destination: new Address(0, Buffer.alloc(32)),
57
- responseDestination: new Address(0, Buffer.alloc(32)),
58
- customPayload: null,
59
- forwardAmount: BigInt(0),
60
- forwardPayload: null,
61
- knownJetton: null,
62
- };
63
- const nftPayload = {
64
- type: "nft-transfer",
65
- queryId: null,
66
- newOwner: new Address(0, Buffer.alloc(32)),
67
- responseDestination: new Address(0, Buffer.alloc(32)),
68
- customPayload: null,
69
- forwardAmount: BigInt(0),
70
- forwardPayload: null,
71
- };
72
- test("Check if the transaction is jetton transfer", () => {
73
- /**
74
- * Checks if the given payload is a jetton transfer.
75
- */
76
- const isJettonTransfer = (payload) => payload.type === "jetton-transfer";
77
- expect(isJettonTransfer(commentPayload)).toBe(false);
78
- expect(isJettonTransfer(transferPayload)).toBe(true);
79
- expect(isJettonTransfer(nftPayload)).toBe(false);
80
- });
81
- });
82
- describe("Get TON paths", () => {
83
- const correctPath = ["44'/607'/0'/0'/0'/0'", "m/44'/607'/0'/0'/0'/0'"];
84
- const wrongPaths = [
85
- "44'/607'/0'/0'/0'",
86
- "44'/607'/0'/0/'/0'",
87
- "44'/607'/0'/0'/x'/0'",
88
- "44'/607'/0'/-3'/0'/0'",
89
- "44'/607'/0'/2147483650'/0'/0'",
90
- ];
91
- test("Correct paths return a correct response", () => {
92
- correctPath.map((path) => {
93
- expect(getLedgerTonPath(path)).toStrictEqual([44, 607, 0, 0, 0, 0]);
94
- });
95
- });
96
- test("Wrong paths fail", () => {
97
- wrongPaths.map((path) => {
98
- expect(() => getLedgerTonPath(path)).toThrow(/^(\[ton\] Path)/);
99
- });
100
- });
101
- });
102
- describe("Build TON transaction", () => {
103
- beforeAll(() => {
104
- setCoinConfig(() => ({
105
- status: {
106
- type: "active",
107
- },
108
- infra: {
109
- API_TON_ENDPOINT: API_TON_ENDPOINT,
110
- KNOWN_JETTONS: [],
111
- },
112
- }));
113
- mockServer.listen();
114
- });
115
- afterAll(() => {
116
- mockServer.close();
117
- });
118
- const seqno = 22;
119
- test("Build TON transaction with an specific amount", () => {
120
- const tonTransaction = buildTonTransaction(baseTransaction, seqno, account);
121
- // Convert the Address to string to compare
122
- expect({ ...tonTransaction, to: tonTransaction.to.toString() }).toEqual({
123
- to: Address.parse(baseTransaction.recipient).toString(),
124
- seqno,
125
- amount: BigInt(baseTransaction.amount.toString()),
126
- bounce: false,
127
- timeout: getTransferExpirationTime(),
128
- sendMode: 3,
129
- });
130
- });
131
- test("Build TON transaction when useAllAmount is true and there is a comment", () => {
132
- const transaction = {
133
- ...baseTransaction,
134
- comment: { text: "valid comment", isEncrypted: false },
135
- useAllAmount: true,
136
- };
137
- const tonTransaction = buildTonTransaction(transaction, seqno, account);
138
- // Convert the Address to string to compare
139
- expect({ ...tonTransaction, to: tonTransaction.to.toString() }).toEqual({
140
- to: Address.parse(transaction.recipient).toString(),
141
- seqno,
142
- amount: BigInt(0),
143
- bounce: false,
144
- timeout: getTransferExpirationTime(),
145
- sendMode: 128,
146
- payload: { type: "comment", text: transaction.comment.text },
147
- });
148
- });
149
- test("Build jetton transaction with an specific amount", () => {
150
- const jettonTransfer = buildTonTransaction(jettonTransaction, seqno, account);
151
- // Convert the Addresses to string to compare
152
- expect({
153
- ...jettonTransfer,
154
- to: jettonTransfer.to.toString(),
155
- payload: undefined,
156
- }).toStrictEqual({
157
- to: Address.parse(account.subAccounts?.[0].jettonWallet ?? "").toString(),
158
- seqno,
159
- amount: toNano(TOKEN_TRANSFER_MAX_FEE),
160
- bounce: true,
161
- timeout: getTransferExpirationTime(),
162
- sendMode: 3,
163
- payload: undefined,
164
- });
165
- expect(jettonTransfer.payload?.type).toStrictEqual("jetton-transfer");
166
- expect({
167
- ...jettonTransfer.payload,
168
- destination: jettonTransfer.payload.destination.toString(),
169
- responseDestination: jettonTransfer.payload.responseDestination.toString(),
170
- queryId: jettonTransfer.payload.queryId?.toString(),
171
- amount: jettonTransfer.payload.amount.toString(),
172
- forwardAmount: jettonTransfer.payload.forwardAmount.toString(),
173
- }).toStrictEqual({
174
- type: "jetton-transfer",
175
- queryId: TOKEN_TRANSFER_QUERY_ID.toString(),
176
- amount: jettonTransaction.amount.toFixed(),
177
- destination: Address.parse(jettonTransaction.recipient).toString(),
178
- responseDestination: Address.parse(account.freshAddress).toString(),
179
- customPayload: null,
180
- forwardAmount: TOKEN_TRANSFER_FORWARD_AMOUNT.toString(),
181
- forwardPayload: null,
182
- knownJetton: null,
183
- });
184
- });
185
- });
186
- //# sourceMappingURL=utils.unit.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/utils.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,UAAU,EAAE,EAAE,gBAAgB,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3,"file":"transaction.unit.test.d.ts","sourceRoot":"","sources":["../src/transaction.unit.test.ts"],"names":[],"mappings":""}