@exodus/balances 13.2.2 → 13.3.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 +12 -0
- package/README.md +46 -82
- package/atoms/has-balance.js +3 -1
- package/atoms/index.js +10 -5
- package/index.js +8 -5
- package/module/index.js +6 -3
- package/package.json +22 -19
- package/plugins/index.js +4 -2
- package/redux/index.js +8 -6
- package/redux/initial-state.js +1 -1
- package/redux/multi-account-helper.js +1 -1
- package/redux/selectors/create-balance-selectors.js +3 -1
- package/redux/selectors/create-fuel-threshold.js +3 -1
- package/redux/selectors/create-requires-fuel-threshold.js +1 -1
- package/redux/selectors/create-unconfirmed-balance.js +4 -2
- package/redux/selectors/get-balance-for-field.js +4 -2
- package/redux/selectors/get-balance-selectors.js +3 -1
- package/redux/selectors/get-balances.js +3 -1
- package/redux/selectors/get-unconfirmed-balance.js +3 -1
- package/redux/selectors/index.js +7 -7
- package/report/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.2.3...@exodus/balances@13.3.0) (2024-08-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- convert balances to valid ESM ([#8590](https://github.com/ExodusMovement/exodus-hydra/issues/8590)) ([e64fc29](https://github.com/ExodusMovement/exodus-hydra/commit/e64fc290dd7b3cea7adb41fe2b41084a83980a6b))
|
|
11
|
+
|
|
12
|
+
## [13.2.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.2.2...@exodus/balances@13.2.3) (2024-07-25)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- migrate definitions ([#8030](https://github.com/ExodusMovement/exodus-hydra/issues/8030)) ([d2dfde5](https://github.com/ExodusMovement/exodus-hydra/commit/d2dfde55dfa843eb52842f64b3aac3a6f9a59069))
|
|
17
|
+
|
|
6
18
|
## [13.2.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.2.1...@exodus/balances@13.2.2) (2024-07-18)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @exodus/balances
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @exodus/balances
|
|
2
2
|
|
|
3
|
+
This Exodus SDK feature tracks the crypto-denominated balances for all enabled wallet accounts. For fiat-denominated balances, check out [@exodus/fiat-balances](../fiat-balances).
|
|
4
|
+
|
|
3
5
|
## Install
|
|
4
6
|
|
|
5
7
|
```sh
|
|
@@ -8,80 +10,69 @@ yarn add @exodus/balances
|
|
|
8
10
|
|
|
9
11
|
## Usage
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- A feature that plugs into the Exodus SDK in your logical or actual background process. This provides the `balancesAtom` to other features.
|
|
14
|
-
- A redux module that plugs into the Exodus SDK in the UI process. This provides selectors for getting [various balances](https://github.com/ExodusMovement/assets/blob/cd0088d03887934685c1bcbb223b55bb94705a56/docs/balances-model.md).
|
|
13
|
+
This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/using-the-sdk.md).
|
|
15
14
|
|
|
16
|
-
###
|
|
15
|
+
### Play with it
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
1. Open the playground https://exodus-hydra.pages.dev/
|
|
18
|
+
2. Run `selectors.balances.byAsset(store.getState())` in the Dev Tools Console to get balances by asset aggregated across enabled wallet accounts.
|
|
19
|
+
3. Try out some other selectors from `selectors.balances`. See example usage in [tests](./redux/__tests__/selectors/).
|
|
20
|
+
4. Mock an address with a balance, tick the blockchain monitor and check your balance.
|
|
19
21
|
|
|
20
22
|
```js
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
In the UI process, plug the `balances` redux module into the SDK:
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import { setupRedux } from '@exodus/redux-dependency-injection'
|
|
31
|
-
import balances from '@exodus/balances/redux'
|
|
32
|
-
|
|
33
|
-
const { selectors, createHandleEvent, reducers, initialState } = setupRedux({
|
|
34
|
-
dependencies: [
|
|
35
|
-
// other redux modules
|
|
36
|
-
// ...
|
|
37
|
-
balances,
|
|
38
|
-
],
|
|
23
|
+
// mock your ethereum address with one that has a balance
|
|
24
|
+
await exodus.debug.addressProvider.mockAddress({
|
|
25
|
+
assetName: 'ethereum',
|
|
26
|
+
walletAccount: 'exodus_0',
|
|
27
|
+
address: '0x1111111111111111111111111111111111111111',
|
|
39
28
|
})
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
// force tick the ethereum monitor, or wait a while
|
|
30
|
+
await exodus.txLogMonitors.update({ assetName: 'ethereum', refresh: true })
|
|
31
|
+
// check your balance
|
|
32
|
+
selectors.balances
|
|
33
|
+
.createTotal({ assetName: 'ethereum', walletAccount: 'exodus_0' })(store.getState())
|
|
34
|
+
.toString()
|
|
42
35
|
```
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
### API Side
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
// forward SDK events to the UI process so the relevant redux module can handle them
|
|
48
|
-
sdk.subscribe(({ type, payload }) => handleEvent(type, payload))
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Consuming Balances
|
|
39
|
+
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.
|
|
52
40
|
|
|
53
|
-
|
|
41
|
+
If you're building a feature that requires balances, add a dependency on the `balancesAtom` as below. See also the [available balance fields](./default-config.js).
|
|
54
42
|
|
|
55
43
|
```js
|
|
56
|
-
const myModuleFactory = ({ balancesAtom }) => {
|
|
57
|
-
const doSomethingSpecial = async () => {
|
|
58
|
-
// {
|
|
59
|
-
// [walletAccount]: {
|
|
60
|
-
// [assetName]: {
|
|
61
|
-
// // e.g. 'total', 'spendable', 'unconfirmedSent', 'unconfirmedReceived'
|
|
62
|
-
// [balanceField]: NumberUnit, // see @exodus/currency
|
|
63
|
-
// }
|
|
64
|
-
// }
|
|
65
|
-
// }
|
|
66
|
-
const { balances } = await balancesAtom.get()
|
|
67
|
-
// ...
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
doSomethingSpecial,
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
44
|
const myModuleDefinition = {
|
|
76
45
|
id: 'myModule',
|
|
77
46
|
type: 'module',
|
|
78
|
-
factory:
|
|
47
|
+
factory: ({ balancesAtom }) => {
|
|
48
|
+
const doSomethingSpecial = async () => {
|
|
49
|
+
// {
|
|
50
|
+
// [walletAccount]: {
|
|
51
|
+
// [assetName]: {
|
|
52
|
+
// // e.g. 'total', 'spendable', 'unconfirmedSent', 'unconfirmedReceived'
|
|
53
|
+
// [balanceField]: NumberUnit, // see @exodus/currency
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
57
|
+
const { balances } = await balancesAtom.get()
|
|
58
|
+
// ...
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
doSomethingSpecial,
|
|
63
|
+
}
|
|
64
|
+
},
|
|
79
65
|
dependencies: ['balancesAtom'],
|
|
80
66
|
}
|
|
81
67
|
```
|
|
82
68
|
|
|
69
|
+
### UI Side
|
|
70
|
+
|
|
71
|
+
See [using the sdk](../../docs/using-the-sdk.md#events) for more details on basic UI-side setup.
|
|
72
|
+
|
|
83
73
|
```js
|
|
84
|
-
|
|
74
|
+
import { selectors } from '~/ui/flux'
|
|
75
|
+
|
|
85
76
|
const MyComponent = () => {
|
|
86
77
|
const bitcoinBalance = useSelector(
|
|
87
78
|
selectors.balances.createSpendable({
|
|
@@ -92,33 +83,6 @@ const MyComponent = () => {
|
|
|
92
83
|
}
|
|
93
84
|
```
|
|
94
85
|
|
|
95
|
-
## Playground
|
|
96
|
-
|
|
97
|
-
Try the balances selectors in the [sdk-playground](../../apps/sdk-playground/).
|
|
98
|
-
|
|
99
|
-
In this repo root, run:
|
|
100
|
-
|
|
101
|
-
```sh
|
|
102
|
-
yarn --cwd apps/sdk-playground dev
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Open `http://localhost:8008` in the browser and run the following in the dev tools console:
|
|
106
|
-
|
|
107
|
-
```js
|
|
108
|
-
// mock your ethereum address with one that has a balance
|
|
109
|
-
await exodus.debug.addressProvider.mockAddress({
|
|
110
|
-
assetName: 'ethereum',
|
|
111
|
-
walletAccount: 'exodus_0',
|
|
112
|
-
address: '0x1111111111111111111111111111111111111111',
|
|
113
|
-
})
|
|
114
|
-
// force tick the ethereum monitor, or wait a while
|
|
115
|
-
await exodus.txLogMonitors.update({ assetName: 'ethereum', refresh: true })
|
|
116
|
-
// check your balance
|
|
117
|
-
selectors.balances.createTotal({ assetName: 'ethereum', walletAccount: 'exodus_0' })(
|
|
118
|
-
store.getState()
|
|
119
|
-
)
|
|
120
|
-
```
|
|
121
|
-
|
|
122
86
|
## Contributing
|
|
123
87
|
|
|
124
88
|
### WARNING: no asset specifics!
|
package/atoms/has-balance.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { compute, createStorageAtomFactory } from '@exodus/atoms'
|
|
2
|
-
import
|
|
2
|
+
import lodash from 'lodash'
|
|
3
|
+
|
|
4
|
+
const { flatMap, map } = lodash
|
|
3
5
|
|
|
4
6
|
// balancesAtom schema: { balances: { [walletAccount]: { [assetName]: { balance: NumberUnit } } } } }
|
|
5
7
|
|
package/atoms/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import createAssetNamesWithBalanceAtom from './asset-names-with-balance'
|
|
2
|
-
import createAssetsWithBalanceCountAtom from './assets-with-balance-count'
|
|
3
|
-
import createBalancesAtom from './balances'
|
|
4
|
-
import createFundedWalletAccountsAtom from './funded-wallet-accounts'
|
|
5
|
-
import createHasBalanceAtom from './has-balance'
|
|
1
|
+
import createAssetNamesWithBalanceAtom from './asset-names-with-balance.js'
|
|
2
|
+
import createAssetsWithBalanceCountAtom from './assets-with-balance-count.js'
|
|
3
|
+
import createBalancesAtom from './balances.js'
|
|
4
|
+
import createFundedWalletAccountsAtom from './funded-wallet-accounts.js'
|
|
5
|
+
import createHasBalanceAtom from './has-balance.js'
|
|
6
6
|
|
|
7
7
|
export const balancesAtomDefinition = {
|
|
8
8
|
id: 'balancesAtom',
|
|
9
9
|
type: 'atom',
|
|
10
10
|
factory: createBalancesAtom,
|
|
11
11
|
dependencies: [],
|
|
12
|
+
public: true,
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const hasBalanceAtomDefinition = {
|
|
@@ -16,6 +17,7 @@ export const hasBalanceAtomDefinition = {
|
|
|
16
17
|
type: 'atom',
|
|
17
18
|
factory: createHasBalanceAtom,
|
|
18
19
|
dependencies: ['balancesAtom', 'storage'],
|
|
20
|
+
public: true,
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export const fundedWalletAccountsAtomDefinition = {
|
|
@@ -23,6 +25,7 @@ export const fundedWalletAccountsAtomDefinition = {
|
|
|
23
25
|
type: 'atom',
|
|
24
26
|
factory: createFundedWalletAccountsAtom,
|
|
25
27
|
dependencies: ['balancesAtom', 'enabledWalletAccountsAtom'],
|
|
28
|
+
public: true,
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export const assetNamesWithBalanceAtomDefinition = {
|
|
@@ -30,6 +33,7 @@ export const assetNamesWithBalanceAtomDefinition = {
|
|
|
30
33
|
type: 'atom',
|
|
31
34
|
factory: createAssetNamesWithBalanceAtom,
|
|
32
35
|
dependencies: ['balancesAtom'],
|
|
36
|
+
public: true,
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export const assetsWithBalanceCountAtomDefinition = {
|
|
@@ -37,4 +41,5 @@ export const assetsWithBalanceCountAtomDefinition = {
|
|
|
37
41
|
type: 'atom',
|
|
38
42
|
factory: createAssetsWithBalanceCountAtom,
|
|
39
43
|
dependencies: ['assetNamesWithBalanceAtom'],
|
|
44
|
+
public: true,
|
|
40
45
|
}
|
package/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import balancesDefinition from './module'
|
|
1
|
+
import balancesDefinition from './module/index.js'
|
|
2
2
|
import {
|
|
3
3
|
balancesAtomDefinition,
|
|
4
4
|
hasBalanceAtomDefinition,
|
|
5
5
|
fundedWalletAccountsAtomDefinition,
|
|
6
6
|
assetsWithBalanceCountAtomDefinition,
|
|
7
7
|
assetNamesWithBalanceAtomDefinition,
|
|
8
|
-
} from './atoms'
|
|
9
|
-
import balancesReportDefinition from './report'
|
|
10
|
-
import {
|
|
8
|
+
} from './atoms/index.js'
|
|
9
|
+
import balancesReportDefinition from './report/index.js'
|
|
10
|
+
import {
|
|
11
|
+
balancesLifecyclePluginDefinition,
|
|
12
|
+
balancesAnalyticsPluginDefinition,
|
|
13
|
+
} from './plugins/index.js'
|
|
11
14
|
import typeforce from '@exodus/typeforce'
|
|
12
|
-
import defaultConfig from './default-config'
|
|
15
|
+
import defaultConfig from './default-config.js'
|
|
13
16
|
|
|
14
17
|
const balances = (walletConfig) => {
|
|
15
18
|
const config = {
|
package/module/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { isNumberUnit } from '@exodus/currency'
|
|
2
2
|
import { TxSet } from '@exodus/models'
|
|
3
3
|
import ExodusModule from '@exodus/module' // eslint-disable-line import/no-deprecated
|
|
4
|
-
import
|
|
4
|
+
import lodash from 'lodash'
|
|
5
5
|
import { difference, flattenToPaths, pick, set } from '@exodus/basic-utils'
|
|
6
6
|
import makeConcurrent from 'make-concurrent'
|
|
7
|
-
import { processAssetBalances, validateBalances } from './balances-utils'
|
|
8
|
-
import defaultConfig from '../default-config'
|
|
7
|
+
import { processAssetBalances, validateBalances } from './balances-utils.js'
|
|
8
|
+
import defaultConfig from '../default-config.js'
|
|
9
|
+
|
|
10
|
+
const { cloneDeepWith, isEmpty, merge, zipObject } = lodash
|
|
9
11
|
|
|
10
12
|
const cloneBalances = (balances) =>
|
|
11
13
|
cloneDeepWith(balances, (val) => {
|
|
@@ -387,6 +389,7 @@ const balancesDefinition = {
|
|
|
387
389
|
'accountStatesAtom',
|
|
388
390
|
'assetsAtom',
|
|
389
391
|
],
|
|
392
|
+
public: true,
|
|
390
393
|
}
|
|
391
394
|
|
|
392
395
|
export default balancesDefinition
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "run -T jest",
|
|
8
|
+
"test": "run -T exodus-test --jest",
|
|
9
9
|
"lint": "run -T eslint . --ignore-path ../../.gitignore",
|
|
10
|
-
"lint:fix": "yarn lint --fix"
|
|
10
|
+
"lint:fix": "yarn lint --fix",
|
|
11
|
+
"format": "run -T prettier --write \"**/*.{json,md,yaml}\" --log-level warn",
|
|
12
|
+
"format:check": "run -T prettier --check \"**/*.{json,md,yaml}\" --log-level warn"
|
|
11
13
|
},
|
|
14
|
+
"type": "module",
|
|
12
15
|
"main": "index.js",
|
|
13
16
|
"files": [
|
|
14
17
|
"module",
|
|
@@ -31,13 +34,13 @@
|
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@exodus/atoms": "^8.0.0",
|
|
34
|
-
"@exodus/basic-utils": "^
|
|
35
|
-
"@exodus/core-selectors": "^
|
|
36
|
-
"@exodus/currency": "^
|
|
37
|
-
"@exodus/models": "^
|
|
38
|
-
"@exodus/module": "^1.
|
|
37
|
+
"@exodus/basic-utils": "^3.0.1",
|
|
38
|
+
"@exodus/core-selectors": "^3.0.0",
|
|
39
|
+
"@exodus/currency": "^5.0.2",
|
|
40
|
+
"@exodus/models": "^12.0.1",
|
|
41
|
+
"@exodus/module": "^1.3.0",
|
|
39
42
|
"@exodus/multi-account-redux": "^2.0.1",
|
|
40
|
-
"@exodus/redux-dependency-injection": "^
|
|
43
|
+
"@exodus/redux-dependency-injection": "^4.0.0",
|
|
41
44
|
"@exodus/typeforce": "^1.18.0",
|
|
42
45
|
"lodash": "^4.17.21",
|
|
43
46
|
"make-concurrent": "^4.0.0",
|
|
@@ -47,19 +50,19 @@
|
|
|
47
50
|
"@exodus/blockchain-metadata": "^9.0.1"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|
|
50
|
-
"@exodus/assets": "^
|
|
51
|
-
"@exodus/assets-base": "^
|
|
52
|
-
"@exodus/assets-feature": "^5.
|
|
53
|
-
"@exodus/available-assets": "^8.
|
|
54
|
-
"@exodus/bitcoin-meta": "^
|
|
55
|
-
"@exodus/blockchain-metadata": "^
|
|
56
|
-
"@exodus/ethereum-meta": "^
|
|
57
|
-
"@exodus/fee-data-monitors": "^4.
|
|
53
|
+
"@exodus/assets": "^11.0.0",
|
|
54
|
+
"@exodus/assets-base": "^10.0.0",
|
|
55
|
+
"@exodus/assets-feature": "^5.11.0",
|
|
56
|
+
"@exodus/available-assets": "^8.4.1",
|
|
57
|
+
"@exodus/bitcoin-meta": "^2.0.0",
|
|
58
|
+
"@exodus/blockchain-metadata": "^15.4.0",
|
|
59
|
+
"@exodus/ethereum-meta": "^2.0.0",
|
|
60
|
+
"@exodus/fee-data-monitors": "^4.3.0",
|
|
58
61
|
"@exodus/redux-dependency-injection": "workspace:^",
|
|
59
62
|
"@exodus/storage-memory": "*",
|
|
60
|
-
"@exodus/wallet-accounts": "^16.
|
|
63
|
+
"@exodus/wallet-accounts": "^16.10.0",
|
|
61
64
|
"events": "^3.3.0",
|
|
62
65
|
"redux": "^4.2.1"
|
|
63
66
|
},
|
|
64
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "bd60146adb05b9a3fe6bd4b3e4dc4d13642a8023"
|
|
65
68
|
}
|
package/plugins/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import createBalancesAnalyticsPlugin from './analytics'
|
|
2
|
-
import createBalancesLifecyclePlugin from './lifecycle'
|
|
1
|
+
import createBalancesAnalyticsPlugin from './analytics.js'
|
|
2
|
+
import createBalancesLifecyclePlugin from './lifecycle.js'
|
|
3
3
|
|
|
4
4
|
export const balancesLifecyclePluginDefinition = {
|
|
5
5
|
id: 'balancesLifecyclePlugin',
|
|
6
6
|
type: 'plugin',
|
|
7
7
|
factory: createBalancesLifecyclePlugin,
|
|
8
8
|
dependencies: ['balancesAtom', 'port', 'balances', 'hasBalanceAtom'],
|
|
9
|
+
public: true,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const balancesAnalyticsPluginDefinition = {
|
|
@@ -13,4 +14,5 @@ export const balancesAnalyticsPluginDefinition = {
|
|
|
13
14
|
type: 'plugin',
|
|
14
15
|
factory: createBalancesAnalyticsPlugin,
|
|
15
16
|
dependencies: ['analytics', 'hasBalanceAtom', 'assetsWithBalanceCountAtom'],
|
|
17
|
+
public: true,
|
|
16
18
|
}
|
package/redux/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import id from './id'
|
|
2
|
-
import initialState from './initial-state'
|
|
3
|
-
import selectorDefinitions from './selectors'
|
|
1
|
+
import id from './id.js'
|
|
2
|
+
import initialState from './initial-state.js'
|
|
3
|
+
import selectorDefinitions from './selectors/index.js'
|
|
4
4
|
import { mapValues } from '@exodus/basic-utils'
|
|
5
|
-
import
|
|
6
|
-
import helper from './multi-account-helper'
|
|
7
|
-
import { setAccounts } from '@exodus/multi-account-redux/src/common'
|
|
5
|
+
import lodash from 'lodash'
|
|
6
|
+
import helper from './multi-account-helper.js'
|
|
7
|
+
import { setAccounts } from '@exodus/multi-account-redux/src/common.js'
|
|
8
|
+
|
|
9
|
+
const { merge } = lodash
|
|
8
10
|
|
|
9
11
|
const mergeChanges = (balancesState, changesByWalletAccount) => {
|
|
10
12
|
return {
|
package/redux/initial-state.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { MY_STATE } from '@exodus/redux-dependency-injection'
|
|
3
3
|
import { createSelector } from 'reselect'
|
|
4
4
|
|
|
5
|
+
const { memoize } = lodash
|
|
6
|
+
|
|
5
7
|
const createBalanceSelectorFactory = ({ field, id }) => {
|
|
6
8
|
const selectorFactory = (selfSelector) =>
|
|
7
9
|
memoize(
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
import { isNumberUnit } from '@exodus/currency'
|
|
4
4
|
|
|
5
|
+
const { memoize } = lodash
|
|
6
|
+
|
|
5
7
|
const selectorFactory = (getFeeDataSelector, assetsSelector) =>
|
|
6
8
|
memoize((assetName) =>
|
|
7
9
|
createSelector(getFeeDataSelector, assetsSelector, (getFeeData, assets) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSelector } from 'reselect'
|
|
2
|
-
import { memoizeByAssetSource } from '@exodus/core-selectors/utils/memoize'
|
|
2
|
+
import { memoizeByAssetSource } from '@exodus/core-selectors/utils/memoize.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Checks if a wallet account has "relative" tokens of the supplied asset (excluding itself):
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
|
-
import { getUnconfirmedBalance } from './get-unconfirmed-balance'
|
|
3
|
+
import { getUnconfirmedBalance } from './get-unconfirmed-balance.js'
|
|
4
|
+
|
|
5
|
+
const { memoize } = lodash
|
|
4
6
|
|
|
5
7
|
const selectorFactory = (assetsSelector, createAssetSourceSelector) =>
|
|
6
8
|
memoize(
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import defaultConfig from '../../default-config'
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
|
+
import defaultConfig from '../../default-config.js'
|
|
3
|
+
|
|
4
|
+
const { memoize } = lodash
|
|
3
5
|
|
|
4
6
|
const { balanceFields } = defaultConfig
|
|
5
7
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash'
|
|
2
|
+
|
|
3
|
+
const { memoize } = lodash // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
4
|
|
|
3
5
|
const createResultFunction = (field) => (getBalanceForField) =>
|
|
4
6
|
memoize(
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
import { MY_STATE } from '@exodus/redux-dependency-injection'
|
|
4
4
|
|
|
5
|
+
const { memoize } = lodash
|
|
6
|
+
|
|
5
7
|
const selectorFactory = (selfSelector) =>
|
|
6
8
|
createSelector(selfSelector, (balances) =>
|
|
7
9
|
memoize(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodash from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
|
|
4
|
+
const { memoize } = lodash
|
|
5
|
+
|
|
4
6
|
export const getUnconfirmedBalance = ({ asset, txs }) => {
|
|
5
7
|
let result = asset.currency.ZERO
|
|
6
8
|
|
package/redux/selectors/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import byAssetSelectorDefinition from './by-asset'
|
|
2
|
-
import createUnconfirmedBalanceSelectorDefinition from './create-unconfirmed-balance'
|
|
3
|
-
import getBalanceForFieldSelectorDefinition from './get-balance-for-field'
|
|
4
|
-
import getBalanceSelectors from './get-balance-selectors'
|
|
5
|
-
import getBalancesSelectorDefinition from './get-balances'
|
|
6
|
-
import createBalancesSelectors from './create-balance-selectors'
|
|
7
|
-
import getUnconfirmedBalanceSelectorDefinition from './get-unconfirmed-balance'
|
|
1
|
+
import byAssetSelectorDefinition from './by-asset.js'
|
|
2
|
+
import createUnconfirmedBalanceSelectorDefinition from './create-unconfirmed-balance.js'
|
|
3
|
+
import getBalanceForFieldSelectorDefinition from './get-balance-for-field.js'
|
|
4
|
+
import getBalanceSelectors from './get-balance-selectors.js'
|
|
5
|
+
import getBalancesSelectorDefinition from './get-balances.js'
|
|
6
|
+
import createBalancesSelectors from './create-balance-selectors.js'
|
|
7
|
+
import getUnconfirmedBalanceSelectorDefinition from './get-unconfirmed-balance.js'
|
|
8
8
|
import createFuelThresholdSelectorDefinition from './create-fuel-threshold.js'
|
|
9
9
|
import createRequiresFuelThresholdSelectorDefinition from './create-requires-fuel-threshold.js'
|
|
10
10
|
|