@ledgerhq/live-common 34.52.0-nightly.5 → 34.52.0-nightly.7
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/__tests__/test-helpers/environment.js +2 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/dada-client/hooks/useInterestRatesByCurrencies.d.ts +5 -1
- package/lib/dada-client/hooks/useInterestRatesByCurrencies.d.ts.map +1 -1
- package/lib/dada-client/hooks/useMarketByCurrencies.d.ts +4 -1
- package/lib/dada-client/hooks/useMarketByCurrencies.d.ts.map +1 -1
- package/lib/deposit/helper.d.ts.map +1 -1
- package/lib/deposit/helper.js +54 -1
- package/lib/deposit/helper.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +8 -5
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +1 -0
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +1 -0
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +1 -1
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/index.d.ts +8 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculosAppVersion.js +1 -1
- package/lib/e2e/speculosAppVersion.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts +2 -2
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +3 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/canton/setup.d.ts +3 -3
- package/lib/families/canton/setup.d.ts.map +1 -1
- package/lib/families/canton/setup.js.map +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +17 -0
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/sui/react.d.ts.map +1 -1
- package/lib/families/sui/react.js +1 -0
- package/lib/families/sui/react.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +3 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -1
- package/lib/generated/specs.d.ts +1 -0
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +7 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/postOnboarding/hooks/useAutoDismissPostOnboardingEntryPoint.js.map +1 -1
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +7 -6
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +2 -0
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/dada-client/hooks/useInterestRatesByCurrencies.d.ts +5 -1
- package/lib-es/dada-client/hooks/useInterestRatesByCurrencies.d.ts.map +1 -1
- package/lib-es/dada-client/hooks/useMarketByCurrencies.d.ts +4 -1
- package/lib-es/dada-client/hooks/useMarketByCurrencies.d.ts.map +1 -1
- package/lib-es/deposit/helper.d.ts.map +1 -1
- package/lib-es/deposit/helper.js +54 -1
- package/lib-es/deposit/helper.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +8 -5
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +1 -0
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +1 -0
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +1 -1
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/index.d.ts +8 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculosAppVersion.js +1 -1
- package/lib-es/e2e/speculosAppVersion.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts +2 -2
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +3 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/setup.d.ts +3 -3
- package/lib-es/families/canton/setup.d.ts.map +1 -1
- package/lib-es/families/canton/setup.js.map +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +17 -0
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/sui/react.d.ts.map +1 -1
- package/lib-es/families/sui/react.js +1 -0
- package/lib-es/families/sui/react.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +3 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +1 -1
- package/lib-es/generated/bridge/mock.d.ts +1 -1
- package/lib-es/generated/specs.d.ts +1 -0
- package/lib-es/generated/specs.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +7 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/postOnboarding/hooks/useAutoDismissPostOnboardingEntryPoint.js.map +1 -1
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js +7 -6
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
- package/package.json +71 -70
- package/src/__tests__/environment.test.ts +8 -5
- package/src/__tests__/migration/account-migration.ts +1 -0
- package/src/__tests__/test-helpers/environment.ts +2 -0
- package/src/deposit/helper.ts +65 -1
- package/src/e2e/data/deviceLabelsData.ts +8 -5
- package/src/e2e/enum/DeviceLabels.ts +1 -0
- package/src/e2e/families/solana.ts +1 -4
- package/src/e2e/speculosAppVersion.ts +1 -1
- package/src/families/canton/bridge/mock.ts +10 -7
- package/src/families/canton/setup.ts +3 -3
- package/src/families/evm/config.ts +17 -0
- package/src/families/sui/react.ts +5 -0
- package/src/featureFlags/defaultFeatures.ts +3 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +7 -0
- package/src/postOnboarding/hooks/useAutoDismissPostOnboardingEntryPoint.ts +1 -1
- package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +7 -9
- package/src/dada-client/MIGRATION_GUIDE.md +0 -187
- package/src/families/sui/__snapshots__/bridge.integration.test.ts.snap +0 -428
|
@@ -110,6 +110,11 @@ export const mapStakingPositions = (
|
|
|
110
110
|
validator,
|
|
111
111
|
stakedSuiId: sp.stakedSuiId,
|
|
112
112
|
formattedAmount: formatCurrencyUnit(unit, BigNumber(sp.principal), formatConfig),
|
|
113
|
+
formattedEstimatedReward: formatCurrencyUnit(
|
|
114
|
+
unit,
|
|
115
|
+
BigNumber(sp.status === "Active" ? sp.estimatedReward : 0),
|
|
116
|
+
formatConfig,
|
|
117
|
+
),
|
|
113
118
|
};
|
|
114
119
|
});
|
|
115
120
|
};
|
|
@@ -97,12 +97,15 @@ export const CURRENCY_DEFAULT_FEATURES = {
|
|
|
97
97
|
currencyBerachain: DEFAULT_FEATURE,
|
|
98
98
|
currencyHyperevm: DEFAULT_FEATURE,
|
|
99
99
|
currencyCantonNetwork: DEFAULT_FEATURE,
|
|
100
|
+
currencyCantonNetworkDevnet: DEFAULT_FEATURE,
|
|
101
|
+
currencyCantonNetworkTestnet: DEFAULT_FEATURE,
|
|
100
102
|
currencyKaspa: DEFAULT_FEATURE,
|
|
101
103
|
currencyEthereumHoodi: DEFAULT_FEATURE,
|
|
102
104
|
currencyCore: DEFAULT_FEATURE,
|
|
103
105
|
currencyWestend: DEFAULT_FEATURE,
|
|
104
106
|
currencyAssetHubPolkadot: DEFAULT_FEATURE,
|
|
105
107
|
currencyAssetHubWestend: DEFAULT_FEATURE,
|
|
108
|
+
currencyMonad: DEFAULT_FEATURE,
|
|
106
109
|
};
|
|
107
110
|
|
|
108
111
|
/**
|
|
@@ -70,6 +70,8 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
70
70
|
const berachain = useFeature("currencyBerachain");
|
|
71
71
|
const hyperevm = useFeature("currencyHyperevm");
|
|
72
72
|
const canton = useFeature("currencyCantonNetwork");
|
|
73
|
+
const cantonDevnet = useFeature("currencyCantonNetworkDevnet");
|
|
74
|
+
const cantonTestnet = useFeature("currencyCantonNetworkTestnet");
|
|
73
75
|
const kaspa = useFeature("currencyKaspa");
|
|
74
76
|
const core = useFeature("currencyCore");
|
|
75
77
|
const ethereumHoodi = useFeature("currencyEthereumHoodi");
|
|
@@ -77,6 +79,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
77
79
|
const assetHubWestend = useFeature("currencyAssetHubWestend");
|
|
78
80
|
const assetHubPolkadot = useFeature("currencyAssetHubPolkadot");
|
|
79
81
|
const polkadot = useFeature("currencyPolkadot");
|
|
82
|
+
const monad = useFeature("currencyMonad");
|
|
80
83
|
|
|
81
84
|
const featureFlaggedCurrencies = useMemo(
|
|
82
85
|
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
|
|
@@ -143,6 +146,8 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
143
146
|
mina,
|
|
144
147
|
babylon,
|
|
145
148
|
canton_network: canton,
|
|
149
|
+
canton_network_devnet: cantonDevnet,
|
|
150
|
+
canton_network_testnet: cantonTestnet,
|
|
146
151
|
kaspa,
|
|
147
152
|
core,
|
|
148
153
|
ethereum_hoodi: ethereumHoodi,
|
|
@@ -150,6 +155,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
150
155
|
assethub_westend: assetHubWestend,
|
|
151
156
|
assethub_polkadot: assetHubPolkadot,
|
|
152
157
|
polkadot,
|
|
158
|
+
monad,
|
|
153
159
|
}),
|
|
154
160
|
[
|
|
155
161
|
aptos,
|
|
@@ -222,6 +228,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
222
228
|
assetHubWestend,
|
|
223
229
|
assetHubPolkadot,
|
|
224
230
|
polkadot,
|
|
231
|
+
monad,
|
|
225
232
|
],
|
|
226
233
|
);
|
|
227
234
|
|
|
@@ -6,7 +6,7 @@ import { usePostOnboardingEntryPointVisibleOnWallet } from "./usePostOnboardingE
|
|
|
6
6
|
|
|
7
7
|
const millisecondsInADay = 1000 * 60 * 60 * 24;
|
|
8
8
|
|
|
9
|
-
const isMoreThanSevenDaysAgo = (date: Date) => {
|
|
9
|
+
const isMoreThanSevenDaysAgo = (date: Date | null) => {
|
|
10
10
|
if (!date) return false;
|
|
11
11
|
|
|
12
12
|
const datePlusSevenDays = new Date(date).getTime() + 7 * millisecondsInADay;
|
|
@@ -26,15 +26,13 @@ export function usePostOnboardingHubState(): PostOnboardingHubState {
|
|
|
26
26
|
actionsState: [],
|
|
27
27
|
postOnboardingInProgress: hubState.postOnboardingInProgress,
|
|
28
28
|
};
|
|
29
|
-
const actionsState = hubState.actionsToComplete
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
!actionWithState.featureFlagId || getFeature(actionWithState.featureFlagId)?.enabled,
|
|
37
|
-
);
|
|
29
|
+
const actionsState = hubState.actionsToComplete.flatMap(actionId => {
|
|
30
|
+
const action = getPostOnboardingAction(actionId);
|
|
31
|
+
if (!action || (action.featureFlagId && !getFeature(action.featureFlagId)?.enabled)) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return [{ ...action, completed: !!hubState.actionsCompleted[actionId] }];
|
|
35
|
+
});
|
|
38
36
|
const lastActionCompleted = hubState.lastActionCompleted
|
|
39
37
|
? getPostOnboardingAction(hubState.lastActionCompleted)
|
|
40
38
|
: null;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# DaDa Client Migration Guide
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
Migrate from `listTokens()` and `listTokensForCryptoCurrency()` to the DaDa Client API.
|
|
6
|
-
|
|
7
|
-
> **Remove CAL Initiative ([LIVE-21487](https://ledgerhq.atlassian.net/browse/LIVE-21487))**: Replace static token lists with dynamic, server-managed asset data. Beware there are many usages of listTokens that actually are going to get dropped or moved to simpler solution than even using DaDa. This guide is for the usecases we still need to list tokens.
|
|
8
|
-
|
|
9
|
-
### useAssetsData
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
const { data, isLoading, isSuccess, isError, loadNext, error, refetch } = useAssetsData({
|
|
13
|
-
product: "lld" | "llm", // app identifier
|
|
14
|
-
version: string, // app version
|
|
15
|
-
search?: string, // server-side search query
|
|
16
|
-
currencyIds?: string[], // filter by parent currencies
|
|
17
|
-
areCurrenciesFiltered?: boolean, // required when using currencyIds
|
|
18
|
-
useCase?: string, // optimize server response
|
|
19
|
-
isStaging?: boolean, // use staging API
|
|
20
|
-
});
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Integration on LLD
|
|
24
|
-
|
|
25
|
-
**Configuration:**
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
product: "lld";
|
|
29
|
-
version: __APP_VERSION__;
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Pagination:** Use `react-window`'s `InfiniteLoader` + `FixedSizeList` with `loadMoreItems` callback, or implement scroll detection to call `loadNext`
|
|
33
|
-
|
|
34
|
-
## Integration on LLM
|
|
35
|
-
|
|
36
|
-
**Configuration:**
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import { VersionNumber } from "react-native-version-number";
|
|
40
|
-
|
|
41
|
-
product: "llm";
|
|
42
|
-
version: VersionNumber.appVersion;
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Pagination:** Use `BottomSheetVirtualizedList` or `FlatList` with `onEndReached={loadNext}`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## Migration Examples
|
|
49
|
-
|
|
50
|
-
### 1. Basic Token Lists
|
|
51
|
-
|
|
52
|
-
**Before:**
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { listTokens } from "@ledgerhq/cryptoassets";
|
|
56
|
-
|
|
57
|
-
function TokenList() {
|
|
58
|
-
const tokens = listTokens();
|
|
59
|
-
return (
|
|
60
|
-
<div>
|
|
61
|
-
{tokens.map(token => <div key={token.id}>{token.name}</div>)}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**After:**
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { useAssetsData } from "@ledgerhq/live-common/dada-client/hooks/useAssetsData";
|
|
71
|
-
|
|
72
|
-
function TokenList() {
|
|
73
|
-
const { data, isLoading, loadNext } = useAssetsData({
|
|
74
|
-
product: "lld",
|
|
75
|
-
version: __APP_VERSION__,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (isLoading) return <div>Loading...</div>;
|
|
79
|
-
|
|
80
|
-
const tokens = Object.values(data?.cryptoOrTokenCurrencies || {})
|
|
81
|
-
.filter(currency => currency.type === "TokenCurrency");
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<SomethingThatManagesInfiniteScrollList
|
|
85
|
-
data={tokens}
|
|
86
|
-
renderItem={(token, index) => (
|
|
87
|
-
<div key={token.id}>{token.name}</div>
|
|
88
|
-
)}
|
|
89
|
-
onScrollEnd={loadNext}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### 2. Currency-Specific Tokens
|
|
96
|
-
|
|
97
|
-
**Before:**
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
|
|
101
|
-
|
|
102
|
-
function EthereumTokens({ currency }) {
|
|
103
|
-
const tokens = listTokensForCryptoCurrency(currency);
|
|
104
|
-
return (
|
|
105
|
-
<select>
|
|
106
|
-
{tokens.map(token => (
|
|
107
|
-
<option key={token.id} value={token.id}>{token.name}</option>
|
|
108
|
-
))}
|
|
109
|
-
</select>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**After:**
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
import { useAssetsData } from "@ledgerhq/live-common/dada-client/hooks/useAssetsData";
|
|
118
|
-
|
|
119
|
-
function EthereumTokens({ currency }) {
|
|
120
|
-
const { data, isLoading } = useAssetsData({
|
|
121
|
-
currencyIds: [currency.id],
|
|
122
|
-
areCurrenciesFiltered: true,
|
|
123
|
-
product: "lld",
|
|
124
|
-
version: __APP_VERSION__,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (isLoading) return <div>Loading...</div>;
|
|
128
|
-
|
|
129
|
-
const tokens = Object.values(data?.cryptoOrTokenCurrencies || {})
|
|
130
|
-
.filter(c => c.type === "TokenCurrency" && c.parentCurrency?.id === currency.id);
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<select>
|
|
134
|
-
{tokens.map(token => (
|
|
135
|
-
<option key={token.id} value={token.id}>{token.name}</option>
|
|
136
|
-
))}
|
|
137
|
-
</select>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### 3. Search
|
|
143
|
-
|
|
144
|
-
**Before:**
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
import { listTokens } from "@ledgerhq/cryptoassets";
|
|
148
|
-
|
|
149
|
-
function SearchableTokens({ searchQuery }) {
|
|
150
|
-
const allTokens = listTokens();
|
|
151
|
-
const filteredTokens = allTokens.filter(token =>
|
|
152
|
-
token.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
153
|
-
);
|
|
154
|
-
return (
|
|
155
|
-
<div>
|
|
156
|
-
{filteredTokens.map(token => <div key={token.id}>{token.name}</div>)}
|
|
157
|
-
</div>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**After:**
|
|
163
|
-
|
|
164
|
-
```typescript
|
|
165
|
-
import { useAssetsData } from "@ledgerhq/live-common/dada-client/hooks/useAssetsData";
|
|
166
|
-
|
|
167
|
-
function SearchableTokens({ searchQuery }) {
|
|
168
|
-
const { data, isLoading, loadNext } = useAssetsData({
|
|
169
|
-
search: searchQuery,
|
|
170
|
-
product: "lld",
|
|
171
|
-
version: __APP_VERSION__,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
if (isLoading) return <div>Loading...</div>;
|
|
175
|
-
|
|
176
|
-
const tokens = Object.values(data?.cryptoOrTokenCurrencies || {})
|
|
177
|
-
.filter(currency => currency.type === "TokenCurrency");
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<SomethingThatManagesInfiniteScrollList
|
|
181
|
-
data={tokens}
|
|
182
|
-
renderItem={(token) => <div key={token.id}>{token.name}</div>}
|
|
183
|
-
onScrollEnd={loadNext}
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
```
|