@exodus/solana-plugin 1.24.6 → 1.25.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 +6 -5
- package/src/create-asset-utils.js +55 -0
- package/src/create-asset.js +42 -17
- package/src/index.js +1 -2
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
|
+
## [1.25.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.6...@exodus/solana-plugin@1.25.0) (2025-10-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: integrate Solana fee payer service (#6615)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [1.24.7](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.6...@exodus/solana-plugin@1.24.7) (2025-10-09)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @exodus/solana-plugin
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [1.24.6](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.5...@exodus/solana-plugin@1.24.6) (2025-09-29)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @exodus/solana-plugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Solana plugin for Exodus SDK powered wallets.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"homepage": "https://github.com/ExodusMovement/assets/tree/master/solana/solana-plugin",
|
|
15
15
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
16
|
+
"access": "public",
|
|
17
|
+
"provenance": false
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"test": "run -T exodus-test --jest",
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
"@exodus/bip44-constants": "^195.0.0",
|
|
27
28
|
"@exodus/i18n-dummy": "^1.0.0",
|
|
28
29
|
"@exodus/send-validation-model": "^1.0.0",
|
|
29
|
-
"@exodus/solana-api": "^3.
|
|
30
|
-
"@exodus/solana-lib": "^3.
|
|
30
|
+
"@exodus/solana-api": "^3.21.0",
|
|
31
|
+
"@exodus/solana-lib": "^3.13.0",
|
|
31
32
|
"@exodus/solana-meta": "^2.3.1",
|
|
32
33
|
"@exodus/web3-solana-utils": "^2.9.0",
|
|
33
34
|
"minimalistic-assert": "^1.0.1",
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"type": "git",
|
|
44
45
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "5acad66ba9ec02ffaee656516f72a24ff8a247fb"
|
|
47
48
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SolanaClarityMonitor, SolanaMonitor } from '@exodus/solana-api'
|
|
2
|
+
import assert from 'minimalistic-assert'
|
|
3
|
+
|
|
4
|
+
export const createHistoryMonitorFactory = ({
|
|
5
|
+
monitorType,
|
|
6
|
+
assetClientInterface,
|
|
7
|
+
interval,
|
|
8
|
+
shouldUpdateBalanceBeforeHistory,
|
|
9
|
+
ticksBetweenHistoryFetches,
|
|
10
|
+
ticksBetweenStakeFetches,
|
|
11
|
+
includeUnparsed,
|
|
12
|
+
api,
|
|
13
|
+
txsLimit,
|
|
14
|
+
}) => {
|
|
15
|
+
assert(assetClientInterface, 'expected assetClientInterface')
|
|
16
|
+
assert(monitorType, 'expected monitorType')
|
|
17
|
+
assert(interval, 'expected monitor interval')
|
|
18
|
+
assert(api, 'expected api server')
|
|
19
|
+
|
|
20
|
+
return (args) => {
|
|
21
|
+
let monitor
|
|
22
|
+
switch (monitorType) {
|
|
23
|
+
case 'clarity':
|
|
24
|
+
monitor = new SolanaClarityMonitor({
|
|
25
|
+
assetClientInterface,
|
|
26
|
+
interval,
|
|
27
|
+
shouldUpdateBalanceBeforeHistory,
|
|
28
|
+
ticksBetweenHistoryFetches,
|
|
29
|
+
ticksBetweenStakeFetches,
|
|
30
|
+
includeUnparsed,
|
|
31
|
+
api,
|
|
32
|
+
txsLimit,
|
|
33
|
+
...args,
|
|
34
|
+
})
|
|
35
|
+
break
|
|
36
|
+
case 'rpc':
|
|
37
|
+
monitor = new SolanaMonitor({
|
|
38
|
+
assetClientInterface,
|
|
39
|
+
interval,
|
|
40
|
+
shouldUpdateBalanceBeforeHistory,
|
|
41
|
+
ticksBetweenHistoryFetches,
|
|
42
|
+
ticksBetweenStakeFetches,
|
|
43
|
+
includeUnparsed,
|
|
44
|
+
api,
|
|
45
|
+
txsLimit,
|
|
46
|
+
...args,
|
|
47
|
+
})
|
|
48
|
+
break
|
|
49
|
+
default:
|
|
50
|
+
throw new Error(`Monitor type ${monitorType} of solana is unknown`)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return monitor
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/create-asset.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { connectAssetsList } from '@exodus/assets'
|
|
2
2
|
import bip44Constants from '@exodus/bip44-constants/by-ticker.js'
|
|
3
3
|
import {
|
|
4
|
+
Api,
|
|
5
|
+
ClarityApi,
|
|
4
6
|
createAccountState,
|
|
5
7
|
createAndBroadcastTXFactory,
|
|
8
|
+
createTxFactory,
|
|
9
|
+
feePayerClientFactory,
|
|
6
10
|
getBalancesFactory,
|
|
7
11
|
getFeeAsyncFactory,
|
|
8
12
|
isSolanaRewardsActivityTx,
|
|
9
|
-
SolanaMonitor,
|
|
10
13
|
} from '@exodus/solana-api'
|
|
11
14
|
import {
|
|
12
15
|
createFeeData,
|
|
@@ -23,6 +26,7 @@ import {
|
|
|
23
26
|
} from '@exodus/solana-lib'
|
|
24
27
|
import ms from 'ms'
|
|
25
28
|
|
|
29
|
+
import { createHistoryMonitorFactory } from './create-asset-utils.js'
|
|
26
30
|
import { createGetBalanceForAddress } from './get-balance-for-address.js'
|
|
27
31
|
import sendValidationsFactory from './send-validations.js'
|
|
28
32
|
import { createWeb3API } from './web3/index.js'
|
|
@@ -32,10 +36,11 @@ const DEFAULT_LOW_BALANCE = 0.01
|
|
|
32
36
|
const DEFAULT_MIN_STAKING_AMOUNT = 0.01
|
|
33
37
|
|
|
34
38
|
export const createSolanaAssetFactory =
|
|
35
|
-
({ assetList,
|
|
39
|
+
({ assetList, isTestnet = false }) =>
|
|
36
40
|
({
|
|
37
41
|
assetClientInterface,
|
|
38
42
|
config: {
|
|
43
|
+
monitorType = 'rpc', // 'rpc' | 'clarity'
|
|
39
44
|
stakingFeatureAvailable = true,
|
|
40
45
|
includeUnparsed = false,
|
|
41
46
|
allowSendingAll = true,
|
|
@@ -48,11 +53,13 @@ export const createSolanaAssetFactory =
|
|
|
48
53
|
ticksBetweenStakeFetches,
|
|
49
54
|
txsLimit,
|
|
50
55
|
signWithSigner = true,
|
|
51
|
-
feePayerApiUrl,
|
|
56
|
+
feePayerApiUrl, // @deprecated use feePayer instead
|
|
57
|
+
feePayer = Object.create(null),
|
|
52
58
|
} = {},
|
|
53
59
|
overrideCallback = ({ asset }) => asset,
|
|
54
60
|
} = {}) => {
|
|
55
61
|
const assets = connectAssetsList(assetList)
|
|
62
|
+
const serverApi = monitorType === 'clarity' ? new ClarityApi({ assets }) : new Api({ assets })
|
|
56
63
|
|
|
57
64
|
const { name: baseAssetName } = assetList.find((asset) => asset.baseAssetName === asset.name)
|
|
58
65
|
const base = assets[baseAssetName]
|
|
@@ -83,10 +90,26 @@ export const createSolanaAssetFactory =
|
|
|
83
90
|
|
|
84
91
|
const feeData = createFeeData({ asset: base })
|
|
85
92
|
|
|
93
|
+
let feePayerClient = null
|
|
94
|
+
feePayerApiUrl = feePayer.feePayerApiUrl ?? feePayerApiUrl
|
|
95
|
+
if (feePayerApiUrl) {
|
|
96
|
+
feePayerClient = feePayerClientFactory({
|
|
97
|
+
assetName: baseAssetName,
|
|
98
|
+
feePayerApiUrl,
|
|
99
|
+
requireAuthentication: true,
|
|
100
|
+
...feePayer,
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const createTx = createTxFactory({
|
|
105
|
+
assetClientInterface,
|
|
106
|
+
api: serverApi,
|
|
107
|
+
feePayerClient,
|
|
108
|
+
})
|
|
109
|
+
|
|
86
110
|
const sendTx = createAndBroadcastTXFactory({
|
|
87
111
|
api: serverApi,
|
|
88
112
|
assetClientInterface,
|
|
89
|
-
feePayerApiUrl,
|
|
90
113
|
})
|
|
91
114
|
|
|
92
115
|
const createToken = ({ mintAddress, name, ...tokenDef }) => ({
|
|
@@ -150,7 +173,7 @@ export const createSolanaAssetFactory =
|
|
|
150
173
|
return { fee, priorityFee }
|
|
151
174
|
}
|
|
152
175
|
|
|
153
|
-
const getFeeAsync = getFeeAsyncFactory({
|
|
176
|
+
const getFeeAsync = getFeeAsyncFactory({ createTx })
|
|
154
177
|
|
|
155
178
|
const sendValidations = sendValidationsFactory({
|
|
156
179
|
api: serverApi,
|
|
@@ -158,25 +181,27 @@ export const createSolanaAssetFactory =
|
|
|
158
181
|
assetClientInterface,
|
|
159
182
|
})
|
|
160
183
|
|
|
184
|
+
const createHistoryMonitor = createHistoryMonitorFactory({
|
|
185
|
+
monitorType,
|
|
186
|
+
assetClientInterface,
|
|
187
|
+
interval: monitorInterval,
|
|
188
|
+
shouldUpdateBalanceBeforeHistory,
|
|
189
|
+
ticksBetweenHistoryFetches,
|
|
190
|
+
ticksBetweenStakeFetches,
|
|
191
|
+
includeUnparsed,
|
|
192
|
+
api: serverApi,
|
|
193
|
+
txsLimit,
|
|
194
|
+
})
|
|
195
|
+
|
|
161
196
|
const api = {
|
|
162
197
|
getActivityTxs,
|
|
163
198
|
addressHasHistory: (...args) => serverApi.getAccountInfo(...args).then((acc) => !!acc),
|
|
164
199
|
broadcastTx: (...args) => serverApi.broadcastTransaction(...args),
|
|
165
200
|
createAccountState: () => SolanaAccountState,
|
|
166
|
-
createHistoryMonitor
|
|
167
|
-
new SolanaMonitor({
|
|
168
|
-
assetClientInterface,
|
|
169
|
-
interval: monitorInterval,
|
|
170
|
-
shouldUpdateBalanceBeforeHistory,
|
|
171
|
-
ticksBetweenHistoryFetches,
|
|
172
|
-
ticksBetweenStakeFetches,
|
|
173
|
-
includeUnparsed,
|
|
174
|
-
api: serverApi,
|
|
175
|
-
txsLimit,
|
|
176
|
-
...args,
|
|
177
|
-
}),
|
|
201
|
+
createHistoryMonitor,
|
|
178
202
|
createToken: (tokenDef) =>
|
|
179
203
|
tokenDef.isBuiltIn ? createToken(tokenDef) : createCustomToken(tokenDef),
|
|
204
|
+
createTx,
|
|
180
205
|
defaultAddressPath,
|
|
181
206
|
features,
|
|
182
207
|
getBalances,
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import serverApi from '@exodus/solana-api'
|
|
2
1
|
import assetList from '@exodus/solana-meta'
|
|
3
2
|
|
|
4
3
|
import { createSolanaAssetFactory } from './create-asset.js'
|
|
5
4
|
|
|
6
5
|
export * from './create-asset.js' // for solanatestnet and solanadevnet
|
|
7
6
|
|
|
8
|
-
const createAsset = createSolanaAssetFactory({ assetList
|
|
7
|
+
const createAsset = createSolanaAssetFactory({ assetList })
|
|
9
8
|
|
|
10
9
|
const defaultExport = { createAsset }
|
|
11
10
|
|