@exodus/ethereum-api 6.3.17 → 6.3.18

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.17",
3
+ "version": "6.3.18",
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": "b08bcfa935e1f208104276cc6e07a9992ea2147f"
37
+ "gitHead": "51a5d83c3e8a9abf51117a6e9620a4717632ee27"
38
38
  }
@@ -55,9 +55,10 @@ export function createEthereumStakingService({
55
55
 
56
56
  let txId
57
57
  if (!pendingAmount.isZero) {
58
+ const inactiveAmountToUnstake = pendingAmount.lte(amount) ? pendingAmount : amount
58
59
  const { to, data } = await staking.unstakePending({
59
60
  address: delegatorAddress,
60
- amount,
61
+ amount: inactiveAmountToUnstake,
61
62
  })
62
63
 
63
64
  let { gasPrice, gasLimit, fee } = await estimateTxFee(
@@ -79,10 +80,10 @@ export function createEthereumStakingService({
79
80
 
80
81
  // need also to unstake
81
82
  if (amount.gt(pendingAmount)) {
82
- const amountToUnstake = amount.sub(pendingAmount)
83
+ const activeAmountToUnstake = amount.sub(pendingAmount)
83
84
  const { to, data } = await staking.unstake({
84
85
  address: delegatorAddress,
85
- amount: amountToUnstake,
86
+ amount: activeAmountToUnstake,
86
87
  })
87
88
 
88
89
  let { gasPrice, gasLimit, fee } = await estimateTxFee(delegatorAddress, to, null, data)
@@ -258,7 +259,8 @@ export async function getEthereumStakingInfo({ address, asset }) {
258
259
  return {
259
260
  rewardsBalance,
260
261
  isDelegating,
261
- delegatedBalance,
262
+ delegatedBalance, // balance staked into the validator + pending
263
+ pendingBalance, // balance waiting to be staked
262
264
  minDelegateAmount,
263
265
  unclaimedUndelegatedBalance,
264
266
  canClaimUndelegatedBalance,