@ledgerhq/coin-ton 0.15.0-nightly.8 → 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.
Files changed (144) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +24 -86
  3. package/lib/__tests__/fixtures/api.fixtures.d.ts +4 -0
  4. package/lib/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
  5. package/lib/__tests__/fixtures/api.fixtures.js +37 -0
  6. package/lib/__tests__/fixtures/api.fixtures.js.map +1 -0
  7. package/lib/__tests__/fixtures/common.fixtures.d.ts +32 -0
  8. package/lib/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
  9. package/lib/__tests__/fixtures/common.fixtures.js +176 -0
  10. package/lib/__tests__/fixtures/common.fixtures.js.map +1 -0
  11. package/lib/__tests__/integration/bridge.integration.test.d.ts +14 -0
  12. package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
  13. package/lib/__tests__/integration/bridge.integration.test.js +213 -0
  14. package/lib/__tests__/integration/bridge.integration.test.js.map +1 -0
  15. package/lib/__tests__/unit/api.unit.test.d.ts +2 -0
  16. package/lib/__tests__/unit/api.unit.test.d.ts.map +1 -0
  17. package/lib/__tests__/unit/api.unit.test.js +77 -0
  18. package/lib/__tests__/unit/api.unit.test.js.map +1 -0
  19. package/lib/__tests__/unit/broadcast.unit.test.d.ts +2 -0
  20. package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
  21. package/lib/__tests__/unit/broadcast.unit.test.js +37 -0
  22. package/lib/__tests__/unit/broadcast.unit.test.js.map +1 -0
  23. package/lib/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
  24. package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
  25. package/lib/__tests__/unit/createTransaction.unit.test.js +25 -0
  26. package/lib/__tests__/unit/createTransaction.unit.test.js.map +1 -0
  27. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
  28. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  29. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +111 -0
  30. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
  31. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
  32. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  33. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +30 -0
  34. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
  35. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
  36. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
  37. package/lib/__tests__/unit/getTransactionStatus.unit.test.js +120 -0
  38. package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
  39. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
  40. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
  41. package/lib/__tests__/unit/hw-getAddress.unit.test.js +54 -0
  42. package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
  43. package/lib/__tests__/unit/logic.unit.test.d.ts +2 -0
  44. package/lib/__tests__/unit/logic.unit.test.d.ts.map +1 -0
  45. package/lib/__tests__/unit/logic.unit.test.js +18 -0
  46. package/lib/__tests__/unit/logic.unit.test.js.map +1 -0
  47. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
  48. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
  49. package/lib/__tests__/unit/prepareTransaction.unit.test.js +109 -0
  50. package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
  51. package/lib/__tests__/unit/signOperation.unit.test.d.ts +2 -0
  52. package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
  53. package/lib/__tests__/unit/signOperation.unit.test.js +72 -0
  54. package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -0
  55. package/lib/__tests__/unit/txn.unit.test.d.ts +2 -0
  56. package/lib/__tests__/unit/txn.unit.test.d.ts.map +1 -0
  57. package/lib/__tests__/unit/txn.unit.test.js +298 -0
  58. package/lib/__tests__/unit/txn.unit.test.js.map +1 -0
  59. package/lib/__tests__/unit/utils.unit.test.d.ts +2 -0
  60. package/lib/__tests__/unit/utils.unit.test.d.ts.map +1 -0
  61. package/lib/__tests__/unit/utils.unit.test.js +211 -0
  62. package/lib/__tests__/unit/utils.unit.test.js.map +1 -0
  63. package/lib/transaction.d.ts.map +1 -1
  64. package/lib/transaction.js +0 -44
  65. package/lib/transaction.js.map +1 -1
  66. package/lib/transaction.unit.test.d.ts +2 -0
  67. package/lib/transaction.unit.test.d.ts.map +1 -0
  68. package/lib/transaction.unit.test.js +600 -0
  69. package/lib/transaction.unit.test.js.map +1 -0
  70. package/lib/types.d.ts +2 -40
  71. package/lib/types.d.ts.map +1 -1
  72. package/lib-es/__tests__/fixtures/api.fixtures.d.ts +4 -0
  73. package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
  74. package/lib-es/__tests__/fixtures/api.fixtures.js +34 -0
  75. package/lib-es/__tests__/fixtures/api.fixtures.js.map +1 -0
  76. package/lib-es/__tests__/fixtures/common.fixtures.d.ts +32 -0
  77. package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
  78. package/lib-es/__tests__/fixtures/common.fixtures.js +170 -0
  79. package/lib-es/__tests__/fixtures/common.fixtures.js.map +1 -0
  80. package/lib-es/__tests__/integration/bridge.integration.test.d.ts +14 -0
  81. package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
  82. package/lib-es/__tests__/integration/bridge.integration.test.js +207 -0
  83. package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -0
  84. package/lib-es/__tests__/unit/api.unit.test.d.ts +2 -0
  85. package/lib-es/__tests__/unit/api.unit.test.d.ts.map +1 -0
  86. package/lib-es/__tests__/unit/api.unit.test.js +52 -0
  87. package/lib-es/__tests__/unit/api.unit.test.js.map +1 -0
  88. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +2 -0
  89. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
  90. package/lib-es/__tests__/unit/broadcast.unit.test.js +32 -0
  91. package/lib-es/__tests__/unit/broadcast.unit.test.js.map +1 -0
  92. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
  93. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
  94. package/lib-es/__tests__/unit/createTransaction.unit.test.js +20 -0
  95. package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +1 -0
  96. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
  97. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  98. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +106 -0
  99. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
  100. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
  101. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  102. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +25 -0
  103. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
  104. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
  105. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
  106. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +115 -0
  107. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
  108. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
  109. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
  110. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +49 -0
  111. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
  112. package/lib-es/__tests__/unit/logic.unit.test.d.ts +2 -0
  113. package/lib-es/__tests__/unit/logic.unit.test.d.ts.map +1 -0
  114. package/lib-es/__tests__/unit/logic.unit.test.js +16 -0
  115. package/lib-es/__tests__/unit/logic.unit.test.js.map +1 -0
  116. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
  117. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
  118. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +81 -0
  119. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
  120. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +2 -0
  121. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
  122. package/lib-es/__tests__/unit/signOperation.unit.test.js +67 -0
  123. package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -0
  124. package/lib-es/__tests__/unit/txn.unit.test.d.ts +2 -0
  125. package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +1 -0
  126. package/lib-es/__tests__/unit/txn.unit.test.js +293 -0
  127. package/lib-es/__tests__/unit/txn.unit.test.js.map +1 -0
  128. package/lib-es/__tests__/unit/utils.unit.test.d.ts +2 -0
  129. package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +1 -0
  130. package/lib-es/__tests__/unit/utils.unit.test.js +186 -0
  131. package/lib-es/__tests__/unit/utils.unit.test.js.map +1 -0
  132. package/lib-es/transaction.d.ts.map +1 -1
  133. package/lib-es/transaction.js +0 -44
  134. package/lib-es/transaction.js.map +1 -1
  135. package/lib-es/transaction.unit.test.d.ts +2 -0
  136. package/lib-es/transaction.unit.test.d.ts.map +1 -0
  137. package/lib-es/transaction.unit.test.js +595 -0
  138. package/lib-es/transaction.unit.test.js.map +1 -0
  139. package/lib-es/types.d.ts +2 -40
  140. package/lib-es/types.d.ts.map +1 -1
  141. package/package.json +11 -11
  142. package/src/transaction.ts +0 -44
  143. package/src/transaction.unit.test.ts +8 -71
  144. package/src/types.ts +2 -52
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createTransaction.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransaction.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/createTransaction.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import BigNumber from "bignumber.js";
2
+ import createTransaction from "../../createTransaction";
3
+ import { account } from "../fixtures/common.fixtures";
4
+ describe("createTransaction", () => {
5
+ it("should create a valid transaction", async () => {
6
+ const res = createTransaction(account);
7
+ expect(res).toEqual({
8
+ family: "ton",
9
+ amount: new BigNumber(0),
10
+ fees: new BigNumber(0),
11
+ recipient: "",
12
+ useAllAmount: false,
13
+ comment: {
14
+ isEncrypted: false,
15
+ text: "",
16
+ },
17
+ });
18
+ });
19
+ });
20
+ //# sourceMappingURL=createTransaction.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransaction.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/createTransaction.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,GAAG,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;YACxB,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;YACtB,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACP,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,EAAE;aACT;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deviceTransactionConfig.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceTransactionConfig.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/deviceTransactionConfig.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
2
+ import { getAccountCurrency } from "@ledgerhq/coin-framework/lib/account/index";
3
+ import { toNano } from "@ton/core";
4
+ import BigNumber from "bignumber.js";
5
+ import { TOKEN_TRANSFER_MAX_FEE } from "../../constants";
6
+ import getDeviceTransactionConfig from "../../deviceTransactionConfig";
7
+ import { account, transaction as baseTransaction, jettonTransaction, } from "../fixtures/common.fixtures";
8
+ const status = {
9
+ errors: {},
10
+ warnings: {},
11
+ estimatedFees: new BigNumber(0),
12
+ amount: new BigNumber(0),
13
+ totalSpent: new BigNumber(0),
14
+ };
15
+ describe("deviceTransactionConfig", () => {
16
+ describe("TON transaction", () => {
17
+ it("should return the fields for a transaction when there is a valid comment", async () => {
18
+ const transaction = {
19
+ ...baseTransaction,
20
+ comment: { isEncrypted: false, text: "validComment" },
21
+ };
22
+ const res = await getDeviceTransactionConfig({
23
+ account: account,
24
+ parentAccount: undefined,
25
+ transaction,
26
+ status,
27
+ });
28
+ expect(res).toEqual([
29
+ {
30
+ type: "address",
31
+ label: "To",
32
+ address: transaction.recipient,
33
+ },
34
+ {
35
+ type: "amount",
36
+ label: "Amount",
37
+ },
38
+ { type: "fees", label: "Fee" },
39
+ { type: "text", label: "Comment", value: "validComment" },
40
+ ]);
41
+ });
42
+ it("should return the fields for a transaction when useAllAmount is true and there is a valid comment", async () => {
43
+ const transaction = {
44
+ ...baseTransaction,
45
+ useAllAmount: true,
46
+ comment: { isEncrypted: false, text: "validComment" },
47
+ };
48
+ const res = await getDeviceTransactionConfig({
49
+ account: account,
50
+ parentAccount: undefined,
51
+ transaction,
52
+ status,
53
+ });
54
+ expect(res).toEqual([
55
+ {
56
+ type: "address",
57
+ label: "To",
58
+ address: transaction.recipient,
59
+ },
60
+ {
61
+ type: "text",
62
+ label: "Amount",
63
+ value: "ALL YOUR TONs",
64
+ },
65
+ { type: "fees", label: "Fee" },
66
+ { type: "text", label: "Comment", value: "validComment" },
67
+ ]);
68
+ });
69
+ });
70
+ describe("Jetton transaction", () => {
71
+ it("should return the fields for a jetton transaction", async () => {
72
+ if (account.subAccounts?.[0]) {
73
+ const res = await getDeviceTransactionConfig({
74
+ account: account.subAccounts[0],
75
+ parentAccount: account,
76
+ transaction: jettonTransaction,
77
+ status,
78
+ });
79
+ expect(res).toEqual([
80
+ {
81
+ type: "address",
82
+ label: "To",
83
+ address: jettonTransaction.recipient,
84
+ },
85
+ {
86
+ type: "text",
87
+ label: "Jetton amount",
88
+ value: formatCurrencyUnit(getAccountCurrency(account.subAccounts[0]).units[0], jettonTransaction.amount, {
89
+ showCode: true,
90
+ disableRounding: true,
91
+ }),
92
+ },
93
+ {
94
+ type: "text",
95
+ label: "Amount",
96
+ value: formatCurrencyUnit(getAccountCurrency(account).units[0], BigNumber(toNano(TOKEN_TRANSFER_MAX_FEE).toString()), {
97
+ showCode: true,
98
+ disableRounding: true,
99
+ }),
100
+ },
101
+ ]);
102
+ }
103
+ });
104
+ });
105
+ });
106
+ //# sourceMappingURL=deviceTransactionConfig.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceTransactionConfig.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/deviceTransactionConfig.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE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oBAClB;wBACE,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,IAAI;wBACX,OAAO,EAAE,iBAAiB,CAAC,SAAS;qBACrC;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,eAAe;wBACtB,KAAK,EAAE,kBAAkB,CACvB,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACnD,iBAAiB,CAAC,MAAM,EACxB;4BACE,QAAQ,EAAE,IAAI;4BACd,eAAe,EAAE,IAAI;yBACtB,CACF;qBACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,kBAAkB,CACvB,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACpC,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE,CAAC,EACpD;4BACE,QAAQ,EAAE,IAAI;4BACd,eAAe,EAAE,IAAI;yBACtB,CACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=estimateMaxSpendable.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateMaxSpendable.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/estimateMaxSpendable.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { estimateFee, fetchAccountInfo } from "../../bridge/bridgeHelpers/api";
2
+ import estimateMaxSpendable from "../../estimateMaxSpendable";
3
+ import { account, accountInfo, fees, jettonTransaction, tokenAccount, totalFees, transaction, } from "../fixtures/common.fixtures";
4
+ jest.mock("../../bridge/bridgeHelpers/api");
5
+ describe("estimateMaxSpendable", () => {
6
+ beforeAll(() => {
7
+ const fetchAccountInfoMock = jest.mocked(fetchAccountInfo);
8
+ fetchAccountInfoMock.mockReturnValue(Promise.resolve(accountInfo));
9
+ const fetchEstimateFeeMock = jest.mocked(estimateFee);
10
+ fetchEstimateFeeMock.mockReturnValue(Promise.resolve(fees));
11
+ });
12
+ it("should return the max spendable for a TON transaction", async () => {
13
+ const res = await estimateMaxSpendable({ account, transaction });
14
+ expect(res).toEqual(account.balance.minus(totalFees));
15
+ });
16
+ it("should return the max spendable for a jetton transfer", async () => {
17
+ const res = await estimateMaxSpendable({
18
+ account: tokenAccount,
19
+ parentAccount: account,
20
+ transaction: jettonTransaction,
21
+ });
22
+ expect(res).toEqual(tokenAccount.spendableBalance);
23
+ });
24
+ });
25
+ //# sourceMappingURL=estimateMaxSpendable.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateMaxSpendable.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/estimateMaxSpendable.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAErC,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAE5C,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC3D,oBAAoB,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACnE,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACtD,oBAAoB,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC;YACrC,OAAO,EAAE,YAAY;YACrB,aAAa,EAAE,OAAO;YACtB,WAAW,EAAE,iBAAiB;SAC/B,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getTransactionStatus.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTransactionStatus.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/getTransactionStatus.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,115 @@
1
+ import { AmountRequired, InvalidAddress, InvalidAddressBecauseDestinationIsAlsoSource, NotEnoughBalance, RecipientRequired, } from "@ledgerhq/errors";
2
+ import BigNumber from "bignumber.js";
3
+ import { TonCommentInvalid, TonExcessFee } from "../../errors";
4
+ import getTransactionStatus from "../../getTransactionStatus";
5
+ import { account, transaction as baseTransaction, jettonTransaction, } from "../fixtures/common.fixtures";
6
+ describe("getTransactionStatus", () => {
7
+ describe("Recipient", () => {
8
+ it("should detect the missing recipient and have an error", async () => {
9
+ const transaction = { ...baseTransaction, recipient: "" };
10
+ const res = await getTransactionStatus(account, transaction);
11
+ expect(res.errors).toEqual(expect.objectContaining({
12
+ recipient: new RecipientRequired(),
13
+ }));
14
+ });
15
+ it("should detect the incorrect recipient and have an error", async () => {
16
+ const transaction = { ...baseTransaction, recipient: "isInvalid" };
17
+ const res = await getTransactionStatus(account, transaction);
18
+ expect(res.errors).toEqual(expect.objectContaining({
19
+ recipient: new InvalidAddress("", {
20
+ currencyName: account.currency.name,
21
+ }),
22
+ }));
23
+ });
24
+ it("should detect the recipient and the sender are the same and have an error", async () => {
25
+ const transaction = {
26
+ ...baseTransaction,
27
+ recipient: "UQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbMol",
28
+ };
29
+ const res = await getTransactionStatus(account, transaction);
30
+ expect(res.errors).toEqual(expect.objectContaining({
31
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource("", {
32
+ currencyName: account.currency.name,
33
+ }),
34
+ }));
35
+ });
36
+ });
37
+ describe("Sender", () => {
38
+ it("should detect the sender is not correct and have an error", async () => {
39
+ const tempAccount = { ...account, freshAddress: "isInvalid" };
40
+ const res = await getTransactionStatus(tempAccount, baseTransaction);
41
+ expect(res.errors).toEqual(expect.objectContaining({
42
+ sender: new InvalidAddress(),
43
+ }));
44
+ });
45
+ });
46
+ describe("Amount", () => {
47
+ it("should detect the amount is missing and have an error", async () => {
48
+ const transaction = { ...baseTransaction, amount: new BigNumber(0) };
49
+ const res = await getTransactionStatus(account, transaction);
50
+ expect(res.errors).toEqual(expect.objectContaining({
51
+ amount: new AmountRequired(),
52
+ }));
53
+ });
54
+ it("should detect the amount is greater than the spendable amount and have an error", async () => {
55
+ const transaction = {
56
+ ...baseTransaction,
57
+ amount: BigNumber(1000000002),
58
+ fees: new BigNumber("20"),
59
+ };
60
+ const res = await getTransactionStatus(account, transaction);
61
+ expect(res.errors).toEqual(expect.objectContaining({
62
+ amount: new NotEnoughBalance(),
63
+ }));
64
+ });
65
+ it("should detect the amount is greater than the spendable amount of the token account and have an error", async () => {
66
+ const transaction = {
67
+ ...jettonTransaction,
68
+ amount: BigNumber(1000000002),
69
+ fees: new BigNumber("20"),
70
+ };
71
+ const res = await getTransactionStatus(account, transaction);
72
+ expect(res.errors).toEqual(expect.objectContaining({
73
+ amount: new NotEnoughBalance(),
74
+ }));
75
+ });
76
+ it("should detect the transaction is a jetton transfer and have a warning", async () => {
77
+ const transaction = {
78
+ ...jettonTransaction,
79
+ amount: BigNumber(1000000002),
80
+ fees: new BigNumber("20"),
81
+ };
82
+ const res = await getTransactionStatus(account, transaction);
83
+ expect(res.warnings).toEqual(expect.objectContaining({
84
+ amount: new TonExcessFee(),
85
+ }));
86
+ });
87
+ describe("Comment", () => {
88
+ it("should detect the comment is not valid and have an error", async () => {
89
+ const transaction = {
90
+ ...baseTransaction,
91
+ amount: new BigNumber("1"),
92
+ comment: { isEncrypted: false, text: "comment\nInvalid" },
93
+ };
94
+ const res = await getTransactionStatus(account, transaction);
95
+ expect(res.errors).toEqual(expect.objectContaining({
96
+ transaction: new TonCommentInvalid(),
97
+ }));
98
+ });
99
+ });
100
+ describe("Successful transaction", () => {
101
+ it("should not have errors", async () => {
102
+ const successfulResult = {
103
+ amount: baseTransaction.amount,
104
+ errors: {},
105
+ warnings: {},
106
+ estimatedFees: baseTransaction.fees,
107
+ totalSpent: baseTransaction.amount.plus(baseTransaction.fees),
108
+ };
109
+ const res = await getTransactionStatus(account, baseTransaction);
110
+ expect(res).toEqual(successfulResult);
111
+ });
112
+ });
113
+ });
114
+ });
115
+ //# sourceMappingURL=getTransactionStatus.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTransactionStatus.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/getTransactionStatus.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,4CAA4C,EAC5C,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO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AAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hw-getAddress.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hw-getAddress.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/hw-getAddress.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
2
+ import resolver from "../../hw-getAddress";
3
+ import { getLedgerTonPath } from "../../utils";
4
+ const address = "0xc3f95102d5c8f2c83e49ce3acfb905edfb7f37de";
5
+ const publicKey = "mockedPublicKey";
6
+ const spyGetAddress = jest.fn().mockImplementation(async () => Promise.resolve({
7
+ publicKey,
8
+ address: address.toLowerCase(),
9
+ }));
10
+ const spyValidateAddress = jest.fn().mockImplementation(async () => Promise.resolve({
11
+ publicKey,
12
+ address: address.toLowerCase(),
13
+ }));
14
+ const mockSignerFactory = (_, fn) => fn({
15
+ getAddress: spyGetAddress,
16
+ validateAddress: spyValidateAddress,
17
+ signTransaction: jest.fn(),
18
+ });
19
+ describe("hw-getAddress", () => {
20
+ it("should return an encoded address and a public key when verifiy is false", async () => {
21
+ const getAddress = resolver(mockSignerFactory);
22
+ const response = await getAddress("deviceId", {
23
+ path: "44'/607'/0'/0'/0'/0'",
24
+ verify: false,
25
+ currency: getCryptoCurrencyById("ton"),
26
+ derivationMode: "ton",
27
+ });
28
+ expect(response.address).toBe(address);
29
+ expect(response.publicKey).toBe(publicKey);
30
+ expect(spyGetAddress).toHaveBeenCalledWith(getLedgerTonPath("44'/607'/0'/0'/0'/0'"), {
31
+ bounceable: false,
32
+ });
33
+ });
34
+ it("should return an encoded address and a public key when verifiy is true", async () => {
35
+ const getAddress = resolver(mockSignerFactory);
36
+ const response = await getAddress("deviceId", {
37
+ path: "44'/607'/0'/0'/0'/0'",
38
+ verify: true,
39
+ currency: getCryptoCurrencyById("ton"),
40
+ derivationMode: "ton",
41
+ });
42
+ expect(response.address).toBe(address);
43
+ expect(response.publicKey).toBe(publicKey);
44
+ expect(spyValidateAddress).toHaveBeenCalledWith(getLedgerTonPath("44'/607'/0'/0'/0'/0'"), {
45
+ bounceable: false,
46
+ });
47
+ });
48
+ });
49
+ //# sourceMappingURL=hw-getAddress.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hw-getAddress.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/hw-getAddress.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,OAAO,GAAG,4CAA4C,CAAC;AAC7D,MAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE,CAC5D,OAAO,CAAC,OAAO,CAAC;IACd,SAAS;IACT,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;CAC/B,CAAC,CACH,CAAC;AACF,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE,CACjE,OAAO,CAAC,OAAO,CAAC;IACd,SAAS;IACT,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;CAC/B,CAAC,CACH,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAI,CAAS,EAAE,EAAqC,EAAc,EAAE,CAC5F,EAAE,CAAC;IACD,UAAU,EAAE,aAAa;IACzB,eAAe,EAAE,kBAAkB;IACnC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE;CAC3B,CAAC,CAAC;AAEL,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QAC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2
+ //# sourceMappingURL=logic.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logic.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/logic.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { getCryptoCurrencyById, findTokenById } from "@ledgerhq/cryptoassets";
2
+ import { getSyncHash } from "../../logic";
3
+ describe("getSyncHash", () => {
4
+ const currency = getCryptoCurrencyById("ton");
5
+ it("should provide a valid hex hash", () => {
6
+ // mumurhash is always returning a 32bits uint, so a 4 bytes hexa string
7
+ expect(getSyncHash(currency, [])).toStrictEqual(expect.stringMatching(/^0x[A-Fa-f0-9]{8}$/));
8
+ });
9
+ it("should provide a new hash if a token is added to the blacklistedTokenIds", () => {
10
+ const token = findTokenById("ton/jetton/eqcxe6mutqjkfngfarotkot1lzbdiix1kcixrv7nw2id_sds");
11
+ if (!token)
12
+ throw new Error("TON jetton token not found");
13
+ expect(getSyncHash(currency, [])).not.toEqual(getSyncHash(currency, [token.id]));
14
+ });
15
+ });
16
+ //# sourceMappingURL=logic.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logic.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/logic.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAE9C,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,wEAAwE;QACxE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,KAAK,GAAG,aAAa,CAAC,6DAA6D,CAAC,CAAC;QAC3F,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC1D,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prepareTransaction.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareTransaction.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/prepareTransaction.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { estimateFee, fetchAccountInfo } from "../../bridge/bridgeHelpers/api";
3
+ import { setCoinConfig } from "../../config";
4
+ import prepareTransaction from "../../prepareTransaction";
5
+ import mockServer, { API_TON_ENDPOINT } from "../fixtures/api.fixtures";
6
+ import { account, accountInfo, transaction as baseTransaction, fees, jettonTransaction, totalFees, } from "../fixtures/common.fixtures";
7
+ jest.mock("../../bridge/bridgeHelpers/api");
8
+ describe("prepareTransaction", () => {
9
+ beforeAll(() => {
10
+ const fetchAccountInfoMock = jest.mocked(fetchAccountInfo);
11
+ fetchAccountInfoMock.mockReturnValue(Promise.resolve(accountInfo));
12
+ const fetchEstimateFeeMock = jest.mocked(estimateFee);
13
+ fetchEstimateFeeMock.mockReturnValue(Promise.resolve(fees));
14
+ setCoinConfig(() => ({
15
+ status: {
16
+ type: "active",
17
+ },
18
+ infra: {
19
+ API_TON_ENDPOINT: API_TON_ENDPOINT,
20
+ KNOWN_JETTONS: [],
21
+ },
22
+ }));
23
+ mockServer.listen();
24
+ });
25
+ afterAll(() => {
26
+ mockServer.close();
27
+ });
28
+ describe("Ton Transaction", () => {
29
+ it("should return the transaction with the updated amount and fees", async () => {
30
+ const transaction = await prepareTransaction(account, baseTransaction);
31
+ expect(transaction).toEqual({
32
+ ...baseTransaction,
33
+ fees: totalFees,
34
+ });
35
+ });
36
+ it("should preserve the reference when no change is detected on the transaction", async () => {
37
+ const transaction = await prepareTransaction(account, { ...baseTransaction });
38
+ const transaction2 = await prepareTransaction(account, transaction);
39
+ expect(transaction).toBe(transaction2);
40
+ });
41
+ it("should create a coin transaction using the spendableBalance in the account", async () => {
42
+ const transaction = await prepareTransaction(account, {
43
+ ...baseTransaction,
44
+ useAllAmount: true,
45
+ });
46
+ expect(transaction).toEqual({
47
+ ...baseTransaction,
48
+ useAllAmount: true,
49
+ fees: totalFees,
50
+ amount: account.spendableBalance.minus(totalFees),
51
+ });
52
+ });
53
+ });
54
+ describe("Jetton Transaction", () => {
55
+ it("should return the transaction with the updated amount and fees", async () => {
56
+ const transaction = await prepareTransaction(account, jettonTransaction);
57
+ expect(transaction).toEqual({
58
+ ...jettonTransaction,
59
+ fees: BigNumber("100000000"),
60
+ });
61
+ });
62
+ it("should preserve the reference when no change is detected on the transaction", async () => {
63
+ const transaction = await prepareTransaction(account, { ...jettonTransaction });
64
+ const transaction2 = await prepareTransaction(account, transaction);
65
+ expect(transaction).toBe(transaction2);
66
+ });
67
+ it("should create a coin transaction using the spendableBalance in the account", async () => {
68
+ const transaction = await prepareTransaction(account, {
69
+ ...jettonTransaction,
70
+ useAllAmount: true,
71
+ });
72
+ expect(transaction).toEqual({
73
+ ...jettonTransaction,
74
+ useAllAmount: true,
75
+ fees: BigNumber("100000000"),
76
+ amount: account.subAccounts?.[0].spendableBalance,
77
+ });
78
+ });
79
+ });
80
+ });
81
+ //# sourceMappingURL=prepareTransaction.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareTransaction.unit.test.js","sourceRoot":"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AO,CAAC;gBAC1B,GAAG,iBAAiB;gBACpB,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC;aAC7B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6EAA6E,EAAE,KAAK,IAAI,EAAE;YAC3F,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,EAAE,GAAG,iBAAiB,EAAE,CAAC,CAAC;YAChF,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAEpE,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;YAC1F,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE;gBACpD,GAAG,iBAAiB;gBACpB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;YAEH,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;gBAC1B,GAAG,iBAAiB;gBACpB,YAAY,EAAE,IAAI;gBAClB,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC;gBAC5B,MAAM,EAAE,OAAO,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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signOperation.unit.test.d.ts.map
@@ -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,67 @@
1
+ import { Address, Cell, beginCell, storeMessage } from "@ton/core";
2
+ import BigNumber from "bignumber.js";
3
+ import { fetchAccountInfo } from "../../bridge/bridgeHelpers/api";
4
+ import { buildSignOperation } from "../../signOperation";
5
+ import { account, accountInfo, totalFees, transaction } from "../fixtures/common.fixtures";
6
+ jest.mock("../../bridge/bridgeHelpers/api");
7
+ const spySignTransaction = jest.fn().mockImplementation(async () => Promise.resolve(beginCell()
8
+ .store(storeMessage({
9
+ info: {
10
+ type: "external-in",
11
+ dest: Address.parse("EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"),
12
+ importFee: BigInt(0),
13
+ },
14
+ body: new Cell(),
15
+ }))
16
+ .endCell()));
17
+ const mockSignerContext = (_, fn) => {
18
+ return fn({
19
+ signTransaction: spySignTransaction,
20
+ getAddress: jest.fn(),
21
+ validateAddress: jest.fn(),
22
+ });
23
+ };
24
+ describe("signOperation", () => {
25
+ beforeAll(() => {
26
+ const fetchAccountInfoMock = jest.mocked(fetchAccountInfo);
27
+ fetchAccountInfoMock.mockReturnValue(Promise.resolve(accountInfo));
28
+ });
29
+ it("should return an optimistic operation and a signed hash returned by the app bindings", done => {
30
+ const signOperation = buildSignOperation(mockSignerContext);
31
+ const signOpObservable = signOperation({
32
+ account,
33
+ transaction: { ...transaction, fees: totalFees },
34
+ deviceId: "",
35
+ });
36
+ signOpObservable.subscribe(obs => {
37
+ if (obs.type === "signed") {
38
+ const { signedOperation: { signature, operation }, } = obs;
39
+ const { amount } = transaction;
40
+ expect(operation).toEqual({
41
+ id: "",
42
+ hash: "",
43
+ type: "OUT",
44
+ value: new BigNumber(amount).plus(totalFees),
45
+ fee: totalFees,
46
+ blockHash: null,
47
+ blockHeight: null,
48
+ senders: [account.freshAddress],
49
+ recipients: [transaction.recipient],
50
+ accountId: account.id,
51
+ date: expect.any(Date),
52
+ extra: {
53
+ comment: {
54
+ isEncrypted: false,
55
+ text: "",
56
+ },
57
+ explorerHash: "",
58
+ lt: "",
59
+ },
60
+ });
61
+ expect(signature).toBe("te6cckEBAQEASAAAi4gB5u+NPAnKfR1MYfspXMxuPEc0/C8N9jmU1gWKEgWontgEQA83fGngTlPo6mMP2UrmY3HiOafheG+xzKawLFCQLUT2wCDSMh+F");
62
+ done();
63
+ }
64
+ });
65
+ });
66
+ });
67
+ //# 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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;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,SAAS,EAAE;KACR,KAAK,CACJ,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC;QACvE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;KACrB;IACD,IAAI,EAAE,IAAI,IAAI,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,EAAE,kBAAkB;QACnC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,QAAQ,CAA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;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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=txn.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txn.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/txn.unit.test.ts"],"names":[],"mappings":""}