@ledgerhq/live-common 34.50.0-nightly.2 → 34.50.0-nightly.4
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/e2e/enum/Account.d.ts +4 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +4 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +2 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +2 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -0
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/TokenType.d.ts +2 -1
- package/lib/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib/e2e/enum/TokenType.js +1 -0
- package/lib/e2e/enum/TokenType.js.map +1 -1
- package/lib/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib/e2e/enum/TransactionStatus.js +3 -0
- package/lib/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +2 -0
- package/lib/e2e/families/sui.d.ts.map +1 -0
- package/lib/e2e/families/sui.js +11 -0
- package/lib/e2e/families/sui.js.map +1 -0
- package/lib/e2e/speculos.d.ts +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +23 -1
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js +4 -0
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +224 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +3 -4
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -5
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib/wallet-api/constants.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +4 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +2 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +2 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -0
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/TokenType.d.ts +2 -1
- package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib-es/e2e/enum/TokenType.js +1 -0
- package/lib-es/e2e/enum/TokenType.js.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.js +3 -0
- package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +2 -0
- package/lib-es/e2e/families/sui.d.ts.map +1 -0
- package/lib-es/e2e/families/sui.js +7 -0
- package/lib-es/e2e/families/sui.js.map +1 -0
- package/lib-es/e2e/speculos.d.ts +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +21 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js +4 -0
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +217 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +3 -4
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +3 -4
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/e2e/enum/Account.ts +31 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +10 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/enum/TokenType.ts +1 -0
- package/src/e2e/enum/TransactionStatus.ts +3 -0
- package/src/e2e/families/sui.ts +7 -0
- package/src/e2e/speculos.ts +22 -0
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +4 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +231 -0
- package/src/modularDrawer/utils/index.ts +4 -9
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +0 -46
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonAsset.d.ts +0 -11
- package/lib/modularDrawer/utils/haveOneCommonAsset.d.ts.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonAsset.js +0 -29
- package/lib/modularDrawer/utils/haveOneCommonAsset.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +0 -44
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.d.ts +0 -11
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.js +0 -25
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.js.map +0 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts +0 -49
- package/src/modularDrawer/utils/haveOneCommonAsset.ts +0 -32
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.50.0-nightly.
|
4
|
+
"version": "34.50.0-nightly.4",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -108,9 +108,9 @@
|
|
108
108
|
"@dfinity/principal": "^0.15.6",
|
109
109
|
"@ledgerhq/device-management-kit": "0.9.0",
|
110
110
|
"@ledgerhq/live-app-sdk": "^0.8.1",
|
111
|
-
"@ledgerhq/wallet-api-client": "^1.
|
112
|
-
"@ledgerhq/wallet-api-core": "^1.
|
113
|
-
"@ledgerhq/wallet-api-server": "^1.
|
111
|
+
"@ledgerhq/wallet-api-client": "^1.12.0",
|
112
|
+
"@ledgerhq/wallet-api-core": "^1.24.0",
|
113
|
+
"@ledgerhq/wallet-api-server": "^1.13.0",
|
114
114
|
"@noble/curves": "^1.9.7",
|
115
115
|
"@reduxjs/toolkit": "2.8.2",
|
116
116
|
"@stellar/stellar-sdk": "^14.0.0",
|
@@ -169,26 +169,26 @@
|
|
169
169
|
"@ledgerhq/coin-algorand": "^0.10.3-nightly.1",
|
170
170
|
"@ledgerhq/coin-aptos": "^3.3.2-nightly.1",
|
171
171
|
"@ledgerhq/coin-bitcoin": "^0.22.2-nightly.1",
|
172
|
-
"@ledgerhq/coin-canton": "^0.7.0-nightly.
|
172
|
+
"@ledgerhq/coin-canton": "^0.7.0-nightly.2",
|
173
173
|
"@ledgerhq/coin-cardano": "^0.12.3-nightly.1",
|
174
174
|
"@ledgerhq/coin-casper": "^2.1.3-nightly.1",
|
175
|
-
"@ledgerhq/coin-celo": "^1.
|
175
|
+
"@ledgerhq/coin-celo": "^1.5.0-nightly.2",
|
176
176
|
"@ledgerhq/coin-cosmos": "^0.17.3-nightly.1",
|
177
177
|
"@ledgerhq/coin-evm": "^2.32.0-nightly.1",
|
178
178
|
"@ledgerhq/coin-filecoin": "^1.12.2-nightly.1",
|
179
179
|
"@ledgerhq/coin-framework": "^6.6.0-nightly.1",
|
180
|
-
"@ledgerhq/coin-hedera": "^1.12.0-nightly.
|
180
|
+
"@ledgerhq/coin-hedera": "^1.12.0-nightly.2",
|
181
181
|
"@ledgerhq/coin-icon": "^0.12.3-nightly.1",
|
182
182
|
"@ledgerhq/coin-internet_computer": "^1.8.3-nightly.1",
|
183
183
|
"@ledgerhq/coin-kaspa": "^1.2.0-nightly.1",
|
184
184
|
"@ledgerhq/coin-mina": "^1.2.3-nightly.1",
|
185
185
|
"@ledgerhq/coin-multiversx": "^0.5.3-nightly.1",
|
186
|
-
"@ledgerhq/coin-near": "^0.
|
186
|
+
"@ledgerhq/coin-near": "^0.14.0-nightly.2",
|
187
187
|
"@ledgerhq/coin-polkadot": "^6.10.2-nightly.1",
|
188
188
|
"@ledgerhq/coin-solana": "^0.34.1-nightly.1",
|
189
189
|
"@ledgerhq/coin-stacks": "^0.9.3-nightly.1",
|
190
190
|
"@ledgerhq/coin-stellar": "^6.5.0-nightly.1",
|
191
|
-
"@ledgerhq/coin-sui": "^0.15.0-nightly.
|
191
|
+
"@ledgerhq/coin-sui": "^0.15.0-nightly.3",
|
192
192
|
"@ledgerhq/coin-tezos": "^6.6.0-nightly.1",
|
193
193
|
"@ledgerhq/coin-ton": "^0.14.3-nightly.1",
|
194
194
|
"@ledgerhq/coin-tron": "^5.4.2-nightly.1",
|
@@ -224,21 +224,21 @@
|
|
224
224
|
"@ledgerhq/ledger-cal-service": "^1.5.0",
|
225
225
|
"@ledgerhq/ledger-trust-service": "^0.4.0-nightly.0",
|
226
226
|
"@ledgerhq/live-config": "^3.2.0",
|
227
|
-
"@ledgerhq/live-countervalues": "^0.
|
228
|
-
"@ledgerhq/live-countervalues-react": "^0.6.2-nightly.
|
227
|
+
"@ledgerhq/live-countervalues": "^0.8.0-nightly.2",
|
228
|
+
"@ledgerhq/live-countervalues-react": "^0.6.2-nightly.2",
|
229
229
|
"@ledgerhq/live-dmk-shared": "^0.13.0",
|
230
230
|
"@ledgerhq/live-env": "^2.17.0",
|
231
231
|
"@ledgerhq/live-hooks": "0.1.0",
|
232
232
|
"@ledgerhq/live-network": "^2.0.18",
|
233
233
|
"@ledgerhq/live-promise": "^0.1.1",
|
234
|
-
"@ledgerhq/live-signer-canton": "^0.4.1-nightly.
|
234
|
+
"@ledgerhq/live-signer-canton": "^0.4.1-nightly.2",
|
235
235
|
"@ledgerhq/live-signer-evm": "^0.8.1-nightly.1",
|
236
236
|
"@ledgerhq/live-signer-solana": "^0.5.7-nightly.1",
|
237
237
|
"@ledgerhq/live-wallet": "^0.14.2-nightly.1",
|
238
238
|
"@ledgerhq/logs": "^6.13.0",
|
239
239
|
"@ledgerhq/speculos-transport": "^0.2.11",
|
240
|
-
"@ledgerhq/wallet-api-acre-module": "^0.
|
241
|
-
"@ledgerhq/wallet-api-exchange-module": "^0.
|
240
|
+
"@ledgerhq/wallet-api-acre-module": "^0.8.0-nightly.0",
|
241
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.17.0-nightly.0"
|
242
242
|
},
|
243
243
|
"devDependencies": {
|
244
244
|
"@solana/web3.js": "1.95.4",
|
package/src/e2e/enum/Account.ts
CHANGED
@@ -526,6 +526,19 @@ export class Account {
|
|
526
526
|
1,
|
527
527
|
);
|
528
528
|
|
529
|
+
static readonly SUI_1 = new Account(
|
530
|
+
Currency.SUI,
|
531
|
+
"Sui 1",
|
532
|
+
"0xc6169bcce8718609e43d179b087e6c1e2ac28e5325660af34d22fb5ce284031e",
|
533
|
+
0,
|
534
|
+
);
|
535
|
+
static readonly SUI_2 = new Account(
|
536
|
+
Currency.SUI,
|
537
|
+
"Sui 2",
|
538
|
+
"0x6644c1ce77c5e5ef8d8bd3ae2a4e18239e5d418a5e0800ed5037818399e3a7f6",
|
539
|
+
1,
|
540
|
+
);
|
541
|
+
|
529
542
|
static readonly EMPTY = new Account(Currency.BTC, "Empty", "", 0);
|
530
543
|
}
|
531
544
|
|
@@ -640,6 +653,24 @@ export class TokenAccount extends Account {
|
|
640
653
|
TokenType.TRC20,
|
641
654
|
Account.TRX_1,
|
642
655
|
);
|
656
|
+
|
657
|
+
static readonly SUI_USDC_1 = new TokenAccount(
|
658
|
+
Currency.SUI_USDC,
|
659
|
+
"SUI USDC 1",
|
660
|
+
Account.SUI_1.address,
|
661
|
+
0,
|
662
|
+
TokenType.ERC20,
|
663
|
+
Account.SUI_1,
|
664
|
+
);
|
665
|
+
|
666
|
+
static readonly SUI_USDC_2 = new TokenAccount(
|
667
|
+
Currency.SUI_USDC,
|
668
|
+
"SUI USDC 2",
|
669
|
+
Account.SUI_2.address,
|
670
|
+
1,
|
671
|
+
TokenType.ERC20,
|
672
|
+
Account.SUI_2,
|
673
|
+
);
|
643
674
|
}
|
644
675
|
|
645
676
|
export type AccountType = Account | TokenAccount;
|
package/src/e2e/enum/AppInfos.ts
CHANGED
package/src/e2e/enum/Currency.ts
CHANGED
@@ -83,6 +83,7 @@ export class Currency {
|
|
83
83
|
static readonly XLM = new Currency("Stellar", "XLM", "stellar", AppInfos.STELLAR, [
|
84
84
|
Network.STELLAR,
|
85
85
|
]);
|
86
|
+
static readonly SUI = new Currency("Sui", "SUI", "sui", AppInfos.SUI, [Network.SUI]);
|
86
87
|
static readonly BCH = new Currency("Bitcoin Cash", "BCH", "bitcoin_cash", AppInfos.BITCOIN_CASH, [
|
87
88
|
Network.BITCOIN_CASH,
|
88
89
|
]);
|
@@ -207,4 +208,13 @@ export class Currency {
|
|
207
208
|
static readonly OP = new Currency("OP Mainnet", "OP", "optimism", AppInfos.ETHEREUM, [
|
208
209
|
Network.OPTIMISM,
|
209
210
|
]);
|
211
|
+
|
212
|
+
static readonly SUI_USDC = new Currency(
|
213
|
+
"USDC",
|
214
|
+
"USDC",
|
215
|
+
"sui/coin/usdc_0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::usdc",
|
216
|
+
AppInfos.SUI,
|
217
|
+
[Network.SUI],
|
218
|
+
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
|
219
|
+
);
|
210
220
|
}
|
package/src/e2e/enum/Network.ts
CHANGED
@@ -2,8 +2,11 @@ export enum TransactionStatus {
|
|
2
2
|
RECEIVED = "Received",
|
3
3
|
DELEGATED = "Delegated",
|
4
4
|
NFT_RECEIVED = "NFT Received",
|
5
|
+
SEND = "Send",
|
5
6
|
SENT = "Sent",
|
6
7
|
FEES = "Fees",
|
7
8
|
STAKED = "Staked",
|
8
9
|
SENDING = "Sending",
|
10
|
+
TRANSACTION_SENT = "Transaction sent",
|
11
|
+
CONFIRMED = "Confirmed",
|
9
12
|
}
|
package/src/e2e/speculos.ts
CHANGED
@@ -42,6 +42,7 @@ import { Swap } from "./models/Swap";
|
|
42
42
|
import { delegateOsmosis } from "./families/osmosis";
|
43
43
|
import { AppInfos } from "./enum/AppInfos";
|
44
44
|
import { DEVICE_LABELS_CONFIG } from "./data/deviceLabelsData";
|
45
|
+
import { sendSui } from "./families/sui";
|
45
46
|
|
46
47
|
const isSpeculosRemote = process.env.REMOTE_SPECULOS === "true";
|
47
48
|
|
@@ -223,6 +224,14 @@ export const specs: Specs = {
|
|
223
224
|
},
|
224
225
|
dependency: "",
|
225
226
|
},
|
227
|
+
Sui: {
|
228
|
+
currency: getCryptoCurrencyById("sui"),
|
229
|
+
appQuery: {
|
230
|
+
model: getSpeculosModel(),
|
231
|
+
appName: "Sui",
|
232
|
+
},
|
233
|
+
dependency: "",
|
234
|
+
},
|
226
235
|
Bitcoin_Cash: {
|
227
236
|
currency: getCryptoCurrencyById("bitcoin_cash"),
|
228
237
|
appQuery: {
|
@@ -632,6 +641,10 @@ export async function goToSettings() {
|
|
632
641
|
await pressBoth();
|
633
642
|
}
|
634
643
|
|
644
|
+
export async function providePublicKey() {
|
645
|
+
await pressRightButton();
|
646
|
+
}
|
647
|
+
|
635
648
|
type DeviceLabelsReturn = {
|
636
649
|
delegateConfirmLabel: string;
|
637
650
|
delegateVerifyLabel: string;
|
@@ -660,6 +673,9 @@ export function getDeviceLabels(appInfo: AppInfos): DeviceLabelsReturn {
|
|
660
673
|
}
|
661
674
|
|
662
675
|
export async function expectValidAddressDevice(account: Account, addressDisplayed: string) {
|
676
|
+
if (account.currency === Currency.SUI_USDC) {
|
677
|
+
providePublicKey();
|
678
|
+
}
|
663
679
|
const { receiveVerifyLabel, receiveConfirmLabel } = getDeviceLabels(account.currency.speculosApp);
|
664
680
|
|
665
681
|
await waitFor(receiveVerifyLabel);
|
@@ -721,6 +737,12 @@ export async function signSendTransaction(tx: Transaction) {
|
|
721
737
|
case Currency.HBAR:
|
722
738
|
await sendHedera();
|
723
739
|
break;
|
740
|
+
case Currency.SUI:
|
741
|
+
await sendSui();
|
742
|
+
break;
|
743
|
+
case Currency.SUI_USDC:
|
744
|
+
await sendSui();
|
745
|
+
break;
|
724
746
|
default:
|
725
747
|
throw new Error(`Unsupported currency: ${currencyName.ticker}`);
|
726
748
|
}
|
@@ -75,6 +75,10 @@ const INCOMPATIBLE_NANO_S_CURRENCY_KEYS: Keys = {
|
|
75
75
|
title: "swap.incompatibility.sui_title",
|
76
76
|
description: "swap.incompatibility.sui_description",
|
77
77
|
},
|
78
|
+
kaspa: {
|
79
|
+
title: "swap.incompatibility.kaspa_title",
|
80
|
+
description: "swap.incompatibility.kaspa_description",
|
81
|
+
},
|
78
82
|
};
|
79
83
|
|
80
84
|
export const getIncompatibleCurrencyKeys = (exchange: ExchangeSwap) => {
|
@@ -0,0 +1,231 @@
|
|
1
|
+
import { useMemo } from "react";
|
2
|
+
import { CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
|
3
|
+
import { Feature } from "@ledgerhq/types-live";
|
4
|
+
import { useFeature } from "../../featureFlags";
|
5
|
+
import useEnv from "../../hooks/useEnv";
|
6
|
+
|
7
|
+
export function useCurrenciesUnderFeatureFlag() {
|
8
|
+
const mock = useEnv("MOCK");
|
9
|
+
|
10
|
+
const aptos = useFeature("currencyAptos");
|
11
|
+
const aptosTestnet = useFeature("currencyAptosTestnet");
|
12
|
+
const axelar = useFeature("currencyAxelar");
|
13
|
+
const stargaze = useFeature("currencyStargaze");
|
14
|
+
const secretNetwork = useFeature("currencySecretNetwork");
|
15
|
+
const umee = useFeature("currencyUmee");
|
16
|
+
const desmos = useFeature("currencyDesmos");
|
17
|
+
const dydx = useFeature("currencyDydx");
|
18
|
+
const onomy = useFeature("currencyOnomy");
|
19
|
+
const seiNetwork = useFeature("currencySeiNetwork");
|
20
|
+
const quicksilver = useFeature("currencyQuicksilver");
|
21
|
+
const persistence = useFeature("currencyPersistence");
|
22
|
+
const avaxCChain = useFeature("currencyAvalancheCChain");
|
23
|
+
const stacks = useFeature("currencyStacks");
|
24
|
+
const optimism = useFeature("currencyOptimism");
|
25
|
+
const optimismSepolia = useFeature("currencyOptimismSepolia");
|
26
|
+
const arbitrum = useFeature("currencyArbitrum");
|
27
|
+
const arbitrumSepolia = useFeature("currencyArbitrumSepolia");
|
28
|
+
const rsk = useFeature("currencyRsk");
|
29
|
+
const bittorrent = useFeature("currencyBittorrent");
|
30
|
+
const energyWeb = useFeature("currencyEnergyWeb");
|
31
|
+
const astar = useFeature("currencyAstar");
|
32
|
+
const metis = useFeature("currencyMetis");
|
33
|
+
const boba = useFeature("currencyBoba");
|
34
|
+
const moonriver = useFeature("currencyMoonriver");
|
35
|
+
const velasEvm = useFeature("currencyVelasEvm");
|
36
|
+
const syscoin = useFeature("currencySyscoin");
|
37
|
+
const internetComputer = useFeature("currencyInternetComputer");
|
38
|
+
const telosEvm = useFeature("currencyTelosEvm");
|
39
|
+
const coreum = useFeature("currencyCoreum");
|
40
|
+
const polygonZkEvm = useFeature("currencyPolygonZkEvm");
|
41
|
+
const polygonZkEvmTestnet = useFeature("currencyPolygonZkEvmTestnet");
|
42
|
+
const base = useFeature("currencyBase");
|
43
|
+
const baseSepolia = useFeature("currencyBaseSepolia");
|
44
|
+
const klaytn = useFeature("currencyKlaytn");
|
45
|
+
const injective = useFeature("currencyInjective");
|
46
|
+
const vechain = useFeature("currencyVechain");
|
47
|
+
const casper = useFeature("currencyCasper");
|
48
|
+
const neonEvm = useFeature("currencyNeonEvm");
|
49
|
+
const lukso = useFeature("currencyLukso");
|
50
|
+
const linea = useFeature("currencyLinea");
|
51
|
+
const lineaSepolia = useFeature("currencyLineaSepolia");
|
52
|
+
const blast = useFeature("currencyBlast");
|
53
|
+
const blastSepolia = useFeature("currencyBlastSepolia");
|
54
|
+
const scroll = useFeature("currencyScroll");
|
55
|
+
const scrollSepolia = useFeature("currencyScrollSepolia");
|
56
|
+
const icon = useFeature("currencyIcon");
|
57
|
+
const ton = useFeature("currencyTon");
|
58
|
+
const etherlink = useFeature("currencyEtherlink");
|
59
|
+
const zksync = useFeature("currencyZkSync");
|
60
|
+
const zksyncSepolia = useFeature("currencyZkSyncSepolia");
|
61
|
+
const mantra = useFeature("currencyMantra");
|
62
|
+
const xion = useFeature("currencyXion");
|
63
|
+
const zenrock = useFeature("currencyZenrock");
|
64
|
+
const sonic = useFeature("currencySonic");
|
65
|
+
const sonicBlaze = useFeature("currencySonicBlaze");
|
66
|
+
const sui = useFeature("currencySui");
|
67
|
+
const mina = useFeature("currencyMina");
|
68
|
+
const babylon = useFeature("currencyBabylon");
|
69
|
+
const seiNetworkEvm = useFeature("currencySeiNetworkEvm");
|
70
|
+
const berachain = useFeature("currencyBerachain");
|
71
|
+
const hyperevm = useFeature("currencyHyperevm");
|
72
|
+
const canton = useFeature("currencyCantonNetwork");
|
73
|
+
const kaspa = useFeature("currencyKaspa");
|
74
|
+
const core = useFeature("currencyCore");
|
75
|
+
const ethereumHoodi = useFeature("currencyEthereumHoodi");
|
76
|
+
|
77
|
+
const featureFlaggedCurrencies = useMemo(
|
78
|
+
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
|
79
|
+
aptos,
|
80
|
+
aptos_testnet: aptosTestnet,
|
81
|
+
axelar,
|
82
|
+
stargaze,
|
83
|
+
secret_network: secretNetwork,
|
84
|
+
umee,
|
85
|
+
desmos,
|
86
|
+
dydx,
|
87
|
+
onomy,
|
88
|
+
sei_network: seiNetwork,
|
89
|
+
quicksilver,
|
90
|
+
persistence,
|
91
|
+
avalanche_c_chain: avaxCChain,
|
92
|
+
stacks,
|
93
|
+
optimism,
|
94
|
+
optimism_sepolia: optimismSepolia,
|
95
|
+
arbitrum,
|
96
|
+
arbitrum_sepolia: arbitrumSepolia,
|
97
|
+
rsk,
|
98
|
+
bittorrent,
|
99
|
+
energy_web: energyWeb,
|
100
|
+
astar,
|
101
|
+
metis,
|
102
|
+
boba,
|
103
|
+
moonriver,
|
104
|
+
velas_evm: velasEvm,
|
105
|
+
syscoin,
|
106
|
+
internet_computer: internetComputer,
|
107
|
+
telos_evm: telosEvm,
|
108
|
+
sei_network_evm: seiNetworkEvm,
|
109
|
+
berachain: berachain,
|
110
|
+
hyperevm: hyperevm,
|
111
|
+
coreum,
|
112
|
+
polygon_zk_evm: polygonZkEvm,
|
113
|
+
polygon_zk_evm_testnet: polygonZkEvmTestnet,
|
114
|
+
base,
|
115
|
+
base_sepolia: baseSepolia,
|
116
|
+
klaytn,
|
117
|
+
injective,
|
118
|
+
vechain,
|
119
|
+
casper,
|
120
|
+
neon_evm: neonEvm,
|
121
|
+
lukso,
|
122
|
+
linea,
|
123
|
+
ton,
|
124
|
+
linea_sepolia: lineaSepolia,
|
125
|
+
blast,
|
126
|
+
blast_sepolia: blastSepolia,
|
127
|
+
scroll,
|
128
|
+
scroll_sepolia: scrollSepolia,
|
129
|
+
icon,
|
130
|
+
etherlink,
|
131
|
+
zksync,
|
132
|
+
zksync_sepolia: zksyncSepolia,
|
133
|
+
mantra,
|
134
|
+
xion,
|
135
|
+
zenrock,
|
136
|
+
sonic,
|
137
|
+
sonic_blaze: sonicBlaze,
|
138
|
+
sui,
|
139
|
+
mina,
|
140
|
+
babylon,
|
141
|
+
canton_network: canton,
|
142
|
+
kaspa,
|
143
|
+
core,
|
144
|
+
ethereum_hoodi: ethereumHoodi,
|
145
|
+
}),
|
146
|
+
[
|
147
|
+
aptos,
|
148
|
+
aptosTestnet,
|
149
|
+
axelar,
|
150
|
+
stargaze,
|
151
|
+
secretNetwork,
|
152
|
+
umee,
|
153
|
+
desmos,
|
154
|
+
dydx,
|
155
|
+
onomy,
|
156
|
+
seiNetwork,
|
157
|
+
quicksilver,
|
158
|
+
persistence,
|
159
|
+
avaxCChain,
|
160
|
+
stacks,
|
161
|
+
optimism,
|
162
|
+
optimismSepolia,
|
163
|
+
arbitrum,
|
164
|
+
arbitrumSepolia,
|
165
|
+
rsk,
|
166
|
+
bittorrent,
|
167
|
+
energyWeb,
|
168
|
+
astar,
|
169
|
+
metis,
|
170
|
+
boba,
|
171
|
+
moonriver,
|
172
|
+
velasEvm,
|
173
|
+
syscoin,
|
174
|
+
internetComputer,
|
175
|
+
telosEvm,
|
176
|
+
seiNetworkEvm,
|
177
|
+
berachain,
|
178
|
+
hyperevm,
|
179
|
+
coreum,
|
180
|
+
polygonZkEvm,
|
181
|
+
polygonZkEvmTestnet,
|
182
|
+
base,
|
183
|
+
baseSepolia,
|
184
|
+
klaytn,
|
185
|
+
injective,
|
186
|
+
vechain,
|
187
|
+
casper,
|
188
|
+
neonEvm,
|
189
|
+
lukso,
|
190
|
+
linea,
|
191
|
+
ton,
|
192
|
+
lineaSepolia,
|
193
|
+
blast,
|
194
|
+
blastSepolia,
|
195
|
+
scroll,
|
196
|
+
scrollSepolia,
|
197
|
+
icon,
|
198
|
+
etherlink,
|
199
|
+
zksync,
|
200
|
+
zksyncSepolia,
|
201
|
+
mantra,
|
202
|
+
xion,
|
203
|
+
zenrock,
|
204
|
+
sonic,
|
205
|
+
sonicBlaze,
|
206
|
+
sui,
|
207
|
+
mina,
|
208
|
+
babylon,
|
209
|
+
canton,
|
210
|
+
kaspa,
|
211
|
+
core,
|
212
|
+
ethereumHoodi,
|
213
|
+
],
|
214
|
+
);
|
215
|
+
|
216
|
+
const deactivatedCurrencyIds = useMemo(
|
217
|
+
() =>
|
218
|
+
new Set(
|
219
|
+
mock
|
220
|
+
? [] // mock mode: all currencies are available for playwrigth tests
|
221
|
+
: Object.entries(featureFlaggedCurrencies)
|
222
|
+
.filter(([, feature]) => !feature?.enabled)
|
223
|
+
.map(([id]) => id),
|
224
|
+
),
|
225
|
+
[mock, featureFlaggedCurrencies],
|
226
|
+
);
|
227
|
+
return {
|
228
|
+
featureFlaggedCurrencies,
|
229
|
+
deactivatedCurrencyIds,
|
230
|
+
};
|
231
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
export { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
4
|
+
export { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
5
5
|
|
6
6
|
function isCorrespondingCurrency(
|
7
7
|
elem: CryptoOrTokenCurrency,
|
@@ -16,9 +16,4 @@ function isCorrespondingCurrency(
|
|
16
16
|
return false;
|
17
17
|
}
|
18
18
|
|
19
|
-
export {
|
20
|
-
isCorrespondingCurrency,
|
21
|
-
haveOneCommonAsset,
|
22
|
-
getBalanceAndFiatValue,
|
23
|
-
groupCurrenciesByProvider,
|
24
|
-
};
|
19
|
+
export { isCorrespondingCurrency };
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.test.d.ts","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts"],"names":[],"mappings":""}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const haveOneCommonAsset_1 = require("../haveOneCommonAsset");
|
4
|
-
const currencies_1 = require("@ledgerhq/cryptoassets/lib/currencies");
|
5
|
-
const MOCK_ASSETS_SORTED = [
|
6
|
-
{
|
7
|
-
asset: {
|
8
|
-
id: "ethereum",
|
9
|
-
ticker: "ETH",
|
10
|
-
name: "Ethereum",
|
11
|
-
assetsIds: {
|
12
|
-
ethereum: "ethereum",
|
13
|
-
arbitrum: "arbitrum",
|
14
|
-
},
|
15
|
-
metaCurrencyId: "urn:crypto:meta-currency:ethereum",
|
16
|
-
},
|
17
|
-
networks: [(0, currencies_1.getCryptoCurrencyById)("ethereum"), (0, currencies_1.getCryptoCurrencyById)("arbitrum")],
|
18
|
-
},
|
19
|
-
{
|
20
|
-
asset: {
|
21
|
-
id: "bitcoin",
|
22
|
-
ticker: "BTC",
|
23
|
-
name: "Bitcoin",
|
24
|
-
assetsIds: {
|
25
|
-
bitcoin: "bitcoin",
|
26
|
-
},
|
27
|
-
metaCurrencyId: "bitcoin",
|
28
|
-
},
|
29
|
-
networks: [(0, currencies_1.getCryptoCurrencyById)("bitcoin")],
|
30
|
-
},
|
31
|
-
];
|
32
|
-
describe("haveOneCommonAsset", () => {
|
33
|
-
it("should return false for an empty array", () => {
|
34
|
-
expect((0, haveOneCommonAsset_1.haveOneCommonAsset)([], [])).toBe(false);
|
35
|
-
});
|
36
|
-
it("should return true for a single currency with one provider", () => {
|
37
|
-
expect((0, haveOneCommonAsset_1.haveOneCommonAsset)(["bitcoin"], MOCK_ASSETS_SORTED)).toBe(true);
|
38
|
-
});
|
39
|
-
it("should return false for multiple currencies with different providers", () => {
|
40
|
-
expect((0, haveOneCommonAsset_1.haveOneCommonAsset)(["bitcoin", "ethereum"], MOCK_ASSETS_SORTED)).toBe(false);
|
41
|
-
});
|
42
|
-
it("should return true for multiple currencies with the same provider", () => {
|
43
|
-
expect((0, haveOneCommonAsset_1.haveOneCommonAsset)(["ethereum", "arbitrum"], MOCK_ASSETS_SORTED)).toBe(true);
|
44
|
-
});
|
45
|
-
});
|
46
|
-
//# sourceMappingURL=haveOneCommonAsset.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts"],"names":[],"mappings":";;AAAA,8DAA2D;AAE3D,sEAA8E;AAE9E,MAAM,kBAAkB,GAAgB;IACtC;QACE,KAAK,EAAE;YACL,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE;gBACT,QAAQ,EAAE,UAAU;gBACpB,QAAQ,EAAE,UAAU;aACrB;YACD,cAAc,EAAE,mCAAmC;SACpD;QACD,QAAQ,EAAE,CAAC,IAAA,kCAAqB,EAAC,UAAU,CAAC,EAAE,IAAA,kCAAqB,EAAC,UAAU,CAAC,CAAC;KACjF;IACD;QACE,KAAK,EAAE;YACL,EAAE,EAAE,SAAS;YACb,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS;YACf,SAAS,EAAE;gBACT,OAAO,EAAE,SAAS;aACnB;YACD,cAAc,EAAE,SAAS;SAC1B;QACD,QAAQ,EAAE,CAAC,IAAA,kCAAqB,EAAC,SAAS,CAAC,CAAC;KAC7C;CACF,CAAC;AAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,IAAA,uCAAkB,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,CAAC,IAAA,uCAAkB,EAAC,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,CAAC,IAAA,uCAAkB,EAAC,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,CAAC,IAAA,uCAAkB,EAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AssetData } from "./type";
|
2
|
-
/**
|
3
|
-
* This function checks if all currencies in the provided array
|
4
|
-
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
5
|
-
*
|
6
|
-
* @param currenciesIdsArray array of currency IDs to check
|
7
|
-
* @param currenciesByProvider array of currencies grouped by provider
|
8
|
-
* @returns boolean indicating whether all currencies in the array have one common provider
|
9
|
-
*/
|
10
|
-
export declare const haveOneCommonAsset: (currenciesIdsArray: string[], currenciesByProvider: AssetData[]) => boolean;
|
11
|
-
//# sourceMappingURL=haveOneCommonAsset.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,uBACT,MAAM,EAAE,wBACN,SAAS,EAAE,KAChC,OAiBF,CAAC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.haveOneCommonAsset = void 0;
|
4
|
-
/**
|
5
|
-
* This function checks if all currencies in the provided array
|
6
|
-
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
7
|
-
*
|
8
|
-
* @param currenciesIdsArray array of currency IDs to check
|
9
|
-
* @param currenciesByProvider array of currencies grouped by provider
|
10
|
-
* @returns boolean indicating whether all currencies in the array have one common provider
|
11
|
-
*/
|
12
|
-
const haveOneCommonAsset = (currenciesIdsArray, currenciesByProvider) => {
|
13
|
-
if (currenciesIdsArray.length === 0)
|
14
|
-
return false;
|
15
|
-
const providerIds = new Set();
|
16
|
-
for (const currencyId of currenciesIdsArray) {
|
17
|
-
for (const provider of currenciesByProvider) {
|
18
|
-
if (provider.networks.some(currency => currency.id === currencyId)) {
|
19
|
-
providerIds.add(provider.asset.id);
|
20
|
-
if (providerIds.size > 1) {
|
21
|
-
return false;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
return true;
|
27
|
-
};
|
28
|
-
exports.haveOneCommonAsset = haveOneCommonAsset;
|
29
|
-
//# sourceMappingURL=haveOneCommonAsset.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonAsset.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AAEI,MAAM,kBAAkB,GAAG,CAChC,kBAA4B,EAC5B,oBAAiC,EACxB,EAAE;IACX,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAElD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IAEtC,KAAK,MAAM,UAAU,IAAI,kBAAkB,EAAE;QAC3C,KAAK,MAAM,QAAQ,IAAI,oBAAoB,EAAE;YAC3C,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE;gBAClE,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACnC,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;aACF;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.test.d.ts","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts"],"names":[],"mappings":""}
|