@ledgerhq/live-common 34.51.0-nightly.10 → 34.51.0-nightly.12
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/config/index.d.ts +2 -2
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/index.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +3 -2
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +3 -2
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +12 -10
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/index.d.ts.map +1 -1
- package/lib/exchange/index.js +4 -15
- package/lib/exchange/index.js.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.js +5 -5
- package/lib/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js +16 -4
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib/generated/specs.d.ts +1 -1
- package/lib/market/hooks/useLargeMoverChartData.d.ts +1 -2
- package/lib/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
- package/lib/market/hooks/useLargeMoverChartData.js.map +1 -1
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
- package/lib/market/hooks/useLargeMoverCurrencies.js +1 -3
- package/lib/market/hooks/useLargeMoverCurrencies.js.map +1 -1
- package/lib/market/utils/currencyFormatter.d.ts +1 -1
- package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib/market/utils/currencyFormatter.js +1 -1
- package/lib/market/utils/currencyFormatter.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
- package/lib/wallet-api/constants.d.ts +2 -2
- package/lib-es/config/index.d.ts +2 -2
- package/lib-es/config/index.d.ts.map +1 -1
- package/lib-es/config/index.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +3 -2
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +3 -2
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +12 -10
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/index.d.ts.map +1 -1
- package/lib-es/exchange/index.js +4 -15
- package/lib-es/exchange/index.js.map +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.js +5 -5
- package/lib-es/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js +18 -6
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib-es/generated/specs.d.ts +1 -1
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts +1 -2
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
- package/lib-es/market/hooks/useLargeMoverChartData.js.map +1 -1
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
- package/lib-es/market/hooks/useLargeMoverCurrencies.js +1 -3
- package/lib-es/market/hooks/useLargeMoverCurrencies.js.map +1 -1
- package/lib-es/market/utils/currencyFormatter.d.ts +1 -1
- package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib-es/market/utils/currencyFormatter.js +1 -1
- package/lib-es/market/utils/currencyFormatter.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts +2 -2
- package/package.json +40 -40
- package/src/bridge/cache.test.ts +2 -2
- package/src/config/index.ts +2 -4
- package/src/currencies/sortByMarketcap.test.ts +10 -7
- package/src/e2e/enum/DeviceLabels.ts +3 -2
- package/src/e2e/speculos.ts +15 -10
- package/src/exchange/index.ts +4 -15
- package/src/exchange/swap/getCompleteSwapHistory.ts +5 -5
- package/src/exchange/swap/hooks/useFromState.test.ts +11 -4
- package/src/exchange/swap/hooks/useReverseAccounts.test.ts +11 -4
- package/src/exchange/swap/hooks/useSelectableCurrencies.test.ts +14 -8
- package/src/exchange/swap/hooks/useSelectableCurrencies.ts +23 -6
- package/src/exchange/swap/hooks/useToState.test.ts +11 -4
- package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +11 -4
- package/src/exchange/swap/utils/index.test.ts +10 -4
- package/src/market/hooks/useLargeMoverChartData.ts +1 -2
- package/src/market/hooks/useLargeMoverCurrencies.ts +3 -6
- package/src/market/utils/currencyFormatter.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currencyFormatter.js","sourceRoot":"","sources":["../../../src/market/utils/currencyFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,GAIhB,MAAM,SAAS,CAAC;AAEjB,SAAS,eAAe,CAAC,KAAe,EAAE,CAAS;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC9B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;KACpC;IACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,kBAAkB,CAAC,MAAgB;IAC1C,MAAM,WAAW,GAAG,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,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nB,KAAK,EAAE,QAAQ,CAAC,KAAK;IACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,uBAAuB,EAAE,QAAQ,CAAC,uBAAuB;IACzD,wBAAwB,EAAE,QAAQ,CAAC,wBAAwB;IAC3D,uBAAuB,EAAE,QAAQ,CAAC,uBAAuB;IACzD,wBAAwB,EAAE,QAAQ,CAAC,wBAAwB;IAC3D,uBAAuB,EAAE,QAAQ,CAAC,uBAAuB;IACzD,KAAK,EAAE,QAAQ,CAAC,KAAK;CACtB,CAAC,CAAC"}
|
|
@@ -14,7 +14,7 @@ export declare const useLeftApyModule: (currencies: CryptoOrTokenCurrency[], Apy
|
|
|
14
14
|
delisted?: boolean | undefined;
|
|
15
15
|
keywords?: string[] | undefined;
|
|
16
16
|
type: "CryptoCurrency";
|
|
17
|
-
id:
|
|
17
|
+
id: string;
|
|
18
18
|
forkedFrom?: string | undefined;
|
|
19
19
|
managerAppName: string;
|
|
20
20
|
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
|
@@ -12,7 +12,7 @@ export declare const useLeftMarketTrendModule: (currencies: CryptoOrTokenCurrenc
|
|
|
12
12
|
delisted?: boolean | undefined;
|
|
13
13
|
keywords?: string[] | undefined;
|
|
14
14
|
type: "CryptoCurrency";
|
|
15
|
-
id:
|
|
15
|
+
id: string;
|
|
16
16
|
forkedFrom?: string | undefined;
|
|
17
17
|
managerAppName: string;
|
|
18
18
|
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
|
@@ -18,7 +18,7 @@ export declare const useRightMarketTrendModule: ({ currencies, useBalanceDeps, M
|
|
|
18
18
|
delisted?: boolean | undefined;
|
|
19
19
|
keywords?: string[] | undefined;
|
|
20
20
|
type: "CryptoCurrency";
|
|
21
|
-
id:
|
|
21
|
+
id: string;
|
|
22
22
|
forkedFrom?: string | undefined;
|
|
23
23
|
managerAppName: string;
|
|
24
24
|
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
|
|
2
1
|
import { Feature } from "@ledgerhq/types-live";
|
|
3
2
|
export declare function useCurrenciesUnderFeatureFlag(): {
|
|
4
|
-
featureFlaggedCurrencies: Partial<Record<
|
|
3
|
+
featureFlaggedCurrencies: Partial<Record<string, Feature<unknown> | null>>;
|
|
5
4
|
deactivatedCurrencyIds: Set<string>;
|
|
6
5
|
};
|
|
7
6
|
//# sourceMappingURL=useCurrenciesUnderFeatureFlag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrenciesUnderFeatureFlag.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCurrenciesUnderFeatureFlag.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C,wBAAgB,6BAA6B;;;EAyO5C"}
|
|
@@ -20,7 +20,7 @@ export declare function createUseRightBalanceAsset({ useBalanceDeps, balanceItem
|
|
|
20
20
|
delisted?: boolean | undefined;
|
|
21
21
|
keywords?: string[] | undefined;
|
|
22
22
|
type: "CryptoCurrency";
|
|
23
|
-
id:
|
|
23
|
+
id: string;
|
|
24
24
|
forkedFrom?: string | undefined;
|
|
25
25
|
managerAppName: string;
|
|
26
26
|
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
|
@@ -5,13 +5,13 @@ export declare const FAMILIES_MAPPING_WAPI_TO_LL: {
|
|
|
5
5
|
readonly ripple: "xrp";
|
|
6
6
|
readonly elrond: "multiversx";
|
|
7
7
|
};
|
|
8
|
-
export declare const FAMILIES_MAPPING_LL_TO_WAPI: Record<"evm" | "multiversx" | "xrp", "ethereum" | "
|
|
8
|
+
export declare const FAMILIES_MAPPING_LL_TO_WAPI: Record<"evm" | "multiversx" | "xrp", "ethereum" | "ripple" | "elrond">;
|
|
9
9
|
/**
|
|
10
10
|
* FIXME
|
|
11
11
|
* This is not robust, we should have an explicit adapter between the wallet API currencies (families) and live currencies (families)
|
|
12
12
|
* For example here, the `ethereum` family on `wallet-api` should be mapped to the `evm` family on LL
|
|
13
13
|
*/
|
|
14
|
-
export declare const WALLET_API_FAMILIES: ("
|
|
14
|
+
export declare const WALLET_API_FAMILIES: ("bitcoin" | "cardano" | "aptos" | "crypto_org" | "evm" | "ethereum" | "vechain" | "internet_computer" | "ton" | "sui" | "casper" | "cosmos" | "near" | "solana" | "tron" | "polkadot" | "tezos" | "algorand" | "multiversx" | "stellar" | "xrp" | "ripple" | "elrond" | "celo" | "filecoin" | "hedera" | "kaspa" | "neo" | "stacks")[];
|
|
15
15
|
export declare const WALLET_API_VERSION = "2.0.0";
|
|
16
16
|
export declare const BROWSE_SEARCH_OPTIONS: Fuse.IFuseOptions<AppManifest>;
|
|
17
17
|
export declare const HTTP_REGEX: RegExp;
|
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.51.0-nightly.
|
|
4
|
+
"version": "34.51.0-nightly.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -163,36 +163,36 @@
|
|
|
163
163
|
"xstate": "^5.19.2",
|
|
164
164
|
"yargs": "^17.0.0",
|
|
165
165
|
"zod": "^3.22.4",
|
|
166
|
-
"@ledgerhq/coin-algorand": "^0.11.0-nightly.
|
|
167
|
-
"@ledgerhq/coin-aptos": "^3.4.0-nightly.
|
|
168
|
-
"@ledgerhq/coin-bitcoin": "^0.23.0-nightly.
|
|
169
|
-
"@ledgerhq/coin-canton": "^0.8.0-nightly.
|
|
170
|
-
"@ledgerhq/coin-cardano": "^0.13.0-nightly.
|
|
171
|
-
"@ledgerhq/coin-casper": "^2.2.0-nightly.
|
|
172
|
-
"@ledgerhq/coin-celo": "^1.6.0-nightly.
|
|
173
|
-
"@ledgerhq/coin-cosmos": "^0.18.0-nightly.
|
|
174
|
-
"@ledgerhq/coin-evm": "^2.33.0-nightly.
|
|
175
|
-
"@ledgerhq/coin-filecoin": "^1.13.0-nightly.
|
|
176
|
-
"@ledgerhq/coin-framework": "^6.7.0-nightly.
|
|
177
|
-
"@ledgerhq/coin-hedera": "^1.12.0-nightly.
|
|
178
|
-
"@ledgerhq/coin-icon": "^0.13.0-nightly.
|
|
179
|
-
"@ledgerhq/coin-internet_computer": "^1.9.0-nightly.
|
|
180
|
-
"@ledgerhq/coin-kaspa": "^1.3.0-nightly.
|
|
181
|
-
"@ledgerhq/coin-mina": "^1.3.0-nightly.
|
|
182
|
-
"@ledgerhq/coin-multiversx": "^0.6.0-nightly.
|
|
183
|
-
"@ledgerhq/coin-near": "^0.14.0-nightly.
|
|
184
|
-
"@ledgerhq/coin-polkadot": "^6.11.0-nightly.
|
|
185
|
-
"@ledgerhq/coin-solana": "^0.35.0-nightly.
|
|
186
|
-
"@ledgerhq/coin-stacks": "^0.10.0-nightly.
|
|
187
|
-
"@ledgerhq/coin-stellar": "^6.5.0-nightly.
|
|
188
|
-
"@ledgerhq/coin-sui": "^0.16.0-nightly.
|
|
189
|
-
"@ledgerhq/coin-tezos": "^6.7.0-nightly.
|
|
190
|
-
"@ledgerhq/coin-ton": "^0.15.0-nightly.
|
|
191
|
-
"@ledgerhq/coin-tron": "^5.5.0-nightly.
|
|
192
|
-
"@ledgerhq/coin-vechain": "^2.11.0-nightly.
|
|
193
|
-
"@ledgerhq/coin-xrp": "^7.6.0-nightly.
|
|
166
|
+
"@ledgerhq/coin-algorand": "^0.11.0-nightly.9",
|
|
167
|
+
"@ledgerhq/coin-aptos": "^3.4.0-nightly.9",
|
|
168
|
+
"@ledgerhq/coin-bitcoin": "^0.23.0-nightly.9",
|
|
169
|
+
"@ledgerhq/coin-canton": "^0.8.0-nightly.9",
|
|
170
|
+
"@ledgerhq/coin-cardano": "^0.13.0-nightly.9",
|
|
171
|
+
"@ledgerhq/coin-casper": "^2.2.0-nightly.9",
|
|
172
|
+
"@ledgerhq/coin-celo": "^1.6.0-nightly.10",
|
|
173
|
+
"@ledgerhq/coin-cosmos": "^0.18.0-nightly.9",
|
|
174
|
+
"@ledgerhq/coin-evm": "^2.33.0-nightly.10",
|
|
175
|
+
"@ledgerhq/coin-filecoin": "^1.13.0-nightly.9",
|
|
176
|
+
"@ledgerhq/coin-framework": "^6.7.0-nightly.9",
|
|
177
|
+
"@ledgerhq/coin-hedera": "^1.12.0-nightly.9",
|
|
178
|
+
"@ledgerhq/coin-icon": "^0.13.0-nightly.9",
|
|
179
|
+
"@ledgerhq/coin-internet_computer": "^1.9.0-nightly.9",
|
|
180
|
+
"@ledgerhq/coin-kaspa": "^1.3.0-nightly.9",
|
|
181
|
+
"@ledgerhq/coin-mina": "^1.3.0-nightly.9",
|
|
182
|
+
"@ledgerhq/coin-multiversx": "^0.6.0-nightly.9",
|
|
183
|
+
"@ledgerhq/coin-near": "^0.14.0-nightly.9",
|
|
184
|
+
"@ledgerhq/coin-polkadot": "^6.11.0-nightly.10",
|
|
185
|
+
"@ledgerhq/coin-solana": "^0.35.0-nightly.9",
|
|
186
|
+
"@ledgerhq/coin-stacks": "^0.10.0-nightly.9",
|
|
187
|
+
"@ledgerhq/coin-stellar": "^6.5.0-nightly.9",
|
|
188
|
+
"@ledgerhq/coin-sui": "^0.16.0-nightly.11",
|
|
189
|
+
"@ledgerhq/coin-tezos": "^6.7.0-nightly.9",
|
|
190
|
+
"@ledgerhq/coin-ton": "^0.15.0-nightly.9",
|
|
191
|
+
"@ledgerhq/coin-tron": "^5.5.0-nightly.9",
|
|
192
|
+
"@ledgerhq/coin-vechain": "^2.11.0-nightly.9",
|
|
193
|
+
"@ledgerhq/coin-xrp": "^7.6.0-nightly.9",
|
|
194
194
|
"@ledgerhq/crypto-icons-ui": "^1.21.0-nightly.2",
|
|
195
|
-
"@ledgerhq/cryptoassets": "^13.31.0-nightly.
|
|
195
|
+
"@ledgerhq/cryptoassets": "^13.31.0-nightly.8",
|
|
196
196
|
"@ledgerhq/device-core": "^0.6.6-nightly.6",
|
|
197
197
|
"@ledgerhq/devices": "8.6.2-nightly.0",
|
|
198
198
|
"@ledgerhq/errors": "^6.27.0-nightly.0",
|
|
@@ -201,8 +201,8 @@
|
|
|
201
201
|
"@ledgerhq/hw-app-btc": "^10.11.3-nightly.0",
|
|
202
202
|
"@ledgerhq/hw-app-celo": "^6.35.1-nightly.6",
|
|
203
203
|
"@ledgerhq/hw-app-cosmos": "^6.32.9-nightly.0",
|
|
204
|
-
"@ledgerhq/hw-app-eth": "^6.46.1-nightly.6",
|
|
205
204
|
"@ledgerhq/hw-app-exchange": "^0.15.1-nightly.1",
|
|
205
|
+
"@ledgerhq/hw-app-eth": "^6.46.1-nightly.6",
|
|
206
206
|
"@ledgerhq/hw-app-hedera": "^1.2.9-nightly.0",
|
|
207
207
|
"@ledgerhq/hw-app-icon": "^1.3.9-nightly.0",
|
|
208
208
|
"@ledgerhq/hw-app-kaspa": "^1.3.2-nightly.0",
|
|
@@ -210,7 +210,6 @@
|
|
|
210
210
|
"@ledgerhq/hw-app-near": "^6.31.9-nightly.0",
|
|
211
211
|
"@ledgerhq/hw-app-polkadot": "^6.34.9-nightly.0",
|
|
212
212
|
"@ledgerhq/hw-app-str": "^7.2.9-nightly.0",
|
|
213
|
-
"@ledgerhq/hw-app-sui": "^1.4.0",
|
|
214
213
|
"@ledgerhq/hw-app-tezos": "^6.31.9-nightly.0",
|
|
215
214
|
"@ledgerhq/hw-app-trx": "^6.31.9-nightly.0",
|
|
216
215
|
"@ledgerhq/hw-app-vet": "^0.7.0-nightly.4",
|
|
@@ -221,17 +220,18 @@
|
|
|
221
220
|
"@ledgerhq/ledger-cal-service": "^1.7.0-nightly.3",
|
|
222
221
|
"@ledgerhq/ledger-trust-service": "^0.3.15-nightly.3",
|
|
223
222
|
"@ledgerhq/live-config": "^3.2.0",
|
|
224
|
-
"@ledgerhq/live-countervalues": "^0.8.0-nightly.
|
|
225
|
-
"@ledgerhq/live-countervalues-react": "^0.7.0-nightly.
|
|
226
|
-
"@ledgerhq/live-dmk-shared": "^0.14.0-nightly.2",
|
|
223
|
+
"@ledgerhq/live-countervalues": "^0.8.0-nightly.9",
|
|
224
|
+
"@ledgerhq/live-countervalues-react": "^0.7.0-nightly.9",
|
|
227
225
|
"@ledgerhq/live-env": "^2.19.0-nightly.2",
|
|
226
|
+
"@ledgerhq/live-dmk-shared": "^0.14.0-nightly.2",
|
|
227
|
+
"@ledgerhq/hw-app-sui": "^1.4.0",
|
|
228
228
|
"@ledgerhq/live-hooks": "0.2.0-nightly.0",
|
|
229
229
|
"@ledgerhq/live-network": "^2.0.20-nightly.3",
|
|
230
230
|
"@ledgerhq/live-promise": "^0.1.1",
|
|
231
|
-
"@ledgerhq/live-signer-canton": "^0.4.2-nightly.
|
|
232
|
-
"@ledgerhq/live-signer-evm": "^0.8.2-nightly.
|
|
233
|
-
"@ledgerhq/live-signer-solana": "^0.6.0-nightly.
|
|
234
|
-
"@ledgerhq/live-wallet": "^0.14.3-nightly.
|
|
231
|
+
"@ledgerhq/live-signer-canton": "^0.4.2-nightly.9",
|
|
232
|
+
"@ledgerhq/live-signer-evm": "^0.8.2-nightly.10",
|
|
233
|
+
"@ledgerhq/live-signer-solana": "^0.6.0-nightly.9",
|
|
234
|
+
"@ledgerhq/live-wallet": "^0.14.3-nightly.9",
|
|
235
235
|
"@ledgerhq/logs": "^6.13.0",
|
|
236
236
|
"@ledgerhq/speculos-transport": "^0.2.13-nightly.3",
|
|
237
237
|
"@ledgerhq/wallet-api-acre-module": "^0.8.0-nightly.3",
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
"uuid": "^8.3.2",
|
|
285
285
|
"ws": "7",
|
|
286
286
|
"@ledgerhq/device-react": "^0.3.0-nightly.6",
|
|
287
|
-
"@ledgerhq/types-cryptoassets": "^7.29.0-nightly.
|
|
287
|
+
"@ledgerhq/types-cryptoassets": "^7.29.0-nightly.1",
|
|
288
288
|
"@ledgerhq/types-devices": "^6.27.0",
|
|
289
289
|
"@ledgerhq/types-live": "^6.87.0-nightly.5"
|
|
290
290
|
},
|
package/src/bridge/cache.test.ts
CHANGED
|
@@ -28,7 +28,7 @@ describe("Bridge Cache", () => {
|
|
|
28
28
|
|
|
29
29
|
await prepareCurrency(getCryptoCurrencyById("solana"));
|
|
30
30
|
expect(makeLRUCache).toHaveBeenCalledTimes(1);
|
|
31
|
-
});
|
|
31
|
+
}, 10000);
|
|
32
32
|
|
|
33
33
|
it("forces the LRU cache to be re-generated", async () => {
|
|
34
34
|
const makeLRUCache = jest.spyOn(cacheModule, "makeLRUCache");
|
|
@@ -42,5 +42,5 @@ describe("Bridge Cache", () => {
|
|
|
42
42
|
|
|
43
43
|
await prepareCurrency(getCryptoCurrencyById("solana"), { forceUpdate: true });
|
|
44
44
|
expect(makeLRUCache).toHaveBeenCalledTimes(2);
|
|
45
|
-
});
|
|
45
|
+
}, 10000);
|
|
46
46
|
});
|
package/src/config/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CryptoCurrency
|
|
1
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
2
|
import { ConfigInfo, LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
3
3
|
import { CurrencyConfig } from "@ledgerhq/coin-framework/config";
|
|
4
4
|
|
|
5
|
-
export type CurrencyLiveConfigDefinition =
|
|
6
|
-
Record<`config_currency_${CryptoCurrencyId}`, ConfigInfo>
|
|
7
|
-
>;
|
|
5
|
+
export type CurrencyLiveConfigDefinition = Record<`config_currency_${string}`, ConfigInfo>;
|
|
8
6
|
|
|
9
7
|
const getCurrencyConfiguration = <T extends CurrencyConfig>(
|
|
10
8
|
currency: CryptoCurrency,
|
|
@@ -2,18 +2,21 @@ import { sortCurrenciesByIds } from "./sortByMarketcap";
|
|
|
2
2
|
import { listCryptoCurrencies, listTokens } from ".";
|
|
3
3
|
import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
|
|
4
4
|
import { CURRENCIES_LIST, IDS } from "./mock";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import { findCryptoCurrencyByTicker, findFiatCurrencyByTicker } from "@ledgerhq/cryptoassets/index";
|
|
6
|
+
import { getCryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
7
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
|
|
8
|
+
import { setup } from "../bridge/impl";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
setCryptoAssetsStoreForCoinFramework({} as CryptoAssetsStore);
|
|
10
|
+
setup(legacyCryptoAssetsStore);
|
|
11
11
|
|
|
12
|
-
test("sortCurrenciesByIds snapshot", () => {
|
|
12
|
+
test("sortCurrenciesByIds snapshot", async () => {
|
|
13
13
|
const list = [...listCryptoCurrencies(), ...listTokens()];
|
|
14
14
|
const ids: string[] = [];
|
|
15
15
|
for (const k in getBTCValues()) {
|
|
16
|
-
const c =
|
|
16
|
+
const c =
|
|
17
|
+
findCryptoCurrencyByTicker(k) ||
|
|
18
|
+
findFiatCurrencyByTicker(k) ||
|
|
19
|
+
(await getCryptoAssetsStore().findTokenById(k));
|
|
17
20
|
if (c && (c.type == "CryptoCurrency" || c.type == "TokenCurrency")) {
|
|
18
21
|
ids.push(c.id);
|
|
19
22
|
}
|
|
@@ -12,6 +12,8 @@ export enum DeviceLabels {
|
|
|
12
12
|
CONFIRM = "Confirm",
|
|
13
13
|
CONNECT = "Connect",
|
|
14
14
|
CONNECT_TO = "Connect to",
|
|
15
|
+
CONNECT_WITH = "Connect with",
|
|
16
|
+
CONNECT_WITH_LEDGER_SYNC = "Connect with Ledger Sync",
|
|
15
17
|
CONTINUE = "Continue",
|
|
16
18
|
CONTINUE_TO_ACTION = "Continue to actions",
|
|
17
19
|
CONTRACT_DATA = "Contract data",
|
|
@@ -33,8 +35,8 @@ export enum DeviceLabels {
|
|
|
33
35
|
REGISTER = "Register",
|
|
34
36
|
REJECT = "Reject",
|
|
35
37
|
REMOVE = "Remove",
|
|
36
|
-
REMOVE_FROM_LEDGER_SYNC = "Remove from",
|
|
37
38
|
REVIEW_OPERATION = "Review",
|
|
39
|
+
REMOVE_PHONE_OR_COMPUTER = "Remove phone or computer",
|
|
38
40
|
REVIEW_TRANSACTION = "Review transaction",
|
|
39
41
|
SEND = "Send",
|
|
40
42
|
SEND_TO_ADDRESS = "Send to address",
|
|
@@ -48,7 +50,6 @@ export enum DeviceLabels {
|
|
|
48
50
|
TRANSACTION_SIGNED = "Transaction Signed",
|
|
49
51
|
TRANSFER = "Transfer",
|
|
50
52
|
TURN_ON_SYNC = "Turn on sync",
|
|
51
|
-
TURN_ON_SYNC2 = "Turn On sync",
|
|
52
53
|
TYPE_DELEGATE = "Type Delegate",
|
|
53
54
|
VALUE = "Value",
|
|
54
55
|
VERIFY_ADDRESS = "Verify address",
|
package/src/e2e/speculos.ts
CHANGED
|
@@ -520,7 +520,9 @@ export async function pressUntilTextFound(
|
|
|
520
520
|
|
|
521
521
|
for (let attempts = 0; attempts < maxAttempts; attempts++) {
|
|
522
522
|
const texts = await fetchCurrentScreenTexts(speculosApiPort);
|
|
523
|
-
if (
|
|
523
|
+
if (
|
|
524
|
+
strictMatch ? texts === targetText : texts.toLowerCase().includes(targetText.toLowerCase())
|
|
525
|
+
) {
|
|
524
526
|
return await fetchAllEvents(speculosApiPort);
|
|
525
527
|
}
|
|
526
528
|
|
|
@@ -597,25 +599,25 @@ export async function waitForTimeOut(ms: number) {
|
|
|
597
599
|
}
|
|
598
600
|
|
|
599
601
|
export async function removeMemberLedgerSync() {
|
|
600
|
-
await waitFor(DeviceLabels.
|
|
601
|
-
await pressUntilTextFound(DeviceLabels.
|
|
602
|
+
await waitFor(DeviceLabels.CONNECT_WITH);
|
|
603
|
+
await pressUntilTextFound(DeviceLabels.CONNECT_WITH_LEDGER_SYNC, true);
|
|
602
604
|
await pressBoth();
|
|
603
|
-
await waitFor(DeviceLabels.
|
|
604
|
-
await pressUntilTextFound(DeviceLabels.
|
|
605
|
+
await waitFor(DeviceLabels.REMOVE_PHONE_OR_COMPUTER);
|
|
606
|
+
await pressUntilTextFound(DeviceLabels.REMOVE_PHONE_OR_COMPUTER, true);
|
|
605
607
|
await pressBoth();
|
|
606
608
|
await waitFor(DeviceLabels.TURN_ON_SYNC);
|
|
607
609
|
await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
|
|
608
|
-
await pressUntilTextFound(DeviceLabels.
|
|
610
|
+
await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
|
|
609
611
|
await pressBoth();
|
|
610
612
|
}
|
|
611
613
|
|
|
612
614
|
export async function activateLedgerSync() {
|
|
613
|
-
await waitFor(DeviceLabels.
|
|
614
|
-
await pressUntilTextFound(DeviceLabels.
|
|
615
|
+
await waitFor(DeviceLabels.CONNECT_WITH);
|
|
616
|
+
await pressUntilTextFound(DeviceLabels.CONNECT_WITH_LEDGER_SYNC, true);
|
|
615
617
|
await pressBoth();
|
|
616
618
|
await waitFor(DeviceLabels.TURN_ON_SYNC);
|
|
617
619
|
await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
|
|
618
|
-
await pressUntilTextFound(DeviceLabels.
|
|
620
|
+
await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
|
|
619
621
|
await pressBoth();
|
|
620
622
|
}
|
|
621
623
|
|
|
@@ -801,7 +803,10 @@ export async function getDelegateEvents(delegatingAccount: Delegate): Promise<st
|
|
|
801
803
|
|
|
802
804
|
export async function verifyAmountsAndAcceptSwap(swap: Swap, amount: string) {
|
|
803
805
|
await waitFor(DeviceLabels.REVIEW_TRANSACTION);
|
|
804
|
-
const events =
|
|
806
|
+
const events =
|
|
807
|
+
getSpeculosModel() === DeviceModelId.nanoS
|
|
808
|
+
? await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND)
|
|
809
|
+
: await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
|
|
805
810
|
verifySwapData(swap, events, amount);
|
|
806
811
|
await pressBoth();
|
|
807
812
|
}
|
package/src/exchange/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { valid, gte } from "semver";
|
|
2
2
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
3
3
|
import { getEnv } from "@ledgerhq/live-env";
|
|
4
|
-
import { findExchangeCurrencyConfig as findProdExchangeCurrencyConfig } from "@ledgerhq/cryptoassets";
|
|
5
4
|
import calService from "@ledgerhq/ledger-cal-service";
|
|
6
5
|
// Minimum version of a currency app which has exchange capabilities, meaning it can be used
|
|
7
6
|
// for sell/swap, and do silent signing.
|
|
@@ -40,21 +39,11 @@ export const isExchangeSupportedByApp = (appName: string, appVersion: string): b
|
|
|
40
39
|
export const getCurrencyExchangeConfig = async (
|
|
41
40
|
currency: CryptoCurrency | TokenCurrency,
|
|
42
41
|
): Promise<ExchangeCurrencyNameAndSignature> => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const env = getEnv("MOCK_EXCHANGE_TEST_CONFIG") ? "test" : "prod";
|
|
46
|
-
res = await calService.findCurrencyData(currency.id, { env });
|
|
42
|
+
const env = getEnv("MOCK_EXCHANGE_TEST_CONFIG") ? "test" : "prod";
|
|
43
|
+
const res = await calService.findCurrencyData(currency.id, { env });
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
// Fallback to old production config if the primary fetch fails, should be removed when we have a HA CAL
|
|
53
|
-
res = await findProdExchangeCurrencyConfig(currency.id);
|
|
54
|
-
|
|
55
|
-
if (!res) {
|
|
56
|
-
throw new Error(`Exchange, missing configuration for ${currency.id}`);
|
|
57
|
-
}
|
|
45
|
+
if (!res) {
|
|
46
|
+
throw new Error(`Exchange, missing configuration for ${currency.id}`);
|
|
58
47
|
}
|
|
59
48
|
|
|
60
49
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCryptoAssetsStore } from "../../bridge/crypto-assets/index";
|
|
2
2
|
import type { AccountLike, SwapOperation } from "@ledgerhq/types-live";
|
|
3
3
|
import { accountWithMandatoryTokens, getAccountCurrency } from "../../account";
|
|
4
4
|
import type { MappedSwapOperation, SwapHistorySection } from "./types";
|
|
5
5
|
|
|
6
6
|
const getSwapOperationMap =
|
|
7
7
|
(account: AccountLike, accounts: AccountLike[]) =>
|
|
8
|
-
(swapOperation: SwapOperation): MappedSwapOperation | null | undefined => {
|
|
8
|
+
async (swapOperation: SwapOperation): Promise<MappedSwapOperation | null | undefined> => {
|
|
9
9
|
const {
|
|
10
10
|
provider,
|
|
11
11
|
swapId,
|
|
@@ -34,7 +34,7 @@ const getSwapOperationMap =
|
|
|
34
34
|
toExists = true;
|
|
35
35
|
}
|
|
36
36
|
if (toAccount && tokenId) {
|
|
37
|
-
const token = findTokenById(tokenId);
|
|
37
|
+
const token = await getCryptoAssetsStore().findTokenById(tokenId);
|
|
38
38
|
|
|
39
39
|
if (token && toAccount.type === "Account") {
|
|
40
40
|
toParentAccount = toAccount;
|
|
@@ -74,7 +74,7 @@ function startOfDay(t) {
|
|
|
74
74
|
return new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const getCompleteSwapHistory = (accounts: AccountLike[]): SwapHistorySection[] => {
|
|
77
|
+
const getCompleteSwapHistory = async (accounts: AccountLike[]): Promise<SwapHistorySection[]> => {
|
|
78
78
|
const swaps: MappedSwapOperation[] = [];
|
|
79
79
|
|
|
80
80
|
for (const account of accounts) {
|
|
@@ -83,7 +83,7 @@ const getCompleteSwapHistory = (accounts: AccountLike[]): SwapHistorySection[] =
|
|
|
83
83
|
const mapFn = getSwapOperationMap(account, accounts);
|
|
84
84
|
|
|
85
85
|
if (swapHistory) {
|
|
86
|
-
const mappedSwapHistory = swapHistory.map(mapFn);
|
|
86
|
+
const mappedSwapHistory = await Promise.all(swapHistory.map(mapFn));
|
|
87
87
|
|
|
88
88
|
if (mappedSwapHistory) {
|
|
89
89
|
const filteredMappdSwapOperations = <MappedSwapOperation[]>(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
import "../../../__tests__/test-helpers/dom-polyfill";
|
|
5
|
-
import { getCryptoCurrencyById
|
|
5
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
6
6
|
import { Account } from "@ledgerhq/types-live";
|
|
7
7
|
import { renderHook, act } from "@testing-library/react";
|
|
8
8
|
import BigNumber from "bignumber.js";
|
|
@@ -14,9 +14,16 @@ import { useFromState } from "./useFromState";
|
|
|
14
14
|
|
|
15
15
|
const BTC = getCryptoCurrencyById("bitcoin");
|
|
16
16
|
const ETH = getCryptoCurrencyById("ethereum");
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const USDT = {
|
|
18
|
+
type: "TokenCurrency" as const,
|
|
19
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
20
|
+
name: "Tether USD (ERC-20)",
|
|
21
|
+
ticker: "USDT",
|
|
22
|
+
units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }],
|
|
23
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
24
|
+
parentCurrency: ETH,
|
|
25
|
+
tokenType: "erc20" as const,
|
|
26
|
+
};
|
|
20
27
|
|
|
21
28
|
jest.useFakeTimers();
|
|
22
29
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
import "../../../__tests__/test-helpers/dom-polyfill";
|
|
5
|
-
import { getCryptoCurrencyById
|
|
5
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
6
6
|
import type { Account } from "@ledgerhq/types-live";
|
|
7
7
|
import { renderHook, act } from "@testing-library/react";
|
|
8
8
|
import { genTokenAccount } from "@ledgerhq/coin-framework/mocks/account";
|
|
@@ -11,9 +11,16 @@ import { useReverseAccounts } from "./useReverseAccounts";
|
|
|
11
11
|
|
|
12
12
|
const BTC = getCryptoCurrencyById("bitcoin");
|
|
13
13
|
const ETH = getCryptoCurrencyById("ethereum");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const USDT = {
|
|
15
|
+
type: "TokenCurrency" as const,
|
|
16
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
17
|
+
name: "Tether USD (ERC-20)",
|
|
18
|
+
ticker: "USDT",
|
|
19
|
+
units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }],
|
|
20
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
21
|
+
parentCurrency: ETH,
|
|
22
|
+
tokenType: "erc20" as const,
|
|
23
|
+
};
|
|
17
24
|
|
|
18
25
|
const fromParentAccount = genAccount("mocked-account-2", {
|
|
19
26
|
currency: ETH,
|
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
import { renderHook } from "@testing-library/react";
|
|
4
|
+
import { renderHook, waitFor } from "@testing-library/react";
|
|
5
5
|
|
|
6
6
|
import { useSelectableCurrencies } from "./useSelectableCurrencies";
|
|
7
7
|
import { getCryptoCurrencyById } from "../../../currencies";
|
|
8
8
|
|
|
9
9
|
describe("useSelectableCurrencies", () => {
|
|
10
|
-
test("returns an empty array when empty list are passed", () => {
|
|
10
|
+
test("returns an empty array when empty list are passed", async () => {
|
|
11
11
|
const allCurrencies = [];
|
|
12
12
|
|
|
13
13
|
const { result } = renderHook(() => useSelectableCurrencies({ allCurrencies }));
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
await waitFor(() => {
|
|
16
|
+
expect(result.current).toEqual([]);
|
|
17
|
+
});
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
test("returns an empty array when incorrect ids are passed", () => {
|
|
20
|
+
test("returns an empty array when incorrect ids are passed", async () => {
|
|
19
21
|
const allCurrencies = ["ethercoin", "bitether", "polkamos"];
|
|
20
22
|
|
|
21
23
|
const { result } = renderHook(() => useSelectableCurrencies({ allCurrencies }));
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
await waitFor(() => {
|
|
26
|
+
expect(result.current).toEqual([]);
|
|
27
|
+
});
|
|
24
28
|
});
|
|
25
29
|
|
|
26
|
-
test("returns correct currencies for all correct ids, in the same order", () => {
|
|
30
|
+
test("returns correct currencies for all correct ids, in the same order", async () => {
|
|
27
31
|
const allCurrencies = ["ethereum", "bitcoin", "polkamos"];
|
|
28
32
|
const ethereumCurrency = getCryptoCurrencyById("ethereum");
|
|
29
33
|
const bitcoinCurrency = getCryptoCurrencyById("bitcoin");
|
|
30
34
|
|
|
31
35
|
const { result } = renderHook(() => useSelectableCurrencies({ allCurrencies }));
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
await waitFor(() => {
|
|
38
|
+
expect(result.current).toHaveLength(2);
|
|
39
|
+
expect(result.current).toEqual([ethereumCurrency, bitcoinCurrency]);
|
|
40
|
+
});
|
|
35
41
|
});
|
|
36
42
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { findCryptoCurrencyById
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { findCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
3
|
+
import { getCryptoAssetsStore } from "../../../bridge/crypto-assets/index";
|
|
3
4
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
5
|
|
|
5
6
|
export const useSelectableCurrencies = ({
|
|
@@ -7,10 +8,26 @@ export const useSelectableCurrencies = ({
|
|
|
7
8
|
}: {
|
|
8
9
|
allCurrencies: string[];
|
|
9
10
|
}): (TokenCurrency | CryptoCurrency)[] => {
|
|
10
|
-
const currencies =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const [currencies, setCurrencies] = useState<(TokenCurrency | CryptoCurrency)[]>([]);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const loadCurrencies = async () => {
|
|
15
|
+
const results = await Promise.all(
|
|
16
|
+
allCurrencies.map(async id => {
|
|
17
|
+
// Try token first, then crypto currency
|
|
18
|
+
const token = await getCryptoAssetsStore().findTokenById(id);
|
|
19
|
+
if (token) return token;
|
|
20
|
+
|
|
21
|
+
const crypto = findCryptoCurrencyById(id);
|
|
22
|
+
return crypto;
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const validCurrencies = results.filter(Boolean) as (TokenCurrency | CryptoCurrency)[];
|
|
27
|
+
setCurrencies(validCurrencies);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
loadCurrencies();
|
|
14
31
|
}, [allCurrencies]);
|
|
15
32
|
|
|
16
33
|
return currencies;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import "../../../__tests__/test-helpers/dom-polyfill";
|
|
5
5
|
import { renderHook, act } from "@testing-library/react";
|
|
6
|
-
import { getCryptoCurrencyById
|
|
6
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
7
7
|
import { selectorStateDefaultValues, useToState } from ".";
|
|
8
8
|
import { genTokenAccount } from "@ledgerhq/coin-framework/mocks/account";
|
|
9
9
|
import { genAccount } from "../../../mock/account";
|
|
@@ -12,9 +12,16 @@ import type { Account } from "@ledgerhq/types-live";
|
|
|
12
12
|
|
|
13
13
|
const BTC = getCryptoCurrencyById("bitcoin");
|
|
14
14
|
const ETH = getCryptoCurrencyById("ethereum");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const USDT = {
|
|
16
|
+
type: "TokenCurrency" as const,
|
|
17
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
18
|
+
name: "Tether USD (ERC-20)",
|
|
19
|
+
ticker: "USDT",
|
|
20
|
+
units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }],
|
|
21
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
22
|
+
parentCurrency: ETH,
|
|
23
|
+
tokenType: "erc20" as const,
|
|
24
|
+
};
|
|
18
25
|
|
|
19
26
|
const selectedAccount = genAccount("mocked-account-selected", { currency: ETH });
|
|
20
27
|
|