@exodus/fiat-balances 12.2.0 → 12.4.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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/module/fiat-balances.js +5 -6
- package/package.json +14 -17
- package/redux/index.js +2 -0
- package/redux/initial-state.js +1 -0
- package/redux/selectors/get-format-fiat.js +1 -3
- package/redux/selectors/helpers/sort-assets-selector-factory-creator.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [12.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.3.0...@exodus/fiat-balances@12.4.0) (2024-11-26)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat(fiat-balances): optimisticLoaded selector (#10550)
|
|
11
|
+
|
|
12
|
+
- feat: use formatting v9 (#9903)
|
|
13
|
+
|
|
14
|
+
## [12.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.2.0...@exodus/fiat-balances@12.3.0) (2024-10-07)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- use atoms v9 ([#9651](https://github.com/ExodusMovement/exodus-hydra/issues/9651)) ([524aa61](https://github.com/ExodusMovement/exodus-hydra/commit/524aa61f69c81e6ac00b2f94ea830688a105b3e4))
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- base assets without balance should be lower than tokens with balance ([#9815](https://github.com/ExodusMovement/exodus-hydra/issues/9815)) ([5e9be7d](https://github.com/ExodusMovement/exodus-hydra/commit/5e9be7d1e5647230ab6dab79592c511312f62eff))
|
|
23
|
+
|
|
6
24
|
## [12.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.1.4...@exodus/fiat-balances@12.2.0) (2024-09-20)
|
|
7
25
|
|
|
8
26
|
### Features
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ yarn add @exodus/fiat-balances
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/using-the-sdk.md).
|
|
13
|
+
This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md).
|
|
14
14
|
|
|
15
15
|
### Play with it
|
|
16
16
|
|
|
@@ -37,7 +37,7 @@ selectors.fiatBalances.byAsset(store.getState()).ethereum.toDefaultString({ unit
|
|
|
37
37
|
|
|
38
38
|
### API Side
|
|
39
39
|
|
|
40
|
-
See [using the sdk](../../docs/using-the-sdk.md#setup-the-api-side) for more details on how features plug into the SDK. Note that the balances feature currently doesn't provide a top level API and is meant to be used purely through selectors.
|
|
40
|
+
See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md#setup-the-api-side) for more details on how features plug into the SDK. Note that the balances feature currently doesn't provide a top level API and is meant to be used purely through selectors.
|
|
41
41
|
|
|
42
42
|
If you're building a feature that requires balances, add a dependency on the `fiatBalancesAtom` as below.
|
|
43
43
|
|
|
@@ -64,7 +64,7 @@ const myModuleDefinition = {
|
|
|
64
64
|
|
|
65
65
|
### UI Side
|
|
66
66
|
|
|
67
|
-
See [using the sdk](../../docs/using-the-sdk.md#events) for more details on basic UI-side setup.
|
|
67
|
+
See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md#events) for more details on basic UI-side setup.
|
|
68
68
|
|
|
69
69
|
```js
|
|
70
70
|
import { selectors } from '~/ui/flux'
|
package/module/fiat-balances.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { set } from '@exodus/basic-utils'
|
|
2
2
|
import { isNumberUnit } from '@exodus/currency'
|
|
3
|
-
import ExodusModule from '@exodus/module'
|
|
4
3
|
import { cloneDeepWith, isEqual } from 'lodash'
|
|
5
4
|
import fiatCurrencies from '@exodus/fiat-currencies'
|
|
6
5
|
import { combine } from '@exodus/atoms'
|
|
@@ -16,7 +15,8 @@ const cloneBalances = (balances) =>
|
|
|
16
15
|
if (isNumberUnit(val)) return val
|
|
17
16
|
})
|
|
18
17
|
|
|
19
|
-
class FiatBalances
|
|
18
|
+
class FiatBalances {
|
|
19
|
+
#logger
|
|
20
20
|
#assetsModule
|
|
21
21
|
#balanceFields
|
|
22
22
|
#fiatCurrency
|
|
@@ -41,8 +41,7 @@ class FiatBalances extends ExodusModule {
|
|
|
41
41
|
ratesAtom,
|
|
42
42
|
currencyAtom,
|
|
43
43
|
}) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
this.#logger = logger
|
|
46
45
|
this.#assetsModule = assetsModule
|
|
47
46
|
this.#balanceFields = balanceFields
|
|
48
47
|
this.#fiatBalancesAtom = fiatBalancesAtom
|
|
@@ -146,7 +145,7 @@ class FiatBalances extends ExodusModule {
|
|
|
146
145
|
|
|
147
146
|
if (needsRecompute) return this.#recompute()
|
|
148
147
|
|
|
149
|
-
this.
|
|
148
|
+
this.#logger.log('recomputing based on new balances')
|
|
150
149
|
|
|
151
150
|
const fiatZero = fiatCurrencies[this.#fiatCurrency].ZERO
|
|
152
151
|
|
|
@@ -232,7 +231,7 @@ class FiatBalances extends ExodusModule {
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
#flush = () => {
|
|
235
|
-
this.
|
|
234
|
+
this.#logger.log('fiat balances updated')
|
|
236
235
|
const data = cloneBalances({ balances: this.#balances })
|
|
237
236
|
this.#fiatBalancesAtom.set((current) => (isEqual(current, data) ? current : data))
|
|
238
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.0",
|
|
4
4
|
"description": "Track asset and portfolio fiat balances based on changes in crypto balances and the user's preferred fiat currency",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,13 +32,11 @@
|
|
|
32
32
|
"url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Afiat-balances"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@exodus/atoms": "^
|
|
35
|
+
"@exodus/atoms": "^9.0.0",
|
|
36
36
|
"@exodus/basic-utils": "^3.0.1",
|
|
37
37
|
"@exodus/currency": "^5.0.2",
|
|
38
38
|
"@exodus/fiat-currencies": "^1.1.0",
|
|
39
|
-
"@exodus/formatting": "^
|
|
40
|
-
"@exodus/module": "^1.1.0",
|
|
41
|
-
"@exodus/typeforce": "^1.18.1",
|
|
39
|
+
"@exodus/formatting": "^9.0.0",
|
|
42
40
|
"lodash": "^4.17.21",
|
|
43
41
|
"minimalistic-assert": "^1.0.1",
|
|
44
42
|
"reselect": "^3.0.1"
|
|
@@ -46,23 +44,22 @@
|
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@exodus/assets": "^9.1.0",
|
|
48
46
|
"@exodus/assets-base": "^8.1.17",
|
|
49
|
-
"@exodus/assets-feature": "^5.
|
|
50
|
-
"@exodus/available-assets": "^8.
|
|
51
|
-
"@exodus/balances": "^13.
|
|
52
|
-
"@exodus/blockchain-metadata": "^15.
|
|
47
|
+
"@exodus/assets-feature": "^5.14.1",
|
|
48
|
+
"@exodus/available-assets": "^8.7.0",
|
|
49
|
+
"@exodus/balances": "^13.4.0",
|
|
50
|
+
"@exodus/blockchain-metadata": "^15.7.0",
|
|
53
51
|
"@exodus/combined-assets-meta": "^1.3.0",
|
|
54
|
-
"@exodus/enabled-assets": "^10.
|
|
52
|
+
"@exodus/enabled-assets": "^10.8.0",
|
|
55
53
|
"@exodus/favorite-assets": "^2.4.3",
|
|
56
|
-
"@exodus/fee-data-monitors": "^
|
|
57
|
-
"@exodus/
|
|
58
|
-
"@exodus/models": "^12.0.1",
|
|
54
|
+
"@exodus/fee-data-monitors": "^5.0.2",
|
|
55
|
+
"@exodus/models": "^12.1.1",
|
|
59
56
|
"@exodus/rates-monitor": "^4.4.1",
|
|
60
|
-
"@exodus/redux-dependency-injection": "^4.
|
|
57
|
+
"@exodus/redux-dependency-injection": "^4.1.1",
|
|
61
58
|
"@exodus/solana-meta": "^1.0.4",
|
|
62
|
-
"@exodus/storage-memory": "^2.2.
|
|
63
|
-
"@exodus/wallet-accounts": "^
|
|
59
|
+
"@exodus/storage-memory": "^2.2.2",
|
|
60
|
+
"@exodus/wallet-accounts": "^17.1.1",
|
|
64
61
|
"events": "^3.3.0",
|
|
65
62
|
"redux": "^4.2.1"
|
|
66
63
|
},
|
|
67
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "901254d521ab3c43da0be4a4537ed80015e1c6b9"
|
|
68
65
|
}
|
package/redux/index.js
CHANGED
|
@@ -42,12 +42,14 @@ const createFiatBalancesReduxDefinition = ({
|
|
|
42
42
|
return {
|
|
43
43
|
...state,
|
|
44
44
|
loaded: true,
|
|
45
|
+
optimisticLoaded: true,
|
|
45
46
|
data,
|
|
46
47
|
optimisticData: optimisticActivityEnabled ? state.optimisticData : data,
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
50
|
optimisticFiatBalances: (state, { balances }) => ({
|
|
50
51
|
...state,
|
|
52
|
+
optimisticLoaded: true,
|
|
51
53
|
optimisticData: prepareData({ state, payload: balances }),
|
|
52
54
|
}),
|
|
53
55
|
},
|
package/redux/initial-state.js
CHANGED
|
@@ -9,7 +9,6 @@ const resultFunction =
|
|
|
9
9
|
customCurrency,
|
|
10
10
|
adaptiveFraction, // use adaptiveFraction when convert crypto amount (balance for example) to fiat
|
|
11
11
|
useGrouping,
|
|
12
|
-
convertDust,
|
|
13
12
|
} = {}
|
|
14
13
|
) => {
|
|
15
14
|
const fiatCurrency = customCurrency || currency
|
|
@@ -18,8 +17,7 @@ const resultFunction =
|
|
|
18
17
|
return formatPrice(value, {
|
|
19
18
|
currency: fiatCurrency,
|
|
20
19
|
useGrouping,
|
|
21
|
-
|
|
22
|
-
fraction: adaptiveFraction ? getFiatAdaptiveFraction(value) : undefined,
|
|
20
|
+
maxFraction: adaptiveFraction ? getFiatAdaptiveFraction(value) : undefined,
|
|
23
21
|
})
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -6,8 +6,8 @@ import { isDustAmount } from '@exodus/formatting/lib/asset'
|
|
|
6
6
|
|
|
7
7
|
const SORTING_MAP = [
|
|
8
8
|
[(a) => a.sortAssetMetaData.isFavoriteAsset, 'desc'],
|
|
9
|
-
[(a) => a.sortAssetMetaData.isBaseAsset, 'desc'],
|
|
10
9
|
[(a) => a.sortAssetMetaData.fiatBalance, 'desc'],
|
|
10
|
+
[(a) => a.sortAssetMetaData.isBaseAsset, 'desc'],
|
|
11
11
|
[(a) => a.sortAssetMetaData.hasBalance, 'desc'],
|
|
12
12
|
[(a) => a.sortAssetMetaData.isDust, 'asc'],
|
|
13
13
|
[(a) => a.sortAssetMetaData.cap, 'desc'],
|