@exodus/ethereum-api 6.3.30 → 6.3.31
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.31",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@exodus/models": "^8.10.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "fdcd4a653b2de7a722c2d4936b196961f20563fd"
|
|
38
38
|
}
|
package/src/get-balances.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
1
|
+
import { getEthereumBalances, isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
2
|
+
|
|
2
3
|
import { get } from 'lodash'
|
|
3
4
|
|
|
4
5
|
const fixBalance = ({ txLog, balance }) => {
|
|
@@ -35,6 +36,15 @@ const getBalance = ({ asset, accountState, txLog }) => {
|
|
|
35
36
|
|
|
36
37
|
const shouldFixBalance = isRpcBalanceAsset(asset)
|
|
37
38
|
|
|
39
|
+
if (['ethereum', 'ethereumgoerli'].includes(asset.name)) {
|
|
40
|
+
const { balance: ethereumBalance } = getEthereumBalances({
|
|
41
|
+
asset,
|
|
42
|
+
liquidBalance: balance,
|
|
43
|
+
accountState,
|
|
44
|
+
})
|
|
45
|
+
return ethereumBalance
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
return shouldFixBalance ? fixBalance({ txLog, balance }) : balance
|
|
39
49
|
}
|
|
40
50
|
|
|
@@ -94,6 +94,16 @@ export class EthereumStaking {
|
|
|
94
94
|
return this.asset.currency.baseUnit(userBalance)
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/** Return user pending deposited balance. Balance which deposited into validator but not active yet. Pending deposited balance can't be unstake till validator activation */
|
|
98
|
+
async pendingDepositedBalanceOf(address) {
|
|
99
|
+
const userBalance = await this.callReadFunctionContract(
|
|
100
|
+
this.contractAccounting,
|
|
101
|
+
'pendingDepositedBalanceOf',
|
|
102
|
+
address
|
|
103
|
+
)
|
|
104
|
+
return this.asset.currency.baseUnit(userBalance)
|
|
105
|
+
}
|
|
106
|
+
|
|
97
107
|
/** Return user active origin deposited balance */
|
|
98
108
|
async depositedBalanceOf(address) {
|
|
99
109
|
const depositedBalance = await this.callReadFunctionContract(
|
|
@@ -236,14 +236,21 @@ export async function getEthereumStakingInfo({ address, asset }) {
|
|
|
236
236
|
const delegator = address.toLowerCase()
|
|
237
237
|
const staking = new EthereumStaking(asset)
|
|
238
238
|
|
|
239
|
-
const [
|
|
239
|
+
const [
|
|
240
|
+
activeStakedBalance,
|
|
241
|
+
pendingBalance,
|
|
242
|
+
pendingDepositedBalance,
|
|
243
|
+
withdrawRequest,
|
|
244
|
+
rewardsBalance,
|
|
245
|
+
] = await Promise.all([
|
|
240
246
|
staking.autocompoundBalanceOf(delegator),
|
|
241
247
|
staking.pendingBalanceOf(delegator),
|
|
248
|
+
staking.pendingDepositedBalanceOf(delegator),
|
|
242
249
|
staking.withdrawRequest(delegator),
|
|
243
250
|
staking.getLiquidRewards(delegator),
|
|
244
251
|
])
|
|
245
252
|
|
|
246
|
-
const delegatedBalance = activeStakedBalance.add(pendingBalance)
|
|
253
|
+
const delegatedBalance = activeStakedBalance.add(pendingBalance).add(pendingDepositedBalance)
|
|
247
254
|
const minDelegateAmount = currency.defaultUnit(0.1)
|
|
248
255
|
|
|
249
256
|
const {
|
|
@@ -262,8 +269,10 @@ export async function getEthereumStakingInfo({ address, asset }) {
|
|
|
262
269
|
return {
|
|
263
270
|
rewardsBalance,
|
|
264
271
|
isDelegating,
|
|
272
|
+
activeStakedBalance, // balance staked into the validator
|
|
265
273
|
delegatedBalance, // balance staked into the validator + pending
|
|
266
274
|
pendingBalance, // balance waiting to be staked
|
|
275
|
+
pendingDepositedBalance, // balance deposited into validator but not active yet
|
|
267
276
|
minDelegateAmount,
|
|
268
277
|
unclaimedUndelegatedBalance,
|
|
269
278
|
canClaimUndelegatedBalance,
|