@exodus/balances 13.7.0 → 13.8.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 +10 -0
- package/index.js +2 -1
- package/module/mockable-balances.js +27 -0
- package/package.json +5 -4
- package/report/index.js +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.8.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.7.1...@exodus/balances@13.8.0) (2025-03-19)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: mockable balances (#11824)
|
|
11
|
+
|
|
12
|
+
## [13.7.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.7.0...@exodus/balances@13.7.1) (2025-03-12)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @exodus/balances
|
|
15
|
+
|
|
6
16
|
## [13.7.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.6.2...@exodus/balances@13.7.0) (2025-02-27)
|
|
7
17
|
|
|
8
18
|
### Features
|
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from './plugins/index.js'
|
|
15
15
|
import typeforce from '@exodus/typeforce'
|
|
16
16
|
import defaultConfig from './default-config.js'
|
|
17
|
+
import mockableBalancesDefinition from './module/mockable-balances.js'
|
|
17
18
|
|
|
18
19
|
const balances = (walletConfig) => {
|
|
19
20
|
const config = {
|
|
@@ -36,7 +37,7 @@ const balances = (walletConfig) => {
|
|
|
36
37
|
id: 'balances',
|
|
37
38
|
definitions: [
|
|
38
39
|
{
|
|
39
|
-
definition: balancesDefinition,
|
|
40
|
+
definition: walletConfig?.importReport ? mockableBalancesDefinition : balancesDefinition,
|
|
40
41
|
config,
|
|
41
42
|
},
|
|
42
43
|
{ definition: balancesAtomDefinition },
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class Balances {
|
|
2
|
+
#balancesAtom
|
|
3
|
+
#configBalances
|
|
4
|
+
|
|
5
|
+
constructor({ config, balancesAtom }) {
|
|
6
|
+
this.#balancesAtom = balancesAtom
|
|
7
|
+
this.#configBalances = config.importReport
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
load = async () => {
|
|
11
|
+
this.#balancesAtom.set({ balances: this.#configBalances })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
stop = () => {}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const createBalances = (opts) => new Balances(opts)
|
|
18
|
+
|
|
19
|
+
const mockableBalancesDefinition = {
|
|
20
|
+
id: 'balances',
|
|
21
|
+
type: 'module',
|
|
22
|
+
factory: createBalances,
|
|
23
|
+
dependencies: ['config', 'balancesAtom'],
|
|
24
|
+
public: true,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default mockableBalancesDefinition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.8.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@exodus/multi-account-redux": "^2.0.1",
|
|
43
43
|
"@exodus/redux-dependency-injection": "^4.0.3",
|
|
44
44
|
"@exodus/typeforce": "^1.18.0",
|
|
45
|
+
"@exodus/zod": "^3.24.2",
|
|
45
46
|
"lodash": "^4.17.21",
|
|
46
47
|
"make-concurrent": "^4.0.0",
|
|
47
48
|
"reselect": "^3.0.1"
|
|
@@ -55,16 +56,16 @@
|
|
|
55
56
|
"@exodus/assets-feature": "^7.0.2",
|
|
56
57
|
"@exodus/available-assets": "^8.7.0",
|
|
57
58
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
58
|
-
"@exodus/blockchain-metadata": "^15.
|
|
59
|
+
"@exodus/blockchain-metadata": "^15.9.2",
|
|
59
60
|
"@exodus/ethereum-meta": "^2.0.0",
|
|
60
61
|
"@exodus/fee-data-monitors": "^5.0.4",
|
|
61
62
|
"@exodus/storage-memory": "^2.2.2",
|
|
62
|
-
"@exodus/wallet-accounts": "^17.
|
|
63
|
+
"@exodus/wallet-accounts": "^17.5.0",
|
|
63
64
|
"events": "^3.3.0",
|
|
64
65
|
"redux": "^4.2.1"
|
|
65
66
|
},
|
|
66
67
|
"publishConfig": {
|
|
67
68
|
"access": "public"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "d60f4e72c702fd3a171ffbcf4f7ba38d836ce86e"
|
|
70
71
|
}
|
package/report/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SafeError } from '@exodus/errors'
|
|
2
|
+
import { memoize } from '@exodus/basic-utils'
|
|
3
|
+
import { z } from '@exodus/zod'
|
|
2
4
|
|
|
3
5
|
const createBalancesReport = ({ enabledWalletAccountsAtom, balancesAtom }) => ({
|
|
4
6
|
namespace: 'balances',
|
|
@@ -32,6 +34,20 @@ const createBalancesReport = ({ enabledWalletAccountsAtom, balancesAtom }) => ({
|
|
|
32
34
|
return data
|
|
33
35
|
}, {})
|
|
34
36
|
},
|
|
37
|
+
getSchema: memoize(() =>
|
|
38
|
+
z.union([
|
|
39
|
+
z.null(),
|
|
40
|
+
z.object({ error: z.instanceof(SafeError) }).strict(),
|
|
41
|
+
z.record(
|
|
42
|
+
z.string(),
|
|
43
|
+
z
|
|
44
|
+
.object({
|
|
45
|
+
balances: z.record(z.string(), z.string()),
|
|
46
|
+
})
|
|
47
|
+
.strict()
|
|
48
|
+
),
|
|
49
|
+
])
|
|
50
|
+
),
|
|
35
51
|
})
|
|
36
52
|
|
|
37
53
|
const balancesReportDefinition = {
|