@exodus/solana-api 3.9.2 → 3.9.3
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 +8 -0
- package/package.json +3 -3
- package/src/account-state.js +1 -1
- package/src/get-balances.js +3 -3
- package/src/staking-utils.js +11 -11
- package/src/tx-log/me-solana-monitor.js +1 -1
- package/src/tx-log/solana-auto-withdraw-monitor.js +3 -3
- package/src/tx-log/solana-monitor.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.9.3](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.9.2...@exodus/solana-api@3.9.3) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/solana-api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [3.9.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.9.1...@exodus/solana-api@3.9.2) (2024-07-18)
|
|
7
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.3",
|
|
4
4
|
"description": "Exodus internal Solana asset API wrapper",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "restricted"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"test": "run -T jest",
|
|
19
|
+
"test": "run -T exodus-test --jest --esbuild",
|
|
20
20
|
"lint": "run -T eslint .",
|
|
21
21
|
"lint:fix": "yarn lint --fix"
|
|
22
22
|
},
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@exodus/assets-testing": "^1.0.0",
|
|
48
48
|
"@solana/web3.js": "^1.91.8"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "faa92e86406bfff4f738557b73773bc8c539d53d",
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
53
53
|
},
|
package/src/account-state.js
CHANGED
package/src/get-balances.js
CHANGED
|
@@ -10,9 +10,9 @@ export const getBalancesFactory =
|
|
|
10
10
|
const { balance, locked, withdrawable, pending } = fixBalances({
|
|
11
11
|
txLog,
|
|
12
12
|
balance: getBalanceFromAccountState({ asset, accountState }),
|
|
13
|
-
locked: accountState.
|
|
14
|
-
withdrawable: accountState.
|
|
15
|
-
pending: accountState.
|
|
13
|
+
locked: accountState.stakingInfo?.locked || zero,
|
|
14
|
+
withdrawable: accountState.stakingInfo?.withdrawable || zero,
|
|
15
|
+
pending: accountState.stakingInfo?.pending || zero,
|
|
16
16
|
asset,
|
|
17
17
|
})
|
|
18
18
|
if (asset.baseAsset.name !== asset.name) {
|
package/src/staking-utils.js
CHANGED
|
@@ -12,21 +12,21 @@ export const getSolStakedFee = ({ asset, stakingInfo, fee }) => {
|
|
|
12
12
|
return allPending > 0 ? fee.mul(allPending) : currency.ZERO
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const getStakingInfo = (
|
|
15
|
+
export const getStakingInfo = (stakingInfo) => {
|
|
16
16
|
return {
|
|
17
|
-
loaded:
|
|
18
|
-
staking:
|
|
19
|
-
isDelegating:
|
|
20
|
-
locked:
|
|
21
|
-
activating:
|
|
22
|
-
withdrawable:
|
|
23
|
-
pending:
|
|
24
|
-
accounts:
|
|
25
|
-
earned:
|
|
17
|
+
loaded: stakingInfo.loaded,
|
|
18
|
+
staking: stakingInfo.staking,
|
|
19
|
+
isDelegating: stakingInfo.isDelegating,
|
|
20
|
+
locked: stakingInfo.locked,
|
|
21
|
+
activating: stakingInfo.activating,
|
|
22
|
+
withdrawable: stakingInfo.withdrawable,
|
|
23
|
+
pending: stakingInfo.pending,
|
|
24
|
+
accounts: stakingInfo.accounts,
|
|
25
|
+
earned: stakingInfo.earned,
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const getUnstakingFee = ({ asset, fee, accountState }) => {
|
|
30
|
-
const stakingInfo = getStakingInfo(accountState.
|
|
30
|
+
const stakingInfo = getStakingInfo(accountState.stakingInfo ?? {})
|
|
31
31
|
return getSolStakedFee({ asset, stakingInfo, fee })
|
|
32
32
|
}
|
|
@@ -125,7 +125,7 @@ export class MeSolanaMonitor extends SolanaMonitor {
|
|
|
125
125
|
const staking =
|
|
126
126
|
this.isStakingEnabled() && fetchStakingInfo
|
|
127
127
|
? await this.getStakingInfo({ address, walletAccount })
|
|
128
|
-
: { ...accountState.
|
|
128
|
+
: { ...accountState.stakingInfo, staking: this.staking }
|
|
129
129
|
|
|
130
130
|
return { account, tokenAccounts, staking }
|
|
131
131
|
}
|
|
@@ -31,8 +31,8 @@ export class SolanaAutoWithdrawMonitor {
|
|
|
31
31
|
assetName: this.assetName,
|
|
32
32
|
walletAccount,
|
|
33
33
|
})
|
|
34
|
-
const { cursor,
|
|
35
|
-
const { loaded, withdrawable } =
|
|
34
|
+
const { cursor, stakingInfo } = accountState
|
|
35
|
+
const { loaded, withdrawable } = stakingInfo
|
|
36
36
|
|
|
37
37
|
if (!Array.isArray(this.cursors[walletAccount])) this.cursors[walletAccount] = []
|
|
38
38
|
const cursorChanged = !this.cursors[walletAccount].includes(cursor)
|
|
@@ -49,7 +49,7 @@ export class SolanaAutoWithdrawMonitor {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
async tryWithdraw({ accountState, walletAccount }) {
|
|
52
|
-
const stakingInfo = accountState.
|
|
52
|
+
const stakingInfo = accountState.stakingInfo
|
|
53
53
|
const feeData = await this.aci.getFeeData({ assetName: this.assetName })
|
|
54
54
|
const fee = get(feeData, 'fee', this.asset.currency.ZERO)
|
|
55
55
|
|
|
@@ -309,7 +309,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
309
309
|
const staking =
|
|
310
310
|
this.isStakingEnabled() && fetchStakingInfo
|
|
311
311
|
? await this.getStakingInfo({ address, walletAccount })
|
|
312
|
-
: { ...accountState.
|
|
312
|
+
: { ...accountState.stakingInfo, staking: this.staking }
|
|
313
313
|
|
|
314
314
|
const stakedBalance = this.asset.currency.baseUnit(staking.locked)
|
|
315
315
|
const withdrawableBalance = this.asset.currency.baseUnit(staking.withdrawable)
|
|
@@ -332,7 +332,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
332
332
|
|
|
333
333
|
async updateState({ account, cursorState, walletAccount, staking }) {
|
|
334
334
|
const { balance, tokenBalances } = account
|
|
335
|
-
const newData = { balance, tokenBalances,
|
|
335
|
+
const newData = { balance, tokenBalances, stakingInfo: staking, ...cursorState }
|
|
336
336
|
return this.updateAccountState({ newData, walletAccount })
|
|
337
337
|
}
|
|
338
338
|
|