@ledgerhq/cryptoassets 13.32.0-nightly.4 → 13.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +38 -23
- package/lib/cal-client/state-manager/types.d.ts +2 -2
- package/lib/cal-client/state-manager/types.d.ts.map +1 -1
- package/lib-es/cal-client/state-manager/types.d.ts +2 -2
- package/lib-es/cal-client/state-manager/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/cal-client/MIGRATION_GUIDE.md +6 -6
- package/src/cal-client/README.md +5 -4
- package/src/cal-client/hooks/__tests__/useTokensData.test.ts +6 -6
- package/src/cal-client/state-manager/types.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/cryptoassets@13.32.0
|
|
2
|
+
> @ledgerhq/cryptoassets@13.32.0 build /home/runner/work/ledger-live/ledger-live/libs/ledgerjs/packages/cryptoassets
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,57 +1,72 @@
|
|
|
1
1
|
# @ledgerhq/cryptoassets
|
|
2
2
|
|
|
3
|
-
## 13.32.0
|
|
3
|
+
## 13.32.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- [#12257](https://github.com/LedgerHQ/ledger-live/pull/12257) [`b4ceaff`](https://github.com/LedgerHQ/ledger-live/commit/b4ceaff2ecf68d8a14e09801c76ab0b014c45286) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Introduce hooks in cryptoassets
|
|
8
|
+
|
|
9
|
+
- [#12277](https://github.com/LedgerHQ/ledger-live/pull/12277) [`da750a1`](https://github.com/LedgerHQ/ledger-live/commit/da750a16ee5f2c083114569b8ae3c708cceba06c) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Make CryptoCurrency dynamically loadable.
|
|
10
|
+
|
|
11
|
+
- [#12321](https://github.com/LedgerHQ/ledger-live/pull/12321) [`63e8f34`](https://github.com/LedgerHQ/ledger-live/commit/63e8f342f6b951ab77bb710b9971f033c05e579e) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Bump axios version to 1.12.2
|
|
12
|
+
|
|
13
|
+
- [#12316](https://github.com/LedgerHQ/ledger-live/pull/12316) [`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726) Thanks [@qperrot](https://github.com/qperrot)! - Feature CoinTester Bitcoin and Currency regtest
|
|
14
|
+
|
|
15
|
+
- [#12420](https://github.com/LedgerHQ/ledger-live/pull/12420) [`34b28dd`](https://github.com/LedgerHQ/ledger-live/commit/34b28dd5e819906daaa79db5fe6064674def5e7d) Thanks [@semeano](https://github.com/semeano)! - Add Monad currency
|
|
16
|
+
|
|
7
17
|
- [#12460](https://github.com/LedgerHQ/ledger-live/pull/12460) [`607e4be`](https://github.com/LedgerHQ/ledger-live/commit/607e4be33145c102debce1606224b08579888aa8) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Simplify & implement all cal-client API for future Remove CAL.
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
- [#12516](https://github.com/LedgerHQ/ledger-live/pull/12516) [`f8d904d`](https://github.com/LedgerHQ/ledger-live/commit/f8d904de5607c103549f247428b5a4079f28c1c0) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Update networkFamily params in CAL-client
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
- [#12421](https://github.com/LedgerHQ/ledger-live/pull/12421) [`b962966`](https://github.com/LedgerHQ/ledger-live/commit/b962966525517c5cfa7f1f8826f8f2b9162189e4) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Introduce CAL client hook
|
|
22
|
+
|
|
23
|
+
- [#12307](https://github.com/LedgerHQ/ledger-live/pull/12307) [`36e5168`](https://github.com/LedgerHQ/ledger-live/commit/36e5168397eaec2a5f425038392a4400f60571d0) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Add useCurrencyById hook to cryptoassets package that finds a currency by ID (crypto or token) with async loading state. Updates mobile and desktop apps to use the new hook for currency/token lookups.
|
|
12
24
|
|
|
13
25
|
- [#12442](https://github.com/LedgerHQ/ledger-live/pull/12442) [`6ccabef`](https://github.com/LedgerHQ/ledger-live/commit/6ccabef8f3c4e8cc042299d531684595ebadcc55) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Refactor api-token-converter to fix bad tokens data
|
|
14
26
|
|
|
27
|
+
- [#12382](https://github.com/LedgerHQ/ledger-live/pull/12382) [`3d4188a`](https://github.com/LedgerHQ/ledger-live/commit/3d4188a26021d33b950129d82cb55d2c2e8d4358) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Introduce CryptoAssetStore#getTokensSyncHash function
|
|
28
|
+
|
|
29
|
+
- [#12274](https://github.com/LedgerHQ/ledger-live/pull/12274) [`d9305e8`](https://github.com/LedgerHQ/ledger-live/commit/d9305e8a4d8364366aaba05dd698396d28b539dc) Thanks [@hhumphrey-ledger](https://github.com/hhumphrey-ledger)! - Remove cryptoassets fallback from exchange config flow
|
|
30
|
+
|
|
15
31
|
### Patch Changes
|
|
16
32
|
|
|
17
|
-
- Updated dependencies [[`77566c5`](https://github.com/LedgerHQ/ledger-live/commit/77566c5a3b5795f5938bd5daaa5f8d65934c56b8)]:
|
|
18
|
-
- @ledgerhq/
|
|
33
|
+
- Updated dependencies [[`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726), [`34b28dd`](https://github.com/LedgerHQ/ledger-live/commit/34b28dd5e819906daaa79db5fe6064674def5e7d), [`7744980`](https://github.com/LedgerHQ/ledger-live/commit/774498090411f1a6d6c06395dda1fc7cd24adf24), [`77566c5`](https://github.com/LedgerHQ/ledger-live/commit/77566c5a3b5795f5938bd5daaa5f8d65934c56b8), [`b962966`](https://github.com/LedgerHQ/ledger-live/commit/b962966525517c5cfa7f1f8826f8f2b9162189e4), [`f392f69`](https://github.com/LedgerHQ/ledger-live/commit/f392f6912f445cc2f7cf4dfcfd030fa3da76f736), [`cadf2e1`](https://github.com/LedgerHQ/ledger-live/commit/cadf2e1dfb09248d3f77d96f94ae774425dbca75), [`cbc0648`](https://github.com/LedgerHQ/ledger-live/commit/cbc064885d8e0459e40d327a2e5389204b3ec705), [`3d4188a`](https://github.com/LedgerHQ/ledger-live/commit/3d4188a26021d33b950129d82cb55d2c2e8d4358), [`2c6a198`](https://github.com/LedgerHQ/ledger-live/commit/2c6a198ba28391695202a0787ce168c53768ff37)]:
|
|
34
|
+
- @ledgerhq/live-env@2.20.0
|
|
35
|
+
- @ledgerhq/types-live@6.88.0
|
|
19
36
|
|
|
20
|
-
## 13.32.0-
|
|
37
|
+
## 13.32.0-next.0
|
|
21
38
|
|
|
22
39
|
### Minor Changes
|
|
23
40
|
|
|
24
|
-
- [#
|
|
41
|
+
- [#12257](https://github.com/LedgerHQ/ledger-live/pull/12257) [`b4ceaff`](https://github.com/LedgerHQ/ledger-live/commit/b4ceaff2ecf68d8a14e09801c76ab0b014c45286) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Introduce hooks in cryptoassets
|
|
25
42
|
|
|
26
|
-
- [#
|
|
43
|
+
- [#12277](https://github.com/LedgerHQ/ledger-live/pull/12277) [`da750a1`](https://github.com/LedgerHQ/ledger-live/commit/da750a16ee5f2c083114569b8ae3c708cceba06c) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Make CryptoCurrency dynamically loadable.
|
|
27
44
|
|
|
28
|
-
- [#
|
|
45
|
+
- [#12321](https://github.com/LedgerHQ/ledger-live/pull/12321) [`63e8f34`](https://github.com/LedgerHQ/ledger-live/commit/63e8f342f6b951ab77bb710b9971f033c05e579e) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Bump axios version to 1.12.2
|
|
29
46
|
|
|
30
|
-
|
|
47
|
+
- [#12316](https://github.com/LedgerHQ/ledger-live/pull/12316) [`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726) Thanks [@qperrot](https://github.com/qperrot)! - Feature CoinTester Bitcoin and Currency regtest
|
|
31
48
|
|
|
32
|
-
-
|
|
33
|
-
- @ledgerhq/live-env@2.20.0-nightly.0
|
|
34
|
-
- @ledgerhq/types-live@6.88.0-nightly.2
|
|
49
|
+
- [#12420](https://github.com/LedgerHQ/ledger-live/pull/12420) [`34b28dd`](https://github.com/LedgerHQ/ledger-live/commit/34b28dd5e819906daaa79db5fe6064674def5e7d) Thanks [@semeano](https://github.com/semeano)! - Add Monad currency
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
- [#12460](https://github.com/LedgerHQ/ledger-live/pull/12460) [`607e4be`](https://github.com/LedgerHQ/ledger-live/commit/607e4be33145c102debce1606224b08579888aa8) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Simplify & implement all cal-client API for future Remove CAL.
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
- [#12516](https://github.com/LedgerHQ/ledger-live/pull/12516) [`f8d904d`](https://github.com/LedgerHQ/ledger-live/commit/f8d904de5607c103549f247428b5a4079f28c1c0) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Update networkFamily params in CAL-client
|
|
39
54
|
|
|
40
|
-
- [#
|
|
55
|
+
- [#12421](https://github.com/LedgerHQ/ledger-live/pull/12421) [`b962966`](https://github.com/LedgerHQ/ledger-live/commit/b962966525517c5cfa7f1f8826f8f2b9162189e4) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Introduce CAL client hook
|
|
41
56
|
|
|
42
|
-
- [#
|
|
57
|
+
- [#12307](https://github.com/LedgerHQ/ledger-live/pull/12307) [`36e5168`](https://github.com/LedgerHQ/ledger-live/commit/36e5168397eaec2a5f425038392a4400f60571d0) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Add useCurrencyById hook to cryptoassets package that finds a currency by ID (crypto or token) with async loading state. Updates mobile and desktop apps to use the new hook for currency/token lookups.
|
|
43
58
|
|
|
44
|
-
|
|
59
|
+
- [#12442](https://github.com/LedgerHQ/ledger-live/pull/12442) [`6ccabef`](https://github.com/LedgerHQ/ledger-live/commit/6ccabef8f3c4e8cc042299d531684595ebadcc55) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Refactor api-token-converter to fix bad tokens data
|
|
45
60
|
|
|
46
|
-
-
|
|
47
|
-
- @ledgerhq/types-live@6.88.0-nightly.1
|
|
61
|
+
- [#12382](https://github.com/LedgerHQ/ledger-live/pull/12382) [`3d4188a`](https://github.com/LedgerHQ/ledger-live/commit/3d4188a26021d33b950129d82cb55d2c2e8d4358) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Introduce CryptoAssetStore#getTokensSyncHash function
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
- [#12274](https://github.com/LedgerHQ/ledger-live/pull/12274) [`d9305e8`](https://github.com/LedgerHQ/ledger-live/commit/d9305e8a4d8364366aaba05dd698396d28b539dc) Thanks [@hhumphrey-ledger](https://github.com/hhumphrey-ledger)! - Remove cryptoassets fallback from exchange config flow
|
|
50
64
|
|
|
51
65
|
### Patch Changes
|
|
52
66
|
|
|
53
|
-
- Updated dependencies [[`2c6a198`](https://github.com/LedgerHQ/ledger-live/commit/2c6a198ba28391695202a0787ce168c53768ff37)]:
|
|
54
|
-
- @ledgerhq/
|
|
67
|
+
- Updated dependencies [[`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726), [`34b28dd`](https://github.com/LedgerHQ/ledger-live/commit/34b28dd5e819906daaa79db5fe6064674def5e7d), [`7744980`](https://github.com/LedgerHQ/ledger-live/commit/774498090411f1a6d6c06395dda1fc7cd24adf24), [`77566c5`](https://github.com/LedgerHQ/ledger-live/commit/77566c5a3b5795f5938bd5daaa5f8d65934c56b8), [`b962966`](https://github.com/LedgerHQ/ledger-live/commit/b962966525517c5cfa7f1f8826f8f2b9162189e4), [`f392f69`](https://github.com/LedgerHQ/ledger-live/commit/f392f6912f445cc2f7cf4dfcfd030fa3da76f736), [`cadf2e1`](https://github.com/LedgerHQ/ledger-live/commit/cadf2e1dfb09248d3f77d96f94ae774425dbca75), [`cbc0648`](https://github.com/LedgerHQ/ledger-live/commit/cbc064885d8e0459e40d327a2e5389204b3ec705), [`3d4188a`](https://github.com/LedgerHQ/ledger-live/commit/3d4188a26021d33b950129d82cb55d2c2e8d4358), [`2c6a198`](https://github.com/LedgerHQ/ledger-live/commit/2c6a198ba28391695202a0787ce168c53768ff37)]:
|
|
68
|
+
- @ledgerhq/live-env@2.20.0-next.0
|
|
69
|
+
- @ledgerhq/types-live@6.88.0-next.0
|
|
55
70
|
|
|
56
71
|
## 13.31.0
|
|
57
72
|
|
|
@@ -5,7 +5,7 @@ export declare enum TokensDataTags {
|
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for the getTokensData query
|
|
7
7
|
*
|
|
8
|
-
* @param networkFamily - Filter by network families (e.g.,
|
|
8
|
+
* @param networkFamily - Filter by network families (e.g., "ethereum", "polygon")
|
|
9
9
|
* @param isStaging - Use staging or production environment
|
|
10
10
|
* @param pageSize - Number of items per page (default: 100, options: 10, 100, 1000)
|
|
11
11
|
* @param output - Specify output fields (default: all fields, values: id, name, ticker, units, delisted)
|
|
@@ -17,7 +17,7 @@ export declare enum TokensDataTags {
|
|
|
17
17
|
* - CAL reference to use
|
|
18
18
|
*/
|
|
19
19
|
export interface GetTokensDataParams {
|
|
20
|
-
networkFamily?: string
|
|
20
|
+
networkFamily?: string;
|
|
21
21
|
output?: string[];
|
|
22
22
|
limit?: number;
|
|
23
23
|
pageSize?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cal-client/state-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,cAAc;IACxB,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cal-client/state-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,cAAc;IACxB,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE;QACV,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -5,7 +5,7 @@ export declare enum TokensDataTags {
|
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for the getTokensData query
|
|
7
7
|
*
|
|
8
|
-
* @param networkFamily - Filter by network families (e.g.,
|
|
8
|
+
* @param networkFamily - Filter by network families (e.g., "ethereum", "polygon")
|
|
9
9
|
* @param isStaging - Use staging or production environment
|
|
10
10
|
* @param pageSize - Number of items per page (default: 100, options: 10, 100, 1000)
|
|
11
11
|
* @param output - Specify output fields (default: all fields, values: id, name, ticker, units, delisted)
|
|
@@ -17,7 +17,7 @@ export declare enum TokensDataTags {
|
|
|
17
17
|
* - CAL reference to use
|
|
18
18
|
*/
|
|
19
19
|
export interface GetTokensDataParams {
|
|
20
|
-
networkFamily?: string
|
|
20
|
+
networkFamily?: string;
|
|
21
21
|
output?: string[];
|
|
22
22
|
limit?: number;
|
|
23
23
|
pageSize?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cal-client/state-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,cAAc;IACxB,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cal-client/state-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,cAAc;IACxB,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE;QACV,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/cryptoassets",
|
|
3
|
-
"version": "13.32.0
|
|
3
|
+
"version": "13.32.0",
|
|
4
4
|
"description": "Ledger crypto-assets list",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"invariant": "2",
|
|
26
26
|
"zod": "^3.22.4",
|
|
27
27
|
"@reduxjs/toolkit": "2.8.2",
|
|
28
|
-
"@ledgerhq/live-env": "^2.20.0
|
|
29
|
-
"@ledgerhq/types-live": "^6.88.0
|
|
28
|
+
"@ledgerhq/live-env": "^2.20.0",
|
|
29
|
+
"@ledgerhq/types-live": "^6.88.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@testing-library/react": "14.2.2",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ts-jest": "^29.1.1",
|
|
44
44
|
"ts-node": "^10.7.0",
|
|
45
45
|
"react-redux": "^9.1.2",
|
|
46
|
-
"@ledgerhq/types-cryptoassets": "^7.
|
|
46
|
+
"@ledgerhq/types-cryptoassets": "^7.30.0"
|
|
47
47
|
},
|
|
48
48
|
"typesVersions": {
|
|
49
49
|
"*": {
|
|
@@ -10,7 +10,7 @@ Migrate from `listTokens()` and `listTokensForCryptoCurrency()` to the CAL Clien
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
const { data, isLoading, isSuccess, isError, loadNext, error, refetch } = useTokensData({
|
|
13
|
-
networkFamily?: string
|
|
13
|
+
networkFamily?: string, // Filter by network families (e.g., "ethereum", "polygon")
|
|
14
14
|
output?: string[], // Specify output fields (e.g., ["id", "name", "ticker", "units", "delisted"])
|
|
15
15
|
limit?: number, // Maximum number of assets to return
|
|
16
16
|
pageSize?: number, // Number of items per page (default: 100, options: 10, 100, 1000)
|
|
@@ -109,7 +109,7 @@ import { useTokensData } from "@ledgerhq/cryptoassets/cal-client/hooks/useTokens
|
|
|
109
109
|
|
|
110
110
|
function EthereumTokens({ networkFamily }) {
|
|
111
111
|
const { data, isLoading, loadNext } = useTokensData({
|
|
112
|
-
networkFamily:
|
|
112
|
+
networkFamily: networkFamily, // e.g., "ethereum" or "polygon"
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
if (isLoading) return <div>Loading...</div>;
|
|
@@ -198,7 +198,7 @@ import { useTokensData } from "@ledgerhq/cryptoassets/cal-client/hooks/useTokens
|
|
|
198
198
|
function TokenDropdown() {
|
|
199
199
|
const { data, isLoading } = useTokensData({
|
|
200
200
|
output: ["id", "name", "ticker"], // Only fetch what you need
|
|
201
|
-
networkFamily:
|
|
201
|
+
networkFamily: "ethereum",
|
|
202
202
|
pageSize: 100,
|
|
203
203
|
});
|
|
204
204
|
|
|
@@ -236,7 +236,7 @@ For use cases where you only need a subset of tokens (e.g., displaying top token
|
|
|
236
236
|
const { data, isLoading } = useTokensData({
|
|
237
237
|
limit: 50, // Only fetch first 50 tokens
|
|
238
238
|
pageSize: 50, // Match page size to limit for single request
|
|
239
|
-
networkFamily:
|
|
239
|
+
networkFamily: "ethereum",
|
|
240
240
|
});
|
|
241
241
|
```
|
|
242
242
|
|
|
@@ -247,7 +247,7 @@ For testing with staging data:
|
|
|
247
247
|
```typescript
|
|
248
248
|
const { data, isLoading, isError } = useTokensData({
|
|
249
249
|
isStaging: true, // Use staging API
|
|
250
|
-
networkFamily:
|
|
250
|
+
networkFamily: "ethereum",
|
|
251
251
|
});
|
|
252
252
|
```
|
|
253
253
|
|
|
@@ -266,7 +266,7 @@ The CAL Client is actively evolving and will be enhanced based on real-world usa
|
|
|
266
266
|
## Migration Checklist
|
|
267
267
|
|
|
268
268
|
- [ ] Replace `listTokens()` calls with `useTokensData({})`
|
|
269
|
-
- [ ] Replace `listTokensForCryptoCurrency()` with `useTokensData({ networkFamily:
|
|
269
|
+
- [ ] Replace `listTokensForCryptoCurrency()` with `useTokensData({ networkFamily: "..." })`
|
|
270
270
|
- [ ] Update component to handle async loading state
|
|
271
271
|
- [ ] Implement pagination if displaying large lists
|
|
272
272
|
- [ ] Update data access from flat array to `data?.tokens`
|
package/src/cal-client/README.md
CHANGED
|
@@ -55,6 +55,7 @@ const store = configureStore({
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
The `cryptoAssetsApi` instance is pre-configured and environment-aware. It automatically uses `getEnv()` to fetch:
|
|
58
|
+
|
|
58
59
|
- `CAL_SERVICE_URL` - Base URL for the CAL API
|
|
59
60
|
- `LEDGER_CLIENT_VERSION` - Client version for request headers
|
|
60
61
|
|
|
@@ -72,7 +73,7 @@ const InfiniteTokensList = () => {
|
|
|
72
73
|
loadNext,
|
|
73
74
|
refetch
|
|
74
75
|
} = useTokensData({
|
|
75
|
-
networkFamily:
|
|
76
|
+
networkFamily: "ethereum",
|
|
76
77
|
pageSize: 100,
|
|
77
78
|
output: ["id", "name", "ticker", "contract_address"],
|
|
78
79
|
});
|
|
@@ -98,13 +99,13 @@ import { cryptoAssetsApi } from "@ledgerhq/cryptoassets/cal-client";
|
|
|
98
99
|
|
|
99
100
|
// Find a specific token by ID
|
|
100
101
|
const { data: token, isLoading } = cryptoAssetsApi.useFindTokenByIdQuery({
|
|
101
|
-
id: "ethereum/erc20/usdt"
|
|
102
|
+
id: "ethereum/erc20/usdt",
|
|
102
103
|
});
|
|
103
104
|
|
|
104
105
|
// Find token by contract address and network
|
|
105
106
|
const { data: token } = cryptoAssetsApi.useFindTokenByAddressInCurrencyQuery({
|
|
106
107
|
contract_address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
107
|
-
network: "ethereum"
|
|
108
|
+
network: "ethereum",
|
|
108
109
|
});
|
|
109
110
|
|
|
110
111
|
// Get sync hash for a currency (useful for cache invalidation)
|
|
@@ -117,7 +118,7 @@ const { data: hash } = cryptoAssetsApi.useGetTokensSyncHashQuery("ethereum");
|
|
|
117
118
|
|
|
118
119
|
- `useTokensData(params)` - Fetch paginated tokens data with infinite scroll support
|
|
119
120
|
- **Parameters:**
|
|
120
|
-
- `networkFamily?: string
|
|
121
|
+
- `networkFamily?: string` - Filter by network families (e.g., "ethereum", "polygon")
|
|
121
122
|
- `pageSize?: number` - Number of items per page (default: 100, options: 10, 100, 1000)
|
|
122
123
|
- `isStaging?: boolean` - Use staging environment
|
|
123
124
|
- `output?: string[]` - Specify output fields (default: all fields)
|
|
@@ -40,7 +40,7 @@ describe("useAssetsData", () => {
|
|
|
40
40
|
|
|
41
41
|
const { result } = renderHook(() =>
|
|
42
42
|
useTokensData({
|
|
43
|
-
networkFamily:
|
|
43
|
+
networkFamily: "ethereum",
|
|
44
44
|
pageSize: 100,
|
|
45
45
|
output: ["id", "name", "ticker", "contract_address"],
|
|
46
46
|
}),
|
|
@@ -92,7 +92,7 @@ describe("useAssetsData", () => {
|
|
|
92
92
|
|
|
93
93
|
const { result } = renderHook(() =>
|
|
94
94
|
useTokensData({
|
|
95
|
-
networkFamily:
|
|
95
|
+
networkFamily: "ethereum",
|
|
96
96
|
pageSize: 100,
|
|
97
97
|
output: ["id", "name", "ticker", "contract_address"],
|
|
98
98
|
}),
|
|
@@ -140,7 +140,7 @@ describe("useAssetsData", () => {
|
|
|
140
140
|
|
|
141
141
|
const { result } = renderHook(() =>
|
|
142
142
|
useTokensData({
|
|
143
|
-
networkFamily:
|
|
143
|
+
networkFamily: "ethereum",
|
|
144
144
|
pageSize: 100,
|
|
145
145
|
output: ["id", "name", "ticker", "contract_address"],
|
|
146
146
|
}),
|
|
@@ -167,7 +167,7 @@ describe("useAssetsData", () => {
|
|
|
167
167
|
|
|
168
168
|
const { result } = renderHook(() =>
|
|
169
169
|
useTokensData({
|
|
170
|
-
networkFamily:
|
|
170
|
+
networkFamily: "ethereum",
|
|
171
171
|
pageSize: 100,
|
|
172
172
|
output: ["id", "name", "ticker", "contract_address"],
|
|
173
173
|
}),
|
|
@@ -194,7 +194,7 @@ describe("useAssetsData", () => {
|
|
|
194
194
|
|
|
195
195
|
const { result } = renderHook(() =>
|
|
196
196
|
useTokensData({
|
|
197
|
-
networkFamily:
|
|
197
|
+
networkFamily: "ethereum",
|
|
198
198
|
pageSize: 100,
|
|
199
199
|
output: ["id", "name", "ticker", "contract_address"],
|
|
200
200
|
}),
|
|
@@ -210,7 +210,7 @@ describe("useAssetsData", () => {
|
|
|
210
210
|
|
|
211
211
|
const { result } = renderHook(() =>
|
|
212
212
|
useTokensData({
|
|
213
|
-
networkFamily:
|
|
213
|
+
networkFamily: "ethereum",
|
|
214
214
|
pageSize: 100,
|
|
215
215
|
output: ["id", "name", "ticker", "contract_address"],
|
|
216
216
|
}),
|
|
@@ -7,7 +7,7 @@ export enum TokensDataTags {
|
|
|
7
7
|
/**
|
|
8
8
|
* Parameters for the getTokensData query
|
|
9
9
|
*
|
|
10
|
-
* @param networkFamily - Filter by network families (e.g.,
|
|
10
|
+
* @param networkFamily - Filter by network families (e.g., "ethereum", "polygon")
|
|
11
11
|
* @param isStaging - Use staging or production environment
|
|
12
12
|
* @param pageSize - Number of items per page (default: 100, options: 10, 100, 1000)
|
|
13
13
|
* @param output - Specify output fields (default: all fields, values: id, name, ticker, units, delisted)
|
|
@@ -19,7 +19,7 @@ export enum TokensDataTags {
|
|
|
19
19
|
* - CAL reference to use
|
|
20
20
|
*/
|
|
21
21
|
export interface GetTokensDataParams {
|
|
22
|
-
networkFamily?: string
|
|
22
|
+
networkFamily?: string;
|
|
23
23
|
output?: string[];
|
|
24
24
|
limit?: number;
|
|
25
25
|
pageSize?: number;
|