@ledgerhq/live-common 34.49.0-nightly.6 → 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.
- package/lib/apps/config.js +1 -1
- package/lib/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib/bridge/react/BridgeSync.js +4 -17
- package/lib/bridge/react/BridgeSync.js.map +1 -1
- package/lib/deposit/deposit.integration.test.js +1 -60
- package/lib/deposit/deposit.integration.test.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +2 -2
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +0 -2
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +1 -3
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +9 -3
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +8 -2
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts +0 -1
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +1 -28
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +3 -5
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +0 -4
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/models/Swap.d.ts +0 -2
- package/lib/e2e/models/Swap.d.ts.map +1 -1
- package/lib/e2e/models/Swap.js +0 -6
- package/lib/e2e/models/Swap.js.map +1 -1
- package/lib/e2e/speculos.d.ts +0 -8
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +31 -23
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/providers/swap.js +2 -2
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/families/celo/bridge.integration.test.js +1 -4
- package/lib/families/celo/bridge.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/axelar.integration.test.js +1 -4
- package/lib/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/desmos.integration.test.js +1 -4
- package/lib/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/onomy.integration.test.js +1 -4
- package/lib/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
- package/lib/families/filecoin/bridge.integration.test.js +1 -4
- package/lib/families/filecoin/bridge.integration.test.js.map +1 -1
- package/lib/families/kaspa/bridge.integration.test.js +1 -4
- package/lib/families/kaspa/bridge.integration.test.js.map +1 -1
- package/lib/families/mina/bridge.integration.test.js +1 -4
- package/lib/families/mina/bridge.integration.test.js.map +1 -1
- package/lib/families/multiversx/synchronisation.integration.test.js +1 -4
- package/lib/families/multiversx/synchronisation.integration.test.js.map +1 -1
- package/lib/families/ton/bridge.integration.test.js +1 -4
- package/lib/families/ton/bridge.integration.test.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +0 -2
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +0 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +0 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +0 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +0 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +0 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts +1 -18
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +9 -47
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/types.d.ts +1 -3
- package/lib/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
- package/lib/wallet-api/react.d.ts +1 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +1 -1
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/apps/config.js +1 -1
- package/lib-es/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib-es/bridge/react/BridgeSync.js +4 -17
- package/lib-es/bridge/react/BridgeSync.js.map +1 -1
- package/lib-es/deposit/deposit.integration.test.js +1 -37
- package/lib-es/deposit/deposit.integration.test.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +2 -2
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +0 -2
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +1 -3
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +9 -3
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +8 -2
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts +0 -1
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +1 -27
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +4 -6
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +0 -4
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/models/Swap.d.ts +0 -2
- package/lib-es/e2e/models/Swap.d.ts.map +1 -1
- package/lib-es/e2e/models/Swap.js +0 -6
- package/lib-es/e2e/models/Swap.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts +0 -8
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +32 -23
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/providers/swap.js +2 -2
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/families/celo/bridge.integration.test.js +1 -4
- package/lib-es/families/celo/bridge.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/axelar.integration.test.js +1 -4
- package/lib-es/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/desmos.integration.test.js +1 -4
- package/lib-es/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/onomy.integration.test.js +1 -4
- package/lib-es/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
- package/lib-es/families/filecoin/bridge.integration.test.js +1 -4
- package/lib-es/families/filecoin/bridge.integration.test.js.map +1 -1
- package/lib-es/families/kaspa/bridge.integration.test.js +1 -4
- package/lib-es/families/kaspa/bridge.integration.test.js.map +1 -1
- package/lib-es/families/mina/bridge.integration.test.js +1 -4
- package/lib-es/families/mina/bridge.integration.test.js.map +1 -1
- package/lib-es/families/multiversx/synchronisation.integration.test.js +1 -4
- package/lib-es/families/multiversx/synchronisation.integration.test.js.map +1 -1
- package/lib-es/families/ton/bridge.integration.test.js +1 -4
- package/lib-es/families/ton/bridge.integration.test.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +0 -2
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +0 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +0 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +0 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +0 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +0 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts +1 -18
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +9 -47
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/types.d.ts +1 -3
- package/lib-es/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
- package/lib-es/wallet-api/react.d.ts +1 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +1 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +69 -69
- package/src/apps/config.ts +1 -1
- package/src/bridge/react/BridgeSync.tsx +3 -17
- package/src/deposit/deposit.integration.test.ts +2 -41
- package/src/e2e/data/deviceLabelsData.ts +2 -2
- package/src/e2e/enum/Account.ts +0 -13
- package/src/e2e/enum/DeviceLabels.ts +8 -2
- package/src/e2e/families/bitcoin.ts +1 -33
- package/src/e2e/families/tezos.ts +4 -13
- package/src/e2e/models/Swap.ts +0 -8
- package/src/e2e/speculos.ts +35 -26
- package/src/exchange/providers/swap.ts +2 -2
- package/src/families/celo/__snapshots__/bridge.integration.test.ts.snap +285 -0
- package/src/families/celo/bridge.integration.test.ts +1 -4
- package/src/families/cosmos/datasets/__snapshots__/axelar.integration.test.ts.snap +45 -0
- package/src/families/cosmos/datasets/__snapshots__/babylon.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +4 -299
- package/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/desmos.integration.test.ts.snap +45 -0
- package/src/families/cosmos/datasets/__snapshots__/injective.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/mantra.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/onomy.integration.test.ts.snap +45 -0
- package/src/families/cosmos/datasets/__snapshots__/osmosis.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/persistence.integration.test.ts.snap +4 -4
- package/src/families/cosmos/datasets/__snapshots__/stargaze.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/axelar.integration.test.ts +1 -4
- package/src/families/cosmos/datasets/desmos.integration.test.ts +1 -4
- package/src/families/cosmos/datasets/onomy.integration.test.ts +1 -4
- package/src/families/filecoin/__snapshots__/bridge.integration.test.ts.snap +242 -0
- package/src/families/filecoin/bridge.integration.test.ts +1 -4
- package/src/families/internet_computer/__snapshots__/bridge.integration.test.ts.snap +3 -60
- package/src/families/kaspa/__snapshots__/bridge.integration.test.ts.snap +66 -0
- package/src/families/kaspa/bridge.integration.test.ts +1 -4
- package/src/families/mina/__snapshots__/bridge.integration.test.ts.snap +169 -0
- package/src/families/mina/bridge.integration.test.ts +1 -4
- package/src/families/multiversx/synchronisation.integration.test.ts +1 -5
- package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +4 -50
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +3 -23
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +74 -1504
- package/src/families/ton/__snapshots__/bridge.integration.test.ts.snap +338 -0
- package/src/families/ton/bridge.integration.test.ts +1 -4
- package/src/featureFlags/defaultFeatures.ts +0 -2
- package/src/notifications/ServiceStatusProvider/index.tsx +13 -61
- package/src/notifications/ServiceStatusProvider/types.ts +1 -4
- package/src/wallet-api/react.ts +3 -3
- package/lib/bridge/syncSessionManager/index.d.ts +0 -18
- package/lib/bridge/syncSessionManager/index.d.ts.map +0 -1
- package/lib/bridge/syncSessionManager/index.js +0 -75
- package/lib/bridge/syncSessionManager/index.js.map +0 -1
- package/lib/bridge/syncSessionManager/index.test.d.ts +0 -2
- package/lib/bridge/syncSessionManager/index.test.d.ts.map +0 -1
- package/lib/bridge/syncSessionManager/index.test.js +0 -118
- package/lib/bridge/syncSessionManager/index.test.js.map +0 -1
- package/lib/notifications/ServiceStatusProvider/entry-points.d.ts +0 -3
- package/lib/notifications/ServiceStatusProvider/entry-points.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/entry-points.js +0 -3
- package/lib/notifications/ServiceStatusProvider/entry-points.js.map +0 -1
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/index.test.js +0 -88
- package/lib/notifications/ServiceStatusProvider/index.test.js.map +0 -1
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/ledger-components.js +0 -17
- package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +0 -154
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +0 -1192
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +0 -1
- package/lib-es/bridge/syncSessionManager/index.d.ts +0 -18
- package/lib-es/bridge/syncSessionManager/index.d.ts.map +0 -1
- package/lib-es/bridge/syncSessionManager/index.js +0 -68
- package/lib-es/bridge/syncSessionManager/index.js.map +0 -1
- package/lib-es/bridge/syncSessionManager/index.test.d.ts +0 -2
- package/lib-es/bridge/syncSessionManager/index.test.d.ts.map +0 -1
- package/lib-es/bridge/syncSessionManager/index.test.js +0 -116
- package/lib-es/bridge/syncSessionManager/index.test.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts +0 -3
- package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/entry-points.js +0 -2
- package/lib-es/notifications/ServiceStatusProvider/entry-points.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.js +0 -86
- package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +0 -14
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +0 -154
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +0 -1189
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +0 -1
- package/src/bridge/syncSessionManager/index.test.ts +0 -151
- package/src/bridge/syncSessionManager/index.ts +0 -93
- package/src/notifications/ServiceStatusProvider/entry-points.ts +0 -3
- package/src/notifications/ServiceStatusProvider/index.test.ts +0 -102
- package/src/notifications/ServiceStatusProvider/ledger-components.ts +0 -13
- 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
|
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
|
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
|
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
|
8
|
-
|
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.
|
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
|
},
|
package/src/e2e/enum/Account.ts
CHANGED
@@ -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(
|
@@ -392,12 +385,6 @@ export class Account {
|
|
392
385
|
"JC2dR4QRMt68r2h7Sjs5wshx1RdmDVrSbdL2jWBuVf2t",
|
393
386
|
2,
|
394
387
|
);
|
395
|
-
static readonly SOL_4 = new Account(
|
396
|
-
Currency.SOL,
|
397
|
-
"Solana 4",
|
398
|
-
"FKFMRmTEJ6wHMWviuDocuhsZoTi3DnypoPQXBUjCCTXM",
|
399
|
-
3,
|
400
|
-
);
|
401
388
|
|
402
389
|
static readonly tBTC_1 = new Account(
|
403
390
|
Currency.tBTC,
|
@@ -6,8 +6,9 @@ export enum DeviceLabels {
|
|
6
6
|
ADDRESS = "Address",
|
7
7
|
AMOUNT = "Amount",
|
8
8
|
APPROVE = "Approve",
|
9
|
-
|
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
|
-
|
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()
|
20
|
-
await pressUntilTextFound(DeviceLabels.
|
10
|
+
if (getSpeculosModel() !== DeviceModelId.nanoS) {
|
11
|
+
await pressUntilTextFound(DeviceLabels.ACCEPT);
|
21
12
|
await pressBoth();
|
22
13
|
}
|
23
14
|
}
|
package/src/e2e/models/Swap.ts
CHANGED
@@ -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
|
}
|
package/src/e2e/speculos.ts
CHANGED
@@ -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 {
|
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
|
-
|
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.
|
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
|
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
|
-
|
800
|
-
|
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
|
806
|
-
const
|
807
|
-
|
808
|
-
|
809
|
-
|
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://
|
180
|
+
termsOfUseUrl: "https://docs.thorswap.finance/thorswap/resources/terms-of-service",
|
181
181
|
supportUrl: "https://ledgerhelp.swapkit.dev/",
|
182
|
-
mainUrl: "https://www.
|
182
|
+
mainUrl: "https://www.thorswap.finance/",
|
183
183
|
needsKYC: false,
|
184
184
|
version: 2,
|
185
185
|
publicKey: {
|