@ledgerhq/coin-ton 0.15.0 → 0.15.1-nightly.1
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/.unimportedrc.json +2 -1
- package/CHANGELOG.md +16 -0
- package/lib/{__tests__/integration/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +2 -2
- package/lib/test/bridge.dataset.d.ts.map +1 -0
- package/lib/{__tests__/integration/bridge.integration.test.js → test/bridge.dataset.js} +4 -4
- package/lib/test/bridge.dataset.js.map +1 -0
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +44 -0
- package/lib/transaction.js.map +1 -1
- package/lib/types.d.ts +40 -2
- package/lib/types.d.ts.map +1 -1
- package/lib-es/{__tests__/integration/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +2 -2
- package/lib-es/test/bridge.dataset.d.ts.map +1 -0
- package/lib-es/{__tests__/integration/bridge.integration.test.js → test/bridge.dataset.js} +4 -4
- package/lib-es/test/bridge.dataset.js.map +1 -0
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +44 -0
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/types.d.ts +40 -2
- package/lib-es/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/{__tests__/integration/bridge.integration.test.ts → test/bridge.dataset.ts} +4 -4
- package/src/transaction.ts +44 -0
- package/src/transaction.unit.test.ts +71 -8
- package/src/types.ts +52 -2
- package/lib/__tests__/fixtures/api.fixtures.d.ts +0 -4
- package/lib/__tests__/fixtures/api.fixtures.d.ts.map +0 -1
- package/lib/__tests__/fixtures/api.fixtures.js +0 -37
- package/lib/__tests__/fixtures/api.fixtures.js.map +0 -1
- package/lib/__tests__/fixtures/common.fixtures.d.ts +0 -32
- package/lib/__tests__/fixtures/common.fixtures.d.ts.map +0 -1
- package/lib/__tests__/fixtures/common.fixtures.js +0 -176
- package/lib/__tests__/fixtures/common.fixtures.js.map +0 -1
- package/lib/__tests__/integration/bridge.integration.test.d.ts.map +0 -1
- package/lib/__tests__/integration/bridge.integration.test.js.map +0 -1
- package/lib/__tests__/unit/api.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/api.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/api.unit.test.js +0 -77
- package/lib/__tests__/unit/api.unit.test.js.map +0 -1
- package/lib/__tests__/unit/broadcast.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/broadcast.unit.test.js +0 -37
- package/lib/__tests__/unit/broadcast.unit.test.js.map +0 -1
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/createTransaction.unit.test.js +0 -25
- package/lib/__tests__/unit/createTransaction.unit.test.js.map +0 -1
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +0 -111
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +0 -1
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +0 -30
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +0 -1
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js +0 -120
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +0 -1
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/hw-getAddress.unit.test.js +0 -54
- package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +0 -1
- package/lib/__tests__/unit/logic.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/logic.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/logic.unit.test.js +0 -18
- package/lib/__tests__/unit/logic.unit.test.js.map +0 -1
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/prepareTransaction.unit.test.js +0 -109
- package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +0 -1
- package/lib/__tests__/unit/signOperation.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/signOperation.unit.test.js +0 -72
- package/lib/__tests__/unit/signOperation.unit.test.js.map +0 -1
- package/lib/__tests__/unit/txn.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/txn.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/txn.unit.test.js +0 -298
- package/lib/__tests__/unit/txn.unit.test.js.map +0 -1
- package/lib/__tests__/unit/utils.unit.test.d.ts +0 -2
- package/lib/__tests__/unit/utils.unit.test.d.ts.map +0 -1
- package/lib/__tests__/unit/utils.unit.test.js +0 -211
- package/lib/__tests__/unit/utils.unit.test.js.map +0 -1
- package/lib/transaction.unit.test.d.ts +0 -2
- package/lib/transaction.unit.test.d.ts.map +0 -1
- package/lib/transaction.unit.test.js +0 -600
- package/lib/transaction.unit.test.js.map +0 -1
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts +0 -4
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +0 -1
- package/lib-es/__tests__/fixtures/api.fixtures.js +0 -34
- package/lib-es/__tests__/fixtures/api.fixtures.js.map +0 -1
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts +0 -32
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +0 -1
- package/lib-es/__tests__/fixtures/common.fixtures.js +0 -170
- package/lib-es/__tests__/fixtures/common.fixtures.js.map +0 -1
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +0 -1
- package/lib-es/__tests__/integration/bridge.integration.test.js.map +0 -1
- package/lib-es/__tests__/unit/api.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/api.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/api.unit.test.js +0 -52
- package/lib-es/__tests__/unit/api.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/broadcast.unit.test.js +0 -32
- package/lib-es/__tests__/unit/broadcast.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/createTransaction.unit.test.js +0 -20
- package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +0 -106
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +0 -25
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +0 -115
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +0 -49
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/logic.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/logic.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/logic.unit.test.js +0 -16
- package/lib-es/__tests__/unit/logic.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +0 -81
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/signOperation.unit.test.js +0 -67
- package/lib-es/__tests__/unit/signOperation.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/txn.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/txn.unit.test.js +0 -293
- package/lib-es/__tests__/unit/txn.unit.test.js.map +0 -1
- package/lib-es/__tests__/unit/utils.unit.test.d.ts +0 -2
- package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/unit/utils.unit.test.js +0 -186
- package/lib-es/__tests__/unit/utils.unit.test.js.map +0 -1
- package/lib-es/transaction.unit.test.d.ts +0 -2
- package/lib-es/transaction.unit.test.d.ts.map +0 -1
- package/lib-es/transaction.unit.test.js +0 -595
- package/lib-es/transaction.unit.test.js.map +0 -1
package/src/transaction.ts
CHANGED
|
@@ -153,6 +153,28 @@ const fromTransactionPayloadRaw = (payload: TonPayloadFormatRaw): TonPayloadForm
|
|
|
153
153
|
queryId: safeToBigInt(payload.queryId),
|
|
154
154
|
swapId: Buffer.from(payload.swapId, "hex"),
|
|
155
155
|
};
|
|
156
|
+
case "tonwhales-pool-deposit":
|
|
157
|
+
return {
|
|
158
|
+
type: payload.type,
|
|
159
|
+
queryId: BigInt(payload.queryId),
|
|
160
|
+
gasLimit: BigInt(payload.gasLimit),
|
|
161
|
+
};
|
|
162
|
+
case "tonwhales-pool-withdraw":
|
|
163
|
+
return {
|
|
164
|
+
type: payload.type,
|
|
165
|
+
queryId: BigInt(payload.queryId),
|
|
166
|
+
gasLimit: BigInt(payload.gasLimit),
|
|
167
|
+
amount: BigInt(payload.amount),
|
|
168
|
+
};
|
|
169
|
+
case "vesting-send-msg-comment":
|
|
170
|
+
return {
|
|
171
|
+
type: payload.type,
|
|
172
|
+
queryId: safeToBigInt(payload.queryId),
|
|
173
|
+
sendMode: payload.sendMode,
|
|
174
|
+
value: BigInt(payload.value),
|
|
175
|
+
destination: Address.parse(payload.destination),
|
|
176
|
+
text: payload.text,
|
|
177
|
+
};
|
|
156
178
|
case "comment":
|
|
157
179
|
return payload;
|
|
158
180
|
default: {
|
|
@@ -289,6 +311,28 @@ const toTransactionPayloadRaw = (payload: TonPayloadFormat): TonPayloadFormatRaw
|
|
|
289
311
|
queryId: safeFromBigInt(payload.queryId),
|
|
290
312
|
swapId: payload.swapId.toString("hex"),
|
|
291
313
|
};
|
|
314
|
+
case "tonwhales-pool-deposit":
|
|
315
|
+
return {
|
|
316
|
+
type: payload.type,
|
|
317
|
+
queryId: payload.queryId.toString(),
|
|
318
|
+
gasLimit: payload.gasLimit.toString(),
|
|
319
|
+
};
|
|
320
|
+
case "tonwhales-pool-withdraw":
|
|
321
|
+
return {
|
|
322
|
+
type: payload.type,
|
|
323
|
+
queryId: payload.queryId.toString(),
|
|
324
|
+
gasLimit: payload.gasLimit.toString(),
|
|
325
|
+
amount: payload.amount.toString(),
|
|
326
|
+
};
|
|
327
|
+
case "vesting-send-msg-comment":
|
|
328
|
+
return {
|
|
329
|
+
type: payload.type,
|
|
330
|
+
queryId: safeFromBigInt(payload.queryId),
|
|
331
|
+
sendMode: payload.sendMode,
|
|
332
|
+
value: payload.value.toString(),
|
|
333
|
+
destination: payload.destination.toRawString(),
|
|
334
|
+
text: payload.text,
|
|
335
|
+
};
|
|
292
336
|
case "comment":
|
|
293
337
|
return payload;
|
|
294
338
|
default: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import { Address, Cell } from "@ton/core";
|
|
4
4
|
import type { Account } from "@ledgerhq/types-live";
|
|
5
|
-
import type {
|
|
5
|
+
import type { Transaction, TransactionRaw } from "./types";
|
|
6
6
|
import { formatTransaction, fromTransactionRaw, toTransactionRaw } from "./transaction";
|
|
7
7
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
8
8
|
import { genAccount } from "@ledgerhq/coin-framework/mocks/account";
|
|
@@ -516,20 +516,83 @@ const cases: Array<{
|
|
|
516
516
|
},
|
|
517
517
|
},
|
|
518
518
|
{
|
|
519
|
-
name: "tx with payload
|
|
519
|
+
name: "tx with payload for tonwhales-pool-deposit",
|
|
520
|
+
tx: {
|
|
521
|
+
...baseTx,
|
|
522
|
+
payload: {
|
|
523
|
+
type: "tonwhales-pool-deposit",
|
|
524
|
+
queryId: BigInt(1),
|
|
525
|
+
gasLimit: BigInt(1000),
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
rawTx: {
|
|
529
|
+
...baseRawTx,
|
|
530
|
+
payload: {
|
|
531
|
+
type: "tonwhales-pool-deposit",
|
|
532
|
+
queryId: "1",
|
|
533
|
+
gasLimit: "1000",
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: "tx with payload for tonwhales-pool-withdraw",
|
|
539
|
+
tx: {
|
|
540
|
+
...baseTx,
|
|
541
|
+
payload: {
|
|
542
|
+
type: "tonwhales-pool-withdraw",
|
|
543
|
+
queryId: BigInt(2),
|
|
544
|
+
gasLimit: BigInt(2000),
|
|
545
|
+
amount: BigInt(3000),
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
rawTx: {
|
|
549
|
+
...baseRawTx,
|
|
550
|
+
payload: {
|
|
551
|
+
type: "tonwhales-pool-withdraw",
|
|
552
|
+
queryId: "2",
|
|
553
|
+
gasLimit: "2000",
|
|
554
|
+
amount: "3000",
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: "tx with payload for vesting-send-msg-comment",
|
|
520
560
|
tx: {
|
|
521
561
|
...baseTx,
|
|
522
562
|
payload: {
|
|
523
|
-
type: "
|
|
524
|
-
|
|
525
|
-
|
|
563
|
+
type: "vesting-send-msg-comment",
|
|
564
|
+
queryId: BigInt(3),
|
|
565
|
+
sendMode: 0,
|
|
566
|
+
value: BigInt(4000),
|
|
567
|
+
destination: randomAddress,
|
|
568
|
+
text: "vesting comment",
|
|
569
|
+
},
|
|
526
570
|
},
|
|
527
571
|
rawTx: {
|
|
528
572
|
...baseRawTx,
|
|
529
573
|
payload: {
|
|
530
|
-
type: "
|
|
531
|
-
|
|
532
|
-
|
|
574
|
+
type: "vesting-send-msg-comment",
|
|
575
|
+
queryId: "3",
|
|
576
|
+
sendMode: 0,
|
|
577
|
+
value: "4000",
|
|
578
|
+
destination: rawRandomAddress,
|
|
579
|
+
text: "vesting comment",
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
// Intentionally testing an unsupported payload type.
|
|
584
|
+
{
|
|
585
|
+
name: "tx with payload we don't support",
|
|
586
|
+
// Cast via unknown to avoid direct any assertions
|
|
587
|
+
tx: {
|
|
588
|
+
...baseTx,
|
|
589
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
590
|
+
payload: { type: "fake-type", as: "is" } as unknown as Transaction["payload"],
|
|
591
|
+
},
|
|
592
|
+
rawTx: {
|
|
593
|
+
...baseRawTx,
|
|
594
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
595
|
+
payload: { type: "fake-type", as: "is" } as unknown as TransactionRaw["payload"],
|
|
533
596
|
},
|
|
534
597
|
},
|
|
535
598
|
];
|
package/src/types.ts
CHANGED
|
@@ -241,6 +241,50 @@ export type TonPayloadTokenBridgePaySwapRaw = {
|
|
|
241
241
|
swapId: string;
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
+
export type TonPayloadTonWhalesPoolDeposit = {
|
|
245
|
+
type: "tonwhales-pool-deposit";
|
|
246
|
+
queryId: bigint;
|
|
247
|
+
gasLimit: bigint;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export type TonPayloadTonWhalesPoolDepositRaw = {
|
|
251
|
+
type: "tonwhales-pool-deposit";
|
|
252
|
+
queryId: string;
|
|
253
|
+
gasLimit: string;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export type TonPayloadTonWhalesPoolWithdraw = {
|
|
257
|
+
type: "tonwhales-pool-withdraw";
|
|
258
|
+
queryId: bigint;
|
|
259
|
+
gasLimit: bigint;
|
|
260
|
+
amount: bigint;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export type TonPayloadTonWhalesPoolWithdrawRaw = {
|
|
264
|
+
type: "tonwhales-pool-withdraw";
|
|
265
|
+
queryId: string;
|
|
266
|
+
gasLimit: string;
|
|
267
|
+
amount: string;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export type TonPayloadVestingSendMsgComment = {
|
|
271
|
+
type: "vesting-send-msg-comment";
|
|
272
|
+
queryId: bigint | null;
|
|
273
|
+
sendMode: number;
|
|
274
|
+
value: bigint;
|
|
275
|
+
destination: Address;
|
|
276
|
+
text: string;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export type TonPayloadVestingSendMsgCommentRaw = {
|
|
280
|
+
type: "vesting-send-msg-comment";
|
|
281
|
+
queryId: string | null;
|
|
282
|
+
sendMode: number;
|
|
283
|
+
value: string;
|
|
284
|
+
destination: string;
|
|
285
|
+
text: string;
|
|
286
|
+
};
|
|
287
|
+
|
|
244
288
|
export type TonPayloadFormat =
|
|
245
289
|
| TonPayloadComment
|
|
246
290
|
| TonPayloadJettonTransfer
|
|
@@ -253,7 +297,10 @@ export type TonPayloadFormat =
|
|
|
253
297
|
| TonPayloadTonStakersDeposit
|
|
254
298
|
| TonPayloadVoteForProposal
|
|
255
299
|
| TonPayloadChangeDnsRecord
|
|
256
|
-
| TonPayloadTokenBridgePaySwap
|
|
300
|
+
| TonPayloadTokenBridgePaySwap
|
|
301
|
+
| TonPayloadTonWhalesPoolDeposit
|
|
302
|
+
| TonPayloadTonWhalesPoolWithdraw
|
|
303
|
+
| TonPayloadVestingSendMsgComment;
|
|
257
304
|
|
|
258
305
|
export type TonPayloadFormatRaw =
|
|
259
306
|
| TonPayloadCommentRaw
|
|
@@ -267,7 +314,10 @@ export type TonPayloadFormatRaw =
|
|
|
267
314
|
| TonPayloadTonStakersDepositRaw
|
|
268
315
|
| TonPayloadVoteForProposalRaw
|
|
269
316
|
| TonPayloadChangeDnsRecordRaw
|
|
270
|
-
| TonPayloadTokenBridgePaySwapRaw
|
|
317
|
+
| TonPayloadTokenBridgePaySwapRaw
|
|
318
|
+
| TonPayloadTonWhalesPoolDepositRaw
|
|
319
|
+
| TonPayloadTonWhalesPoolWithdrawRaw
|
|
320
|
+
| TonPayloadVestingSendMsgCommentRaw;
|
|
271
321
|
|
|
272
322
|
export interface TonTransaction {
|
|
273
323
|
to: Address;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/api.fixtures.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB,uCAAuC,CAAC;AA8BrE,QAAA,MAAM,UAAU,mCAA2B,CAAC;AAE5C,eAAe,UAAU,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.API_TON_ENDPOINT = void 0;
|
|
4
|
-
const msw_1 = require("msw");
|
|
5
|
-
const node_1 = require("msw/node");
|
|
6
|
-
const common_fixtures_1 = require("./common.fixtures");
|
|
7
|
-
// Define the mock base URL for the TON API
|
|
8
|
-
exports.API_TON_ENDPOINT = "https://ton.coin.ledger.com/api/v3";
|
|
9
|
-
// Create request handlers for the mock server
|
|
10
|
-
const handlers = [
|
|
11
|
-
// Handle GET request for masterchainInfo endpoint
|
|
12
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/masterchainInfo`, () => {
|
|
13
|
-
return msw_1.HttpResponse.json(common_fixtures_1.lastBlockNumber);
|
|
14
|
-
}),
|
|
15
|
-
// Handle GET request for transactions endpoint
|
|
16
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/transactions`, () => {
|
|
17
|
-
return msw_1.HttpResponse.json(common_fixtures_1.tonTransactionResponse);
|
|
18
|
-
}),
|
|
19
|
-
// Handle GET request for account endpoint
|
|
20
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/account`, () => {
|
|
21
|
-
return msw_1.HttpResponse.json(common_fixtures_1.tonAccount);
|
|
22
|
-
}),
|
|
23
|
-
// Handle GET request for wallet endpoint
|
|
24
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/wallet`, () => {
|
|
25
|
-
return msw_1.HttpResponse.json(common_fixtures_1.tonWallet);
|
|
26
|
-
}),
|
|
27
|
-
// Handle GET request for jetton transfers endpoint
|
|
28
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/jetton/transfers`, () => msw_1.HttpResponse.json(common_fixtures_1.jettonTransferResponse)),
|
|
29
|
-
// Handle GET request for jetton wallets endpoint
|
|
30
|
-
msw_1.http.get(`${exports.API_TON_ENDPOINT}/jetton/wallets`, () => msw_1.HttpResponse.json(common_fixtures_1.jettonWallets)),
|
|
31
|
-
// Handle POST request for estimate fee endpoint
|
|
32
|
-
msw_1.http.post(`${exports.API_TON_ENDPOINT}/estimateFee`, () => msw_1.HttpResponse.json(common_fixtures_1.tonEstimateFee)),
|
|
33
|
-
];
|
|
34
|
-
// Set up the mock server with the defined handlers
|
|
35
|
-
const mockServer = (0, node_1.setupServer)(...handlers);
|
|
36
|
-
exports.default = mockServer;
|
|
37
|
-
//# sourceMappingURL=api.fixtures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.fixtures.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/api.fixtures.ts"],"names":[],"mappings":";;;AAAA,6BAAyC;AACzC,mCAAuC;AACvC,uDAQ2B;AAE3B,2CAA2C;AAC9B,QAAA,gBAAgB,GAAG,oCAAoC,CAAC;AAErE,8CAA8C;AAC9C,MAAM,QAAQ,GAAG;IACf,kDAAkD;IAClD,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,kBAAkB,EAAE,GAAG,EAAE;QACnD,OAAO,kBAAY,CAAC,IAAI,CAAC,iCAAe,CAAC,CAAC;IAC5C,CAAC,CAAC;IACF,+CAA+C;IAC/C,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,eAAe,EAAE,GAAG,EAAE;QAChD,OAAO,kBAAY,CAAC,IAAI,CAAC,wCAAsB,CAAC,CAAC;IACnD,CAAC,CAAC;IACF,0CAA0C;IAC1C,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,UAAU,EAAE,GAAG,EAAE;QAC3C,OAAO,kBAAY,CAAC,IAAI,CAAC,4BAAU,CAAC,CAAC;IACvC,CAAC,CAAC;IACF,yCAAyC;IACzC,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,SAAS,EAAE,GAAG,EAAE;QAC1C,OAAO,kBAAY,CAAC,IAAI,CAAC,2BAAS,CAAC,CAAC;IACtC,CAAC,CAAC;IACF,mDAAmD;IACnD,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,mBAAmB,EAAE,GAAG,EAAE,CAAC,kBAAY,CAAC,IAAI,CAAC,wCAAsB,CAAC,CAAC;IACjG,iDAAiD;IACjD,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,iBAAiB,EAAE,GAAG,EAAE,CAAC,kBAAY,CAAC,IAAI,CAAC,+BAAa,CAAC,CAAC;IAEtF,gDAAgD;IAChD,UAAI,CAAC,IAAI,CAAC,GAAG,wBAAgB,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAY,CAAC,IAAI,CAAC,gCAAc,CAAC,CAAC;CACtF,CAAC;AAEF,mDAAmD;AACnD,MAAM,UAAU,GAAG,IAAA,kBAAW,EAAC,GAAG,QAAQ,CAAC,CAAC;AAE5C,kBAAe,UAAU,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { TonAccountInfo, TonResponseEstimateFee, TonResponseJettonTransfer, TonResponseJettonWallets, TonResponseWalletInfo, TonTransactionsList } from "../../bridge/bridgeHelpers/api.types";
|
|
3
|
-
import type { TonAccount, TonSubAccount, Transaction } from "../../types";
|
|
4
|
-
export declare const mockAddress = "UQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbMol";
|
|
5
|
-
export declare const mockAccountId = "js:2:ton:b19891a06654f21c64147550b3321bef63acd25b5dd61b688b022c42fac4831d:ton";
|
|
6
|
-
export declare const tokenAccount: TonSubAccount;
|
|
7
|
-
export declare const account: TonAccount;
|
|
8
|
-
export declare const transaction: Transaction;
|
|
9
|
-
export declare const jettonTransaction: Transaction;
|
|
10
|
-
export declare const fees: {
|
|
11
|
-
in_fwd_fee: number;
|
|
12
|
-
storage_fee: number;
|
|
13
|
-
gas_fee: number;
|
|
14
|
-
fwd_fee: number;
|
|
15
|
-
};
|
|
16
|
-
export declare const totalFees: BigNumber;
|
|
17
|
-
export declare const lastBlockNumber: {
|
|
18
|
-
last: {
|
|
19
|
-
seqno: number;
|
|
20
|
-
};
|
|
21
|
-
first: {
|
|
22
|
-
seqno: number;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare const tonAccount: TonAccountInfo;
|
|
26
|
-
export declare const tonWallet: TonResponseWalletInfo;
|
|
27
|
-
export declare const jettonWallets: TonResponseJettonWallets;
|
|
28
|
-
export declare const tonEstimateFee: TonResponseEstimateFee;
|
|
29
|
-
export declare const jettonTransferResponse: TonResponseJettonTransfer;
|
|
30
|
-
export declare const tonTransactionResponse: TonTransactionsList;
|
|
31
|
-
export declare const accountInfo: TonAccountInfo;
|
|
32
|
-
//# sourceMappingURL=common.fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/common.fixtures.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1E,eAAO,MAAM,WAAW,qDAAqD,CAAC;AAC9E,eAAO,MAAM,aAAa,kFACuD,CAAC;AAElF,eAAO,MAAM,YAAY,eAeP,CAAC;AAEnB,eAAO,MAAM,OAAO,YAWL,CAAC;AAEhB,eAAO,MAAM,WAAW,EAAE,WAOzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAG/B,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,SAAS,WAErB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CAO3B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAMxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,qBAQvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,wBAY3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,sBAG5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,yBAkBpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,mBAkDpC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAC"}
|
|
@@ -1,176 +0,0 @@
|
|
|
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
|
-
exports.accountInfo = exports.tonTransactionResponse = exports.jettonTransferResponse = exports.tonEstimateFee = exports.jettonWallets = exports.tonWallet = exports.tonAccount = exports.lastBlockNumber = exports.totalFees = exports.fees = exports.jettonTransaction = exports.transaction = exports.account = exports.tokenAccount = exports.mockAccountId = exports.mockAddress = void 0;
|
|
7
|
-
const currencies_1 = require("@ledgerhq/cryptoassets/currencies");
|
|
8
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
-
exports.mockAddress = "UQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbMol";
|
|
10
|
-
exports.mockAccountId = "js:2:ton:b19891a06654f21c64147550b3321bef63acd25b5dd61b688b022c42fac4831d:ton";
|
|
11
|
-
exports.tokenAccount = {
|
|
12
|
-
id: "subAccountId",
|
|
13
|
-
type: "TokenAccount",
|
|
14
|
-
spendableBalance: new bignumber_js_1.default("5000000"),
|
|
15
|
-
token: {
|
|
16
|
-
contractAddress: "contractAddress",
|
|
17
|
-
units: [
|
|
18
|
-
{
|
|
19
|
-
code: "NOT",
|
|
20
|
-
magnitude: 9,
|
|
21
|
-
name: "Notcoin",
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
jettonWallet: "0:A2CC9B938389950125001F6B8AF280CACA23BE045714AD69387DD546588D667E",
|
|
26
|
-
};
|
|
27
|
-
exports.account = {
|
|
28
|
-
id: exports.mockAccountId,
|
|
29
|
-
freshAddress: exports.mockAddress,
|
|
30
|
-
freshAddressPath: "44'/607'/0'/0'/0'/0'",
|
|
31
|
-
xpub: "",
|
|
32
|
-
type: "Account",
|
|
33
|
-
currency: (0, currencies_1.getCryptoCurrencyById)("ton"),
|
|
34
|
-
spendableBalance: new bignumber_js_1.default("1000000000"),
|
|
35
|
-
balance: new bignumber_js_1.default("1000000000"),
|
|
36
|
-
seedIdentifier: "seedIdentifier",
|
|
37
|
-
subAccounts: [exports.tokenAccount],
|
|
38
|
-
};
|
|
39
|
-
exports.transaction = {
|
|
40
|
-
recipient: "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4",
|
|
41
|
-
amount: new bignumber_js_1.default("1000000"),
|
|
42
|
-
useAllAmount: false,
|
|
43
|
-
comment: { isEncrypted: false, text: "" },
|
|
44
|
-
family: "ton",
|
|
45
|
-
fees: new bignumber_js_1.default(1000),
|
|
46
|
-
};
|
|
47
|
-
exports.jettonTransaction = {
|
|
48
|
-
...exports.transaction,
|
|
49
|
-
subAccountId: "subAccountId",
|
|
50
|
-
};
|
|
51
|
-
exports.fees = {
|
|
52
|
-
in_fwd_fee: 10000,
|
|
53
|
-
storage_fee: 10000,
|
|
54
|
-
gas_fee: 10000,
|
|
55
|
-
fwd_fee: 10000,
|
|
56
|
-
};
|
|
57
|
-
exports.totalFees = (0, bignumber_js_1.default)(exports.fees.fwd_fee + exports.fees.gas_fee + exports.fees.in_fwd_fee + exports.fees.storage_fee);
|
|
58
|
-
exports.lastBlockNumber = {
|
|
59
|
-
last: {
|
|
60
|
-
seqno: 38574413,
|
|
61
|
-
},
|
|
62
|
-
first: {
|
|
63
|
-
seqno: 3,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
exports.tonAccount = {
|
|
67
|
-
balance: "1000000000",
|
|
68
|
-
last_transaction_lt: "47055058000008",
|
|
69
|
-
last_transaction_hash: "psVQqt6rf/Lo6xyLzxx0to0jUIx8I2/4znOVf2KhAI0=",
|
|
70
|
-
status: "active",
|
|
71
|
-
seqno: 3,
|
|
72
|
-
};
|
|
73
|
-
exports.tonWallet = {
|
|
74
|
-
balance: "7726736262",
|
|
75
|
-
wallet_type: "wallet v4 r2",
|
|
76
|
-
seqno: 22,
|
|
77
|
-
wallet_id: 698983191,
|
|
78
|
-
last_transaction_lt: "47055058000008",
|
|
79
|
-
last_transaction_hash: "psVQqt6rf/Lo6xyLzxx0to0jUIx8I2/4znOVf2KhAI0=",
|
|
80
|
-
status: "active",
|
|
81
|
-
};
|
|
82
|
-
exports.jettonWallets = {
|
|
83
|
-
jetton_wallets: [
|
|
84
|
-
{
|
|
85
|
-
address: "0:495AB6C978E3C0AE7FCF863A2D4504E37CE8D2D04A5E59048301BA29EC372F79",
|
|
86
|
-
balance: "1200000000000",
|
|
87
|
-
owner: "0:D02D314791CB10EF3F964CC7421E4F46348C262444946F7A64C2374700E3ED19",
|
|
88
|
-
jetton: "0:3C52A0A732A83F022E517E5C2715E0EE458A4B9772580E903FF491526C3E9137",
|
|
89
|
-
last_transaction_lt: "30345242000008",
|
|
90
|
-
code_hash: "3axDia4eCUnTVixqU0/BUA4i8id5BtVw1pt/yayZd6k=",
|
|
91
|
-
data_hash: "P8j0kENM5s4zE2w5IpD8NrrSneGQ7d0mzs5yTBNPlqo=",
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
};
|
|
95
|
-
exports.tonEstimateFee = {
|
|
96
|
-
source_fees: exports.fees,
|
|
97
|
-
destination_fees: [],
|
|
98
|
-
};
|
|
99
|
-
exports.jettonTransferResponse = {
|
|
100
|
-
jetton_transfers: [
|
|
101
|
-
{
|
|
102
|
-
query_id: "1",
|
|
103
|
-
source: "UQDnqcVSV4S9m2Y9gLAQrDerQktKSx2I1uhs6r5o_H8VT4x7",
|
|
104
|
-
destination: exports.mockAddress,
|
|
105
|
-
amount: "",
|
|
106
|
-
source_wallet: "",
|
|
107
|
-
jetton_master: "0:2F956143C461769579BAEF2E32CC2D7BC18283F40D20BB03E432CD603AC33FFC",
|
|
108
|
-
transaction_hash: "",
|
|
109
|
-
transaction_lt: "",
|
|
110
|
-
transaction_now: 0,
|
|
111
|
-
response_destination: "",
|
|
112
|
-
custom_payload: null,
|
|
113
|
-
forward_ton_amount: "",
|
|
114
|
-
forward_payload: null,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
exports.tonTransactionResponse = {
|
|
119
|
-
transactions: [
|
|
120
|
-
{
|
|
121
|
-
account: exports.mockAddress,
|
|
122
|
-
hash: "hash",
|
|
123
|
-
lt: "lt",
|
|
124
|
-
now: 1718241443,
|
|
125
|
-
orig_status: "active",
|
|
126
|
-
end_status: "active",
|
|
127
|
-
total_fees: "0",
|
|
128
|
-
prev_trans_hash: "",
|
|
129
|
-
prev_trans_lt: "",
|
|
130
|
-
description: {
|
|
131
|
-
aborted: true,
|
|
132
|
-
destroyed: false,
|
|
133
|
-
compute_ph: {
|
|
134
|
-
success: false,
|
|
135
|
-
exit_code: -14,
|
|
136
|
-
},
|
|
137
|
-
credit_first: true,
|
|
138
|
-
},
|
|
139
|
-
block_ref: null,
|
|
140
|
-
in_msg: {
|
|
141
|
-
source: "0:959EAA8BD0E3A2662D814278D51A6F997946207D48478008BEBE7F45F3EF781F",
|
|
142
|
-
destination: exports.mockAddress,
|
|
143
|
-
value: "13509565",
|
|
144
|
-
hash: "inMsgHash",
|
|
145
|
-
fwd_fee: "266669",
|
|
146
|
-
ihr_fee: "0",
|
|
147
|
-
created_lt: "47055058000007",
|
|
148
|
-
created_at: "1718241443",
|
|
149
|
-
opcode: "0xd53276db",
|
|
150
|
-
ihr_disabled: true,
|
|
151
|
-
bounce: false,
|
|
152
|
-
bounced: false,
|
|
153
|
-
import_fee: null,
|
|
154
|
-
message_content: {
|
|
155
|
-
hash: "Qa0w2xg42wA9taurO/aCVOqGTzjOeP3EpzD2Sl7tTss=",
|
|
156
|
-
body: "te6cckEBAQEADgAAGNUydtsAAAAAAAAAAfRC8y4=",
|
|
157
|
-
decoded: null,
|
|
158
|
-
},
|
|
159
|
-
init_state: null,
|
|
160
|
-
},
|
|
161
|
-
out_msgs: [],
|
|
162
|
-
account_state_before: null,
|
|
163
|
-
account_state_after: null,
|
|
164
|
-
mc_block_seqno: 3,
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
address_book: {},
|
|
168
|
-
};
|
|
169
|
-
exports.accountInfo = {
|
|
170
|
-
balance: "7726736262",
|
|
171
|
-
last_transaction_lt: "47055058000008",
|
|
172
|
-
last_transaction_hash: "lastTransactionHash",
|
|
173
|
-
status: "active",
|
|
174
|
-
seqno: 22,
|
|
175
|
-
};
|
|
176
|
-
//# sourceMappingURL=common.fixtures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.fixtures.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/common.fixtures.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA0E;AAC1E,gEAAqC;AAWxB,QAAA,WAAW,GAAG,kDAAkD,CAAC;AACjE,QAAA,aAAa,GACxB,+EAA+E,CAAC;AAErE,QAAA,YAAY,GAAG;IAC1B,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,gBAAgB,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC;IAC1C,KAAK,EAAE;QACL,eAAe,EAAE,iBAAiB;QAClC,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,KAAK;gBACX,SAAS,EAAE,CAAC;gBACZ,IAAI,EAAE,SAAS;aAChB;SACF;KACF;IACD,YAAY,EAAE,oEAAoE;CAClE,CAAC;AAEN,QAAA,OAAO,GAAG;IACrB,EAAE,EAAE,qBAAa;IACjB,YAAY,EAAE,mBAAW;IACzB,gBAAgB,EAAE,sBAAsB;IACxC,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X,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE;oBACV,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,CAAC,EAAE;iBACf;gBACD,YAAY,EAAE,IAAI;aACnB;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE;gBACN,MAAM,EAAE,oEAAoE;gBAC5E,WAAW,EAAE,mBAAW;gBACxB,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,GAAG;gBACZ,UAAU,EAAE,gBAAgB;gBAC5B,UAAU,EAAE,YAAY;gBACxB,MAAM,EAAE,YAAY;gBACpB,YAAY,EAAE,IAAI;gBAClB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE;oBACf,IAAI,EAAE,8CAA8C;oBACpD,IAAI,EAAE,0CAA0C;oBAChD,OAAO,EAAE,IAAI;iBACd;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,QAAQ,EAAE,EAAE;YACZ,oBAAoB,EAAE,IAAI;YAC1B,mBAAmB,EAAE,IAAI;YACzB,cAAc,EAAE,CAAC;SAClB;KACF;IACD,YAAY,EAAE,EAAE;CACjB,CAAC;AAEW,QAAA,WAAW,GAAmB;IACzC,OAAO,EAAE,YAAY;IACrB,mBAAmB,EAAE,gBAAgB;IACrC,qBAAqB,EAAE,qBAAqB;IAC5C,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,EAAE;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/bridge.integration.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInE,OAAO,EAAc,WAAW,EAAE,MAAM,aAAa,CAAC;AA+LtD,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAK5C,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/bridge.integration.test.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAoE;AAEpE,gEAAqC;AACrC,yCAAiD;AACjD,mDAAuD;AAEvD,uCAAiD;AAEjD,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAClF,MAAM,OAAO,GAAG,kDAAkD,CAAC;AACnE,MAAM,SAAS,GAAG,kDAAkD,CAAC;AACrE,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,UAAU,GACd,yKAAyK,CAAC;AAE5K,MAAM,GAAG,GAAgC;IACvC,8BAA8B,EAAE,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE;;;;;OAKN;YACD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;gBACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;SACF;KACF;IACD,QAAQ,EAAE;QACR;YACE,WAAW,EAAE;gBACX,uBAAuB;gBACvB,iCAAiC,EAAE,mFAAmF;aACvH;YACD,GAAG,EAAE;gBACH,EAAE,EAAE,YAAY,MAAM,MAAM;gBAC5B,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,MAAM;gBACtB,IAAI,EAAE,OAAO;gBACb,cAAc,EAAE,KAAK;gBACrB,KAAK,EAAE,CAAC;gBACR,YAAY,EAAE,OAAO;gBACrB,gBAAgB,EAAE,IAAI;gBACtB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,EAAE;gBACd,iBAAiB,EAAE,E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IAAI,CAAC;IACvB,UAAU,EAAE;QACV,GAAG;KACJ;CACF,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/api.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const api_1 = require("../../bridge/bridgeHelpers/api");
|
|
27
|
-
const config_1 = require("../../config");
|
|
28
|
-
const api_fixtures_1 = __importStar(require("../fixtures/api.fixtures"));
|
|
29
|
-
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
30
|
-
describe("getAccount", () => {
|
|
31
|
-
beforeAll(() => {
|
|
32
|
-
(0, config_1.setCoinConfig)(() => ({
|
|
33
|
-
status: {
|
|
34
|
-
type: "active",
|
|
35
|
-
},
|
|
36
|
-
infra: {
|
|
37
|
-
API_TON_ENDPOINT: api_fixtures_1.API_TON_ENDPOINT,
|
|
38
|
-
KNOWN_JETTONS: [],
|
|
39
|
-
},
|
|
40
|
-
}));
|
|
41
|
-
api_fixtures_1.default.listen();
|
|
42
|
-
});
|
|
43
|
-
afterAll(() => {
|
|
44
|
-
api_fixtures_1.default.close();
|
|
45
|
-
});
|
|
46
|
-
it("should return last block number", async () => {
|
|
47
|
-
const result = await (0, api_1.fetchLastBlockNumber)();
|
|
48
|
-
expect(result).toEqual(common_fixtures_1.lastBlockNumber.last.seqno);
|
|
49
|
-
});
|
|
50
|
-
it("should return the transactions of an address", async () => {
|
|
51
|
-
const result = await (0, api_1.fetchTransactions)(common_fixtures_1.mockAddress);
|
|
52
|
-
expect(result).toEqual(common_fixtures_1.tonTransactionResponse);
|
|
53
|
-
});
|
|
54
|
-
it("should return the ton account info of an address", async () => {
|
|
55
|
-
const result = await (0, api_1.fetchAccountInfo)(common_fixtures_1.mockAddress);
|
|
56
|
-
expect(result).toEqual({
|
|
57
|
-
balance: common_fixtures_1.tonAccount.balance,
|
|
58
|
-
last_transaction_lt: common_fixtures_1.tonAccount.last_transaction_lt,
|
|
59
|
-
last_transaction_hash: common_fixtures_1.tonAccount.last_transaction_hash,
|
|
60
|
-
status: common_fixtures_1.tonAccount.status,
|
|
61
|
-
seqno: common_fixtures_1.tonWallet.seqno,
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
it("should return the jetton transactions", async () => {
|
|
65
|
-
const result = await (0, api_1.fetchJettonTransactions)(common_fixtures_1.mockAddress);
|
|
66
|
-
expect(result).toEqual(common_fixtures_1.jettonTransferResponse.jetton_transfers);
|
|
67
|
-
});
|
|
68
|
-
it("should return the jetton wallets", async () => {
|
|
69
|
-
const result = await (0, api_1.fetchJettonWallets)();
|
|
70
|
-
expect(result).toEqual(common_fixtures_1.jettonWallets.jetton_wallets);
|
|
71
|
-
});
|
|
72
|
-
it("should return the estimated fees", async () => {
|
|
73
|
-
const result = await (0, api_1.estimateFee)(common_fixtures_1.mockAddress, "");
|
|
74
|
-
expect(result).toEqual(common_fixtures_1.tonEstimateFee.source_fees);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=api.unit.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/api.unit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAOwC;AACxC,yCAA6C;AAC7C,yEAAwE;AACxE,iEASqC;AAErC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,sBAAa,EAAC,GAAG,EAAE,CAAC,CAAC;YACnB,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;aACf;YACD,KAAK,EAAE;gBACL,gBAAgB,EAAE,+BAAgB;gBAClC,aAAa,EAAE,EAAE;aAClB;SACF,CAAC,CAAC,CAAC;QACJ,sBAAU,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAG,EAAE;QACZ,sBAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAoB,GAAE,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,iCAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KA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AAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/broadcast.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
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 api_1 = require("../../bridge/bridgeHelpers/api");
|
|
8
|
-
const broadcast_1 = __importDefault(require("../../broadcast"));
|
|
9
|
-
const signOperation_1 = require("../../signOperation");
|
|
10
|
-
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
11
|
-
jest.mock("../../bridge/bridgeHelpers/api");
|
|
12
|
-
const mockedHash = "validHash";
|
|
13
|
-
describe("broadcast", () => {
|
|
14
|
-
beforeAll(() => {
|
|
15
|
-
const broadcastTxMock = jest.mocked(api_1.broadcastTx);
|
|
16
|
-
broadcastTxMock.mockReturnValue(Promise.resolve(mockedHash));
|
|
17
|
-
});
|
|
18
|
-
it("should broadcast the coin transaction and add the hash in the optimistic transaction", async () => {
|
|
19
|
-
const optimisticCoinOperation = (0, signOperation_1.buildOptimisticOperation)(common_fixtures_1.account, common_fixtures_1.transaction);
|
|
20
|
-
const finalOperation = await (0, broadcast_1.default)({
|
|
21
|
-
account: common_fixtures_1.account,
|
|
22
|
-
signedOperation: {
|
|
23
|
-
operation: optimisticCoinOperation,
|
|
24
|
-
signature: "0xS1gn4tUR3",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
expect(api_1.broadcastTx).toHaveBeenCalled();
|
|
28
|
-
expect(finalOperation).toEqual({
|
|
29
|
-
...optimisticCoinOperation,
|
|
30
|
-
id: (0, operation_1.encodeOperationId)(common_fixtures_1.account.id, mockedHash, "OUT"),
|
|
31
|
-
hash: mockedHash,
|
|
32
|
-
subOperations: [],
|
|
33
|
-
nftOperations: [],
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=broadcast.unit.test.js.map
|