@ohos-ports/ledgerhq-live-countervalues 0.25.0-beta.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +26 -0
  4. package/jest-global-setup.js +9 -0
  5. package/jest-setup.ts +25 -0
  6. package/jest.config.js +26 -0
  7. package/lib/api/api.d.ts +4 -0
  8. package/lib/api/api.d.ts.map +1 -0
  9. package/lib/api/api.js +104 -0
  10. package/lib/api/api.js.map +1 -0
  11. package/lib/api/api.mock.d.ts +4 -0
  12. package/lib/api/api.mock.d.ts.map +1 -0
  13. package/lib/api/api.mock.js +91 -0
  14. package/lib/api/api.mock.js.map +1 -0
  15. package/lib/api/index.d.ts +4 -0
  16. package/lib/api/index.d.ts.map +1 -0
  17. package/lib/api/index.js +18 -0
  18. package/lib/api/index.js.map +1 -0
  19. package/lib/helpers.d.ts +32 -0
  20. package/lib/helpers.d.ts.map +1 -0
  21. package/lib/helpers.js +86 -0
  22. package/lib/helpers.js.map +1 -0
  23. package/lib/logic.d.ts +47 -0
  24. package/lib/logic.d.ts.map +1 -0
  25. package/lib/logic.js +465 -0
  26. package/lib/logic.js.map +1 -0
  27. package/lib/mock.d.ts +5 -0
  28. package/lib/mock.d.ts.map +1 -0
  29. package/lib/mock.js +89 -0
  30. package/lib/mock.js.map +1 -0
  31. package/lib/types.d.ts +53 -0
  32. package/lib/types.d.ts.map +1 -0
  33. package/lib/types.js +4 -0
  34. package/lib/types.js.map +1 -0
  35. package/lib-es/api/api.d.ts +4 -0
  36. package/lib-es/api/api.d.ts.map +1 -0
  37. package/lib-es/api/api.js +99 -0
  38. package/lib-es/api/api.js.map +1 -0
  39. package/lib-es/api/api.mock.d.ts +4 -0
  40. package/lib-es/api/api.mock.d.ts.map +1 -0
  41. package/lib-es/api/api.mock.js +86 -0
  42. package/lib-es/api/api.mock.js.map +1 -0
  43. package/lib-es/api/index.d.ts +4 -0
  44. package/lib-es/api/index.d.ts.map +1 -0
  45. package/lib-es/api/index.js +13 -0
  46. package/lib-es/api/index.js.map +1 -0
  47. package/lib-es/helpers.d.ts +32 -0
  48. package/lib-es/helpers.d.ts.map +1 -0
  49. package/lib-es/helpers.js +76 -0
  50. package/lib-es/helpers.js.map +1 -0
  51. package/lib-es/logic.d.ts +47 -0
  52. package/lib-es/logic.d.ts.map +1 -0
  53. package/lib-es/logic.js +446 -0
  54. package/lib-es/logic.js.map +1 -0
  55. package/lib-es/mock.d.ts +5 -0
  56. package/lib-es/mock.d.ts.map +1 -0
  57. package/lib-es/mock.js +85 -0
  58. package/lib-es/mock.js.map +1 -0
  59. package/lib-es/types.d.ts +53 -0
  60. package/lib-es/types.d.ts.map +1 -0
  61. package/lib-es/types.js +3 -0
  62. package/lib-es/types.js.map +1 -0
  63. package/package.json +88 -0
  64. package/src/api/api.mock.ts +104 -0
  65. package/src/api/api.ts +123 -0
  66. package/src/api/index.ts +17 -0
  67. package/src/helpers.ts +92 -0
  68. package/src/logic.test.ts +394 -0
  69. package/src/logic.ts +613 -0
  70. package/src/mock.test.ts +262 -0
  71. package/src/mock.ts +85 -0
  72. package/src/tests/currencies.ts +69 -0
  73. package/src/types.ts +88 -0
  74. package/tsconfig.build.json +22 -0
  75. package/tsconfig.json +15 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,281 @@
