@exodus/solana-api 3.17.3 → 3.18.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 +26 -0
- package/package.json +2 -2
- package/src/create-unsigned-tx-for-send.js +8 -6
- package/src/index.js +1 -1
- package/src/staking-utils.js +0 -17
- package/src/tx-log/solana-monitor.js +3 -2
- package/src/tx-send.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.18.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.17.4...@exodus/solana-api@3.18.0) (2025-05-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat(solana): make shouldUpdateBalanceBeforeHistory configurable (#5544)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* fix: SOL staking regression (#5539)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.17.4](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.17.3...@exodus/solana-api@3.17.4) (2025-04-25)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* fix(solana): don't throw for rent when we add a fee payer (#5501)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
## [3.17.3](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.17.2...@exodus/solana-api@3.17.3) (2025-04-23)
|
|
7
33
|
|
|
8
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@exodus/assets-testing": "^1.0.0",
|
|
48
48
|
"@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "74fe0904cd863e2674e4c2e705a2e8624a8a92be",
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
53
53
|
},
|
|
@@ -218,17 +218,19 @@ export const createUnsignedTxForSend = async ({
|
|
|
218
218
|
.gte(rentExemptAmount)
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
const tx = await maybeAddFeePayer({
|
|
222
|
+
unsignedTx,
|
|
223
|
+
feePayerApiUrl,
|
|
224
|
+
assetName: asset.baseAsset.name,
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
if (!isEnoughForRent && !tx.txMeta.usedFeePayer) {
|
|
222
228
|
const err = new Error('Sending SOL amount is too low to cover the rent exemption fee.')
|
|
223
229
|
err.rentExemptAmount = true
|
|
224
230
|
throw err
|
|
225
231
|
}
|
|
226
232
|
|
|
227
|
-
return
|
|
228
|
-
unsignedTx,
|
|
229
|
-
feePayerApiUrl,
|
|
230
|
-
assetName: asset.baseAsset.name,
|
|
231
|
-
})
|
|
233
|
+
return tx
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
export const extractTxLogData = async ({ unsignedTx, api }) => {
|
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Api } from './api.js'
|
|
|
6
6
|
|
|
7
7
|
export { SolanaMonitor } from './tx-log/index.js'
|
|
8
8
|
export { createAccountState } from './account-state.js'
|
|
9
|
-
export {
|
|
9
|
+
export { getStakingInfo } from './staking-utils.js'
|
|
10
10
|
export {
|
|
11
11
|
isSolanaStaking,
|
|
12
12
|
isSolanaUnstaking,
|
package/src/staking-utils.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates pending Fee for stake-able asset
|
|
3
|
-
* @param {Object} stakingInfo solana staking information object
|
|
4
|
-
* @param {Object} fee solana asset fee
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export const getSolStakedFee = ({ asset, stakingInfo, fee }) => {
|
|
8
|
-
const { currency } = asset
|
|
9
|
-
const { accounts } = stakingInfo
|
|
10
|
-
|
|
11
|
-
// TODO: REMOVE this method.. only used in Desktop!
|
|
12
|
-
// (also this is wrong, accounts must be filtered by state to compute the right fee)
|
|
13
|
-
|
|
14
|
-
const allPending = Object.entries(accounts).length
|
|
15
|
-
return allPending > 0 ? fee.mul(allPending) : currency.ZERO
|
|
16
|
-
}
|
|
17
|
-
|
|
18
1
|
export const getStakingInfo = (stakingInfo) => {
|
|
19
2
|
return {
|
|
20
3
|
loaded: stakingInfo.loaded,
|
|
@@ -23,6 +23,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
23
23
|
ticksBetweenHistoryFetches = TICKS_BETWEEN_HISTORY_FETCHES,
|
|
24
24
|
ticksBetweenStakeFetches = TICKS_BETWEEN_STAKE_FETCHES,
|
|
25
25
|
txsLimit,
|
|
26
|
+
shouldUpdateBalanceBeforeHistory = true,
|
|
26
27
|
...args
|
|
27
28
|
}) {
|
|
28
29
|
super(args)
|
|
@@ -33,6 +34,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
33
34
|
this.staking = DEFAULT_REMOTE_CONFIG.staking
|
|
34
35
|
this.ticksBetweenStakeFetches = ticksBetweenStakeFetches
|
|
35
36
|
this.ticksBetweenHistoryFetches = ticksBetweenHistoryFetches
|
|
37
|
+
this.shouldUpdateBalanceBeforeHistory = shouldUpdateBalanceBeforeHistory
|
|
36
38
|
this.includeUnparsed = includeUnparsed
|
|
37
39
|
this.txsLimit = txsLimit
|
|
38
40
|
this.addHook('before-stop', (...args) => this.beforeStop(...args))
|
|
@@ -167,10 +169,9 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
167
169
|
|
|
168
170
|
const shouldUpdateHistory = refresh || isHistoryUpdateTick || balanceChanged
|
|
169
171
|
const shouldUpdateOnlyBalance = balanceChanged && !shouldUpdateHistory
|
|
170
|
-
const shouldUpdateBalanceBeforeHistory = true
|
|
171
172
|
|
|
172
173
|
// getHistory is more likely to fail/be rate limited, so we want to update users balance only on a lot of ticks
|
|
173
|
-
if (shouldUpdateBalanceBeforeHistory || shouldUpdateOnlyBalance) {
|
|
174
|
+
if (this.shouldUpdateBalanceBeforeHistory || shouldUpdateOnlyBalance) {
|
|
174
175
|
// update all state at once
|
|
175
176
|
await this.updateState({ account, walletAccount, staking })
|
|
176
177
|
await this.emitUnknownTokensEvent({ tokenAccounts })
|
package/src/tx-send.js
CHANGED
|
@@ -69,8 +69,7 @@ export const createAndBroadcastTXFactory =
|
|
|
69
69
|
let data
|
|
70
70
|
if (isStakingTx) {
|
|
71
71
|
data = {
|
|
72
|
-
...txLogData.stakingParams,
|
|
73
|
-
stake: coinAmount.toBaseNumber(),
|
|
72
|
+
staking: { ...txLogData.stakingParams, stake: coinAmount.toBaseNumber() },
|
|
74
73
|
}
|
|
75
74
|
} else {
|
|
76
75
|
data = Object.create(null)
|