@exodus/solana-plugin 1.24.5 → 1.24.7
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 +16 -0
- package/package.json +6 -5
- package/src/create-asset-utils.js +55 -0
- package/src/create-asset.js +19 -14
- package/src/index.js +1 -2
- package/src/send-validations.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.24.7](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.6...@exodus/solana-plugin@1.24.7) (2025-10-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/solana-plugin
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.24.6](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.5...@exodus/solana-plugin@1.24.6) (2025-09-29)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @exodus/solana-plugin
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.24.5](https://github.com/ExodusMovement/assets/compare/@exodus/solana-plugin@1.24.4...@exodus/solana-plugin@1.24.5) (2025-09-18)
|
|
7
23
|
|
|
8
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-plugin",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.7",
|
|
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.20.
|
|
30
|
-
"@exodus/solana-lib": "^3.
|
|
30
|
+
"@exodus/solana-api": "^3.20.9",
|
|
31
|
+
"@exodus/solana-lib": "^3.12.1",
|
|
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": "6237b0d98791ed9e6290260947068d2600bf8270"
|
|
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,13 @@
|
|
|
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,
|
|
6
8
|
getBalancesFactory,
|
|
7
9
|
getFeeAsyncFactory,
|
|
8
10
|
isSolanaRewardsActivityTx,
|
|
9
|
-
SolanaMonitor,
|
|
10
11
|
} from '@exodus/solana-api'
|
|
11
12
|
import {
|
|
12
13
|
createFeeData,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
} from '@exodus/solana-lib'
|
|
24
25
|
import ms from 'ms'
|
|
25
26
|
|
|
27
|
+
import { createHistoryMonitorFactory } from './create-asset-utils.js'
|
|
26
28
|
import { createGetBalanceForAddress } from './get-balance-for-address.js'
|
|
27
29
|
import sendValidationsFactory from './send-validations.js'
|
|
28
30
|
import { createWeb3API } from './web3/index.js'
|
|
@@ -32,10 +34,11 @@ const DEFAULT_LOW_BALANCE = 0.01
|
|
|
32
34
|
const DEFAULT_MIN_STAKING_AMOUNT = 0.01
|
|
33
35
|
|
|
34
36
|
export const createSolanaAssetFactory =
|
|
35
|
-
({ assetList,
|
|
37
|
+
({ assetList, isTestnet = false }) =>
|
|
36
38
|
({
|
|
37
39
|
assetClientInterface,
|
|
38
40
|
config: {
|
|
41
|
+
monitorType = 'rpc', // 'rpc' | 'clarity'
|
|
39
42
|
stakingFeatureAvailable = true,
|
|
40
43
|
includeUnparsed = false,
|
|
41
44
|
allowSendingAll = true,
|
|
@@ -53,6 +56,7 @@ export const createSolanaAssetFactory =
|
|
|
53
56
|
overrideCallback = ({ asset }) => asset,
|
|
54
57
|
} = {}) => {
|
|
55
58
|
const assets = connectAssetsList(assetList)
|
|
59
|
+
const serverApi = monitorType === 'clarity' ? new ClarityApi({ assets }) : new Api({ assets })
|
|
56
60
|
|
|
57
61
|
const { name: baseAssetName } = assetList.find((asset) => asset.baseAssetName === asset.name)
|
|
58
62
|
const base = assets[baseAssetName]
|
|
@@ -158,23 +162,24 @@ export const createSolanaAssetFactory =
|
|
|
158
162
|
assetClientInterface,
|
|
159
163
|
})
|
|
160
164
|
|
|
165
|
+
const createHistoryMonitor = createHistoryMonitorFactory({
|
|
166
|
+
monitorType,
|
|
167
|
+
assetClientInterface,
|
|
168
|
+
interval: monitorInterval,
|
|
169
|
+
shouldUpdateBalanceBeforeHistory,
|
|
170
|
+
ticksBetweenHistoryFetches,
|
|
171
|
+
ticksBetweenStakeFetches,
|
|
172
|
+
includeUnparsed,
|
|
173
|
+
api: serverApi,
|
|
174
|
+
txsLimit,
|
|
175
|
+
})
|
|
176
|
+
|
|
161
177
|
const api = {
|
|
162
178
|
getActivityTxs,
|
|
163
179
|
addressHasHistory: (...args) => serverApi.getAccountInfo(...args).then((acc) => !!acc),
|
|
164
180
|
broadcastTx: (...args) => serverApi.broadcastTransaction(...args),
|
|
165
181
|
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
|
-
}),
|
|
182
|
+
createHistoryMonitor,
|
|
178
183
|
createToken: (tokenDef) =>
|
|
179
184
|
tokenDef.isBuiltIn ? createToken(tokenDef) : createCustomToken(tokenDef),
|
|
180
185
|
defaultAddressPath,
|
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
|
|
package/src/send-validations.js
CHANGED
|
@@ -71,7 +71,7 @@ const sendValidationsFactory = ({ api, assetName, assetClientInterface }) => {
|
|
|
71
71
|
id: 'SOL_RENT_EXEMPT_AMOUNT',
|
|
72
72
|
type: VALIDATION_TYPES.ERROR,
|
|
73
73
|
shouldValidate: ({ asset, sendAmount }) => sendAmount,
|
|
74
|
-
isValid: async ({ asset, destinationAddress, sendAmount, baseAssetBalance,
|
|
74
|
+
isValid: async ({ asset, destinationAddress, sendAmount, baseAssetBalance, fees }) => {
|
|
75
75
|
if (!destinationAddress || !sendAmount || sendAmount.isZero) {
|
|
76
76
|
return true
|
|
77
77
|
}
|
|
@@ -87,7 +87,7 @@ const sendValidationsFactory = ({ api, assetName, assetClientInterface }) => {
|
|
|
87
87
|
} else {
|
|
88
88
|
// sending token
|
|
89
89
|
isEnoughForRent = baseAssetBalance
|
|
90
|
-
.sub(
|
|
90
|
+
.sub(fees?.fee || asset.feeAsset.currency.ZERO)
|
|
91
91
|
.gte(rentExemptAmount)
|
|
92
92
|
}
|
|
93
93
|
|