@exodus/fiat-balances 13.0.1 → 13.1.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 +16 -0
- package/README.md +3 -3
- package/index.d.ts +13 -0
- package/package.json +14 -13
- package/redux/selectors/helpers/sort-assets-selector-factory-creator.js +4 -4
- package/report/index.js +14 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [13.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.0.2...@exodus/fiat-balances@13.1.0) (2025-02-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: add placeholder types files (#11228)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- fix: don't export hardware wallet account balances (#11551)
|
|
15
|
+
|
|
16
|
+
## [13.0.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.0.1...@exodus/fiat-balances@13.0.2) (2025-01-20)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- fix(fiat-balances): assets with balance above favorite assets on sort (#11117)
|
|
21
|
+
|
|
6
22
|
## [13.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.0.0...@exodus/fiat-balances@13.0.1) (2025-01-02)
|
|
7
23
|
|
|
8
24
|
### Bug Fixes
|
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/
|
|
13
|
+
This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../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/
|
|
40
|
+
See [using the sdk](../../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/
|
|
67
|
+
See [using the sdk](../../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/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface FiatBalancesConfig {
|
|
2
|
+
optimistic?: boolean
|
|
3
|
+
balanceFields?: string[]
|
|
4
|
+
nonDustAssets?: any
|
|
5
|
+
assetsToTrackForBalances?: any[]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare const fiatBalances: (config?: FiatBalancesConfig) => {
|
|
9
|
+
id: 'fiatBalances'
|
|
10
|
+
definitions: []
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default fiatBalances
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.1.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": "MIT",
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "index.js",
|
|
15
15
|
"files": [
|
|
16
|
-
"module",
|
|
17
|
-
"redux",
|
|
18
16
|
"atoms",
|
|
17
|
+
"module",
|
|
19
18
|
"plugin",
|
|
19
|
+
"redux",
|
|
20
20
|
"report",
|
|
21
21
|
"shared",
|
|
22
|
-
"
|
|
22
|
+
"index.d.ts",
|
|
23
23
|
"CHANGELOG.md",
|
|
24
|
+
"README.md",
|
|
24
25
|
"!**/__tests__/**"
|
|
25
26
|
],
|
|
26
27
|
"repository": {
|
|
@@ -44,25 +45,25 @@
|
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@exodus/assets": "^9.1.0",
|
|
46
47
|
"@exodus/assets-base": "^8.1.17",
|
|
47
|
-
"@exodus/assets-feature": "^
|
|
48
|
+
"@exodus/assets-feature": "^7.0.1",
|
|
48
49
|
"@exodus/available-assets": "^8.7.0",
|
|
49
|
-
"@exodus/balances": "^13.
|
|
50
|
-
"@exodus/blockchain-metadata": "^15.
|
|
50
|
+
"@exodus/balances": "^13.6.1",
|
|
51
|
+
"@exodus/blockchain-metadata": "^15.8.4",
|
|
51
52
|
"@exodus/combined-assets-meta": "^1.3.0",
|
|
52
53
|
"@exodus/enabled-assets": "^10.8.2",
|
|
53
|
-
"@exodus/favorite-assets": "^2.
|
|
54
|
-
"@exodus/fee-data-monitors": "^5.0.
|
|
55
|
-
"@exodus/models": "^12.
|
|
56
|
-
"@exodus/rates-monitor": "^4.
|
|
54
|
+
"@exodus/favorite-assets": "^2.5.0",
|
|
55
|
+
"@exodus/fee-data-monitors": "^5.0.4",
|
|
56
|
+
"@exodus/models": "^12.7.0",
|
|
57
|
+
"@exodus/rates-monitor": "^4.8.3",
|
|
57
58
|
"@exodus/redux-dependency-injection": "^4.1.1",
|
|
58
59
|
"@exodus/solana-meta": "^1.0.4",
|
|
59
60
|
"@exodus/storage-memory": "^2.2.2",
|
|
60
|
-
"@exodus/wallet-accounts": "^17.
|
|
61
|
+
"@exodus/wallet-accounts": "^17.3.0",
|
|
61
62
|
"events": "^3.3.0",
|
|
62
63
|
"redux": "^4.2.1"
|
|
63
64
|
},
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ad73865b1ecfacb076a4c4a83084d819fb8d60c8"
|
|
68
69
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { memoize } from '
|
|
1
|
+
import { keyBy, memoize, orderBy } from '@exodus/basic-utils'
|
|
2
|
+
import { isDustAmount } from '@exodus/formatting/lib/asset'
|
|
2
3
|
import { createSelector } from 'reselect'
|
|
3
4
|
import { isMultiNetworkAsset } from '../utils'
|
|
4
|
-
import { keyBy, orderBy } from '@exodus/basic-utils'
|
|
5
|
-
import { isDustAmount } from '@exodus/formatting/lib/asset'
|
|
6
5
|
|
|
7
6
|
const SORTING_MAP = [
|
|
8
|
-
[(a) => a.sortAssetMetaData.isFavoriteAsset, 'desc'],
|
|
7
|
+
[(a) => a.sortAssetMetaData.fiatBalance && a.sortAssetMetaData.isFavoriteAsset, 'desc'],
|
|
9
8
|
[(a) => a.sortAssetMetaData.fiatBalance, 'desc'],
|
|
9
|
+
[(a) => a.sortAssetMetaData.isFavoriteAsset, 'desc'],
|
|
10
10
|
[(a) => a.sortAssetMetaData.isBaseAsset, 'desc'],
|
|
11
11
|
[(a) => a.sortAssetMetaData.hasBalance, 'desc'],
|
|
12
12
|
[(a) => a.sortAssetMetaData.isDust, 'asc'],
|
package/report/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapValues } from '@exodus/basic-utils'
|
|
1
|
+
import { mapValues, pick, pickBy } from '@exodus/basic-utils'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* sample report
|
|
@@ -10,16 +10,25 @@ import { mapValues } from '@exodus/basic-utils'
|
|
|
10
10
|
const fiatBalancesReportDefinition = {
|
|
11
11
|
type: 'report',
|
|
12
12
|
id: 'fiatBalancesReport',
|
|
13
|
-
factory: ({ fiatBalancesAtom }) => ({
|
|
13
|
+
factory: ({ wallet, walletAccountsAtom, fiatBalancesAtom }) => ({
|
|
14
14
|
namespace: 'fiatBalances',
|
|
15
15
|
export: async () => {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
if (!(await wallet.exists())) {
|
|
17
|
+
return Object.create(null)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const [walletAccounts, { balances }] = await Promise.all([
|
|
21
|
+
walletAccountsAtom.get(),
|
|
22
|
+
fiatBalancesAtom.get(),
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
const softwareWalletAccountNames = Object.keys(pickBy(walletAccounts, (w) => w.isSoftware))
|
|
26
|
+
return mapValues(pick(balances.byWalletAccount, softwareWalletAccountNames), ({ balance }) =>
|
|
18
27
|
balance.toDefaultString({ unit: true })
|
|
19
28
|
)
|
|
20
29
|
},
|
|
21
30
|
}),
|
|
22
|
-
dependencies: ['fiatBalancesAtom'],
|
|
31
|
+
dependencies: ['wallet', 'fiatBalancesAtom', 'walletAccountsAtom'],
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
export default fiatBalancesReportDefinition
|