@exodus/solana-api 3.30.12 → 3.31.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 +18 -0
- package/package.json +3 -3
- package/src/api.js +8 -2
- package/src/fee-payer.js +22 -4
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.31.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.31.0...@exodus/solana-api@3.31.1) (2026-04-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/solana-api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.31.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.30.12...@exodus/solana-api@3.31.0) (2026-04-23)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* feat: add passing headers to solana api and wretch (#7846)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [3.30.12](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.30.10...@exodus/solana-api@3.30.12) (2026-04-17)
|
|
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.31.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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lint:fix": "yarn lint --fix"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@exodus/asset-json-rpc": "^
|
|
26
|
+
"@exodus/asset-json-rpc": "^2.0.2",
|
|
27
27
|
"@exodus/asset-lib": "^5.7.0",
|
|
28
28
|
"@exodus/assets": "^11.0.0",
|
|
29
29
|
"@exodus/auth-client-base": "^2.2.0",
|
|
@@ -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": "4bf6290a71108efdd1e20d48d7898dd7b38aff4d",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
55
55
|
},
|
package/src/api.js
CHANGED
|
@@ -47,7 +47,8 @@ const TX_DETAIL_FETCH_CONCURRENCY = 10
|
|
|
47
47
|
|
|
48
48
|
// Tokens + SOL api support
|
|
49
49
|
export class Api {
|
|
50
|
-
constructor({ rpcUrl, wsUrl, assets, txsLimit }) {
|
|
50
|
+
constructor({ rpcUrl, wsUrl, assets, txsLimit, headers = {} } = {}) {
|
|
51
|
+
this.headers = headers
|
|
51
52
|
this.setServer(rpcUrl)
|
|
52
53
|
this.setTokens(assets)
|
|
53
54
|
this.tokensToSkip = {}
|
|
@@ -73,7 +74,12 @@ export class Api {
|
|
|
73
74
|
|
|
74
75
|
setServer(rpcUrl) {
|
|
75
76
|
this.rpcUrl = rpcUrl || RPC_URL
|
|
76
|
-
|
|
77
|
+
const options = {}
|
|
78
|
+
if (this.headers) {
|
|
79
|
+
options.headers = this.headers
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.api = createApi(this.rpcUrl, options)
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
setTokens(assets = {}) {
|
package/src/fee-payer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createClient as createAuthClient } from '@exodus/auth-client-base'
|
|
2
2
|
import { signAttached } from '@exodus/crypto/ed25519'
|
|
3
|
-
import { fetchival } from '@exodus/fetch'
|
|
3
|
+
import { fetch as exodusFetch, fetchival } from '@exodus/fetch'
|
|
4
4
|
import {
|
|
5
5
|
deserializeTransaction,
|
|
6
6
|
prepareForSigning,
|
|
@@ -21,18 +21,30 @@ import { getAuthKeyPair } from './auth.js'
|
|
|
21
21
|
*
|
|
22
22
|
* @param {Object} config - Configuration for the fee payer client
|
|
23
23
|
* @param {string} config.assetName - The asset from the transaction
|
|
24
|
-
* @param {string} config.
|
|
24
|
+
* @param {string} config.feePayerApiUrl - The fee payer service URL
|
|
25
25
|
* @param {boolean} [config.requireAuthentication=false] - Whether the service requires authentication
|
|
26
|
-
* @param {
|
|
26
|
+
* @param {Object} [config.headers] - Headers to include in fee payer service requests
|
|
27
|
+
* @param {Object} [config.metadata] - Metadata forwarded to the auth client
|
|
27
28
|
*/
|
|
28
29
|
export const feePayerClientFactory = ({
|
|
29
30
|
assetName = 'solana', // baseAsset name
|
|
30
31
|
feePayerApiUrl,
|
|
31
32
|
requireAuthentication = false,
|
|
32
33
|
authKeyPair: customAuthKeyPair = null,
|
|
34
|
+
headers: defaultHeaders = {},
|
|
35
|
+
metadata = {},
|
|
33
36
|
} = {}) => {
|
|
34
37
|
assert(feePayerApiUrl, 'feePayerApiUrl is required')
|
|
35
38
|
|
|
39
|
+
const fetchWithHeaders = (url, options = {}) =>
|
|
40
|
+
exodusFetch(url, {
|
|
41
|
+
...options,
|
|
42
|
+
headers: {
|
|
43
|
+
...defaultHeaders,
|
|
44
|
+
...options.headers,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
36
48
|
// Create auth client if authentication is required
|
|
37
49
|
let authClient = null
|
|
38
50
|
if (requireAuthentication) {
|
|
@@ -45,17 +57,23 @@ export const feePayerClientFactory = ({
|
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
authClient = createAuthClient({
|
|
60
|
+
fetch: fetchWithHeaders,
|
|
48
61
|
config: {
|
|
49
62
|
keyPair,
|
|
50
63
|
baseUrl: feePayerApiUrl,
|
|
51
64
|
authTokenUrl: `${feePayerApiUrl}/auth/token`,
|
|
52
65
|
authChallengeUrl: `${feePayerApiUrl}/auth/challenge`,
|
|
53
66
|
},
|
|
67
|
+
metadata,
|
|
54
68
|
})
|
|
55
69
|
}
|
|
56
70
|
|
|
57
71
|
const makeSponsorRequest = async ({ encodedTransaction }) => {
|
|
58
|
-
const headers = {
|
|
72
|
+
const headers = {
|
|
73
|
+
...defaultHeaders,
|
|
74
|
+
Accept: 'application/json',
|
|
75
|
+
'Content-Type': 'application/json',
|
|
76
|
+
}
|
|
59
77
|
|
|
60
78
|
if (requireAuthentication && authClient) {
|
|
61
79
|
await authClient._awaitAuthenticated()
|