@ledgerhq/live-common 34.48.0-nightly.0 → 34.48.0-nightly.2

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 (211) hide show
  1. package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
  2. package/lib/bridge/crypto-assets/index.js +0 -4
  3. package/lib/bridge/crypto-assets/index.js.map +1 -1
  4. package/lib/bridge/crypto-assets/index.test.js +0 -36
  5. package/lib/bridge/crypto-assets/index.test.js.map +1 -1
  6. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  7. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  8. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
  9. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  10. package/lib/bridge/generic-alpaca/signOperation.js +1 -1
  11. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
  12. package/lib/config/sharedConfig.d.ts.map +1 -1
  13. package/lib/config/sharedConfig.js +2 -0
  14. package/lib/config/sharedConfig.js.map +1 -1
  15. package/lib/e2e/index.d.ts +4 -4
  16. package/lib/e2e/index.d.ts.map +1 -1
  17. package/lib/env.react.d.ts +1 -1
  18. package/lib/env.react.d.ts.map +1 -1
  19. package/lib/families/canton/bridge/mock-data.d.ts +6 -0
  20. package/lib/families/canton/bridge/mock-data.d.ts.map +1 -0
  21. package/lib/families/canton/bridge/mock-data.js +120 -0
  22. package/lib/families/canton/bridge/mock-data.js.map +1 -0
  23. package/lib/families/canton/bridge/mock.d.ts +12 -0
  24. package/lib/families/canton/bridge/mock.d.ts.map +1 -0
  25. package/lib/families/canton/bridge/mock.js +154 -0
  26. package/lib/families/canton/bridge/mock.js.map +1 -0
  27. package/lib/families/canton/config.d.ts.map +1 -1
  28. package/lib/families/canton/config.js +5 -2
  29. package/lib/families/canton/config.js.map +1 -1
  30. package/lib/families/canton/setup.d.ts.map +1 -1
  31. package/lib/families/canton/setup.js +8 -2
  32. package/lib/families/canton/setup.js.map +1 -1
  33. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  34. package/lib/featureFlags/defaultFeatures.js +0 -1
  35. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  36. package/lib/featureFlags/useFeature.d.ts +1 -1
  37. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  38. package/lib/generated/bridge/mock.d.ts +8 -0
  39. package/lib/generated/bridge/mock.d.ts.map +1 -1
  40. package/lib/generated/bridge/mock.js +26 -24
  41. package/lib/generated/bridge/mock.js.map +1 -1
  42. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
  43. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
  44. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +206 -0
  45. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
  46. package/lib/modularDrawer/hooks/useAssetsData.d.ts +1 -0
  47. package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
  48. package/lib/modularDrawer/hooks/useAssetsData.js +3 -2
  49. package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
  50. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
  51. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
  52. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js +29 -0
  53. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
  54. package/lib/modularDrawer/hooks/useSearch.d.ts +16 -0
  55. package/lib/modularDrawer/hooks/useSearch.d.ts.map +1 -0
  56. package/lib/modularDrawer/hooks/useSearch.js +24 -0
  57. package/lib/modularDrawer/hooks/useSearch.js.map +1 -0
  58. package/lib/notifications/ServiceStatusProvider/index.d.ts +16 -1
  59. package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
  60. package/lib/notifications/ServiceStatusProvider/index.js +31 -7
  61. package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
  62. package/lib/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
  63. package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
  64. package/lib/notifications/ServiceStatusProvider/index.test.js +88 -0
  65. package/lib/notifications/ServiceStatusProvider/index.test.js.map +1 -0
  66. package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
  67. package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
  68. package/lib/notifications/ServiceStatusProvider/ledger-components.js +16 -0
  69. package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
  70. package/lib/wallet-api/ACRE/server.d.ts +13 -6
  71. package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
  72. package/lib/wallet-api/ACRE/server.js +142 -1
  73. package/lib/wallet-api/ACRE/server.js.map +1 -1
  74. package/lib/wallet-api/ACRE/server.test.d.ts +2 -0
  75. package/lib/wallet-api/ACRE/server.test.d.ts.map +1 -0
  76. package/lib/wallet-api/ACRE/server.test.js +393 -0
  77. package/lib/wallet-api/ACRE/server.test.js.map +1 -0
  78. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
  79. package/lib-es/bridge/crypto-assets/index.js +0 -4
  80. package/lib-es/bridge/crypto-assets/index.js.map +1 -1
  81. package/lib-es/bridge/crypto-assets/index.test.js +0 -36
  82. package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
  83. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  84. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  85. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
  86. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  87. package/lib-es/bridge/generic-alpaca/signOperation.js +1 -1
  88. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
  89. package/lib-es/config/sharedConfig.d.ts.map +1 -1
  90. package/lib-es/config/sharedConfig.js +2 -0
  91. package/lib-es/config/sharedConfig.js.map +1 -1
  92. package/lib-es/e2e/index.d.ts +4 -4
  93. package/lib-es/e2e/index.d.ts.map +1 -1
  94. package/lib-es/env.react.d.ts +1 -1
  95. package/lib-es/env.react.d.ts.map +1 -1
  96. package/lib-es/families/canton/bridge/mock-data.d.ts +6 -0
  97. package/lib-es/families/canton/bridge/mock-data.d.ts.map +1 -0
  98. package/lib-es/families/canton/bridge/mock-data.js +116 -0
  99. package/lib-es/families/canton/bridge/mock-data.js.map +1 -0
  100. package/lib-es/families/canton/bridge/mock.d.ts +12 -0
  101. package/lib-es/families/canton/bridge/mock.d.ts.map +1 -0
  102. package/lib-es/families/canton/bridge/mock.js +152 -0
  103. package/lib-es/families/canton/bridge/mock.js.map +1 -0
  104. package/lib-es/families/canton/config.d.ts.map +1 -1
  105. package/lib-es/families/canton/config.js +5 -2
  106. package/lib-es/families/canton/config.js.map +1 -1
  107. package/lib-es/families/canton/setup.d.ts.map +1 -1
  108. package/lib-es/families/canton/setup.js +8 -2
  109. package/lib-es/families/canton/setup.js.map +1 -1
  110. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  111. package/lib-es/featureFlags/defaultFeatures.js +0 -1
  112. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  113. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  114. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  115. package/lib-es/generated/bridge/mock.d.ts +8 -0
  116. package/lib-es/generated/bridge/mock.d.ts.map +1 -1
  117. package/lib-es/generated/bridge/mock.js +2 -0
  118. package/lib-es/generated/bridge/mock.js.map +1 -1
  119. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
  120. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
  121. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +204 -0
  122. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
  123. package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +1 -0
  124. package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
  125. package/lib-es/modularDrawer/hooks/useAssetsData.js +3 -2
  126. package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
  127. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
  128. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
  129. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js +25 -0
  130. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
  131. package/lib-es/modularDrawer/hooks/useSearch.d.ts +16 -0
  132. package/lib-es/modularDrawer/hooks/useSearch.d.ts.map +1 -0
  133. package/lib-es/modularDrawer/hooks/useSearch.js +20 -0
  134. package/lib-es/modularDrawer/hooks/useSearch.js.map +1 -0
  135. package/lib-es/notifications/ServiceStatusProvider/index.d.ts +16 -1
  136. package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
  137. package/lib-es/notifications/ServiceStatusProvider/index.js +31 -7
  138. package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
  139. package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
  140. package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
  141. package/lib-es/notifications/ServiceStatusProvider/index.test.js +86 -0
  142. package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +1 -0
  143. package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
  144. package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
  145. package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +13 -0
  146. package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
  147. package/lib-es/wallet-api/ACRE/server.d.ts +13 -6
  148. package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
  149. package/lib-es/wallet-api/ACRE/server.js +140 -2
  150. package/lib-es/wallet-api/ACRE/server.js.map +1 -1
  151. package/lib-es/wallet-api/ACRE/server.test.d.ts +2 -0
  152. package/lib-es/wallet-api/ACRE/server.test.d.ts.map +1 -0
  153. package/lib-es/wallet-api/ACRE/server.test.js +388 -0
  154. package/lib-es/wallet-api/ACRE/server.test.js.map +1 -0
  155. package/package.json +48 -48
  156. package/src/bridge/crypto-assets/index.test.ts +0 -47
  157. package/src/bridge/crypto-assets/index.ts +0 -5
  158. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +4 -3
  159. package/src/bridge/generic-alpaca/signOperation.ts +1 -1
  160. package/src/config/sharedConfig.ts +2 -0
  161. package/src/families/canton/bridge/mock-data.ts +175 -0
  162. package/src/families/canton/bridge/mock.ts +180 -0
  163. package/src/families/canton/config.ts +5 -3
  164. package/src/families/canton/setup.ts +8 -5
  165. package/src/featureFlags/defaultFeatures.ts +0 -1
  166. package/src/generated/bridge/mock.ts +2 -0
  167. package/src/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.ts +251 -0
  168. package/src/modularDrawer/hooks/useAssetsData.ts +3 -2
  169. package/src/modularDrawer/hooks/useModularDrawerConfiguration.ts +33 -0
  170. package/src/modularDrawer/hooks/useSearch.ts +52 -0
  171. package/src/notifications/ServiceStatusProvider/index.test.ts +102 -0
  172. package/src/notifications/ServiceStatusProvider/index.tsx +37 -12
  173. package/src/notifications/ServiceStatusProvider/ledger-components.ts +12 -0
  174. package/src/wallet-api/ACRE/server.test.ts +470 -0
  175. package/src/wallet-api/ACRE/server.ts +202 -14
  176. package/lib/bridge/crypto-assets/cal-integration.d.ts +0 -4
  177. package/lib/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
  178. package/lib/bridge/crypto-assets/cal-integration.js +0 -26
  179. package/lib/bridge/crypto-assets/cal-integration.js.map +0 -1
  180. package/lib/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
  181. package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
  182. package/lib/bridge/crypto-assets/cal-integration.test.js +0 -45
  183. package/lib/bridge/crypto-assets/cal-integration.test.js.map +0 -1
  184. package/lib/bridge/crypto-assets/cal-store.d.ts +0 -14
  185. package/lib/bridge/crypto-assets/cal-store.d.ts.map +0 -1
  186. package/lib/bridge/crypto-assets/cal-store.js +0 -58
  187. package/lib/bridge/crypto-assets/cal-store.js.map +0 -1
  188. package/lib/bridge/crypto-assets/cal-store.test.d.ts +0 -2
  189. package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
  190. package/lib/bridge/crypto-assets/cal-store.test.js +0 -70
  191. package/lib/bridge/crypto-assets/cal-store.test.js.map +0 -1
  192. package/lib-es/bridge/crypto-assets/cal-integration.d.ts +0 -4
  193. package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
  194. package/lib-es/bridge/crypto-assets/cal-integration.js +0 -21
  195. package/lib-es/bridge/crypto-assets/cal-integration.js.map +0 -1
  196. package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
  197. package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
  198. package/lib-es/bridge/crypto-assets/cal-integration.test.js +0 -43
  199. package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +0 -1
  200. package/lib-es/bridge/crypto-assets/cal-store.d.ts +0 -14
  201. package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +0 -1
  202. package/lib-es/bridge/crypto-assets/cal-store.js +0 -54
  203. package/lib-es/bridge/crypto-assets/cal-store.js.map +0 -1
  204. package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +0 -2
  205. package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
  206. package/lib-es/bridge/crypto-assets/cal-store.test.js +0 -68
  207. package/lib-es/bridge/crypto-assets/cal-store.test.js.map +0 -1
  208. package/src/bridge/crypto-assets/cal-integration.test.ts +0 -53
  209. package/src/bridge/crypto-assets/cal-integration.ts +0 -23
  210. package/src/bridge/crypto-assets/cal-store.test.ts +0 -93
  211. package/src/bridge/crypto-assets/cal-store.ts +0 -63
