@ledgerhq/live-common 34.49.0-nightly.5 → 34.49.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 (253) hide show
  1. package/lib/bridge/react/BridgeSync.d.ts.map +1 -1
  2. package/lib/bridge/react/BridgeSync.js +4 -17
  3. package/lib/bridge/react/BridgeSync.js.map +1 -1
  4. package/lib/deposit/deposit.integration.test.js +1 -60
  5. package/lib/deposit/deposit.integration.test.js.map +1 -1
  6. package/lib/e2e/data/deviceLabelsData.js +2 -2
  7. package/lib/e2e/data/deviceLabelsData.js.map +1 -1
  8. package/lib/e2e/enum/Account.d.ts +0 -1
  9. package/lib/e2e/enum/Account.d.ts.map +1 -1
  10. package/lib/e2e/enum/Account.js +1 -2
  11. package/lib/e2e/enum/Account.js.map +1 -1
  12. package/lib/e2e/enum/DeviceLabels.d.ts +9 -3
  13. package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
  14. package/lib/e2e/enum/DeviceLabels.js +8 -2
  15. package/lib/e2e/enum/DeviceLabels.js.map +1 -1
  16. package/lib/e2e/families/bitcoin.d.ts +0 -1
  17. package/lib/e2e/families/bitcoin.d.ts.map +1 -1
  18. package/lib/e2e/families/bitcoin.js +1 -28
  19. package/lib/e2e/families/bitcoin.js.map +1 -1
  20. package/lib/e2e/families/tezos.d.ts.map +1 -1
  21. package/lib/e2e/families/tezos.js +3 -5
  22. package/lib/e2e/families/tezos.js.map +1 -1
  23. package/lib/e2e/index.d.ts +0 -4
  24. package/lib/e2e/index.d.ts.map +1 -1
  25. package/lib/e2e/models/Swap.d.ts +0 -2
  26. package/lib/e2e/models/Swap.d.ts.map +1 -1
  27. package/lib/e2e/models/Swap.js +0 -6
  28. package/lib/e2e/models/Swap.js.map +1 -1
  29. package/lib/e2e/speculos.d.ts +0 -8
  30. package/lib/e2e/speculos.d.ts.map +1 -1
  31. package/lib/e2e/speculos.js +31 -23
  32. package/lib/e2e/speculos.js.map +1 -1
  33. package/lib/exchange/providers/swap.js +2 -2
  34. package/lib/exchange/providers/swap.js.map +1 -1
  35. package/lib/families/celo/bridge.integration.test.js +1 -4
  36. package/lib/families/celo/bridge.integration.test.js.map +1 -1
  37. package/lib/families/cosmos/datasets/axelar.integration.test.js +1 -4
  38. package/lib/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
  39. package/lib/families/cosmos/datasets/desmos.integration.test.js +1 -4
  40. package/lib/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
  41. package/lib/families/cosmos/datasets/onomy.integration.test.js +1 -4
  42. package/lib/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
  43. package/lib/families/filecoin/bridge.integration.test.js +1 -4
  44. package/lib/families/filecoin/bridge.integration.test.js.map +1 -1
  45. package/lib/families/kaspa/bridge.integration.test.js +1 -4
  46. package/lib/families/kaspa/bridge.integration.test.js.map +1 -1
  47. package/lib/families/mina/bridge.integration.test.js +1 -4
  48. package/lib/families/mina/bridge.integration.test.js.map +1 -1
  49. package/lib/families/multiversx/synchronisation.integration.test.js +1 -4
  50. package/lib/families/multiversx/synchronisation.integration.test.js.map +1 -1
  51. package/lib/families/ton/bridge.integration.test.js +1 -4
  52. package/lib/families/ton/bridge.integration.test.js.map +1 -1
  53. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  54. package/lib/featureFlags/defaultFeatures.js +0 -2
  55. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  56. package/lib/featureFlags/useFeature.d.ts +1 -1
  57. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  58. package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +0 -1
  59. package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
  60. package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +0 -1
  61. package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
  62. package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +0 -1
  63. package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
  64. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +0 -1
  65. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  66. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +0 -1
  67. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  68. package/lib/notifications/ServiceStatusProvider/index.d.ts +1 -18
  69. package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
  70. package/lib/notifications/ServiceStatusProvider/index.js +9 -47
  71. package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
  72. package/lib/notifications/ServiceStatusProvider/types.d.ts +1 -3
  73. package/lib/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
  74. package/lib/wallet-api/react.d.ts +1 -1
  75. package/lib/wallet-api/react.d.ts.map +1 -1
  76. package/lib/wallet-api/react.js +1 -1
  77. package/lib/wallet-api/react.js.map +1 -1
  78. package/lib-es/bridge/react/BridgeSync.d.ts.map +1 -1
  79. package/lib-es/bridge/react/BridgeSync.js +4 -17
  80. package/lib-es/bridge/react/BridgeSync.js.map +1 -1
  81. package/lib-es/deposit/deposit.integration.test.js +1 -37
  82. package/lib-es/deposit/deposit.integration.test.js.map +1 -1
  83. package/lib-es/e2e/data/deviceLabelsData.js +2 -2
  84. package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
  85. package/lib-es/e2e/enum/Account.d.ts +0 -1
  86. package/lib-es/e2e/enum/Account.d.ts.map +1 -1
  87. package/lib-es/e2e/enum/Account.js +1 -2
  88. package/lib-es/e2e/enum/Account.js.map +1 -1
  89. package/lib-es/e2e/enum/DeviceLabels.d.ts +9 -3
  90. package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
  91. package/lib-es/e2e/enum/DeviceLabels.js +8 -2
  92. package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
  93. package/lib-es/e2e/families/bitcoin.d.ts +0 -1
  94. package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
  95. package/lib-es/e2e/families/bitcoin.js +1 -27
  96. package/lib-es/e2e/families/bitcoin.js.map +1 -1
  97. package/lib-es/e2e/families/tezos.d.ts.map +1 -1
  98. package/lib-es/e2e/families/tezos.js +4 -6
  99. package/lib-es/e2e/families/tezos.js.map +1 -1
  100. package/lib-es/e2e/index.d.ts +0 -4
  101. package/lib-es/e2e/index.d.ts.map +1 -1
  102. package/lib-es/e2e/models/Swap.d.ts +0 -2
  103. package/lib-es/e2e/models/Swap.d.ts.map +1 -1
  104. package/lib-es/e2e/models/Swap.js +0 -6
  105. package/lib-es/e2e/models/Swap.js.map +1 -1
  106. package/lib-es/e2e/speculos.d.ts +0 -8
  107. package/lib-es/e2e/speculos.d.ts.map +1 -1
  108. package/lib-es/e2e/speculos.js +32 -23
  109. package/lib-es/e2e/speculos.js.map +1 -1
  110. package/lib-es/exchange/providers/swap.js +2 -2
  111. package/lib-es/exchange/providers/swap.js.map +1 -1
  112. package/lib-es/families/celo/bridge.integration.test.js +1 -4
  113. package/lib-es/families/celo/bridge.integration.test.js.map +1 -1
  114. package/lib-es/families/cosmos/datasets/axelar.integration.test.js +1 -4
  115. package/lib-es/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
  116. package/lib-es/families/cosmos/datasets/desmos.integration.test.js +1 -4
  117. package/lib-es/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
  118. package/lib-es/families/cosmos/datasets/onomy.integration.test.js +1 -4
  119. package/lib-es/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
  120. package/lib-es/families/filecoin/bridge.integration.test.js +1 -4
  121. package/lib-es/families/filecoin/bridge.integration.test.js.map +1 -1
  122. package/lib-es/families/kaspa/bridge.integration.test.js +1 -4
  123. package/lib-es/families/kaspa/bridge.integration.test.js.map +1 -1
  124. package/lib-es/families/mina/bridge.integration.test.js +1 -4
  125. package/lib-es/families/mina/bridge.integration.test.js.map +1 -1
  126. package/lib-es/families/multiversx/synchronisation.integration.test.js +1 -4
  127. package/lib-es/families/multiversx/synchronisation.integration.test.js.map +1 -1
  128. package/lib-es/families/ton/bridge.integration.test.js +1 -4
  129. package/lib-es/families/ton/bridge.integration.test.js.map +1 -1
  130. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  131. package/lib-es/featureFlags/defaultFeatures.js +0 -2
  132. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  133. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  134. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  135. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +0 -1
  136. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
  137. package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +0 -1
  138. package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
  139. package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +0 -1
  140. package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
  141. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +0 -1
  142. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  143. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +0 -1
  144. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  145. package/lib-es/notifications/ServiceStatusProvider/index.d.ts +1 -18
  146. package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
  147. package/lib-es/notifications/ServiceStatusProvider/index.js +9 -47
  148. package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
  149. package/lib-es/notifications/ServiceStatusProvider/types.d.ts +1 -3
  150. package/lib-es/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
  151. package/lib-es/wallet-api/react.d.ts +1 -1
  152. package/lib-es/wallet-api/react.d.ts.map +1 -1
  153. package/lib-es/wallet-api/react.js +1 -1
  154. package/lib-es/wallet-api/react.js.map +1 -1
  155. package/package.json +69 -69
  156. package/src/bridge/react/BridgeSync.tsx +3 -17
  157. package/src/deposit/deposit.integration.test.ts +2 -41
  158. package/src/e2e/data/deviceLabelsData.ts +2 -2
  159. package/src/e2e/enum/Account.ts +0 -7
  160. package/src/e2e/enum/DeviceLabels.ts +8 -2
  161. package/src/e2e/families/bitcoin.ts +1 -33
  162. package/src/e2e/families/tezos.ts +4 -13
  163. package/src/e2e/models/Swap.ts +0 -8
  164. package/src/e2e/speculos.ts +35 -26
  165. package/src/exchange/providers/swap.ts +2 -2
  166. package/src/families/celo/__snapshots__/bridge.integration.test.ts.snap +285 -0
  167. package/src/families/celo/bridge.integration.test.ts +1 -4
  168. package/src/families/cosmos/datasets/__snapshots__/axelar.integration.test.ts.snap +45 -0
  169. package/src/families/cosmos/datasets/__snapshots__/babylon.integration.test.ts.snap +2 -2
  170. package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +4 -299
  171. package/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap +2 -2
  172. package/src/families/cosmos/datasets/__snapshots__/desmos.integration.test.ts.snap +45 -0
  173. package/src/families/cosmos/datasets/__snapshots__/injective.integration.test.ts.snap +2 -2
  174. package/src/families/cosmos/datasets/__snapshots__/mantra.integration.test.ts.snap +2 -2
  175. package/src/families/cosmos/datasets/__snapshots__/onomy.integration.test.ts.snap +45 -0
  176. package/src/families/cosmos/datasets/__snapshots__/osmosis.integration.test.ts.snap +2 -2
  177. package/src/families/cosmos/datasets/__snapshots__/persistence.integration.test.ts.snap +4 -4
  178. package/src/families/cosmos/datasets/__snapshots__/stargaze.integration.test.ts.snap +2 -2
  179. package/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap +2 -2
  180. package/src/families/cosmos/datasets/axelar.integration.test.ts +1 -4
  181. package/src/families/cosmos/datasets/desmos.integration.test.ts +1 -4
  182. package/src/families/cosmos/datasets/onomy.integration.test.ts +1 -4
  183. package/src/families/filecoin/__snapshots__/bridge.integration.test.ts.snap +242 -0
  184. package/src/families/filecoin/bridge.integration.test.ts +1 -4
  185. package/src/families/internet_computer/__snapshots__/bridge.integration.test.ts.snap +3 -60
  186. package/src/families/kaspa/__snapshots__/bridge.integration.test.ts.snap +66 -0
  187. package/src/families/kaspa/bridge.integration.test.ts +1 -4
  188. package/src/families/mina/__snapshots__/bridge.integration.test.ts.snap +169 -0
  189. package/src/families/mina/bridge.integration.test.ts +1 -4
  190. package/src/families/multiversx/synchronisation.integration.test.ts +1 -5
  191. package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +4 -50
  192. package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +3 -23
  193. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +74 -1504
  194. package/src/families/ton/__snapshots__/bridge.integration.test.ts.snap +338 -0
  195. package/src/families/ton/bridge.integration.test.ts +1 -4
  196. package/src/featureFlags/defaultFeatures.ts +0 -2
  197. package/src/notifications/ServiceStatusProvider/index.tsx +13 -61
  198. package/src/notifications/ServiceStatusProvider/types.ts +1 -4
  199. package/src/wallet-api/react.ts +3 -3
  200. package/lib/bridge/syncSessionManager/index.d.ts +0 -18
  201. package/lib/bridge/syncSessionManager/index.d.ts.map +0 -1
  202. package/lib/bridge/syncSessionManager/index.js +0 -75
  203. package/lib/bridge/syncSessionManager/index.js.map +0 -1
  204. package/lib/bridge/syncSessionManager/index.test.d.ts +0 -2
  205. package/lib/bridge/syncSessionManager/index.test.d.ts.map +0 -1
  206. package/lib/bridge/syncSessionManager/index.test.js +0 -118
  207. package/lib/bridge/syncSessionManager/index.test.js.map +0 -1
  208. package/lib/notifications/ServiceStatusProvider/entry-points.d.ts +0 -3
  209. package/lib/notifications/ServiceStatusProvider/entry-points.d.ts.map +0 -1
  210. package/lib/notifications/ServiceStatusProvider/entry-points.js +0 -3
  211. package/lib/notifications/ServiceStatusProvider/entry-points.js.map +0 -1
  212. package/lib/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
  213. package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
  214. package/lib/notifications/ServiceStatusProvider/index.test.js +0 -88
  215. package/lib/notifications/ServiceStatusProvider/index.test.js.map +0 -1
  216. package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
  217. package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
  218. package/lib/notifications/ServiceStatusProvider/ledger-components.js +0 -17
  219. package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
  220. package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +0 -154
  221. package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +0 -1
  222. package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +0 -1192
  223. package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +0 -1
  224. package/lib-es/bridge/syncSessionManager/index.d.ts +0 -18
  225. package/lib-es/bridge/syncSessionManager/index.d.ts.map +0 -1
  226. package/lib-es/bridge/syncSessionManager/index.js +0 -68
  227. package/lib-es/bridge/syncSessionManager/index.js.map +0 -1
  228. package/lib-es/bridge/syncSessionManager/index.test.d.ts +0 -2
  229. package/lib-es/bridge/syncSessionManager/index.test.d.ts.map +0 -1
  230. package/lib-es/bridge/syncSessionManager/index.test.js +0 -116
  231. package/lib-es/bridge/syncSessionManager/index.test.js.map +0 -1
  232. package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts +0 -3
  233. package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts.map +0 -1
  234. package/lib-es/notifications/ServiceStatusProvider/entry-points.js +0 -2
  235. package/lib-es/notifications/ServiceStatusProvider/entry-points.js.map +0 -1
  236. package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
  237. package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
  238. package/lib-es/notifications/ServiceStatusProvider/index.test.js +0 -86
  239. package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +0 -1
  240. package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
  241. package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
  242. package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +0 -14
  243. package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
  244. package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +0 -154
  245. package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +0 -1
  246. package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +0 -1189
  247. package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +0 -1
  248. package/src/bridge/syncSessionManager/index.test.ts +0 -151
  249. package/src/bridge/syncSessionManager/index.ts +0 -93
  250. package/src/notifications/ServiceStatusProvider/entry-points.ts +0 -3
  251. package/src/notifications/ServiceStatusProvider/index.test.ts +0 -102
  252. package/src/notifications/ServiceStatusProvider/ledger-components.ts +0 -13
  253. package/src/notifications/ServiceStatusProvider/mocks/ledgerStatus.ts +0 -1188
