@ledgerhq/live-common 34.53.0-nightly.20251111023817 → 34.53.0-nightly.20251113023835
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/bridge/generic-alpaca/buildSubAccounts.js +4 -4
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib/bridge/useBridgeTransaction.d.ts +4 -0
- package/lib/bridge/useBridgeTransaction.d.ts.map +1 -1
- package/lib/bridge/useBridgeTransaction.js +48 -5
- package/lib/bridge/useBridgeTransaction.js.map +1 -1
- package/lib/e2e/index.d.ts +166 -1
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/index.js +2 -2
- package/lib/e2e/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +4 -4
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib-es/bridge/useBridgeTransaction.d.ts +4 -0
- package/lib-es/bridge/useBridgeTransaction.d.ts.map +1 -1
- package/lib-es/bridge/useBridgeTransaction.js +46 -4
- package/lib-es/bridge/useBridgeTransaction.js.map +1 -1
- package/lib-es/e2e/index.d.ts +166 -1
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/index.js +2 -2
- package/lib-es/e2e/index.js.map +1 -1
- package/package.json +48 -48
- package/src/bridge/generic-alpaca/buildSubAccounts.test.ts +66 -0
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +5 -5
- package/src/bridge/useBridgeTransaction.test.ts +64 -0
- package/src/bridge/useBridgeTransaction.ts +70 -4
- package/src/e2e/index.ts +2 -1
- package/src/exchange/swap/hooks/useFromState.test.ts +19 -0
|
@@ -4,6 +4,7 @@ import { log } from "@ledgerhq/logs";
|
|
|
4
4
|
import { getAccountBridge } from ".";
|
|
5
5
|
import { getMainAccount } from "../account";
|
|
6
6
|
import { delay } from "../promise";
|
|
7
|
+
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
7
8
|
const initial = {
|
|
8
9
|
account: null,
|
|
9
10
|
parentAccount: null,
|
|
@@ -18,6 +19,18 @@ const initial = {
|
|
|
18
19
|
statusOnTransaction: null,
|
|
19
20
|
errorAccount: null,
|
|
20
21
|
errorStatus: null,
|
|
22
|
+
syncing: false,
|
|
23
|
+
synced: false,
|
|
24
|
+
};
|
|
25
|
+
export const shouldSyncBeforeTx = (currency) => {
|
|
26
|
+
const currencyConfig = LiveConfig.getValueByKey(`config_currency_${currency.id}`);
|
|
27
|
+
const sharedConfig = LiveConfig.getValueByKey("config_currency");
|
|
28
|
+
if (currencyConfig && "syncBeforeTx" in currencyConfig) {
|
|
29
|
+
return currencyConfig.syncBeforeTx === true;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return sharedConfig && "syncBeforeTx" in sharedConfig && sharedConfig.syncBeforeTx === true;
|
|
33
|
+
}
|
|
21
34
|
};
|
|
22
35
|
const makeInit = (optionalInit) => () => {
|
|
23
36
|
let s = initial;
|
|
@@ -67,6 +80,8 @@ const reducer = (state, action) => {
|
|
|
67
80
|
account,
|
|
68
81
|
parentAccount,
|
|
69
82
|
transaction: t,
|
|
83
|
+
syncing: false,
|
|
84
|
+
synced: false,
|
|
70
85
|
};
|
|
71
86
|
}
|
|
72
87
|
catch (e) {
|
|
@@ -75,6 +90,8 @@ const reducer = (state, action) => {
|
|
|
75
90
|
account,
|
|
76
91
|
parentAccount,
|
|
77
92
|
errorAccount: e,
|
|
93
|
+
syncing: false,
|
|
94
|
+
synced: false,
|
|
78
95
|
};
|
|
79
96
|
}
|
|
80
97
|
}
|
|
@@ -102,6 +119,10 @@ const reducer = (state, action) => {
|
|
|
102
119
|
if (action.error === state.errorStatus)
|
|
103
120
|
return state;
|
|
104
121
|
return { ...state, errorStatus: action.error };
|
|
122
|
+
case "onStartSync":
|
|
123
|
+
return { ...state, syncing: true, synced: false };
|
|
124
|
+
case "onSync":
|
|
125
|
+
return { ...state, syncing: false, synced: true };
|
|
105
126
|
default:
|
|
106
127
|
return state;
|
|
107
128
|
}
|
|
@@ -110,7 +131,7 @@ const INITIAL_ERROR_RETRY_DELAY = 1000;
|
|
|
110
131
|
const ERROR_RETRY_DELAY_MULTIPLIER = 1.5;
|
|
111
132
|
const DEBOUNCE_STATUS_DELAY = 300;
|
|
112
133
|
const useBridgeTransaction = (optionalInit) => {
|
|
113
|
-
const [{ account, parentAccount, transaction, status, statusOnTransaction, errorAccount, errorStatus }, dispatch,] = useReducer(reducer, undefined, makeInit(optionalInit));
|
|
134
|
+
const [{ account, parentAccount, transaction, status, statusOnTransaction, syncing, synced, errorAccount, errorStatus, }, dispatch,] = useReducer(reducer, undefined, makeInit(optionalInit));
|
|
114
135
|
const setAccount = useCallback((account, parentAccount) => dispatch({
|
|
115
136
|
type: "setAccount",
|
|
116
137
|
account,
|
|
@@ -127,6 +148,27 @@ const useBridgeTransaction = (optionalInit) => {
|
|
|
127
148
|
const mainAccount = account ? getMainAccount(account, parentAccount) : null;
|
|
128
149
|
const errorDelay = useRef(INITIAL_ERROR_RETRY_DELAY);
|
|
129
150
|
const statusIsPending = useRef(false); // Stores if status already being processed
|
|
151
|
+
const shouldSync = mainAccount && shouldSyncBeforeTx(mainAccount.currency);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (mainAccount === null || synced || syncing)
|
|
154
|
+
return;
|
|
155
|
+
if (!shouldSync)
|
|
156
|
+
return; // skip sync if not required by currency config
|
|
157
|
+
dispatch({ type: "onStartSync" });
|
|
158
|
+
const bridge = getAccountBridge(mainAccount, null);
|
|
159
|
+
const sub = bridge.sync(mainAccount, { paginationConfig: {} }).subscribe({
|
|
160
|
+
error: (_) => {
|
|
161
|
+
// we do not block the user in case of error for now but it should be the case
|
|
162
|
+
dispatch({ type: "onSync" });
|
|
163
|
+
},
|
|
164
|
+
complete: () => {
|
|
165
|
+
dispatch({ type: "onSync" });
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
return () => {
|
|
169
|
+
sub.unsubscribe();
|
|
170
|
+
};
|
|
171
|
+
}, [mainAccount, synced, syncing, shouldSync]);
|
|
130
172
|
const bridgePending = transaction !== statusOnTransaction;
|
|
131
173
|
// when transaction changes, prepare the transaction
|
|
132
174
|
useEffect(() => {
|
|
@@ -134,7 +176,7 @@ const useBridgeTransaction = (optionalInit) => {
|
|
|
134
176
|
let errorTimeout;
|
|
135
177
|
// If bridge is not pending, transaction change is due to
|
|
136
178
|
// the last onStatus dispatch (prepareTransaction changed original transaction) and must be ignored
|
|
137
|
-
if (!bridgePending)
|
|
179
|
+
if (!bridgePending && !synced)
|
|
138
180
|
return;
|
|
139
181
|
if (mainAccount && transaction) {
|
|
140
182
|
// We don't debounce first status refresh, but any subsequent to avoid multiple calls
|
|
@@ -200,7 +242,7 @@ const useBridgeTransaction = (optionalInit) => {
|
|
|
200
242
|
errorTimeout = null;
|
|
201
243
|
}
|
|
202
244
|
};
|
|
203
|
-
}, [transaction, mainAccount, bridgePending, dispatch]);
|
|
245
|
+
}, [transaction, mainAccount, bridgePending, dispatch, synced]);
|
|
204
246
|
const bridgeError = errorAccount || errorStatus;
|
|
205
247
|
useEffect(() => {
|
|
206
248
|
if (bridgeError && globalOnBridgeError) {
|
|
@@ -216,7 +258,7 @@ const useBridgeTransaction = (optionalInit) => {
|
|
|
216
258
|
parentAccount,
|
|
217
259
|
setAccount,
|
|
218
260
|
bridgeError,
|
|
219
|
-
bridgePending,
|
|
261
|
+
bridgePending: bridgePending && (shouldSync ? !synced : true),
|
|
220
262
|
};
|
|
221
263
|
};
|
|
222
264
|
let globalOnBridgeError = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBridgeTransaction.js","sourceRoot":"","sources":["../../src/bridge/useBridgeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;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GAAG,IAAI,CAAC;YAEd,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,YAAY,CAAC,CAAC;gBAC3B,YAAY,GAAG,IAAI,CAAC;aACrB;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEhE,MAAM,WAAW,GAAG,YAAY,IAAI,WAAW,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,IAAI,mBAAmB,EAAE;YACtC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAClC;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,WAAW;QACX,cAAc;QACd,iBAAiB;QACjB,MAAM;QACN,OAAO;QACP,aAAa;QACb,UAAU;QACV,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;KAC9D,CAAC;AACJ,CAAC,CAAC;AAIF,IAAI,mBAAmB,GAAwB,IAAI,CAAC;AAEpD,mGAAmG;AACnG,MAAM,UAAU,sBAAsB,CAAC,CAAsB;IAC3D,mBAAmB,GAAG,CAAC,CAAC;AAC1B,CAAC;AACD,MAAM,UAAU,sBAAsB;IACpC,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
package/lib-es/e2e/index.d.ts
CHANGED
|
@@ -1,6 +1,171 @@
|
|
|
1
1
|
import { EnvName } from "@ledgerhq/live-env";
|
|
2
2
|
import { Feature, FeatureId } from "@ledgerhq/types-live";
|
|
3
|
-
export declare const getAllFeatureFlags: (appLanguage?: string
|
|
3
|
+
export declare const getAllFeatureFlags: (appLanguage?: string, localOverrides?: {
|
|
4
|
+
currencyAvalancheCChain?: Feature | undefined;
|
|
5
|
+
currencyStacks?: Feature | undefined;
|
|
6
|
+
currencyOptimism?: Feature | undefined;
|
|
7
|
+
currencyOptimismSepolia?: Feature | undefined;
|
|
8
|
+
currencyArbitrum?: Feature | undefined;
|
|
9
|
+
currencyArbitrumSepolia?: Feature | undefined;
|
|
10
|
+
currencyRsk?: Feature | undefined;
|
|
11
|
+
currencyBittorrent?: Feature | undefined;
|
|
12
|
+
currencyEnergyWeb?: Feature | undefined;
|
|
13
|
+
currencyAstar?: Feature | undefined;
|
|
14
|
+
currencyMetis?: Feature | undefined;
|
|
15
|
+
currencyBoba?: Feature | undefined;
|
|
16
|
+
currencyMoonriver?: Feature | undefined;
|
|
17
|
+
currencyVelasEvm?: Feature | undefined;
|
|
18
|
+
currencySyscoin?: Feature | undefined;
|
|
19
|
+
currencyAptos?: Feature | undefined;
|
|
20
|
+
currencyAptosTestnet?: Feature | undefined;
|
|
21
|
+
currencyAxelar?: Feature | undefined;
|
|
22
|
+
currencySecretNetwork?: Feature | undefined;
|
|
23
|
+
currencySeiNetwork?: Feature | undefined;
|
|
24
|
+
currencyDesmos?: Feature | undefined;
|
|
25
|
+
currencyDydx?: Feature | undefined;
|
|
26
|
+
currencyUmee?: Feature | undefined;
|
|
27
|
+
currencyStargaze?: Feature | undefined;
|
|
28
|
+
currencyOnomy?: Feature | undefined;
|
|
29
|
+
currencyPersistence?: Feature | undefined;
|
|
30
|
+
currencyQuicksilver?: Feature | undefined;
|
|
31
|
+
currencyInternetComputer?: Feature | undefined;
|
|
32
|
+
currencyInjective?: Feature | undefined;
|
|
33
|
+
currencyTelosEvm?: Feature | undefined;
|
|
34
|
+
currencyCoreum?: Feature | undefined;
|
|
35
|
+
currencyPolygonZkEvm?: Feature | undefined;
|
|
36
|
+
currencyPolygonZkEvmTestnet?: Feature | undefined;
|
|
37
|
+
currencyBase?: Feature | undefined;
|
|
38
|
+
currencyBaseSepolia?: Feature | undefined;
|
|
39
|
+
currencyKlaytn?: Feature | undefined;
|
|
40
|
+
currencyVechain?: Feature | undefined;
|
|
41
|
+
currencyCasper?: Feature | undefined;
|
|
42
|
+
currencyNeonEvm?: Feature | undefined;
|
|
43
|
+
currencyLukso?: Feature | undefined;
|
|
44
|
+
currencyLinea?: Feature | undefined;
|
|
45
|
+
currencyLineaSepolia?: Feature | undefined;
|
|
46
|
+
currencyBlast?: Feature | undefined;
|
|
47
|
+
currencyBlastSepolia?: Feature | undefined;
|
|
48
|
+
currencyScroll?: Feature | undefined;
|
|
49
|
+
currencyScrollSepolia?: Feature | undefined;
|
|
50
|
+
currencyIcon?: Feature | undefined;
|
|
51
|
+
currencyTon?: Feature | undefined;
|
|
52
|
+
currencyEtherlink?: Feature | undefined;
|
|
53
|
+
currencyZkSync?: Feature | undefined;
|
|
54
|
+
currencyZkSyncSepolia?: Feature | undefined;
|
|
55
|
+
currencyMantra?: Feature | undefined;
|
|
56
|
+
currencyXion?: Feature | undefined;
|
|
57
|
+
currencyZenrock?: Feature | undefined;
|
|
58
|
+
currencySonic?: Feature | undefined;
|
|
59
|
+
currencySonicBlaze?: Feature | undefined;
|
|
60
|
+
currencySui?: Feature | undefined;
|
|
61
|
+
currencyMina?: Feature | undefined;
|
|
62
|
+
currencyBabylon?: Feature | undefined;
|
|
63
|
+
currencySeiNetworkEvm?: Feature | undefined;
|
|
64
|
+
currencyBerachain?: Feature | undefined;
|
|
65
|
+
currencyHyperevm?: Feature | undefined;
|
|
66
|
+
currencyCantonNetwork?: Feature | undefined;
|
|
67
|
+
currencyCantonNetworkDevnet?: Feature | undefined;
|
|
68
|
+
currencyCantonNetworkTestnet?: Feature | undefined;
|
|
69
|
+
currencyKaspa?: Feature | undefined;
|
|
70
|
+
currencyEthereumHoodi?: Feature | undefined;
|
|
71
|
+
currencyCore?: Feature | undefined;
|
|
72
|
+
currencyWestend?: Feature | undefined;
|
|
73
|
+
currencyAssetHubWestend?: Feature | undefined;
|
|
74
|
+
currencyAssetHubPolkadot?: Feature | undefined;
|
|
75
|
+
currencyPolkadot?: Feature | undefined;
|
|
76
|
+
currencyMonad?: Feature | undefined;
|
|
77
|
+
nanoOnboardingFundWallet?: Feature | undefined;
|
|
78
|
+
mixpanelAnalytics?: Feature | undefined;
|
|
79
|
+
welcomeScreenVideoCarousel?: Feature | undefined;
|
|
80
|
+
brazePushNotifications?: Feature | undefined;
|
|
81
|
+
ratingsPrompt?: Feature | undefined;
|
|
82
|
+
npsRatingsPrompt?: Feature | undefined;
|
|
83
|
+
counterValue?: Feature | undefined;
|
|
84
|
+
deviceInitialApps?: Feature | undefined;
|
|
85
|
+
buyDeviceFromLive?: Feature | undefined;
|
|
86
|
+
mockFeature?: Feature | undefined;
|
|
87
|
+
buySellUi?: Feature | undefined;
|
|
88
|
+
buySellLoader?: Feature | undefined;
|
|
89
|
+
buySellShortcut?: Feature | undefined;
|
|
90
|
+
referralProgramDesktopSidebar?: Feature | undefined;
|
|
91
|
+
disableNftSend?: Feature | undefined;
|
|
92
|
+
disableNftLedgerMarket?: Feature | undefined;
|
|
93
|
+
disableNftRaribleOpensea?: Feature | undefined;
|
|
94
|
+
receiveStakingFlowConfigDesktop?: Feature | undefined;
|
|
95
|
+
ethStakingModalWithFilters?: Feature | undefined;
|
|
96
|
+
ethStakingProviders?: Feature | undefined;
|
|
97
|
+
storyly?: Feature | undefined;
|
|
98
|
+
postOnboardingAssetsTransfer?: Feature | undefined;
|
|
99
|
+
firebaseEnvironmentReadOnly?: Feature | undefined;
|
|
100
|
+
protectServicesMobile?: Feature | undefined;
|
|
101
|
+
protectServicesDesktop?: Feature | undefined;
|
|
102
|
+
ptxServiceCtaExchangeDrawer?: Feature | undefined;
|
|
103
|
+
ptxServiceCtaScreens?: Feature | undefined;
|
|
104
|
+
swapWalletApiPartnerList?: Feature | undefined;
|
|
105
|
+
stakePrograms?: Feature | undefined;
|
|
106
|
+
portfolioExchangeBanner?: Feature | undefined;
|
|
107
|
+
editEvmTx?: Feature | undefined;
|
|
108
|
+
stakeAccountBanner?: Feature | undefined;
|
|
109
|
+
newsfeedPage?: Feature | undefined;
|
|
110
|
+
domainInputResolution?: Feature | undefined;
|
|
111
|
+
discover?: Feature | undefined;
|
|
112
|
+
transactionsAlerts?: Feature | undefined;
|
|
113
|
+
fetchAdditionalCoins?: Feature | undefined;
|
|
114
|
+
ptxCard?: Feature | undefined;
|
|
115
|
+
ptxSwapLiveAppMobile?: Feature | undefined;
|
|
116
|
+
ptxSwapLiveAppKycWarning?: Feature | undefined;
|
|
117
|
+
ptxSwapLiveApp?: Feature | undefined;
|
|
118
|
+
ptxSwapDetailedView?: Feature | undefined;
|
|
119
|
+
ptxEarnLiveApp?: Feature | undefined;
|
|
120
|
+
ptxEarnDrawerConfiguration?: Feature | undefined;
|
|
121
|
+
ptxSwapReceiveTRC20WithoutTrx?: Feature | undefined;
|
|
122
|
+
flexibleContentCards?: Feature | undefined;
|
|
123
|
+
llmAnalyticsOptInPrompt?: Feature | undefined;
|
|
124
|
+
ptxSwapMoonpayProvider?: Feature | undefined;
|
|
125
|
+
ptxSwapExodusProvider?: Feature | undefined;
|
|
126
|
+
lldAnalyticsOptInPrompt?: Feature | undefined;
|
|
127
|
+
lldChatbotSupport?: Feature | undefined;
|
|
128
|
+
llmChatbotSupport?: Feature | undefined;
|
|
129
|
+
myLedgerDisplayAppDeveloperName?: Feature | undefined;
|
|
130
|
+
lldActionCarousel?: Feature | undefined;
|
|
131
|
+
marketperformanceWidgetDesktop?: Feature | undefined;
|
|
132
|
+
lldRefreshMarketData?: Feature | undefined;
|
|
133
|
+
llmRefreshMarketData?: Feature | undefined;
|
|
134
|
+
lldWalletSync?: Feature | undefined;
|
|
135
|
+
llmWalletSync?: Feature | undefined;
|
|
136
|
+
enableAppsBackup?: Feature | undefined;
|
|
137
|
+
web3hub?: Feature | undefined;
|
|
138
|
+
llmMemoTag?: Feature | undefined;
|
|
139
|
+
lldMemoTag?: Feature | undefined;
|
|
140
|
+
ldmkTransport?: Feature | undefined;
|
|
141
|
+
llMevProtection?: Feature | undefined;
|
|
142
|
+
llCounterValueGranularitiesRates?: Feature | undefined;
|
|
143
|
+
llmRebornLP?: Feature | undefined;
|
|
144
|
+
llmAccountListUI?: Feature | undefined;
|
|
145
|
+
llmLedgerSyncEntryPoints?: Feature | undefined;
|
|
146
|
+
lldLedgerSyncEntryPoints?: Feature | undefined;
|
|
147
|
+
lldNanoSUpsellBanners?: Feature | undefined;
|
|
148
|
+
llmNanoSUpsellBanners?: Feature | undefined;
|
|
149
|
+
llmThai?: Feature | undefined;
|
|
150
|
+
lldThai?: Feature | undefined;
|
|
151
|
+
largemoverLandingpage?: Feature | undefined;
|
|
152
|
+
llmMmkvMigration?: Feature | undefined;
|
|
153
|
+
lldModularDrawer?: Feature | undefined;
|
|
154
|
+
llmModularDrawer?: Feature | undefined;
|
|
155
|
+
llNftEntryPoint?: Feature | undefined;
|
|
156
|
+
ldmkConnectApp?: Feature | undefined;
|
|
157
|
+
lldNetworkBasedAddAccount?: Feature | undefined;
|
|
158
|
+
llmDatadog?: Feature | undefined;
|
|
159
|
+
llmSentry?: Feature | undefined;
|
|
160
|
+
onboardingIgnoredOsUpdates?: Feature | undefined;
|
|
161
|
+
llmHomescreen?: Feature | undefined;
|
|
162
|
+
supportDeviceApex?: Feature | undefined;
|
|
163
|
+
llmSyncOnboardingIncr1?: Feature | undefined;
|
|
164
|
+
lldSyncOnboardingIncr1?: Feature | undefined;
|
|
165
|
+
noah?: Feature | undefined;
|
|
166
|
+
newSendFlow?: Feature | undefined;
|
|
167
|
+
lldSessionReplay?: Feature | undefined;
|
|
168
|
+
} | undefined) => Partial<{
|
|
4
169
|
currencyAvalancheCChain: Feature;
|
|
5
170
|
currencyStacks: Feature;
|
|
6
171
|
currencyOptimism: Feature;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/e2e/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG1D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1
|
import { getFeature, DEFAULT_FEATURES } from "../featureFlags";
|
|
2
|
-
export const getAllFeatureFlags = (appLanguage) => {
|
|
2
|
+
export const getAllFeatureFlags = (appLanguage, localOverrides) => {
|
|
3
3
|
const res = {};
|
|
4
4
|
Object.keys(DEFAULT_FEATURES).forEach(k => {
|
|
5
5
|
const key = k;
|
|
6
|
-
const value = getFeature({ key, appLanguage });
|
|
6
|
+
const value = getFeature({ key, appLanguage, localOverrides });
|
|
7
7
|
if (value !== null)
|
|
8
8
|
res[key] = value;
|
|
9
9
|
});
|
package/lib-es/e2e/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/e2e/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/e2e/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAoB,EACpB,cAA6D,EACnB,EAAE;IAC5C,MAAM,GAAG,GAA6C,EAAE,CAAC;IACzD,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACxC,MAAM,GAAG,GAAG,CAAkC,CAAC;QAC/C,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;QAC/D,IAAI,KAAK,KAAK,IAAI;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,C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M,aAAa,GAAG,CAAC,IAAmC,EAAE,EAAE;IACnE,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC/C,UAAU,IAAI,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;KACzC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-common",
|
|
3
3
|
"description": "Common ground for the Ledger Live apps",
|
|
4
|
-
"version": "34.53.0-nightly.
|
|
4
|
+
"version": "34.53.0-nightly.20251113023835",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -168,45 +168,45 @@
|
|
|
168
168
|
"yargs": "^17.0.0",
|
|
169
169
|
"zod": "^3.22.4",
|
|
170
170
|
"react-redux": "7.2.9",
|
|
171
|
-
"@ledgerhq/coin-algorand": "^0.13.0-nightly.
|
|
172
|
-
"@ledgerhq/coin-aptos": "^3.6.0-nightly.
|
|
173
|
-
"@ledgerhq/coin-bitcoin": "^0.25.0-nightly.
|
|
174
|
-
"@ledgerhq/coin-canton": "^0.10.0-nightly.
|
|
175
|
-
"@ledgerhq/coin-cardano": "^0.15.0-nightly.
|
|
176
|
-
"@ledgerhq/coin-casper": "^2.3.1-nightly.
|
|
177
|
-
"@ledgerhq/coin-celo": "^1.7.1-nightly.
|
|
178
|
-
"@ledgerhq/coin-cosmos": "^0.20.0-nightly.
|
|
179
|
-
"@ledgerhq/coin-evm": "^2.35.0-nightly.
|
|
180
|
-
"@ledgerhq/coin-filecoin": "^1.14.1-nightly.
|
|
181
|
-
"@ledgerhq/coin-framework": "^6.9.0-nightly.
|
|
182
|
-
"@ledgerhq/coin-hedera": "^1.14.0-nightly.
|
|
183
|
-
"@ledgerhq/coin-icon": "^0.15.0-nightly.
|
|
184
|
-
"@ledgerhq/coin-internet_computer": "^1.10.1-nightly.
|
|
185
|
-
"@ledgerhq/coin-kaspa": "^1.4.1-nightly.
|
|
186
|
-
"@ledgerhq/coin-mina": "^1.4.1-nightly.
|
|
187
|
-
"@ledgerhq/coin-multiversx": "^0.8.0-nightly.
|
|
188
|
-
"@ledgerhq/coin-near": "^0.16.0-nightly.
|
|
189
|
-
"@ledgerhq/coin-polkadot": "^6.13.0-nightly.
|
|
190
|
-
"@ledgerhq/coin-solana": "^0.37.0-nightly.
|
|
191
|
-
"@ledgerhq/coin-stacks": "^0.12.0-nightly.
|
|
192
|
-
"@ledgerhq/coin-stellar": "^6.7.0-nightly.
|
|
193
|
-
"@ledgerhq/coin-sui": "^0.18.0-nightly.
|
|
194
|
-
"@ledgerhq/coin-tezos": "^6.9.0-nightly.
|
|
195
|
-
"@ledgerhq/coin-ton": "^0.17.0-nightly.
|
|
196
|
-
"@ledgerhq/coin-tron": "^5.7.0-nightly.
|
|
197
|
-
"@ledgerhq/coin-vechain": "^2.12.1-nightly.
|
|
198
|
-
"@ledgerhq/coin-xrp": "^7.8.0-nightly.
|
|
199
|
-
"@ledgerhq/crypto-icons-ui": "^1.23.0-nightly.
|
|
200
|
-
"@ledgerhq/cryptoassets": "^13.33.0-nightly.
|
|
201
|
-
"@ledgerhq/device-core": "^0.6.8-nightly.
|
|
171
|
+
"@ledgerhq/coin-algorand": "^0.13.0-nightly.20251113023835",
|
|
172
|
+
"@ledgerhq/coin-aptos": "^3.6.0-nightly.20251113023835",
|
|
173
|
+
"@ledgerhq/coin-bitcoin": "^0.25.0-nightly.20251113023835",
|
|
174
|
+
"@ledgerhq/coin-canton": "^0.10.0-nightly.20251113023835",
|
|
175
|
+
"@ledgerhq/coin-cardano": "^0.15.0-nightly.20251113023835",
|
|
176
|
+
"@ledgerhq/coin-casper": "^2.3.1-nightly.20251113023835",
|
|
177
|
+
"@ledgerhq/coin-celo": "^1.7.1-nightly.20251113023835",
|
|
178
|
+
"@ledgerhq/coin-cosmos": "^0.20.0-nightly.20251113023835",
|
|
179
|
+
"@ledgerhq/coin-evm": "^2.35.0-nightly.20251113023835",
|
|
180
|
+
"@ledgerhq/coin-filecoin": "^1.14.1-nightly.20251113023835",
|
|
181
|
+
"@ledgerhq/coin-framework": "^6.9.0-nightly.20251113023835",
|
|
182
|
+
"@ledgerhq/coin-hedera": "^1.14.0-nightly.20251113023835",
|
|
183
|
+
"@ledgerhq/coin-icon": "^0.15.0-nightly.20251113023835",
|
|
184
|
+
"@ledgerhq/coin-internet_computer": "^1.10.1-nightly.20251113023835",
|
|
185
|
+
"@ledgerhq/coin-kaspa": "^1.4.1-nightly.20251113023835",
|
|
186
|
+
"@ledgerhq/coin-mina": "^1.4.1-nightly.20251113023835",
|
|
187
|
+
"@ledgerhq/coin-multiversx": "^0.8.0-nightly.20251113023835",
|
|
188
|
+
"@ledgerhq/coin-near": "^0.16.0-nightly.20251113023835",
|
|
189
|
+
"@ledgerhq/coin-polkadot": "^6.13.0-nightly.20251113023835",
|
|
190
|
+
"@ledgerhq/coin-solana": "^0.37.0-nightly.20251113023835",
|
|
191
|
+
"@ledgerhq/coin-stacks": "^0.12.0-nightly.20251113023835",
|
|
192
|
+
"@ledgerhq/coin-stellar": "^6.7.0-nightly.20251113023835",
|
|
193
|
+
"@ledgerhq/coin-sui": "^0.18.0-nightly.20251113023835",
|
|
194
|
+
"@ledgerhq/coin-tezos": "^6.9.0-nightly.20251113023835",
|
|
195
|
+
"@ledgerhq/coin-ton": "^0.17.0-nightly.20251113023835",
|
|
196
|
+
"@ledgerhq/coin-tron": "^5.7.0-nightly.20251113023835",
|
|
197
|
+
"@ledgerhq/coin-vechain": "^2.12.1-nightly.20251113023835",
|
|
198
|
+
"@ledgerhq/coin-xrp": "^7.8.0-nightly.20251113023835",
|
|
199
|
+
"@ledgerhq/crypto-icons-ui": "^1.23.0-nightly.20251113023835",
|
|
200
|
+
"@ledgerhq/cryptoassets": "^13.33.0-nightly.20251113023835",
|
|
201
|
+
"@ledgerhq/device-core": "^0.6.8-nightly.20251113023835",
|
|
202
202
|
"@ledgerhq/devices": "8.7.0",
|
|
203
203
|
"@ledgerhq/errors": "^6.27.0",
|
|
204
204
|
"@ledgerhq/hw-app-algorand": "^6.31.9",
|
|
205
205
|
"@ledgerhq/hw-app-aptos": "^6.34.9",
|
|
206
206
|
"@ledgerhq/hw-app-btc": "^10.12.0",
|
|
207
|
-
"@ledgerhq/hw-app-celo": "^6.35.3-nightly.
|
|
207
|
+
"@ledgerhq/hw-app-celo": "^6.35.3-nightly.20251113023835",
|
|
208
208
|
"@ledgerhq/hw-app-cosmos": "^6.32.9",
|
|
209
|
-
"@ledgerhq/hw-app-eth": "^6.47.1-nightly.
|
|
209
|
+
"@ledgerhq/hw-app-eth": "^6.47.1-nightly.20251113023835",
|
|
210
210
|
"@ledgerhq/hw-app-exchange": "^0.17.0",
|
|
211
211
|
"@ledgerhq/hw-app-hedera": "^1.2.9",
|
|
212
212
|
"@ledgerhq/hw-app-icon": "^1.3.9",
|
|
@@ -223,24 +223,24 @@
|
|
|
223
223
|
"@ledgerhq/hw-bolos": "^6.32.9",
|
|
224
224
|
"@ledgerhq/hw-transport": "6.31.13",
|
|
225
225
|
"@ledgerhq/hw-transport-mocker": "^6.29.13",
|
|
226
|
-
"@ledgerhq/ledger-cal-service": "^1.9.0-nightly.
|
|
227
|
-
"@ledgerhq/ledger-trust-service": "^0.4.2-nightly.
|
|
226
|
+
"@ledgerhq/ledger-cal-service": "^1.9.0-nightly.20251113023835",
|
|
227
|
+
"@ledgerhq/ledger-trust-service": "^0.4.2-nightly.20251113023835",
|
|
228
228
|
"@ledgerhq/live-config": "^3.2.0",
|
|
229
|
-
"@ledgerhq/live-countervalues": "^0.10.0-nightly.
|
|
230
|
-
"@ledgerhq/live-countervalues-react": "^0.7.2-nightly.
|
|
229
|
+
"@ledgerhq/live-countervalues": "^0.10.0-nightly.20251113023835",
|
|
230
|
+
"@ledgerhq/live-countervalues-react": "^0.7.2-nightly.20251113023835",
|
|
231
231
|
"@ledgerhq/live-dmk-shared": "^0.15.0",
|
|
232
|
-
"@ledgerhq/live-env": "^2.21.0-nightly.
|
|
232
|
+
"@ledgerhq/live-env": "^2.21.0-nightly.20251113023835",
|
|
233
233
|
"@ledgerhq/live-hooks": "0.2.0",
|
|
234
|
+
"@ledgerhq/live-network": "^2.1.1-nightly.20251113023835",
|
|
234
235
|
"@ledgerhq/live-promise": "^0.1.1",
|
|
235
|
-
"@ledgerhq/live-signer-canton": "^0.5.1-nightly.
|
|
236
|
-
"@ledgerhq/live-signer-evm": "^0.10.1-nightly.
|
|
237
|
-
"@ledgerhq/live-signer-solana": "^0.6.1-nightly.
|
|
238
|
-
"@ledgerhq/live-wallet": "^0.16.0-nightly.
|
|
236
|
+
"@ledgerhq/live-signer-canton": "^0.5.1-nightly.20251113023835",
|
|
237
|
+
"@ledgerhq/live-signer-evm": "^0.10.1-nightly.20251113023835",
|
|
238
|
+
"@ledgerhq/live-signer-solana": "^0.6.1-nightly.20251113023835",
|
|
239
|
+
"@ledgerhq/live-wallet": "^0.16.0-nightly.20251113023835",
|
|
239
240
|
"@ledgerhq/logs": "^6.13.0",
|
|
240
|
-
"@ledgerhq/speculos-transport": "^0.2.15-nightly.
|
|
241
|
+
"@ledgerhq/speculos-transport": "^0.2.15-nightly.20251113023835",
|
|
241
242
|
"@ledgerhq/wallet-api-acre-module": "^0.9.0",
|
|
242
|
-
"@ledgerhq/wallet-api-exchange-module": "^0.18.0"
|
|
243
|
-
"@ledgerhq/live-network": "^2.1.1-nightly.20251111023817"
|
|
243
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.18.0"
|
|
244
244
|
},
|
|
245
245
|
"devDependencies": {
|
|
246
246
|
"@solana/web3.js": "1.95.4",
|
|
@@ -288,10 +288,10 @@
|
|
|
288
288
|
"undici": "6.19.2",
|
|
289
289
|
"uuid": "^8.3.2",
|
|
290
290
|
"ws": "7",
|
|
291
|
-
"@ledgerhq/device-react": "^0.3.2-nightly.
|
|
291
|
+
"@ledgerhq/device-react": "^0.3.2-nightly.20251113023835",
|
|
292
292
|
"@ledgerhq/types-cryptoassets": "^7.30.0",
|
|
293
293
|
"@ledgerhq/types-devices": "^6.27.0",
|
|
294
|
-
"@ledgerhq/types-live": "^6.89.0-nightly.
|
|
294
|
+
"@ledgerhq/types-live": "^6.89.0-nightly.20251113023835"
|
|
295
295
|
},
|
|
296
296
|
"scripts": {
|
|
297
297
|
"build": "zx ./scripts/build-ts.mjs",
|
|
@@ -534,4 +534,70 @@ describe("mergeSubAccounts", () => {
|
|
|
534
534
|
},
|
|
535
535
|
]);
|
|
536
536
|
});
|
|
537
|
+
|
|
538
|
+
it("prevents duplicates when token account ID changes but token.id stays the same", () => {
|
|
539
|
+
const oldSubAccounts = [
|
|
540
|
+
{
|
|
541
|
+
id: "accountId+stellar:USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
542
|
+
type: "TokenAccount",
|
|
543
|
+
parentId: "accountId",
|
|
544
|
+
token: {
|
|
545
|
+
id: "stellar/asset/USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
546
|
+
},
|
|
547
|
+
balance: new BigNumber(100),
|
|
548
|
+
spendableBalance: new BigNumber(100),
|
|
549
|
+
operations: [
|
|
550
|
+
{
|
|
551
|
+
id: "old-op-1",
|
|
552
|
+
type: "IN",
|
|
553
|
+
senders: ["sender1"],
|
|
554
|
+
recipients: ["owner"],
|
|
555
|
+
date: new Date("2019-01-01"),
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
id: "old-op-2",
|
|
559
|
+
type: "OUT",
|
|
560
|
+
senders: ["owner"],
|
|
561
|
+
recipients: ["recipient1"],
|
|
562
|
+
date: new Date("2019-01-02"),
|
|
563
|
+
},
|
|
564
|
+
],
|
|
565
|
+
operationsCount: 2,
|
|
566
|
+
},
|
|
567
|
+
] as Array<TokenAccount>;
|
|
568
|
+
|
|
569
|
+
const newSubAccounts = [
|
|
570
|
+
{
|
|
571
|
+
id: "accountId+stellar/asset/USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
572
|
+
type: "TokenAccount",
|
|
573
|
+
parentId: "accountId",
|
|
574
|
+
token: {
|
|
575
|
+
id: "stellar/asset/USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
576
|
+
},
|
|
577
|
+
balance: new BigNumber(150),
|
|
578
|
+
spendableBalance: new BigNumber(150),
|
|
579
|
+
operations: [
|
|
580
|
+
{
|
|
581
|
+
id: "new-op-1",
|
|
582
|
+
type: "IN",
|
|
583
|
+
senders: ["sender2"],
|
|
584
|
+
recipients: ["owner"],
|
|
585
|
+
date: new Date("2019-01-03"),
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
operationsCount: 1,
|
|
589
|
+
},
|
|
590
|
+
] as Array<TokenAccount>;
|
|
591
|
+
|
|
592
|
+
const merged = mergeSubAccounts(oldSubAccounts, newSubAccounts);
|
|
593
|
+
|
|
594
|
+
expect(merged).toHaveLength(1);
|
|
595
|
+
expect(merged[0]).toMatchObject({
|
|
596
|
+
token: { id: "stellar/asset/USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5" },
|
|
597
|
+
balance: new BigNumber(150),
|
|
598
|
+
spendableBalance: new BigNumber(150),
|
|
599
|
+
operationsCount: 3,
|
|
600
|
+
});
|
|
601
|
+
expect(merged[0].operations).toHaveLength(3);
|
|
602
|
+
});
|
|
537
603
|
});
|
|
@@ -106,14 +106,14 @@ export function mergeSubAccounts(
|
|
|
106
106
|
return newSubAccounts;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
const
|
|
110
|
-
oldSubAccounts.map(account => [account.id, account]),
|
|
109
|
+
const oldSubAccountsByTokenId = Object.fromEntries(
|
|
110
|
+
oldSubAccounts.map(account => [account.token.id, account]),
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
const newSubAccountsToAdd: Array<TokenAccount> = [];
|
|
114
114
|
|
|
115
115
|
for (const newSubAccount of newSubAccounts) {
|
|
116
|
-
const existingSubAccount =
|
|
116
|
+
const existingSubAccount = oldSubAccountsByTokenId[newSubAccount.token.id];
|
|
117
117
|
|
|
118
118
|
if (!existingSubAccount) {
|
|
119
119
|
// New sub account does not exist yet. Just add it as is.
|
|
@@ -123,7 +123,7 @@ export function mergeSubAccounts(
|
|
|
123
123
|
|
|
124
124
|
// New sub account is already known, probably outdated
|
|
125
125
|
const operations = mergeOps(existingSubAccount.operations, newSubAccount.operations);
|
|
126
|
-
|
|
126
|
+
oldSubAccountsByTokenId[newSubAccount.token.id] = {
|
|
127
127
|
...existingSubAccount,
|
|
128
128
|
balance: newSubAccount.balance,
|
|
129
129
|
spendableBalance: newSubAccount.spendableBalance,
|
|
@@ -132,7 +132,7 @@ export function mergeSubAccounts(
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
const updatedOldSubAccounts = Object.values(
|
|
135
|
+
const updatedOldSubAccounts = Object.values(oldSubAccountsByTokenId);
|
|
136
136
|
|
|
137
137
|
return [...updatedOldSubAccounts, ...newSubAccountsToAdd];
|
|
138
138
|
}
|