@@ -123,7 +123,7 @@ export const genericSignOperation =
123
123
  transactionIntent.sequence = sequenceNumber;
124
124
 
125
125
  /* Craft unsigned blob via Alpaca */
126
- const unsigned: string = await getAlpacaApi(network, kind).craftTransaction(
126
+ const { transaction: unsigned } = await getAlpacaApi(network, kind).craftTransaction(
127
127
  transactionIntent,
128
128
  { value: fees },
129
129
  );
@@ -24,6 +24,7 @@ import { tronConfig } from "../families/tron/config";
24
24
  import { vechainConfig } from "../families/vechain/config";
25
25
  import { iconConfig } from "../families/icon/config";
26
26
  import { suiConfig } from "../families/sui/config";
27
+ import { cantonConfig } from "../families/canton/config";
27
28
 
28
29
  const countervaluesConfig: ConfigSchema = {
29
30
  config_countervalues_refreshRate: {
@@ -67,4 +68,5 @@ export const liveConfig: ConfigSchema = {
67
68
  ...iconConfig,
68
69
  ...tonConfig,
69
70
  ...suiConfig,
71
+ ...cantonConfig,
70
72
  };
@@ -0,0 +1,175 @@
1
+ type MockTransactionOperation = {
2
+ meta: {
3
+ delivered_amount: string;
4
+ };
5
+ tx: {
6
+ Account: string;
7
+ Amount: string;
8
+ Destination: string;
9
+ Fee: string;
10
+ Memo: string;
11
+ Sequence: number;
12
+ SigningPubKey: string;
13
+ TransactionType: string;
14
+ TxnSignature: string;
15
+ date: number;
16
+ hash: string;
17
+ inLedger: number;
18
+ };
19
+ validated: boolean;
20
+ };
21
+
22
+ const generateMockTransaction = (
23
+ account: string,
24
+ destination: string,
25
+ amount: string,
26
+ fee: string,
27
+ hash: string,
28
+ sequence: number,
29
+ timestamp: number,
30
+ inLedger: number,
31
+ ): MockTransactionOperation => ({
32
+ meta: {
33
+ delivered_amount: amount,
34
+ },
35
+ tx: {
36
+ Account: account,
37
+ Amount: amount,
38
+ Destination: destination,
39
+ Fee: fee,
40
+ Memo: "",
41
+ Sequence: sequence,
42
+ SigningPubKey: "ED" + account.slice(0, 32),
43
+ TransactionType: "Payment",
44
+ TxnSignature: hash.slice(0, 32),
45
+ date: timestamp,
46
+ hash,
47
+ inLedger,
48
+ },
49
+ validated: true,
50
+ });
51
+
52
+ export const getMockedMethods = (): {
53
+ method: string;
54
+ params: unknown[];
55
+ answer: unknown;
56
+ }[] => [
57
+ // Account balance lookup
58
+ {
59
+ method: "getBalance",
60
+ params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
61
+ answer: {
62
+ account_data: {
63
+ Account: "rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
64
+ Balance: "1000000000",
65
+ },
66
+ ledger_hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
67
+ ledger_index: 32570,
68
+ validated: true,
69
+ status: "success",
70
+ },
71
+ },
72
+
73
+ // Empty account (new account)
74
+ {
75
+ method: "getBalance",
76
+ params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
77
+ answer: {
78
+ error: "actNotFound",
79
+ },
80
+ },
81
+
82
+ // Account transactions
83
+ {
84
+ method: "getTransactions",
85
+ params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG", { from: 0, size: 100 }],
86
+ answer: [
87
+ generateMockTransaction(
88
+ "rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
89
+ "rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW",
90
+ "100000000",
91
+ "10000",
92
+ "E3FE6EA3C48F0C2B639448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3A6",
93
+ 1,
94
+ Date.now() - 3600000, // 1 hour ago
95
+ 32569,
96
+ ),
97
+ generateMockTransaction(
98
+ "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
99
+ "rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
100
+ "200000000",
101
+ "10000",
102
+ "B7FDE3B1D3C2F4A9638448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3C8",
103
+ 5,
104
+ Date.now() - 7200000, // 2 hours ago
105
+ 32568,
106
+ ),
107
+ ],
108
+ },
109
+
110
+ // Empty transactions for new account
111
+ {
112
+ method: "getTransactions",
113
+ params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW", { from: 0, size: 100 }],
114
+ answer: [],
115
+ },
116
+
117
+ // Fee estimation
118
+ {
119
+ method: "estimateFees",
120
+ params: ["12000400020000000000000000"], // sample serialized transaction
121
+ answer: "12000",
122
+ },
123
+
124
+ // Transaction submission
125
+ {
126
+ method: "submitTransaction",
127
+ params: ["12000400020000000000000000"], // sample signed transaction
128
+ answer: {
129
+ accepted: true,
130
+ tx_hash: "F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF",
131
+ },
132
+ },
133
+
134
+ // Network info
135
+ {
136
+ method: "getServerInfo",
137
+ params: [],
138
+ answer: {
139
+ info: {
140
+ complete_ledgers: "32570-32570",
141
+ ledger_index: 32570,
142
+ validated_ledger: {
143
+ hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
144
+ seq: 32570,
145
+ },
146
+ },
147
+ status: "success",
148
+ },
149
+ },
150
+
151
+ // Account sequence number
152
+ {
153
+ method: "getNextValidSequence",
154
+ params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
155
+ answer: 2,
156
+ },
157
+
158
+ // New account sequence
159
+ {
160
+ method: "getNextValidSequence",
161
+ params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
162
+ answer: 1,
163
+ },
164
+
165
+ // Last block
166
+ {
167
+ method: "lastBlock",
168
+ params: [],
169
+ answer: {
170
+ height: 32570,
171
+ hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
172
+ time: Date.now(),
173
+ },
174
+ },
175
+ ];
@@ -0,0 +1,180 @@
1
+ import { makeLRUCache, minutes } from "@ledgerhq/live-network/cache";
2
+ import { createApi } from "@ledgerhq/coin-canton/api/index";
3
+ import { Transaction as CantonTransaction } from "@ledgerhq/coin-canton/types";
4
+ import type { AccountBridge } from "@ledgerhq/types-live";
5
+ import { BigNumber } from "bignumber.js";
6
+
7
+ // The calls data can be copied to mock-data.ts from the file.
8
+ // This function creates a live API with logging for generating mock data
9
+ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
10
+ function createMockDataForAPI() {
11
+ const signerContext = {};
12
+
13
+ const apiGetter = makeLRUCache(
14
+ config => Promise.resolve(createApi(config)),
15
+ config => config.nodeUrl || "",
16
+ minutes(1000),
17
+ );
18
+
19
+ return {
20
+ getAPI: apiGetter,
21
+ getQueuedAPI: apiGetter,
22
+ getQueuedAndCachedAPI: apiGetter,
23
+ signerContext,
24
+ };
25
+ }
26
+
27
+ const createTransaction = (): CantonTransaction => {
28
+ return {
29
+ family: "canton",
30
+ amount: new BigNumber(0),
31
+ recipient: "",
32
+ fee: null,
33
+ };
34
+ };
35
+
36
+ const updateTransaction = (
37
+ t: CantonTransaction,
38
+ patch: Partial<CantonTransaction>,
39
+ ): CantonTransaction => {
40
+ return { ...t, ...patch };
41
+ };
42
+
43
+ const getTransactionStatus = async (): Promise<any> => {
44
+ return {
45
+ errors: {},
46
+ warnings: {},
47
+ estimatedFees: new BigNumber(0),
48
+ amount: new BigNumber(0),
49
+ totalSpent: new BigNumber(0),
50
+ };
51
+ };
52
+
53
+ const estimateMaxSpendable = ({ account }: { account: any }): Promise<BigNumber> => {
54
+ return Promise.resolve(account.balance || new BigNumber(0));
55
+ };
56
+
57
+ const prepareTransaction = async (
58
+ _account: any,
59
+ transaction: CantonTransaction,
60
+ ): Promise<CantonTransaction> => {
61
+ return {
62
+ ...transaction,
63
+ fee: transaction.fee || new BigNumber(100),
64
+ };
65
+ };
66
+
67
+ const sync = (_initialAccount: any): any => {
68
+ return {
69
+ subscribe: (observer: any) => {
70
+ observer.next((acc: any) => acc);
71
+ observer.complete();
72
+ return { unsubscribe: () => {} };
73
+ },
74
+ };
75
+ };
76
+
77
+ const receive = (_account: any, _opts: { deviceId: string }): any => {
78
+ return {
79
+ subscribe: (observer: any) => {
80
+ observer.next({
81
+ address: "mock-address",
82
+ path: "44'/60'/0'/0/0",
83
+ publicKey: "mock-public-key",
84
+ });
85
+ observer.complete();
86
+ return { unsubscribe: () => {} };
87
+ },
88
+ };
89
+ };
90
+
91
+ const signOperation = (): any => {
92
+ return {
93
+ subscribe: (observer: any) => {
94
+ observer.next({
95
+ operation: {
96
+ id: "mock-operation-id",
97
+ hash: "mock-hash",
98
+ type: "OUT",
99
+ value: new BigNumber(0),
100
+ fee: new BigNumber(100),
101
+ blockHash: "mock-block-hash",
102
+ blockHeight: 12345,
103
+ accountId: "mock-account-id",
104
+ date: new Date(),
105
+ extra: {},
106
+ },
107
+ signature: "mock-signature",
108
+ });
109
+ observer.complete();
110
+ return { unsubscribe: () => {} };
111
+ },
112
+ };
113
+ };
114
+
115
+ const broadcast = async (): Promise<any> => {
116
+ return {
117
+ id: "mock-operation-id",
118
+ hash: "mock-hash",
119
+ type: "OUT",
120
+ value: new BigNumber(0),
121
+ fee: new BigNumber(100),
122
+ blockHash: "mock-block-hash",
123
+ blockHeight: 12345,
124
+ accountId: "mock-account-id",
125
+ date: new Date(),
126
+ extra: {},
127
+ };
128
+ };
129
+
130
+ const scanAccounts = (): any => {
131
+ return {
132
+ subscribe: (observer: any) => {
133
+ observer.next({
134
+ type: "discovered",
135
+ account: {
136
+ id: "mock-account-id",
137
+ name: "Mock Canton Account",
138
+ address: "mock-address",
139
+ currency: { id: "canton_network_devnet" },
140
+ balance: new BigNumber(0),
141
+ spendableBalance: new BigNumber(0),
142
+ blockHeight: 0,
143
+ lastSyncDate: new Date(),
144
+ operations: [],
145
+ pendingOperations: [],
146
+ },
147
+ });
148
+ observer.complete();
149
+ return { unsubscribe: () => {} };
150
+ },
151
+ };
152
+ };
153
+
154
+ const getSerializedAddressParameters = (): Buffer => {
155
+ return Buffer.from("mock-address-params");
156
+ };
157
+
158
+ const accountBridge: AccountBridge<CantonTransaction> = {
159
+ createTransaction,
160
+ updateTransaction,
161
+ getTransactionStatus,
162
+ estimateMaxSpendable,
163
+ prepareTransaction,
164
+ sync,
165
+ receive,
166
+ signOperation,
167
+ broadcast,
168
+ getSerializedAddressParameters,
169
+ };
170
+
171
+ const currencyBridge = {
172
+ preload: () => Promise.resolve({}),
173
+ hydrate: () => {},
174
+ scanAccounts,
175
+ };
176
+
177
+ export default {
178
+ accountBridge,
179
+ currencyBridge,
180
+ };
@@ -14,6 +14,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
14
14
  gatewayUrl: "https://canton-gateway.api.live.ledger.com",
15
15
  minReserve: 0,
16
16
  useGateway: true,
17
+ networkType: "mainnet",
17
18
  },
18
19
  },
19
20
  config_currency_canton_network_devnet: {
@@ -23,12 +24,12 @@ export const cantonConfig: Record<string, ConfigInfo> = {
23
24
  type: "active",
24
25
  },
25
26
  nodeUrl: "https://wallet-validator-devnet-canton.ledger-test.com",
26
- nodeId: "ledger-live-devnet-prd",
27
+ nodeId: "ledger-devnet-stg",
27
28
  gatewayUrl: "https://canton-gateway.api.live.ledger-test.com",
28
29
  minReserve: 0,
29
30
  useGateway: true,
30
- nativeInstrumentId:
31
- "6e9fc50fb94e56751b49f09ba2dc84da53a9d7cff08115ebb4f6b7a12d0c990c:Splice.Amulet:Amulet",
31
+ networkType: "devnet",
32
+ nativeInstrumentId: "Amulet",
32
33
  },
33
34
  },