@@ -12,7 +12,6 @@ import type { SyncAction, SyncState, BridgeSyncState } from "./types";
12
12
  import { BridgeSyncContext, BridgeSyncStateContext } from "./context";
13
13
  import type { Account, TokenAccount } from "@ledgerhq/types-live";
14
14
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
15
- import { createSyncSessionManager } from "../syncSessionManager";
16
15
 
17
16
  export type Props = {
18
17
  // this is a wrapping component that you need to put in your tree
@@ -53,7 +52,6 @@ export const BridgeSync = ({
53
52
  accounts,
54
53
  hydrateCurrency,
55
54
  });
56
- const sessionManager = useRef(createSyncSessionManager(trackAnalytics)).current;
57
55
  const [syncQueue, syncState] = useSyncQueue({
58
56
  accounts,
59
57
  prepareCurrency,
@@ -61,12 +59,10 @@ export const BridgeSync = ({
61
59
  trackAnalytics,
62
60
  updateAccountWithUpdater,
63
61
  blacklistedTokenIds,
64
- sessionManager,
65
62
  });
66
63
  const sync = useSync({
67
64
  syncQueue,
68
65
  accounts,
69
- sessionManager,
70
66
  });
71
67
  useSyncBackground({
72
68
  sync,
@@ -115,7 +111,6 @@ function useSyncQueue({
115
111
  trackAnalytics,
116
112
  updateAccountWithUpdater,
117
113
  blacklistedTokenIds,
118
- sessionManager,
119
114
  }) {
120
115
  const [bridgeSyncState, setBridgeSyncState]: [BridgeSyncState, any] = useState({});
121
116
  const setAccountSyncState = useCallback((accountId: string, s: SyncState) => {
@@ -209,7 +204,6 @@ function useSyncQueue({
209
204
  pending: false,
210
205
  error: null,
211
206
  });
212
- sessionManager.onAccountSyncDone(accountId, accounts);
213
207
  next();
214
208
  },
215
209
  error: (raw: Error) => {
@@ -221,7 +215,6 @@ function useSyncQueue({
221
215
  pending: false,
222
216
  error: null,
223
217
  });
224
- sessionManager.onAccountSyncDone(accountId, accounts);
225
218
  next();
226
219
  return;
227
220
  }
@@ -230,7 +223,6 @@ function useSyncQueue({
230
223
  pending: false,
231
224
  error,
232
225
  });
233
- sessionManager.onAccountSyncDone(accountId, accounts, true);
234
226
  next();
235
227
  },
236
228
  });
@@ -239,7 +231,6 @@ function useSyncQueue({
239
231
  pending: false,
240
232
  error,
241
233
  });
242
- sessionManager.onAccountSyncDone(accountId, accounts, true);
243
234
  next();
244
235
  }
245
236
  },
@@ -252,7 +243,6 @@ function useSyncQueue({
252
243
  trackAnalytics,
253
244
  updateAccountWithUpdater,
254
245
  blacklistedTokenIds,
255
- sessionManager,
256
246
  ],
257
247
  );
258
248
  const synchronizeRef = useRef(synchronize);
@@ -269,7 +259,7 @@ function useSyncQueue({
269
259
  }
270
260
 
271
261
  // useSync: returns a sync function with the syncQueue
272
- function useSync({ syncQueue, accounts, sessionManager }) {
262
+ function useSync({ syncQueue, accounts }) {
273
263
  const skipUnderPriority = useRef(-1);
274
264
  const sync = useMemo(() => {
275
265
  const schedule = (ids: string[], priority: number, reason: string) => {
@@ -277,10 +267,6 @@ function useSync({ syncQueue, accounts, sessionManager }) {
277
267
  // by convention we remove concurrent tasks with same priority
278
268
  // FIXME this is somehow a hack. ideally we should just dedup the account ids in the pending queue...
279
269
  syncQueue.remove(o => priority === o.priority);
280
- // start a global session only if initial + all accounts
281
- if (reason === "initial" && ids.length === accounts.length) {
282
- sessionManager.start(ids, reason);
283
- }
284
270
  log("bridge", "schedule " + ids.join(", "));
285
271
  syncQueue.push(
286
272
  ids.map(accountId => ({
@@ -303,7 +289,7 @@ function useSync({ syncQueue, accounts, sessionManager }) {
303
289
  SET_SKIP_UNDER_PRIORITY: ({ priority }: { priority: number }) => {
304
290
  if (priority === skipUnderPriority.current) return;
305
291
  skipUnderPriority.current = priority;
306
- syncQueue.remove(({ priority }) => priority < skipUnderPriority.current);
292
+ syncQueue.remove(({ priority }) => priority < skipUnderPriority);
307
293
 
308
294
  if (priority === -1 && !accounts.every(isUpToDateAccount)) {
309
295
  // going back to -1 priority => retriggering a background sync if it is "Paused"
@@ -352,7 +338,7 @@ function useSync({ syncQueue, accounts, sessionManager }) {
352
338
  });
353
339
  }
354
340
  };
355
- }, [accounts, syncQueue, sessionManager]);
341
+ }, [accounts, syncQueue]);
356
342
  const ref = useRef(sync);
357
343
  useEffect(() => {
358
344
  ref.current = sync;
@@ -4,49 +4,10 @@
4
4
  import "../__tests__/test-helpers/setup";
5
5
  import { renderHook, waitFor } from "@testing-library/react";
6
6
  import { useGroupedCurrenciesByProvider } from ".";
7
- import { GroupedCurrencies, LoadingBasedGroupedCurrencies, MappedAsset } from "./type";
8
- import * as api from "./api";
9
-
10
- // Mock the API module
11
- jest.mock("./api");
12
- const mockGetMappedAssets = api.getMappedAssets as jest.MockedFunction<typeof api.getMappedAssets>;
13
-
14
- // Create mock data for testing
15
- const mockMappedAssets: MappedAsset[] = [
16
- {
17
- $type: "Coin",
18
- ledgerId: "bitcoin",
19
- providerId: "coingecko",
20
- name: "Bitcoin",
21
- ticker: "BTC",
22
- status: "active",
23
- reason: null,
24
- data: {
25
- img: "https://crypto-icons.example.com/bitcoin.png",
26
- marketCapRank: 1,
27
- },
28
- },
29
- {
30
- $type: "Coin",
31
- ledgerId: "ethereum",
32
- providerId: "coingecko",
33
- name: "Ethereum",
34
- ticker: "ETH",
35
- status: "active",
36
- reason: null,
37
- data: {
38
- img: "https://crypto-icons.example.com/ethereum.png",
39
- marketCapRank: 2,
40
- },
41
- },
42
- ];
7
+ import { GroupedCurrencies, LoadingBasedGroupedCurrencies } from "./type";
8
+ // Explicitly mock the featureFlags module
43
9
 
44
10
  describe("useGroupedCurrenciesByProvider", () => {
45
- beforeEach(() => {
46
- // Mock the API call to return our test data
47
- mockGetMappedAssets.mockResolvedValue(mockMappedAssets);
48
- });
49
-
50
11
  afterEach(() => {
51
12
  jest.clearAllMocks();
52
13
  });
@@ -54,7 +54,7 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
54
54
  [AppInfos.MULTIVERS_X.name]: DeviceLabels.SIGN,
55
55
  [AppInfos.NEAR.name]: DeviceLabels.CONTINUE_TO_ACTION,
56
56
  [AppInfos.SOLANA.name]: DeviceLabels.APPROVE,
57
- [AppInfos.TEZOS.name]: DeviceLabels.ACCEPT_RISK,
57
+ [AppInfos.TEZOS.name]: DeviceLabels.ACCEPT_AND_SEND,
58
58
  default: DeviceLabels.CAPS_APPROVE,
59
59
  },
60
60
  },
@@ -87,12 +87,12 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
87
87
  },
88
88
  delegateConfirm: {
89
89
  [AppInfos.CELO.name]: DeviceLabels.ACCEPT,
90
- [AppInfos.TEZOS.name]: DeviceLabels.ACCEPT_AND_SEND,
91
90
  [AppInfos.COSMOS.name]: DeviceLabels.CAPS_APPROVE,
92
91
  [AppInfos.INJECTIVE.name]: DeviceLabels.CAPS_APPROVE,
93
92
  [AppInfos.MULTIVERS_X.name]: DeviceLabels.SIGN,
94
93
  [AppInfos.NEAR.name]: DeviceLabels.CONTINUE_TO_ACTION,
95
94
  [AppInfos.SOLANA.name]: DeviceLabels.SIGN_TRANSACTION,
95
+ [AppInfos.TEZOS.name]: DeviceLabels.ACCEPT_RISK,
96
96
  [AppInfos.OSMOSIS.name]: DeviceLabels.CAPS_APPROVE,
97
97
  default: DeviceLabels.APPROVE,
98
98
  },
@@ -248,13 +248,6 @@ export class Account {
248
248
  "0xa1baa625c5E6A9304cB7AcD86d2fee6B710eC3eB",
249
249
  1,
250
250
  undefined,
251
- );
252
- static readonly ETH_2_WITH_ENS = new Account(
253
- Currency.ETH,
254
- "Ethereum 2",
255
- "0xa1baa625c5E6A9304cB7AcD86d2fee6B710eC3eB",
256
- 1,
257
- undefined,
258
251
  "speculos.eth",
259
252
  );
260
253
  static readonly ETH_2_LOWER_CASE = new Account(
@@ -6,8 +6,9 @@ export enum DeviceLabels {
6
6
  ADDRESS = "Address",
7
7
  AMOUNT = "Amount",
8
8
  APPROVE = "Approve",
9
- BITCOIN_IS_READY = "Bitcoin is ready",
9
+ CANCEL = "Cancel",
10
10
  CAPS_APPROVE = "APPROVE",
11
+ CAPS_REJECT = "REJECT",
11
12
  CHAIN_ID = "Chain ID",
12
13
  CONFIRM = "Confirm",
13
14
  CONNECT = "Connect",
@@ -18,14 +19,19 @@ export enum DeviceLabels {
18
19
  DELEGATE_FROM = "Delegate from",
19
20
  DELEGATE_STAKE = "Delegate stake",
20
21
  DEPOSIT = "Deposit",
22
+ DEST = "Dest",
23
+ DESTINATION = "Destination",
21
24
  EXPERT_MODE = "Expert mode",
22
25
  FEES = "Fees",
26
+ FINALIZE = "Finalize",
23
27
  GET = "Get",
24
28
  I_UNDERSTAND = "I understand",
25
29
  LEDGER_LIVE_WILL_BE = "Ledger Live will be",
30
+ METHOD_NAME = "Method name",
26
31
  NEW_ORDINARY = "New ordinary",
27
32
  PLEASE_REVIEW = "Please",
28
33
  PUBKEY = "Pubkey",
34
+ PUBLICKEY = "Public Key Hash",
29
35
  READY = "Ready",
30
36
  RECEIVE_ADDRESS_DOES_NOT_BELONG = "Receive address does",
31
37
  RECEIVER = "Receiver",
@@ -45,7 +51,6 @@ export enum DeviceLabels {
45
51
  STAKE_KEY = "Stake key",
46
52
  TO = "To",
47
53
  TRANSACTION_FEE = "Transaction fee",
48
- TRANSACTION_SIGNED = "Transaction Signed",
49
54
  TRANSFER = "Transfer",
50
55
  TURN_ON_SYNC = "Turn on sync",
51
56
  TURN_ON_SYNC2 = "Turn On sync",
@@ -58,4 +63,5 @@ export enum DeviceLabels {
58
63
  VERIFY_SOLANA_ADDRESS = "Verify Solana address",
59
64
  VIEW_ACTION = "View action",
60
65
  VIEW_HEADER = "View Header",
66
+ WALLET_ID = "Wallet ID",
61
67
  }
@@ -1,15 +1,7 @@
1
1
  import expect from "expect";
2
2
  import { Transaction } from "../models/Transaction";
3
- import {
4
- pressBoth,
5
- pressUntilTextFound,
6
- waitFor,
7
- containsSubstringInEvent,
8
- getSpeculosModel,
9
- } from "../speculos";
3
+ import { pressBoth, pressUntilTextFound, waitFor, containsSubstringInEvent } from "../speculos";
10
4
  import { DeviceLabels } from "../enum/DeviceLabels";
11
- import { Device } from "../enum/Device";
12
- import invariant from "invariant";
13
5
 
14
6
  export async function sendBTCBasedCoin(tx: Transaction) {
15
7
  const events = await pressUntilTextFound(DeviceLabels.ACCEPT);
@@ -22,27 +14,3 @@ export async function sendBTCBasedCoin(tx: Transaction) {
22
14
  await pressUntilTextFound(DeviceLabels.ACCEPT);
23
15
  await pressBoth();
24
16
  }
25
-
26
- export async function sendBTC(tx: Transaction) {
27
- const speculosDevice = getSpeculosModel();
28
- try {
29
- const events =
30
- speculosDevice === Device.LNS
31
- ? await pressUntilTextFound(DeviceLabels.CONTINUE)
32
- : await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
33
- const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
34
- expect(isAmountCorrect).toBeTruthy();
35
- const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
36
- expect(isAddressCorrect).toBeTruthy();
37
- await pressBoth();
38
- if (speculosDevice === Device.LNS) {
39
- await pressUntilTextFound(DeviceLabels.SIGN);
40
- await pressBoth();
41
- await waitFor(DeviceLabels.BITCOIN_IS_READY);
42
- } else {
43
- await waitFor(DeviceLabels.TRANSACTION_SIGNED);
44
- }
45
- } catch (e) {
46
- invariant(false, `Error while sending BTC transaction: ${e}`);
47
- }
48
- }
@@ -1,23 +1,14 @@
1
- import {
2
- getDelegateEvents,
3
- getDeviceLabels,
4
- getSpeculosModel,
5
- pressBoth,
6
- pressUntilTextFound,
7
- } from "../speculos";
1
+ import { getDelegateEvents, getSpeculosModel, pressBoth, pressUntilTextFound } from "../speculos";
2
+ import { DeviceLabels } from "../enum/DeviceLabels";
8
3
  import { Delegate } from "../models/Delegate";
9
4
  import { DeviceModelId } from "@ledgerhq/types-devices";
10
- import { DeviceLabels } from "../enum/DeviceLabels";
11
5
 
12
6
  export async function delegateTezos(delegatingAccount: Delegate) {
13
- const { delegateConfirmLabel } = getDeviceLabels(delegatingAccount.account.currency.speculosApp);
14
-
15
7
  await getDelegateEvents(delegatingAccount);
16
- await pressUntilTextFound(delegateConfirmLabel);
17
8
  await pressBoth();
18
9
 
19
- if (getSpeculosModel() == DeviceModelId.nanoS) {
20
- await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND);
10
+ if (getSpeculosModel() !== DeviceModelId.nanoS) {
11
+ await pressUntilTextFound(DeviceLabels.ACCEPT);
21
12
  await pressBoth();
22
13
  }
23
14
  }
@@ -27,12 +27,4 @@ export class Swap extends Transaction {
27
27
  public get getAmount(): string {
28
28
  return this.amount;
29
29
  }
30
-
31
- public get getAccountToDebit(): Account {
32
- return this.accountToDebit;
33
- }
34
-
35
- public get getAccountToCredit(): Account {
36
- return this.accountToCredit;
37
- }
38
30
  }
@@ -19,7 +19,7 @@ import { Account } from "./enum/Account";
19
19
  import { Device as CryptoWallet } from "./enum/Device";
20
20
  import { Currency } from "./enum/Currency";
21
21
  import expect from "expect";
22
- import { sendBTC, sendBTCBasedCoin } from "./families/bitcoin";
22
+ import { sendBTCBasedCoin } from "./families/bitcoin";
23
23
  import { sendEVM, sendEvmNFT } from "./families/evm";
24
24
  import { sendPolkadot } from "./families/polkadot";
25
25
  import { sendAlgorand } from "./families/algorand";
@@ -630,7 +630,7 @@ type DeviceLabelsReturn = {
630
630
  receiveVerifyLabel: string;
631
631
  };
632
632
 
633
- export function getDeviceLabels(appInfo: AppInfos): DeviceLabelsReturn {
633
+ function getDeviceLabels(appInfo: AppInfos): DeviceLabelsReturn {
634
634
  const deviceModel = getSpeculosModel();
635
635
  const deviceConfig = DEVICE_LABELS_CONFIG[deviceModel] ?? DEVICE_LABELS_CONFIG.default;
636
636
 
@@ -668,12 +668,6 @@ export async function signSendTransaction(tx: Transaction) {
668
668
  case Currency.ETH:
669
669
  await sendEVM(tx);
670
670
  break;
671
- case Currency.BTC:
672
- await sendBTC(tx);
673
- break;
674
- case Currency.ETH_USDT:
675
- await sendEVM(tx);
676
- break;
677
671
  case Currency.DOGE:
678
672
  case Currency.BCH:
679
673
  await sendBTCBasedCoin(tx);
@@ -765,7 +759,6 @@ export async function getDelegateEvents(delegatingAccount: Delegate): Promise<st
765
759
  );
766
760
 
767
761
  await waitFor(delegateVerifyLabel);
768
-
769
762
  return await pressUntilTextFound(delegateConfirmLabel);
770
763
  }
771
764
 
@@ -775,38 +768,54 @@ export async function verifyAmountsAndAcceptSwap(swap: Swap, amount: string) {
775
768
  getSpeculosModel() === DeviceModelId.nanoS
776
769
  ? await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND)
777
770
  : await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
778
- verifySwapData(swap, events, amount);
771
+ await verifySwapData(swap, events, amount);
779
772
  await pressBoth();
780
773
  }
781
774
 
782
775
  export async function verifyAmountsAndAcceptSwapForDifferentSeed(swap: Swap, amount: string) {
783
- await waitFor(DeviceLabels.REVIEW_TRANSACTION);
776
+ await waitFor(DeviceLabels.RECEIVE_ADDRESS_DOES_NOT_BELONG);
777
+ await pressUntilTextFound(DeviceLabels.I_UNDERSTAND);
778
+ await pressBoth();
784
779
  const events = await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
785
- verifySwapData(swap, events, amount);
780
+ await verifySwapData(swap, events, amount);
786
781
  await pressBoth();
787
782
  }
788
783
 
789
784
  export async function verifyAmountsAndRejectSwap(swap: Swap, amount: string) {
790
785
  await waitFor(DeviceLabels.REVIEW_TRANSACTION);
791
786
  const events = await pressUntilTextFound(DeviceLabels.REJECT);
792
- verifySwapData(swap, events, amount);
787
+ await verifySwapData(swap, events, amount);
793
788
  await pressBoth();
794
789
  }
795
790
 
796
- function verifySwapData(swap: Swap, events: string[], amount: string) {
797
- const swapPair = `swap ${swap.getAccountToDebit.currency.ticker} to ${swap.getAccountToCredit.currency.ticker}`;
791
+ async function verifySwapData(swap: Swap, events: string[], amount: string) {
792
+ const sendAmountScreen = containsSubstringInEvent(amount, events);
793
+ expect(sendAmountScreen).toBeTruthy();
794
+ verifySwapGetAmountScreen(swap, events);
795
+ verifySwapFeesAmountScreen(swap, events);
796
+ }
797
+
798
+ function verifySwapGetAmountScreen(swap: Swap, events: string[]) {
799
+ const parsedAmountToReceive = extractNumberFromString(swap.amountToReceive);
800
+ swap.amountToReceive =
801
+ parsedAmountToReceive.length < 19
802
+ ? parsedAmountToReceive
803
+ : parsedAmountToReceive.substring(0, 18);
798
804
 
799
- if (getSpeculosModel() !== DeviceModelId.nanoS) {
800
- expectDeviceScreenContains(swapPair, events, "Swap pair not found on the device screen");
801
- }
802
- expectDeviceScreenContains(amount, events, `Amount ${amount} not found on the device screen`);
805
+ const receivedGetAmount = containsSubstringInEvent(`${swap.amountToReceive}`, events);
806
+ expect(receivedGetAmount).toBeTruthy();
803
807
  }
804
808
 
805
- function expectDeviceScreenContains(substring: string, events: string[], message: string) {
806
- const found = containsSubstringInEvent(substring, events);
807
- if (!found) {
808
- throw new Error(
809
- `${message}. Expected events to contain "${substring}". Got: ${JSON.stringify(events)}`,
810
- );
811
- }
809
+ function verifySwapFeesAmountScreen(swap: Swap, events: string[]) {
810
+ const parsedFeesAmount = extractNumberFromString(swap.feesAmount);
811
+ swap.feesAmount =
812
+ parsedFeesAmount.length < 19 ? parsedFeesAmount : parsedFeesAmount.substring(0, 18);
813
+
814
+ const receivedFeesAmount = containsSubstringInEvent(swap.feesAmount, events);
815
+ expect(receivedFeesAmount).toBeTruthy();
812
816
  }
817
+
818
+ const extractNumberFromString = (input: string | undefined): string => {
819
+ const match = input?.match(/[\d.]+/);
820
+ return match ? match[0] : "";
821
+ };
@@ -177,9 +177,9 @@ const DEFAULT_SWAP_PROVIDERS: Record<string, ProviderConfig & Partial<Additional
177
177
  type: "CEX",
178
178
  name: "NEAR Intents",
179
179
  needsBearerToken: false,
180
- termsOfUseUrl: "https://swapkit.dev/terms-of-service/",
180
+ termsOfUseUrl: "https://docs.thorswap.finance/thorswap/resources/terms-of-service",
181
181
  supportUrl: "https://ledgerhelp.swapkit.dev/",
182
- mainUrl: "https://www.near.org/intents",
182
+ mainUrl: "https://www.thorswap.finance/",
183
183
  needsKYC: false,
184
184
  version: 2,
185
185
  publicKey: {