@exodus/balances 1.0.0 → 1.0.1
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/index.js +5 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -21,8 +21,8 @@ class Balances extends ExodusModule {
|
|
|
21
21
|
#walletAccounts = null // string[]
|
|
22
22
|
#ready = false
|
|
23
23
|
|
|
24
|
-
#oldBalances =
|
|
25
|
-
#balances =
|
|
24
|
+
#oldBalances = Object.create(null)
|
|
25
|
+
#balances = Object.create(null)
|
|
26
26
|
|
|
27
27
|
constructor({ assetsModule, blockchainMetadata, walletAccountsAtom, balanceFields, logger }) {
|
|
28
28
|
super({ name: 'Balances', logger })
|
|
@@ -66,7 +66,7 @@ class Balances extends ExodusModule {
|
|
|
66
66
|
|
|
67
67
|
#reset = ({ walletAccounts = this.#walletAccounts } = {}) => {
|
|
68
68
|
walletAccounts.forEach((walletAccount) => {
|
|
69
|
-
this.#balances[walletAccount] =
|
|
69
|
+
this.#balances[walletAccount] = Object.create(null)
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -106,7 +106,7 @@ class Balances extends ExodusModule {
|
|
|
106
106
|
assetNames.map((assetName) => this.#getBalancesForAssetSource({ assetName, walletAccount }))
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
-
return merge(
|
|
109
|
+
return merge(Object.create(null), ...balances)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
#load = async ({ walletAccount }) => {
|
|
@@ -183,7 +183,7 @@ class Balances extends ExodusModule {
|
|
|
183
183
|
|
|
184
184
|
const accountBalances = this.#balances[walletAccount]
|
|
185
185
|
const newBalances = this.#getBalancesFromBlockchainMetadata({ assetName, accountState, txLog })
|
|
186
|
-
const changes =
|
|
186
|
+
const changes = Object.create(null)
|
|
187
187
|
for (let subAssetName in newBalances) {
|
|
188
188
|
const { currency } = this.#getAsset(subAssetName)
|
|
189
189
|
const newAssetBalances = newBalances?.[subAssetName]
|