@exodus/solana-api 3.14.0 → 3.14.1
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 +10 -0
- package/package.json +2 -2
- package/src/tx-log/solana-auto-withdraw-monitor.js +26 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.14.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.14.0...@exodus/solana-api@3.14.1) (2025-03-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: prevent SOL invalid account owner error (#5187)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [3.14.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.13.7...@exodus/solana-api@3.14.0) (2025-03-10)
|
|
7
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Solana",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@exodus/assets-testing": "^1.0.0",
|
|
47
47
|
"@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "83588a56196a14b58f5b05aa2097e4ef6c54079e",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
52
52
|
},
|
|
@@ -22,29 +22,38 @@ export class SolanaAutoWithdrawMonitor {
|
|
|
22
22
|
|
|
23
23
|
async tick() {
|
|
24
24
|
const walletAccounts = await this.aci.getWalletAccounts({ assetName: this.assetName })
|
|
25
|
-
|
|
25
|
+
for (const walletAccount of walletAccounts) {
|
|
26
|
+
await this._tick({ walletAccount })
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async _tick({ walletAccount }) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
this.processing = this.processing || new Set()
|
|
32
|
+
if (this.processing.has(walletAccount)) return
|
|
33
|
+
this.processing.add(walletAccount)
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const accountState = await this.aci.getAccountState({
|
|
37
|
+
assetName: this.assetName,
|
|
38
|
+
walletAccount,
|
|
39
|
+
})
|
|
40
|
+
const { cursor, stakingInfo } = accountState
|
|
41
|
+
const { loaded, withdrawable } = stakingInfo
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const performedWithdraw = this.cursors[walletAccount].length > 0
|
|
43
|
+
if (!Array.isArray(this.cursors[walletAccount])) this.cursors[walletAccount] = []
|
|
44
|
+
const cursorChanged = !this.cursors[walletAccount].includes(cursor)
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
if (loaded && cursorChanged && withdrawable.isPositive) {
|
|
47
|
+
this.cursors[walletAccount].push(cursor)
|
|
48
|
+
try {
|
|
49
|
+
const txIds = await this.tryWithdraw({ accountState, walletAccount })
|
|
50
|
+
this.cursors[walletAccount].push(...txIds)
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log('solana auto withdraw error:', e)
|
|
53
|
+
}
|
|
47
54
|
}
|
|
55
|
+
} finally {
|
|
56
|
+
this.processing.delete(walletAccount)
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
|