34
35
  config_currency_canton_network_localnet: {
@@ -42,6 +43,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
42
43
  gatewayUrl: undefined,
43
44
  minReserve: 0,
44
45
  useGateway: false,
46
+ networkType: "localnet",
45
47
  },
46
48
  },
47
49
  };
@@ -1,6 +1,7 @@
1
1
  // Goal of this file is to inject all necessary device/signer dependency to coin-modules
2
2
 
3
3
  import { createBridges } from "@ledgerhq/coin-canton/bridge/index";
4
+ import { getEnv } from "@ledgerhq/live-env";
4
5
  import Transport from "@ledgerhq/hw-transport";
5
6
  import { CantonSigner } from "@ledgerhq/coin-canton";
6
7
  import cantonResolver from "@ledgerhq/coin-canton/signer";
@@ -10,6 +11,7 @@ import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
10
11
  import { TransactionStatus, Transaction } from "@ledgerhq/coin-canton/types";
11
12
  import { LegacySignerCanton } from "@ledgerhq/live-signer-canton";
12
13
  import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
14
+ import cantonBridgeMock from "./bridge/mock";
13
15
  import { Resolver } from "../../hw/getAddress/types";
14
16
  import { getCurrencyConfiguration } from "../../config";
15
17
  import { getCryptoCurrencyById } from "../../currencies";
