@exodus/solana-api 3.7.1 → 3.8.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 +18 -0
- package/package.json +2 -2
- package/src/account-state.js +1 -0
- package/src/api.js +3 -1
- package/src/staking-utils.js +1 -0
- package/src/tx-log/me-solana-monitor.js +1 -1
- package/src/tx-log/solana-monitor.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
## [3.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.7.2...@exodus/solana-api@3.8.0) (2024-06-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **solana:** Add pending to stake balance ([#2632](https://github.com/ExodusMovement/assets/issues/2632)) ([6a4973a](https://github.com/ExodusMovement/assets/commit/6a4973a33c5ba482d786a3fd5656107110dcf929))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [3.7.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.7.1...@exodus/solana-api@3.7.2) (2024-06-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* me monitor empty accounts error ([#2606](https://github.com/ExodusMovement/assets/issues/2606)) ([4997039](https://github.com/ExodusMovement/assets/commit/4997039a2128dd8281da8aac919075704f4a0e1f))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [3.7.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.7.0...@exodus/solana-api@3.7.1) (2024-06-14)
|
|
7
25
|
|
|
8
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Exodus internal Solana asset API wrapper",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@exodus/assets-testing": "^1.0.0",
|
|
47
47
|
"@solana/web3.js": "^1.91.8"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "9cf36ab52a6d74e3f994ae5d2d4c7db6de78c867",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
52
52
|
},
|
package/src/account-state.js
CHANGED
|
@@ -28,6 +28,7 @@ export const createAccountState = ({ assetList }) => {
|
|
|
28
28
|
locked: asset.currency.defaultUnit(0),
|
|
29
29
|
withdrawable: asset.currency.defaultUnit(0),
|
|
30
30
|
pending: asset.currency.defaultUnit(0),
|
|
31
|
+
activating: asset.currency.defaultUnit(0),
|
|
31
32
|
earned: asset.currency.defaultUnit(0),
|
|
32
33
|
accounts: {}, // stake accounts
|
|
33
34
|
},
|
package/src/api.js
CHANGED
|
@@ -839,6 +839,7 @@ export class Api {
|
|
|
839
839
|
const accounts = {}
|
|
840
840
|
let totalStake = 0
|
|
841
841
|
let locked = 0
|
|
842
|
+
let activating = 0
|
|
842
843
|
let withdrawable = 0
|
|
843
844
|
let pending = 0
|
|
844
845
|
for (const entry of res) {
|
|
@@ -859,11 +860,12 @@ export class Api {
|
|
|
859
860
|
accounts[addr].stake = Number(accounts[addr].stake) || 0 // active staked amount
|
|
860
861
|
totalStake += accounts[addr].stake
|
|
861
862
|
locked += ['active', 'activating'].includes(accounts[addr].state) ? lamports : 0
|
|
863
|
+
activating += accounts[addr].state === 'activating' ? lamports : 0
|
|
862
864
|
withdrawable += accounts[addr].canWithdraw ? lamports : 0
|
|
863
865
|
pending += accounts[addr].isDeactivating ? lamports : 0
|
|
864
866
|
}
|
|
865
867
|
|
|
866
|
-
return { accounts, totalStake, locked, withdrawable, pending }
|
|
868
|
+
return { accounts, totalStake, locked, withdrawable, pending, activating }
|
|
867
869
|
}
|
|
868
870
|
|
|
869
871
|
async getRewards(stakingAddresses = []) {
|
package/src/staking-utils.js
CHANGED
|
@@ -18,6 +18,7 @@ export const getStakingInfo = (accountMem) => {
|
|
|
18
18
|
staking: accountMem.staking,
|
|
19
19
|
isDelegating: accountMem.isDelegating,
|
|
20
20
|
locked: accountMem.locked,
|
|
21
|
+
activating: accountMem.activating,
|
|
21
22
|
withdrawable: accountMem.withdrawable,
|
|
22
23
|
pending: accountMem.pending,
|
|
23
24
|
accounts: accountMem.accounts,
|
|
@@ -111,7 +111,7 @@ export class MeSolanaMonitor extends SolanaMonitor {
|
|
|
111
111
|
const { balances } = await this.request('v1/wallet/balances/fungible').post(body).json()
|
|
112
112
|
|
|
113
113
|
const result = {
|
|
114
|
-
balance:
|
|
114
|
+
balance: this.asset.currency.ZERO,
|
|
115
115
|
tokenBalances: {},
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -324,6 +324,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
324
324
|
['active', 'activating', 'inactive'].includes(state)
|
|
325
325
|
), // true if at least 1 account is delegating
|
|
326
326
|
locked: this.asset.currency.baseUnit(stakingInfo.locked).toDefault(),
|
|
327
|
+
activating: this.asset.currency.baseUnit(stakingInfo.activating),
|
|
327
328
|
withdrawable: this.asset.currency.baseUnit(stakingInfo.withdrawable).toDefault(),
|
|
328
329
|
pending: this.asset.currency.baseUnit(stakingInfo.pending).toDefault(), // still undelegating (not yet available for withdraw)
|
|
329
330
|
earned: this.asset.currency.baseUnit(rewards).toDefault(),
|