@exodus/balances 11.0.3 → 11.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 +6 -0
- package/module/index.js +21 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## [11.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@11.0.3...@exodus/balances@11.1.0) (2023-10-20)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- warn on different number unit ([#4512](https://github.com/ExodusMovement/exodus-hydra/issues/4512)) ([d11cbc7](https://github.com/ExodusMovement/exodus-hydra/commit/d11cbc770535cb5f978526d5634a391b1bd4146f))
|
|
11
|
+
|
|
6
12
|
## [11.0.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@11.0.2...@exodus/balances@11.0.3) (2023-10-20)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/module/index.js
CHANGED
|
@@ -163,7 +163,27 @@ class Balances extends ExodusModule {
|
|
|
163
163
|
const asset = this.#getAsset(assetName)
|
|
164
164
|
const txLog = txLogsByAssetName[assetName]
|
|
165
165
|
const balances = asset.api.getBalances({ asset, accountState, txLog })
|
|
166
|
-
if (!balances || isEmpty(balances)) return null
|
|
166
|
+
if (!balances || isEmpty(balances) || !balances.balance) return null
|
|
167
|
+
if (!balances.balance.unitType.equals(asset.currency)) {
|
|
168
|
+
this.emit('error', {
|
|
169
|
+
fn: 'getAssetBalances',
|
|
170
|
+
error: 'asset.api.getBalances returns different currency',
|
|
171
|
+
args: {
|
|
172
|
+
balanceUnit: balances.balance.unitType.defaultUnit.unitName,
|
|
173
|
+
assetUnit: asset.currency.defaultUnit.unitName,
|
|
174
|
+
},
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
this._logger.warn(
|
|
178
|
+
'asset.api.getBalances returns different currency, asset currency:',
|
|
179
|
+
asset.currency.defaultUnit.unitName,
|
|
180
|
+
'balance currency',
|
|
181
|
+
balances.balance.unitType.defaultUnit.unitName,
|
|
182
|
+
'return zero balance for it'
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
return Object.fromEntries(this.#balanceFields.map((field) => [field, asset.currency.ZERO]))
|
|
186
|
+
}
|
|
167
187
|
|
|
168
188
|
if (balances.balance && this.#balanceFields.includes('confirmedBalance')) {
|
|
169
189
|
balances.confirmedBalance = getConfirmedBalance({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"jest": "^29.1.2",
|
|
59
59
|
"redux": "^4.2.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "b6af95cf4e3658b4d175fe856db453e2545307c0"
|
|
62
62
|
}
|