1
+ # @ledgerhq/live-countervalues
2
+
3
+ ## 0.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#21516](https://github.com/LedgerHQ/ledger-live/pull/21516) [`e42c12a`](https://github.com/LedgerHQ/ledger-live/commit/e42c12a392ba60ee839c9a71f4f0d409ad9430fa) Thanks [@ysitbon](https://github.com/ysitbon)! - Remove `fetchIdsSortedByMarketcap` from the legacy countervalues API client. The RTK Query client in `ledger-live-common` already covers the same endpoint and is the single source of truth going forward.
8
+
9
+ - [#21507](https://github.com/LedgerHQ/ledger-live/pull/21507) [`eb62268`](https://github.com/LedgerHQ/ledger-live/commit/eb622688cb7561882cd02b52c2eed569d5dc68f3) Thanks [@ysitbon](https://github.com/ysitbon)! - Move portfolio and account-coupled logic to live-common
10
+
11
+ `portfolio.ts`, the React `portfolioReact.tsx`, the internal `ranges.ts` and `assetsDistribution.ts`
12
+ helpers, and the `inferTrackingPairForAccounts*` tests migrate from the countervalues packages into
13
+ `libs/ledger-live-common/src/portfolio/`. This removes the account-entity blocker from the
14
+ countervalues epic: `live-countervalues` is now rate logic only.
15
+
16
+ `live-countervalues`: `portfolio` entry point removed; `src/internal/` directory removed.
17
+ `live-countervalues-react`: `portfolio` entry point removed; package now contains only `index.tsx`.
18
+ `live-common`: `portfolio/portfolio` and `portfolio/portfolioReact` entry points added.
19
+
20
+ - [#21509](https://github.com/LedgerHQ/ledger-live/pull/21509) [`53dcdc9`](https://github.com/LedgerHQ/ledger-live/commit/53dcdc9bbef2324b48fac7469c2c1d0e66f7361f) Thanks [@ysitbon](https://github.com/ysitbon)! - wallet-analytics: inline `meaningfulPercentage` as a private utility, removing the `/portfolio` import edge. `live-countervalues`: un-export `meaningfulPercentage` (private implementation detail).
21
+
22
+ - [#21517](https://github.com/LedgerHQ/ledger-live/pull/21517) [`54124e4`](https://github.com/LedgerHQ/ledger-live/commit/54124e435c7adc3a2c3a9ed6cd1865fc68fa2584) Thanks [@ysitbon](https://github.com/ysitbon)! - rename CountervaluesBridge.useMarketcapIds to useSupportedCryptoIds and document why filterSupportedTrackingPairs guards against 422s
23
+
24
+ - [#21508](https://github.com/LedgerHQ/ledger-live/pull/21508) [`a19ffef`](https://github.com/LedgerHQ/ledger-live/commit/a19ffeff9dd4e173890d75d8634a33e53cc5a5d0) Thanks [@ysitbon](https://github.com/ysitbon)! - Reduce `portfolio.ts` export surface from 19 to 10. The 9 symbols that nothing outside the file imported (`startOfHour`, `startOfDay`, `startOfWeek`, `getRanges`, `getDates`, `getPortfolioRangeConfig`, `getPortfolioCountByDate`, `defaultAssetsDistribution`, `AssetsDistributionOpts`) are relocated to two internal modules (`src/internal/ranges.ts` and `src/internal/assetsDistribution.ts`) and re-imported by `portfolio.ts`. No behaviour change; the internal modules are a staging home until the package gains an explicit `exports` map.
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [[`52f573c`](https://github.com/LedgerHQ/ledger-live/commit/52f573c045c52805d250079dd300870c4468493d), [`2d42e64`](https://github.com/LedgerHQ/ledger-live/commit/2d42e647d55f79cf2eb821ec30a232cc07891219), [`b7d0367`](https://github.com/LedgerHQ/ledger-live/commit/b7d03671db1aa022d3ff375465c7d8470bf2b215), [`5b7d11d`](https://github.com/LedgerHQ/ledger-live/commit/5b7d11dd9a988f0034b4b5b6168f02429ba5a406), [`5e971b5`](https://github.com/LedgerHQ/ledger-live/commit/5e971b55429cdcab0f69825ce2056fef24d30215), [`b7a8906`](https://github.com/LedgerHQ/ledger-live/commit/b7a89064587bbcd1f758f7b6205a616225ac2317), [`b9e15ac`](https://github.com/LedgerHQ/ledger-live/commit/b9e15ac78e2b89919c605511f333282610e57225), [`9fb98ab`](https://github.com/LedgerHQ/ledger-live/commit/9fb98ab74e3ca680e686a302b9beaa460a087783)]:
29
+ - @ledgerhq/types-live@6.123.0
30
+ - @ledgerhq/ledger-wallet-framework@3.3.0
31
+ - @ledgerhq/live-env@4.0.0
32
+
33
+ ## 0.25.0-next.0
34
+
35
+ ### Minor Changes
36
+
37
+ - [#21516](https://github.com/LedgerHQ/ledger-live/pull/21516) [`e42c12a`](https://github.com/LedgerHQ/ledger-live/commit/e42c12a392ba60ee839c9a71f4f0d409ad9430fa) Thanks [@ysitbon](https://github.com/ysitbon)! - Remove `fetchIdsSortedByMarketcap` from the legacy countervalues API client. The RTK Query client in `ledger-live-common` already covers the same endpoint and is the single source of truth going forward.
38
+
39
+ - [#21507](https://github.com/LedgerHQ/ledger-live/pull/21507) [`eb62268`](https://github.com/LedgerHQ/ledger-live/commit/eb622688cb7561882cd02b52c2eed569d5dc68f3) Thanks [@ysitbon](https://github.com/ysitbon)! - Move portfolio and account-coupled logic to live-common
40
+
41
+ `portfolio.ts`, the React `portfolioReact.tsx`, the internal `ranges.ts` and `assetsDistribution.ts`
42
+ helpers, and the `inferTrackingPairForAccounts*` tests migrate from the countervalues packages into
43
+ `libs/ledger-live-common/src/portfolio/`. This removes the account-entity blocker from the
44
+ countervalues epic: `live-countervalues` is now rate logic only.
45
+
46
+ `live-countervalues`: `portfolio` entry point removed; `src/internal/` directory removed.
47
+ `live-countervalues-react`: `portfolio` entry point removed; package now contains only `index.tsx`.
48
+ `live-common`: `portfolio/portfolio` and `portfolio/portfolioReact` entry points added.
49
+
50
+ - [#21509](https://github.com/LedgerHQ/ledger-live/pull/21509) [`53dcdc9`](https://github.com/LedgerHQ/ledger-live/commit/53dcdc9bbef2324b48fac7469c2c1d0e66f7361f) Thanks [@ysitbon](https://github.com/ysitbon)! - wallet-analytics: inline `meaningfulPercentage` as a private utility, removing the `/portfolio` import edge. `live-countervalues`: un-export `meaningfulPercentage` (private implementation detail).
51
+
52
+ - [#21517](https://github.com/LedgerHQ/ledger-live/pull/21517) [`54124e4`](https://github.com/LedgerHQ/ledger-live/commit/54124e435c7adc3a2c3a9ed6cd1865fc68fa2584) Thanks [@ysitbon](https://github.com/ysitbon)! - rename CountervaluesBridge.useMarketcapIds to useSupportedCryptoIds and document why filterSupportedTrackingPairs guards against 422s
53
+
54
+ - [#21508](https://github.com/LedgerHQ/ledger-live/pull/21508) [`a19ffef`](https://github.com/LedgerHQ/ledger-live/commit/a19ffeff9dd4e173890d75d8634a33e53cc5a5d0) Thanks [@ysitbon](https://github.com/ysitbon)! - Reduce `portfolio.ts` export surface from 19 to 10. The 9 symbols that nothing outside the file imported (`startOfHour`, `startOfDay`, `startOfWeek`, `getRanges`, `getDates`, `getPortfolioRangeConfig`, `getPortfolioCountByDate`, `defaultAssetsDistribution`, `AssetsDistributionOpts`) are relocated to two internal modules (`src/internal/ranges.ts` and `src/internal/assetsDistribution.ts`) and re-imported by `portfolio.ts`. No behaviour change; the internal modules are a staging home until the package gains an explicit `exports` map.
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [[`52f573c`](https://github.com/LedgerHQ/ledger-live/commit/52f573c045c52805d250079dd300870c4468493d), [`2d42e64`](https://github.com/LedgerHQ/ledger-live/commit/2d42e647d55f79cf2eb821ec30a232cc07891219), [`b7d0367`](https://github.com/LedgerHQ/ledger-live/commit/b7d03671db1aa022d3ff375465c7d8470bf2b215), [`5b7d11d`](https://github.com/LedgerHQ/ledger-live/commit/5b7d11dd9a988f0034b4b5b6168f02429ba5a406), [`5e971b5`](https://github.com/LedgerHQ/ledger-live/commit/5e971b55429cdcab0f69825ce2056fef24d30215), [`b7a8906`](https://github.com/LedgerHQ/ledger-live/commit/b7a89064587bbcd1f758f7b6205a616225ac2317), [`b9e15ac`](https://github.com/LedgerHQ/ledger-live/commit/b9e15ac78e2b89919c605511f333282610e57225), [`9fb98ab`](https://github.com/LedgerHQ/ledger-live/commit/9fb98ab74e3ca680e686a302b9beaa460a087783)]:
59
+ - @ledgerhq/types-live@6.123.0-next.0
60
+ - @ledgerhq/ledger-wallet-framework@3.3.0-next.0
61
+ - @ledgerhq/live-env@4.0.0-next.0
62
+
63
+ ## 0.24.5
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies [[`27388a8`](https://github.com/LedgerHQ/ledger-live/commit/27388a894eaac67b8e162a60f6d3368aad0a8682), [`e21305a`](https://github.com/LedgerHQ/ledger-live/commit/e21305abce18f0a9408bf6c0e2bb47d5c992e06a)]:
68
+ - @ledgerhq/types-live@6.122.0
69
+ - @ledgerhq/ledger-wallet-framework@3.2.0
70
+ - @ledgerhq/live-env@3.2.0
71
+
72
+ ## 0.24.5-next.0
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies [[`27388a8`](https://github.com/LedgerHQ/ledger-live/commit/27388a894eaac67b8e162a60f6d3368aad0a8682), [`e21305a`](https://github.com/LedgerHQ/ledger-live/commit/e21305abce18f0a9408bf6c0e2bb47d5c992e06a)]:
77
+ - @ledgerhq/types-live@6.122.0-next.0
78
+ - @ledgerhq/ledger-wallet-framework@3.2.0-next.0
79
+ - @ledgerhq/live-env@3.2.0-next.0
80
+
81
+ ## 0.24.4
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [[`aa39333`](https://github.com/LedgerHQ/ledger-live/commit/aa393339789242783b168398cb5122a7f1e3f620), [`6c425e0`](https://github.com/LedgerHQ/ledger-live/commit/6c425e0e869c6feed4bd4c87ee0fef5443617708), [`585d8d7`](https://github.com/LedgerHQ/ledger-live/commit/585d8d78d5e153186c39ee2abfcdb7dc4a5d06e0), [`8161bac`](https://github.com/LedgerHQ/ledger-live/commit/8161bac542474212dfefc8519e714da345b03f71), [`fbc8036`](https://github.com/LedgerHQ/ledger-live/commit/fbc8036d9bd4e1cc30eea4233f05e8b0498c0e5e), [`39a676d`](https://github.com/LedgerHQ/ledger-live/commit/39a676d2f861d04913264e61100205b4f6044cf9)]:
86
+ - @ledgerhq/types-live@6.121.0
87
+ - @ledgerhq/ledger-wallet-framework@3.1.0
88
+ - @ledgerhq/live-env@3.1.0
89
+
90
+ ## 0.24.4-next.0
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [[`aa39333`](https://github.com/LedgerHQ/ledger-live/commit/aa393339789242783b168398cb5122a7f1e3f620), [`6c425e0`](https://github.com/LedgerHQ/ledger-live/commit/6c425e0e869c6feed4bd4c87ee0fef5443617708), [`585d8d7`](https://github.com/LedgerHQ/ledger-live/commit/585d8d78d5e153186c39ee2abfcdb7dc4a5d06e0), [`8161bac`](https://github.com/LedgerHQ/ledger-live/commit/8161bac542474212dfefc8519e714da345b03f71), [`fbc8036`](https://github.com/LedgerHQ/ledger-live/commit/fbc8036d9bd4e1cc30eea4233f05e8b0498c0e5e), [`39a676d`](https://github.com/LedgerHQ/ledger-live/commit/39a676d2f861d04913264e61100205b4f6044cf9)]:
95
+ - @ledgerhq/types-live@6.121.0-next.0
96
+ - @ledgerhq/ledger-wallet-framework@3.1.0-next.0
97
+ - @ledgerhq/live-env@3.1.0-next.0
98
+
99
+ ## 0.24.3
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [[`da0a5ce`](https://github.com/LedgerHQ/ledger-live/commit/da0a5ceb8f889f1bace45ed2d3d4c640cdf24ca8), [`eecf99a`](https://github.com/LedgerHQ/ledger-live/commit/eecf99af5c17ab63724843c31d5f3facc6352dad), [`030fc67`](https://github.com/LedgerHQ/ledger-live/commit/030fc677db03e8a411d3d33d2fa88e1ab04df80b), [`5b39a67`](https://github.com/LedgerHQ/ledger-live/commit/5b39a67dd93d4c541a77b0b146881073ca00ed15), [`0807eca`](https://github.com/LedgerHQ/ledger-live/commit/0807ecacfd06057811a3d6f8845b9f4bfc6f693c), [`b6da6b1`](https://github.com/LedgerHQ/ledger-live/commit/b6da6b1b1c98d022f30985c6103c239bffd0c7df), [`79882e2`](https://github.com/LedgerHQ/ledger-live/commit/79882e26a14f246f1cc969937e011b16e701b8f2), [`a20805c`](https://github.com/LedgerHQ/ledger-live/commit/a20805cebd95f2f620d394c4d7598ec93506c83e), [`030b427`](https://github.com/LedgerHQ/ledger-live/commit/030b42707768af3f9c98a15fc6751f1d64b36fe6)]:
104
+ - @ledgerhq/types-live@6.120.0
105
+ - @ledgerhq/ledger-wallet-framework@3.0.0
106
+
107
+ ## 0.24.3-next.1
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [[`da0a5ce`](https://github.com/LedgerHQ/ledger-live/commit/da0a5ceb8f889f1bace45ed2d3d4c640cdf24ca8)]:
112
+ - @ledgerhq/types-live@6.120.0-next.1
113
+ - @ledgerhq/ledger-wallet-framework@3.0.0-next.1
114
+
115
+ ## 0.24.3-next.0
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies [[`eecf99a`](https://github.com/LedgerHQ/ledger-live/commit/eecf99af5c17ab63724843c31d5f3facc6352dad), [`030fc67`](https://github.com/LedgerHQ/ledger-live/commit/030fc677db03e8a411d3d33d2fa88e1ab04df80b), [`5b39a67`](https://github.com/LedgerHQ/ledger-live/commit/5b39a67dd93d4c541a77b0b146881073ca00ed15), [`0807eca`](https://github.com/LedgerHQ/ledger-live/commit/0807ecacfd06057811a3d6f8845b9f4bfc6f693c), [`b6da6b1`](https://github.com/LedgerHQ/ledger-live/commit/b6da6b1b1c98d022f30985c6103c239bffd0c7df), [`79882e2`](https://github.com/LedgerHQ/ledger-live/commit/79882e26a14f246f1cc969937e011b16e701b8f2), [`a20805c`](https://github.com/LedgerHQ/ledger-live/commit/a20805cebd95f2f620d394c4d7598ec93506c83e), [`030b427`](https://github.com/LedgerHQ/ledger-live/commit/030b42707768af3f9c98a15fc6751f1d64b36fe6)]:
120
+ - @ledgerhq/ledger-wallet-framework@3.0.0-next.0
121
+ - @ledgerhq/types-live@6.120.0-next.0
122
+
123
+ ## 0.24.2
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [[`aee0e64`](https://github.com/LedgerHQ/ledger-live/commit/aee0e64b491aafc1ca8fea16b1ef124cb183770b), [`1e9db75`](https://github.com/LedgerHQ/ledger-live/commit/1e9db750a4882f9db7f95278e33c00262487b37b), [`647804e`](https://github.com/LedgerHQ/ledger-live/commit/647804ee755d54776e6b8cd96328bee89fb035e4), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152)]:
128
+ - @ledgerhq/types-live@6.119.0
129
+ - @ledgerhq/ledger-wallet-framework@2.8.0
130
+
131
+ ## 0.24.2-next.0
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies [[`aee0e64`](https://github.com/LedgerHQ/ledger-live/commit/aee0e64b491aafc1ca8fea16b1ef124cb183770b), [`1e9db75`](https://github.com/LedgerHQ/ledger-live/commit/1e9db750a4882f9db7f95278e33c00262487b37b), [`647804e`](https://github.com/LedgerHQ/ledger-live/commit/647804ee755d54776e6b8cd96328bee89fb035e4), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152)]:
136
+ - @ledgerhq/types-live@6.119.0-next.0
137
+ - @ledgerhq/ledger-wallet-framework@2.8.0-next.0
138
+
139
+ ## 0.24.1
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [[`56cfe0b`](https://github.com/LedgerHQ/ledger-live/commit/56cfe0bc6673f416f739c1593abfec718230952d), [`a464f7d`](https://github.com/LedgerHQ/ledger-live/commit/a464f7d6092607ff6b81aa6ec0cd29ef6cfcf35a), [`6a531c5`](https://github.com/LedgerHQ/ledger-live/commit/6a531c54ccd1c65df122286de6f136f9d73b9002), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
144
+ - @ledgerhq/types-live@6.118.0
145
+ - @ledgerhq/ledger-wallet-framework@2.7.0
146
+
147
+ ## 0.24.1-next.0
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [[`56cfe0b`](https://github.com/LedgerHQ/ledger-live/commit/56cfe0bc6673f416f739c1593abfec718230952d), [`a464f7d`](https://github.com/LedgerHQ/ledger-live/commit/a464f7d6092607ff6b81aa6ec0cd29ef6cfcf35a), [`6a531c5`](https://github.com/LedgerHQ/ledger-live/commit/6a531c54ccd1c65df122286de6f136f9d73b9002), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
152
+ - @ledgerhq/types-live@6.118.0-next.0
153
+ - @ledgerhq/ledger-wallet-framework@2.7.0-next.0
154
+
155
+ ## 0.24.0
156
+
157
+ ### Minor Changes
158
+
159
+ - [#20070](https://github.com/LedgerHQ/ledger-live/pull/20070) [`52253f7`](https://github.com/LedgerHQ/ledger-live/commit/52253f70c302056cdc6b367cdd8b1db408b5e07d) Thanks [@ysitbon](https://github.com/ysitbon)! - Remove the now-dead `@ledgerhq/cryptoassets` currency/fiat store injection from the app bootstraps. Nothing reads the legacy currency/fiat accessors anymore (the runtime source of truth is the domain-backed wallet-framework currency resolver), so `setCryptoCurrenciesStore` / `setFiatCurrenciesStore` injected a store no consumer queried. Drop the calls, drop the `@ledgerhq/cryptoassets` dependency from the apps, and remove the remaining stale references to the package in comments.
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies [[`2e1aecc`](https://github.com/LedgerHQ/ledger-live/commit/2e1aeccf6c91761c5d09c91e4be10dcc8c22eb7b), [`1af9ec9`](https://github.com/LedgerHQ/ledger-live/commit/1af9ec984928e0bf5fd23ce12edcc6131b0302a0), [`c475d28`](https://github.com/LedgerHQ/ledger-live/commit/c475d288b4978aa3011c9e76f3e9a1e2f9733010), [`a534db5`](https://github.com/LedgerHQ/ledger-live/commit/a534db5c41da6957d38a330c1da6f7db1b693763), [`c622459`](https://github.com/LedgerHQ/ledger-live/commit/c622459fcbff5dcc094ee10eb360f2a835036007), [`524d763`](https://github.com/LedgerHQ/ledger-live/commit/524d7636d85a79379a9b086323d3121f3199bd1f), [`dbf8acf`](https://github.com/LedgerHQ/ledger-live/commit/dbf8acf27c9405548e7eb559d163a8e0883a20aa)]:
164
+ - @ledgerhq/ledger-wallet-framework@2.6.0
165
+ - @ledgerhq/live-network@3.0.0
166
+ - @ledgerhq/live-env@3.0.0
167
+ - @ledgerhq/types-live@6.117.0
168
+
169
+ ## 0.24.0-next.0
170
+
171
+ ### Minor Changes
172
+
173
+ - [#20070](https://github.com/LedgerHQ/ledger-live/pull/20070) [`52253f7`](https://github.com/LedgerHQ/ledger-live/commit/52253f70c302056cdc6b367cdd8b1db408b5e07d) Thanks [@ysitbon](https://github.com/ysitbon)! - Remove the now-dead `@ledgerhq/cryptoassets` currency/fiat store injection from the app bootstraps. Nothing reads the legacy currency/fiat accessors anymore (the runtime source of truth is the domain-backed wallet-framework currency resolver), so `setCryptoCurrenciesStore` / `setFiatCurrenciesStore` injected a store no consumer queried. Drop the calls, drop the `@ledgerhq/cryptoassets` dependency from the apps, and remove the remaining stale references to the package in comments.
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [[`2e1aecc`](https://github.com/LedgerHQ/ledger-live/commit/2e1aeccf6c91761c5d09c91e4be10dcc8c22eb7b), [`1af9ec9`](https://github.com/LedgerHQ/ledger-live/commit/1af9ec984928e0bf5fd23ce12edcc6131b0302a0), [`c475d28`](https://github.com/LedgerHQ/ledger-live/commit/c475d288b4978aa3011c9e76f3e9a1e2f9733010), [`a534db5`](https://github.com/LedgerHQ/ledger-live/commit/a534db5c41da6957d38a330c1da6f7db1b693763), [`c622459`](https://github.com/LedgerHQ/ledger-live/commit/c622459fcbff5dcc094ee10eb360f2a835036007), [`524d763`](https://github.com/LedgerHQ/ledger-live/commit/524d7636d85a79379a9b086323d3121f3199bd1f), [`dbf8acf`](https://github.com/LedgerHQ/ledger-live/commit/dbf8acf27c9405548e7eb559d163a8e0883a20aa)]:
178
+ - @ledgerhq/ledger-wallet-framework@2.6.0-next.0
179
+ - @ledgerhq/live-network@3.0.0-next.0
180
+ - @ledgerhq/live-env@3.0.0-next.0
181
+ - @ledgerhq/types-live@6.117.0-next.0
182
+
183
+ ## 0.23.0
184
+
185
+ ### Minor Changes
186
+
187
+ - [#19818](https://github.com/LedgerHQ/ledger-live/pull/19818) [`f57602a`](https://github.com/LedgerHQ/ledger-live/commit/f57602a679ed08b437955a2858f84e3086d6e417) Thanks [@0xMM-L](https://github.com/0xMM-L)! - Enable Aleo as a swap currency. Register Aleo as Nano S–incompatible for swap (`INCOMPATIBLE_NANO_S_CURRENCY_KEYS`) with its incompatibility copy, and add Aleo to the live-countervalues mock registry so mocked countervalues cover it. Aleo becomes selectable as a swap source because the `aleo` family is present in `WALLET_API_FAMILIES` (via `@ledgerhq/wallet-api-core` `^1.35.0`, already a dependency), so it resolves through `currency.list`.
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [[`cdf6cf4`](https://github.com/LedgerHQ/ledger-live/commit/cdf6cf40d658b20dd21a7eabe3615c75baf4cb0a), [`22d4a88`](https://github.com/LedgerHQ/ledger-live/commit/22d4a888228b7e5409593a2d6af072b4ab07bb07), [`6935fe0`](https://github.com/LedgerHQ/ledger-live/commit/6935fe04a6304e046fd217350399446194e96d47), [`e7caf31`](https://github.com/LedgerHQ/ledger-live/commit/e7caf310efbbf82aa777a7e86ceafe60f11e7193), [`bb2d2d2`](https://github.com/LedgerHQ/ledger-live/commit/bb2d2d250a1d5b8cde43ba963795d28b10b48be6), [`c498e25`](https://github.com/LedgerHQ/ledger-live/commit/c498e25ca9f4b6ef5c4e3dfd370dab44ccdebc0f), [`4d99006`](https://github.com/LedgerHQ/ledger-live/commit/4d99006589b6855d1a06a8aa1ece23c3f6f3ddf7)]:
192
+ - @ledgerhq/types-live@6.116.0
193
+ - @ledgerhq/live-network@2.7.0
194
+ - @ledgerhq/ledger-wallet-framework@2.5.0
195
+
196
+ ## 0.23.0-next.0
197
+
198
+ ### Minor Changes
199
+
200
+ - [#19818](https://github.com/LedgerHQ/ledger-live/pull/19818) [`f57602a`](https://github.com/LedgerHQ/ledger-live/commit/f57602a679ed08b437955a2858f84e3086d6e417) Thanks [@0xMM-L](https://github.com/0xMM-L)! - Enable Aleo as a swap currency. Register Aleo as Nano S–incompatible for swap (`INCOMPATIBLE_NANO_S_CURRENCY_KEYS`) with its incompatibility copy, and add Aleo to the live-countervalues mock registry so mocked countervalues cover it. Aleo becomes selectable as a swap source because the `aleo` family is present in `WALLET_API_FAMILIES` (via `@ledgerhq/wallet-api-core` `^1.35.0`, already a dependency), so it resolves through `currency.list`.
201
+
202
+ ### Patch Changes
203
+
204
+ - Updated dependencies [[`cdf6cf4`](https://github.com/LedgerHQ/ledger-live/commit/cdf6cf40d658b20dd21a7eabe3615c75baf4cb0a), [`22d4a88`](https://github.com/LedgerHQ/ledger-live/commit/22d4a888228b7e5409593a2d6af072b4ab07bb07), [`6935fe0`](https://github.com/LedgerHQ/ledger-live/commit/6935fe04a6304e046fd217350399446194e96d47), [`e7caf31`](https://github.com/LedgerHQ/ledger-live/commit/e7caf310efbbf82aa777a7e86ceafe60f11e7193), [`bb2d2d2`](https://github.com/LedgerHQ/ledger-live/commit/bb2d2d250a1d5b8cde43ba963795d28b10b48be6), [`c498e25`](https://github.com/LedgerHQ/ledger-live/commit/c498e25ca9f4b6ef5c4e3dfd370dab44ccdebc0f), [`4d99006`](https://github.com/LedgerHQ/ledger-live/commit/4d99006589b6855d1a06a8aa1ece23c3f6f3ddf7)]:
205
+ - @ledgerhq/types-live@6.116.0-next.0
206
+ - @ledgerhq/live-network@2.7.0-next.0
207
+ - @ledgerhq/ledger-wallet-framework@2.5.0-next.0
208
+
209
+ ## 0.22.1
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [[`8f30c75`](https://github.com/LedgerHQ/ledger-live/commit/8f30c75ecb553a720722f1e039b4aec53fce2a87), [`0f85077`](https://github.com/LedgerHQ/ledger-live/commit/0f850774ae3b46fd4a06c0da5762d3d4211b26af), [`a15b864`](https://github.com/LedgerHQ/ledger-live/commit/a15b864576d901f15d480070b475314c3b23c1dd), [`e26e68e`](https://github.com/LedgerHQ/ledger-live/commit/e26e68e854ecea6ebbe5e26196c8d8e899329c7d), [`bde85a7`](https://github.com/LedgerHQ/ledger-live/commit/bde85a7ef50cf7990efd2f9bcd7ccc34c0764fb7), [`fc44f1e`](https://github.com/LedgerHQ/ledger-live/commit/fc44f1e6ddcca939c117e0cb8bc49c404163b003), [`d631f0d`](https://github.com/LedgerHQ/ledger-live/commit/d631f0dd2480950c5f20dec0c9b4aca515ec63f8), [`6ef44af`](https://github.com/LedgerHQ/ledger-live/commit/6ef44afa6807ace32b3f6620173868f2ef20e158), [`6ef44af`](https://github.com/LedgerHQ/ledger-live/commit/6ef44afa6807ace32b3f6620173868f2ef20e158)]:
214
+ - @ledgerhq/ledger-wallet-framework@2.4.0
215
+ - @ledgerhq/live-env@2.42.0
216
+ - @ledgerhq/types-live@6.115.0
217
+ - @ledgerhq/live-network@2.6.8
218
+
219
+ ## 0.22.1-next.0
220
+
221
+ ### Patch Changes
222
+
223
+ - Updated dependencies [[`8f30c75`](https://github.com/LedgerHQ/ledger-live/commit/8f30c75ecb553a720722f1e039b4aec53fce2a87), [`0f85077`](https://github.com/LedgerHQ/ledger-live/commit/0f850774ae3b46fd4a06c0da5762d3d4211b26af), [`a15b864`](https://github.com/LedgerHQ/ledger-live/commit/a15b864576d901f15d480070b475314c3b23c1dd), [`e26e68e`](https://github.com/LedgerHQ/ledger-live/commit/e26e68e854ecea6ebbe5e26196c8d8e899329c7d), [`bde85a7`](https://github.com/LedgerHQ/ledger-live/commit/bde85a7ef50cf7990efd2f9bcd7ccc34c0764fb7), [`fc44f1e`](https://github.com/LedgerHQ/ledger-live/commit/fc44f1e6ddcca939c117e0cb8bc49c404163b003), [`d631f0d`](https://github.com/LedgerHQ/ledger-live/commit/d631f0dd2480950c5f20dec0c9b4aca515ec63f8), [`6ef44af`](https://github.com/LedgerHQ/ledger-live/commit/6ef44afa6807ace32b3f6620173868f2ef20e158), [`6ef44af`](https://github.com/LedgerHQ/ledger-live/commit/6ef44afa6807ace32b3f6620173868f2ef20e158)]:
224
+ - @ledgerhq/ledger-wallet-framework@2.4.0-next.0
225
+ - @ledgerhq/live-env@2.42.0-next.0
226
+ - @ledgerhq/types-live@6.115.0-next.0
227
+ - @ledgerhq/live-network@2.6.8-next.0
228
+
229
+ ## 0.22.0
230
+
231
+ ### Minor Changes
232
+
233
+ - [#18916](https://github.com/LedgerHQ/ledger-live/pull/18916) [`ba433a1`](https://github.com/LedgerHQ/ledger-live/commit/ba433a1a08fa65ce3d376bb0d60fe1d4241b422d) Thanks [@claudiiafg](https://github.com/claudiiafg)! - Add shared LineChart axis/formatters utilities, custom ranges prop, and chart label inset fix. Refactor AssetDetail chart VM to use shared helpers. Add Analytics all-time value change helpers and export `meaningfulPercentage` from live-countervalues.
234
+
235
+ ### Patch Changes
236
+
237
+ - Updated dependencies [[`a2621e2`](https://github.com/LedgerHQ/ledger-live/commit/a2621e2c6c6369c7109af72e1cb59df2448951ff), [`70a706e`](https://github.com/LedgerHQ/ledger-live/commit/70a706e4efe3a6fa176f9827a4a06949ba185f11), [`8b6614e`](https://github.com/LedgerHQ/ledger-live/commit/8b6614eaff423aaeb50b7eb44ba5916a941a573d), [`6400154`](https://github.com/LedgerHQ/ledger-live/commit/6400154daa131b225c6ec62c9134f1cd06370729), [`9f8ab96`](https://github.com/LedgerHQ/ledger-live/commit/9f8ab9672ababc02909e7553d433ee326c37762e), [`e6566ff`](https://github.com/LedgerHQ/ledger-live/commit/e6566ff55d95ff36832d5f77899d67d80842f418), [`addef52`](https://github.com/LedgerHQ/ledger-live/commit/addef52ed445008c16e3f94d66f46222c8c535f7), [`81373c1`](https://github.com/LedgerHQ/ledger-live/commit/81373c1ca46cf2094cfd4f98958eff2114f02cea), [`f495213`](https://github.com/LedgerHQ/ledger-live/commit/f495213e811477c99d62f0d93cc7c513b951a303), [`c8b4ee7`](https://github.com/LedgerHQ/ledger-live/commit/c8b4ee77c03ca2117cbad039331b7b52e50d9620), [`e820e40`](https://github.com/LedgerHQ/ledger-live/commit/e820e402fb57d52b31dcd6de26f8d31d9564e2a4), [`fa0123a`](https://github.com/LedgerHQ/ledger-live/commit/fa0123a1da7b053d58afab498266cf830958e2ff), [`0e30cdc`](https://github.com/LedgerHQ/ledger-live/commit/0e30cdc29d7fb3cab5bf1f2ef7c24cf0a152516e), [`b10ca6a`](https://github.com/LedgerHQ/ledger-live/commit/b10ca6ab5e80889b24805b460f81eff5748f0170), [`cf3aad1`](https://github.com/LedgerHQ/ledger-live/commit/cf3aad160bd9d2002a3154fbc70018fb1f7a6171), [`df6ca42`](https://github.com/LedgerHQ/ledger-live/commit/df6ca422fa70171162974ea71519da5c5eeb55d8), [`b3ffa2f`](https://github.com/LedgerHQ/ledger-live/commit/b3ffa2f4bf735f2cfeed2a8028ea92d4bc3588e3), [`376915c`](https://github.com/LedgerHQ/ledger-live/commit/376915ca520ecc1708090ed9b3eba1ff7e780540), [`5aada6f`](https://github.com/LedgerHQ/ledger-live/commit/5aada6f1a72df070770f4b67112f51b5ced58cff), [`69b201e`](https://github.com/LedgerHQ/ledger-live/commit/69b201e2b1e01b2c6bfb6eaf9e0aa60088f175fc), [`3da6b44`](https://github.com/LedgerHQ/ledger-live/commit/3da6b4439d61a7ad7f06e04be12aa1e92b9cdb55), [`f9411d1`](https://github.com/LedgerHQ/ledger-live/commit/f9411d1e2a06b031555cda9e26ecba37b4cf045e), [`6eea36b`](https://github.com/LedgerHQ/ledger-live/commit/6eea36bfafeba265672a96b37981e2c7e629ef33), [`35d4af9`](https://github.com/LedgerHQ/ledger-live/commit/35d4af90e7bee849814cd98358c80e20ef4e4f2a)]:
238
+ - @ledgerhq/types-live@6.114.0
239
+ - @ledgerhq/live-env@2.41.0
240
+ - @ledgerhq/ledger-wallet-framework@2.3.0
241
+ - @ledgerhq/types-cryptoassets@7.39.0
242
+ - @ledgerhq/live-promise@0.3.0
243
+ - @ledgerhq/live-network@2.6.7
244
+
245
+ ## 0.22.0-next.0
246
+
247
+ ### Minor Changes
248
+
249
+ - [#18916](https://github.com/LedgerHQ/ledger-live/pull/18916) [`ba433a1`](https://github.com/LedgerHQ/ledger-live/commit/ba433a1a08fa65ce3d376bb0d60fe1d4241b422d) Thanks [@claudiiafg](https://github.com/claudiiafg)! - Add shared LineChart axis/formatters utilities, custom ranges prop, and chart label inset fix. Refactor AssetDetail chart VM to use shared helpers. Add Analytics all-time value change helpers and export `meaningfulPercentage` from live-countervalues.
250
+
251
+ ### Patch Changes
252
+
253
+ - Updated dependencies [[`a2621e2`](https://github.com/LedgerHQ/ledger-live/commit/a2621e2c6c6369c7109af72e1cb59df2448951ff), [`70a706e`](https://github.com/LedgerHQ/ledger-live/commit/70a706e4efe3a6fa176f9827a4a06949ba185f11), [`8b6614e`](https://github.com/LedgerHQ/ledger-live/commit/8b6614eaff423aaeb50b7eb44ba5916a941a573d), [`6400154`](https://github.com/LedgerHQ/ledger-live/commit/6400154daa131b225c6ec62c9134f1cd06370729), [`9f8ab96`](https://github.com/LedgerHQ/ledger-live/commit/9f8ab9672ababc02909e7553d433ee326c37762e), [`e6566ff`](https://github.com/LedgerHQ/ledger-live/commit/e6566ff55d95ff36832d5f77899d67d80842f418), [`addef52`](https://github.com/LedgerHQ/ledger-live/commit/addef52ed445008c16e3f94d66f46222c8c535f7), [`81373c1`](https://github.com/LedgerHQ/ledger-live/commit/81373c1ca46cf2094cfd4f98958eff2114f02cea), [`f495213`](https://github.com/LedgerHQ/ledger-live/commit/f495213e811477c99d62f0d93cc7c513b951a303), [`c8b4ee7`](https://github.com/LedgerHQ/ledger-live/commit/c8b4ee77c03ca2117cbad039331b7b52e50d9620), [`e820e40`](https://github.com/LedgerHQ/ledger-live/commit/e820e402fb57d52b31dcd6de26f8d31d9564e2a4), [`fa0123a`](https://github.com/LedgerHQ/ledger-live/commit/fa0123a1da7b053d58afab498266cf830958e2ff), [`0e30cdc`](https://github.com/LedgerHQ/ledger-live/commit/0e30cdc29d7fb3cab5bf1f2ef7c24cf0a152516e), [`b10ca6a`](https://github.com/LedgerHQ/ledger-live/commit/b10ca6ab5e80889b24805b460f81eff5748f0170), [`cf3aad1`](https://github.com/LedgerHQ/ledger-live/commit/cf3aad160bd9d2002a3154fbc70018fb1f7a6171), [`df6ca42`](https://github.com/LedgerHQ/ledger-live/commit/df6ca422fa70171162974ea71519da5c5eeb55d8), [`b3ffa2f`](https://github.com/LedgerHQ/ledger-live/commit/b3ffa2f4bf735f2cfeed2a8028ea92d4bc3588e3), [`376915c`](https://github.com/LedgerHQ/ledger-live/commit/376915ca520ecc1708090ed9b3eba1ff7e780540), [`5aada6f`](https://github.com/LedgerHQ/ledger-live/commit/5aada6f1a72df070770f4b67112f51b5ced58cff), [`69b201e`](https://github.com/LedgerHQ/ledger-live/commit/69b201e2b1e01b2c6bfb6eaf9e0aa60088f175fc), [`3da6b44`](https://github.com/LedgerHQ/ledger-live/commit/3da6b4439d61a7ad7f06e04be12aa1e92b9cdb55), [`f9411d1`](https://github.com/LedgerHQ/ledger-live/commit/f9411d1e2a06b031555cda9e26ecba37b4cf045e), [`6eea36b`](https://github.com/LedgerHQ/ledger-live/commit/6eea36bfafeba265672a96b37981e2c7e629ef33), [`35d4af9`](https://github.com/LedgerHQ/ledger-live/commit/35d4af90e7bee849814cd98358c80e20ef4e4f2a)]:
254
+ - @ledgerhq/types-live@6.114.0-next.0
255
+ - @ledgerhq/live-env@2.41.0-next.0
256
+ - @ledgerhq/ledger-wallet-framework@2.3.0-next.0
257
+ - @ledgerhq/types-cryptoassets@7.39.0-next.0
258
+ - @ledgerhq/live-promise@0.3.0-next.0
259
+ - @ledgerhq/live-network@2.6.7-next.0
260
+
261
+ ## 0.21.0
262
+
263
+ ### Minor Changes
264
+
265
+ - [#18757](https://github.com/LedgerHQ/ledger-live/pull/18757) [`36200f9`](https://github.com/LedgerHQ/ledger-live/commit/36200f969272f31c6737146b154b7dca8139d4cc) Thanks [@deepyjr](https://github.com/deepyjr)! - Fix zero-balance asset trend display
266
+
267
+ - [#18773](https://github.com/LedgerHQ/ledger-live/pull/18773) [`b383bd5`](https://github.com/LedgerHQ/ledger-live/commit/b383bd51879861ab707bbf4795ac1b76393acb98) Thanks [@deepyjr](https://github.com/deepyjr)! - Filter unsupported countervalue tracking pairs before polling.
268
+
269
+ - [#18654](https://github.com/LedgerHQ/ledger-live/pull/18654) [`25101e2`](https://github.com/LedgerHQ/ledger-live/commit/25101e2991ea7c9ab54c7f3e4e5bc0bda8056d0b) Thanks [@deepyjr](https://github.com/deepyjr)! - Display a 1D variation for held assets instead of "-": when an asset's 24h portfolio value change is unavailable (e.g. freshly-acquired positions whose 24h-ago balance was zero), fall back to the asset's 1D price change computed locally from countervalues, expressed in the user's counter-value currency. This applies uniformly to crypto, stablecoins and stocks, and is handled in the shared trend hooks so generic display components stay decoupled from any asset category. A flat price now renders a real 0% (instead of "-"), and the fallback stays neutral when a rate is missing.
270
+
271
+ - [#18847](https://github.com/LedgerHQ/ledger-live/pull/18847) [`37eba10`](https://github.com/LedgerHQ/ledger-live/commit/37eba10db15542fb7859bafac772e6d280650872) Thanks [@semeano](https://github.com/semeano)! - Rename the native TON cryptocurrency to Gram
272
+
273
+ ### Patch Changes
274
+
275
+ - Updated dependencies [[`636a4cb`](https://github.com/LedgerHQ/ledger-live/commit/636a4cbc5ae01364af425e3837cecf1ce4d3f3bc), [`ad68778`](https://github.com/LedgerHQ/ledger-live/commit/ad68778ad71686c9e4f397276917e606a099f573), [`13aeeb6`](https://github.com/LedgerHQ/ledger-live/commit/13aeeb6186997b433785e542ed1dafa6afde2267), [`1f41eee`](https://github.com/LedgerHQ/ledger-live/commit/1f41eee5b4dc6aa50accd94e5a0d6c98fcf76e23), [`93a84fb`](https://github.com/LedgerHQ/ledger-live/commit/93a84fbadb2b1a0e529e2ffa08ca1de790355934), [`798081d`](https://github.com/LedgerHQ/ledger-live/commit/798081db3e427c8d2d09930ceb836703146ca1ba), [`1f11587`](https://github.com/LedgerHQ/ledger-live/commit/1f11587b4681429aa9be2dc50035f292e0394108), [`4ace552`](https://github.com/LedgerHQ/ledger-live/commit/4ace55213a4f1869980aab5160683bb120c65292), [`ca20506`](https://github.com/LedgerHQ/ledger-live/commit/ca20506c138a1cfb9c254f61e6bb930aea4c6ab8)]:
276
+ - @ledgerhq/types-live@6.113.0
277
+ - @ledgerhq/live-env@2.40.0
278
+ - @ledgerhq/ledger-wallet-framework@2.2.1
279
+ - @ledgerhq/live-network@2.6.6
280
+
281
+ <!-- changelog-pruned: older entries were removed to keep this file small. Full history is in `git log -p CHANGELOG.md` and in the GitHub release for each version. -->
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017-present Ledger https://www.ledger.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # live-countervalues
2
+
3
+ > [!NOTE]
4
+ > **Status: STABLE** — Production-ready; API is considered stable.
5
+
6
+ `@ledgerhq/live-countervalues` manages fiat (and cross-crypto) exchange rate fetching, caching, and portfolio valuation for Ledger Live. It fetches rates from Ledger's countervalues API and exposes pure functions to convert crypto amounts to fiat at any point in time.
7
+
8
+ ## What it does
9
+
10
+ - Fetches exchange rates for crypto/fiat pairs from Ledger's API (`api/`)
11
+ - Caches rates with time-bucketing to avoid redundant requests
12
+ - Computes portfolio valuations: per-account balance in fiat, total portfolio value
13
+ - Provides mock data generators for tests
14
+ - Exposes rate interpolation and rounding helpers
15
+
16
+ ## Key exports / concepts
17
+
18
+ - `CountervaluesAPI` — the data-fetching layer (rate queries, batch requests)
19
+ - `logic` — pure functions: `calculateCounterValue`, `inferCounterValue`
20
+ - `portfolio` — functions to compute fiat valuation across a list of accounts
21
+ - `CountervaluesState` — the shape of the cached rate store
22
+ - `CountervaluesPair` — `{ from: Currency, to: Currency }` rate pair type
23
+
24
+ ## Usage context
25
+
26
+ Used by both Desktop and Mobile. The state is managed in Redux (or equivalent) and seeded from `portfolio.ts`. `live-countervalues-react` wraps this for React component consumption.
@@ -0,0 +1,9 @@
1
+ module.exports = async () => {
2
+ /**
3
+ * Set the timezone to EST for all tests
4
+ * This allow us to run tests directly through jest without having to manually
5
+ * set the timezone as an env var beforehand, either manually or through a
6
+ * custom script in package.json
7
+ */
8
+ process.env.TZ = "America/New_York";
9
+ };
package/jest-setup.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { setCurrenciesResolver } from "@ledgerhq/ledger-wallet-framework/currencies";
2
+ import { getCryptoCurrencyById } from "./src/tests/currencies";
3
+
4
+ const LOCAL_CURRENCIES = ["bitcoin", "ethereum"].map(id => getCryptoCurrencyById(id));
5
+
6
+ setCurrenciesResolver({
7
+ getCryptoCurrencyById,
8
+ findCryptoCurrencyById: id => {
9
+ try {
10
+ return getCryptoCurrencyById(id);
11
+ } catch {
12
+ return undefined;
13
+ }
14
+ },
15
+ findCryptoCurrencyByScheme: () => undefined,
16
+ listCryptoCurrencies: () => LOCAL_CURRENCIES,
17
+ hasCryptoCurrencyId: id => {
18
+ try {
19
+ getCryptoCurrencyById(id);
20
+ return true;
21
+ } catch {
22
+ return false;
23
+ }
24
+ },
25
+ });
package/jest.config.js ADDED
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ globalSetup: "<rootDir>/jest-global-setup.js",
3
+ setupFilesAfterEnv: [
4
+ "@ledgerhq/wallet-framework-test-setup",
5
+ "<rootDir>/jest-setup.ts",
6
+ "@ledgerhq/test-quarantine/jest-retries",
7
+ ],
8
+ transform: {
9
+ "^.+\\.(ts|tsx)?$": [
10
+ "@swc/jest",
11
+ {
12
+ jsc: {
13
+ target: "esnext",
14
+ },
15
+ },
16
+ ],
17
+ },
18
+ testPathIgnorePatterns: ["lib/", "lib-es/", "\\.integ\\.test\\.ts"],
19
+ coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../" }], "text"],
20
+ reporters: [
21
+ "default",
22
+ ...(process.env.CI ? ["github-actions"] : []),
23
+ ["jest-sonar", { outputName: "sonar-executionTests-report.xml", reportedFilePath: "absolute" }],
24
+ "@ledgerhq/test-quarantine/jest",
25
+ ],
26
+ };
@@ -0,0 +1,4 @@
1
+ import type { CounterValuesAPI } from "../types";
2
+ declare const api: CounterValuesAPI;
3
+ export default api;
4
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAuB,gBAAgB,EAAgB,MAAM,UAAU,CAAC;AAUpF,QAAA,MAAM,GAAG,EAAE,gBAyGV,CAAC;eAEa,GAAG"}
package/lib/api/api.js ADDED
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const live_network_1 = __importDefault(require("@ledgerhq/live-network"));
7
+ const url_1 = __importDefault(require("url"));
8
+ const live_env_1 = require("@ledgerhq/live-env");
9
+ const live_promise_1 = require("@ledgerhq/live-promise");
10
+ const helpers_1 = require("../helpers");
11
+ const baseURL = () => (0, live_env_1.getEnv)("LEDGER_COUNTERVALUES_API");
12
+ const LATEST_CHUNK = 50;
13
+ const DAILY_RATE_MS = 14 * 24 * 60 * 60 * 1000;
14
+ const HOURLY_RATE_MS = 2 * 24 * 60 * 60 * 1000;
15
+ const api = {
16
+ fetchHistorical: async (granularity, { from, to, startDate }, granularitiesRates) => {
17
+ const format = helpers_1.formatPerGranularity[granularity];
18
+ const now = new Date();
19
+ if (now < startDate) {
20
+ // we can't fetch the future
21
+ return Promise.resolve({});
22
+ }
23
+ const start = format(startDate);
24
+ const end = format(now);
25
+ if (start === end) {
26
+ // if start and end are the same, it's also pointless to fetch
27
+ return Promise.resolve({});
28
+ }
29
+ const granularity_ms = granularitiesRates
30
+ ? granularitiesRates[granularity]
31
+ : granularity === "daily"
32
+ ? DAILY_RATE_MS
33
+ : HOURLY_RATE_MS;
34
+ const start_date_ms_since_epoch = startDate.getTime();
35
+ const end_date_ms_since_epoch = now.getTime();
36
+ const corrected_start_date = format(new Date(Math.floor(start_date_ms_since_epoch / granularity_ms) * granularity_ms));
37
+ const corrected_end_date = format(new Date(Math.ceil(end_date_ms_since_epoch / granularity_ms) * granularity_ms));
38
+ const url = url_1.default.format({
39
+ pathname: `${baseURL()}/v3/historical/${granularity}/simple`,
40
+ query: {
41
+ from: (0, helpers_1.inferCurrencyAPIID)(from),
42
+ to: (0, helpers_1.inferCurrencyAPIID)(to),
43
+ start: corrected_start_date,
44
+ end: corrected_end_date,
45
+ },
46
+ });
47
+ const { data } = await (0, live_network_1.default)({ method: "GET", url });
48
+ return data;
49
+ },
50
+ fetchLatest: async (pairs, batchStrategySolver) => {
51
+ if (pairs.length === 0)
52
+ return [];
53
+ const shouldBatchCurrencyFrom = batchStrategySolver?.shouldBatchCurrencyFrom || (() => true);
54
+ // we group the pairs into chunks (of max LATEST_CHUNK) of the same "to" currency
55
+ // the batches preserve the ordering of "pairs" so the output returns the result in same orders
56
+ // we essentially assume that pairs' to's field are not changing / are sorted
57
+ const batches = []; // array of [froms, to]
58
+ const first = pairs[0];
59
+ let batch = [[first.from], first.to];
60
+ // separately store all the pairs that can't be batched
61
+ const singles = [];
62
+ for (let i = 1; i < pairs.length; i++) {
63
+ const pair = pairs[i];
64
+ const inBatch = shouldBatchCurrencyFrom(pair.from);
65
+ if (!inBatch) {
66
+ singles.push([[pair.from], pair.to]);
67
+ }
68
+ else {
69
+ if (pair.to !== batch[1] || batch[0].length >= LATEST_CHUNK) {
70
+ batches.push(batch);
71
+ batch = [[pair.from], pair.to];
72
+ }
73
+ else {
74
+ batch[0].push(pair.from);
75
+ }
76
+ }
77
+ }
78
+ batches.push(batch);
79
+ const allBatches = batches.concat(singles);
80
+ const map = new Map();
81
+ await (0, live_promise_1.promiseAllBatched)(4, allBatches, async ([froms, to]) => {
82
+ const fromIds = froms.map(helpers_1.inferCurrencyAPIID);
83
+ const url = url_1.default.format({
84
+ pathname: `${baseURL()}/v3/spot/simple`,
85
+ query: {
86
+ to: (0, helpers_1.inferCurrencyAPIID)(to),
87
+ froms: fromIds.join(","),
88
+ },
89
+ });
90
+ const { data } = await (0, live_network_1.default)({ method: "GET", url });
91
+ // store all countervalues in a global map
92
+ for (let i = 0; i < fromIds.length; i++) {
93
+ const from = froms[i];
94
+ const value = data[fromIds[i]];
95
+ map.set((0, helpers_1.pairId)({ from, to }), value);
96
+ }
97
+ });
98
+ // we return the result in the same order as the input pairs
99
+ const data = pairs.map(pair => map.get((0, helpers_1.pairId)(pair)) || 0);
100
+ return data;
101
+ },
102
+ };
103
+ exports.default = api;
104
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":";;;;;AAAA,0EAA6C;AAC7C,8CAAsB;AACtB,iDAA4C;AAC5C,yDAA2D;AAC3D,wCAA8E;AAI9E,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,IAAA,iBAAM,EAAC,0BAA0B,CAAC,CAAC;AAEzD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/C,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,MAAM,GAAG,GAAqB;IAC5B,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,kBAAkB,EAAE,EAAE;QACl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B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/B,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,4DAA4D;QAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3D,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;kBAEa,GAAG"}
@@ -0,0 +1,4 @@
1
+ import type { CounterValuesAPI } from "../types";
2
+ declare const api: CounterValuesAPI;
3
+ export default api;
4
+ //# sourceMappingURL=api.mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.mock.d.ts","sourceRoot":"","sources":["../../src/api/api.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,UAAU,CAAC;AAyFlE,QAAA,MAAM,GAAG,EAAE,gBAaV,CAAC;eACa,GAAG"}