@exodus/solana-api 3.30.0 → 3.30.2
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 +20 -0
- package/package.json +2 -2
- package/src/account-state.js +2 -0
- package/src/api.js +15 -3
- package/src/auth.js +2 -0
- package/src/fee-payer.js +25 -12
- package/src/rpc-api.js +7 -1
- package/src/tx-log/clarity-monitor.js +2 -1
- package/src/ws-api.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.30.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.30.1...@exodus/solana-api@3.30.2) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/solana-api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.30.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.30.0...@exodus/solana-api@3.30.1) (2026-03-13)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* fix(solana-api): add RPC concurrency limit and fix historyCursor loss on error (#7550)
|
|
21
|
+
|
|
22
|
+
* fix(solana-api): improve fetchival error handling in fee payer client (#7570)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.30.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.29.6...@exodus/solana-api@3.30.0) (2026-03-10)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.2",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@exodus/assets-testing": "^1.0.0",
|
|
50
50
|
"@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e746a88ef78a0e7167587bfa14068ceb494d6fd7",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
55
55
|
},
|
package/src/account-state.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assetsListToObject } from '@exodus/assets'
|
|
2
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
2
3
|
import { isNumberUnit } from '@exodus/currency'
|
|
3
4
|
import { AccountState } from '@exodus/models'
|
|
4
5
|
import lodash from 'lodash'
|
|
@@ -6,6 +7,7 @@ import lodash from 'lodash'
|
|
|
6
7
|
const { isString, reduce } = lodash
|
|
7
8
|
|
|
8
9
|
const parseBalance = (balance, asset) =>
|
|
10
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
9
11
|
!isNumberUnit(balance) && isString(balance) ? asset.currency.parse(balance) : balance
|
|
10
12
|
|
|
11
13
|
export const DEFAULT_POOL_ADDRESS = '9QU2QSxhb24FUX3Tu2FpczXjpK3VYrvRudywSZaM29mF' // Everstake
|
package/src/api.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
TOKEN_PROGRAM_ID,
|
|
20
20
|
} from '@exodus/solana-lib'
|
|
21
21
|
import lodash from 'lodash'
|
|
22
|
+
import makeConcurrent from 'make-concurrent'
|
|
22
23
|
import ms from 'ms'
|
|
23
24
|
import urljoin from 'url-join'
|
|
24
25
|
|
|
@@ -41,6 +42,8 @@ const errorMessagesToRetry = [
|
|
|
41
42
|
'Failed to query long-term storage; please try again',
|
|
42
43
|
]
|
|
43
44
|
|
|
45
|
+
const TX_DETAIL_FETCH_CONCURRENCY = 10
|
|
46
|
+
|
|
44
47
|
// Tokens + SOL api support
|
|
45
48
|
export class Api {
|
|
46
49
|
constructor({ rpcUrl, wsUrl, assets, txsLimit }) {
|
|
@@ -230,8 +233,11 @@ export class Api {
|
|
|
230
233
|
let txsId = txsResultsByAccount.flat() // merge arrays
|
|
231
234
|
txsId = lodash.uniqBy(txsId, 'signature')
|
|
232
235
|
|
|
233
|
-
// get txs details
|
|
234
|
-
const
|
|
236
|
+
// get txs details with concurrency limit to avoid overwhelming the RPC server
|
|
237
|
+
const fetchWithLimit = makeConcurrent((signature) => this.getTransactionById(signature), {
|
|
238
|
+
concurrency: TX_DETAIL_FETCH_CONCURRENCY,
|
|
239
|
+
})
|
|
240
|
+
const txsDetails = await Promise.all(txsId.map((tx) => fetchWithLimit(tx.signature)))
|
|
235
241
|
txsDetails.forEach((txDetail) => {
|
|
236
242
|
if (!txDetail) return
|
|
237
243
|
|
|
@@ -465,7 +471,13 @@ export class Api {
|
|
|
465
471
|
return value
|
|
466
472
|
}
|
|
467
473
|
|
|
468
|
-
|
|
474
|
+
/**
|
|
475
|
+
* Returns true if the account exists (has not been reclaimed).
|
|
476
|
+
* Accounts may be reclaimed by the rent collector after their balance dropped below the
|
|
477
|
+
* rent-exempt reserve. getAccountInfo only returns the current account state; if the
|
|
478
|
+
* runtime deleted the account, RPC returns null.
|
|
479
|
+
*/
|
|
480
|
+
async addressIsActive(address) {
|
|
469
481
|
const value = await this.getAccountInfo(address)
|
|
470
482
|
return !!value?.data
|
|
471
483
|
}
|
package/src/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
1
2
|
import { randomBytes } from '@exodus/crypto/randomBytes'
|
|
2
3
|
import { generateKeyPair } from '@exodus/solana-lib'
|
|
3
4
|
|
|
@@ -12,6 +13,7 @@ export const getAuthKeyPair = ({ assetName, apiUrl, network }) => {
|
|
|
12
13
|
const cacheKey = `auth_keypair:v1:${normalizeServiceUrl(apiUrl)}:${assetName}:${network || 'mainnet'}`
|
|
13
14
|
|
|
14
15
|
if (!authKeyPairCache.has(cacheKey)) {
|
|
16
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
15
17
|
const keyPair = generateKeyPair(randomBytes(32))
|
|
16
18
|
authKeyPairCache.set(cacheKey, {
|
|
17
19
|
publicKey: keyPair.publicKey.toBuffer().toString('hex'),
|
package/src/fee-payer.js
CHANGED
|
@@ -64,14 +64,30 @@ export const feePayerClientFactory = ({
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
try {
|
|
68
|
+
return await fetchival(`${feePayerApiUrl}/transactions/sponsor`, {
|
|
69
|
+
mode: 'cors',
|
|
70
|
+
cache: 'no-cache',
|
|
71
|
+
timeout: ms('10s'),
|
|
72
|
+
headers,
|
|
73
|
+
}).post({
|
|
74
|
+
transaction: encodedTransaction,
|
|
75
|
+
})
|
|
76
|
+
} catch (err) {
|
|
77
|
+
let nerr = err
|
|
78
|
+
if (err.response) {
|
|
79
|
+
try {
|
|
80
|
+
const data = await err.response.text()
|
|
81
|
+
nerr = new Error(`${err.response.status}: ${data}`)
|
|
82
|
+
} catch {}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (err.response?.status) {
|
|
86
|
+
nerr.status = err.response.status
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
throw nerr
|
|
90
|
+
}
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
/**
|
|
@@ -84,10 +100,7 @@ export const feePayerClientFactory = ({
|
|
|
84
100
|
try {
|
|
85
101
|
response = await makeSponsorRequest({ encodedTransaction })
|
|
86
102
|
} catch (error) {
|
|
87
|
-
if (
|
|
88
|
-
requireAuthentication &&
|
|
89
|
-
(error.response?.status === 401 || error.response?.status === 403)
|
|
90
|
-
) {
|
|
103
|
+
if (requireAuthentication && (error.status === 401 || error.status === 403)) {
|
|
91
104
|
console.warn('Authentication failed, retrying...')
|
|
92
105
|
if (authClient) {
|
|
93
106
|
await authClient._authenticate()
|
package/src/rpc-api.js
CHANGED
|
@@ -243,7 +243,13 @@ export class RpcApi {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Returns true if the account exists (has not been reclaimed).
|
|
248
|
+
* Accounts may be reclaimed by the rent collector after their balance dropped below the
|
|
249
|
+
* rent-exempt reserve. getAccountInfo only returns the current account state; if the
|
|
250
|
+
* runtime deleted the account, RPC returns null.
|
|
251
|
+
*/
|
|
252
|
+
async addressIsActive(address) {
|
|
247
253
|
const value = await this.getAccountInfo(address)
|
|
248
254
|
return !!value?.data
|
|
249
255
|
}
|
|
@@ -246,7 +246,8 @@ export class SolanaClarityMonitor extends BaseMonitor {
|
|
|
246
246
|
error,
|
|
247
247
|
})
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
// Preserve cursor on transient errors so fetching retries on the next tick
|
|
250
|
+
return { transactions: [], historyCursor }
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
|
package/src/ws-api.js
CHANGED
|
@@ -131,6 +131,9 @@ export class WsApi {
|
|
|
131
131
|
await this.connection.start()
|
|
132
132
|
} else if (this.connection.isOpen) {
|
|
133
133
|
await this.sendSubscriptions({ address, tokensAddresses })
|
|
134
|
+
} else {
|
|
135
|
+
// Connection exists but is closed (e.g. after app refresh). Restart it.
|
|
136
|
+
await this.connection.start()
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
|