@@ -19,13 +21,14 @@ const createSigner: CreateSigner<CantonSigner> = (transport: Transport) => {
19
21
  };
20
22
 
21
23
  const getCurrencyConfig = () => {
22
- return getCurrencyConfiguration<CantonCoinConfig>(getCryptoCurrencyById("canton_network"));
24
+ // Use devnet for development/testing
25
+ const currencyId = getEnv("MOCK") ? "canton_network_devnet" : "canton_network_devnet";
26
+ return getCurrencyConfiguration<CantonCoinConfig>(getCryptoCurrencyById(currencyId));
23
27
  };
24
28
 
25
- const bridge: Bridge<Transaction, Account, TransactionStatus> = createBridges(
26
- executeWithSigner(createSigner),
27
- getCurrencyConfig,
28
- );
29
+ const bridge: Bridge<Transaction, Account, TransactionStatus> = getEnv("MOCK")
30
+ ? cantonBridgeMock
31
+ : createBridges(executeWithSigner(createSigner), getCurrencyConfig);
29
32
 
30
33
  const resolver: Resolver = createResolver(createSigner, cantonResolver);
31
34
 
@@ -108,7 +108,6 @@ export const DEFAULT_FEATURES: Features = {
108
108
  postOnboardingAssetsTransfer: DEFAULT_FEATURE,
109
109
  counterValue: DEFAULT_FEATURE,
110
110
  mockFeature: DEFAULT_FEATURE,
111
- calLedgerService: DEFAULT_FEATURE,
112
111
  ptxServiceCtaExchangeDrawer: DEFAULT_FEATURE,
113
112
  ptxServiceCtaScreens: DEFAULT_FEATURE,
114
113
  ptxSwapReceiveTRC20WithoutTrx: DEFAULT_FEATURE,
@@ -1,5 +1,6 @@
1
1
  import algorand from "../../families/algorand/bridge/mock";
2
2
  import bitcoin from "../../families/bitcoin/bridge/mock";
3
+ import canton from "../../families/canton/bridge/mock";
3
4
  import cardano from "../../families/cardano/bridge/mock";
4
5
  import casper from "../../families/casper/bridge/mock";
5
6
  import cosmos from "../../families/cosmos/bridge/mock";
@@ -16,6 +17,7 @@ import xrp from "../../families/xrp/bridge/mock";
16
17
  export default {
17
18
  algorand,
18
19
  bitcoin,
20
+ canton,
19
21
  cardano,
20
22
  casper,
21
23
  cosmos,