@exodus/solana-api 3.1.0 → 3.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Exodus internal Solana asset API wrapper",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -44,5 +44,5 @@
44
44
  "devDependencies": {
45
45
  "@exodus/assets-testing": "^1.0.0"
46
46
  },
47
- "gitHead": "84f77ed9720dcdabb8057ed9170f45fcb4f9eff9"
47
+ "gitHead": "12ce714047305f7ac06cec7608a59c90aa25c34d"
48
48
  }
@@ -16,7 +16,14 @@ export const getBalancesFactory =
16
16
  asset,
17
17
  })
18
18
  if (asset.baseAsset.name !== asset.name) {
19
- return { balance, spendableBalance: balance }
19
+ return {
20
+ // legacy
21
+ balance,
22
+ spendableBalance: balance,
23
+ // new
24
+ total: balance,
25
+ spendable: balance,
26
+ }
20
27
  }
21
28
 
22
29
  const balanceWithoutStaking = balance
@@ -25,9 +32,21 @@ export const getBalancesFactory =
25
32
  .sub(pending)
26
33
  .clampLowerZero()
27
34
 
35
+ const total = stakingFeatureAvailable ? balance : balanceWithoutStaking
36
+ const spendable = balanceWithoutStaking.sub(asset.accountReserve || zero).clampLowerZero()
37
+
38
+ const staked = locked
39
+ const unstaking = pending
40
+
28
41
  return {
29
- balance: stakingFeatureAvailable ? balance : balanceWithoutStaking,
30
- spendableBalance: balanceWithoutStaking.sub(asset.accountReserve || zero).clampLowerZero(),
42
+ // legacy
43
+ balance: total,
44
+ spendableBalance: spendable,
45
+ // new
46
+ total,
47
+ spendable,
48
+ staked,
49
+ unstaking,
31
50
  }
32
51
  }
33
52