@exodus/solana-api 3.20.3 → 3.20.5
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 +22 -0
- package/package.json +3 -3
- package/src/create-unsigned-tx-for-send.js +18 -6
- package/src/tx-log/solana-monitor.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.20.5](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.4...@exodus/solana-api@3.20.5) (2025-07-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: catch SOL rewards endpoint error (#6055)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.20.4](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.3...@exodus/solana-api@3.20.4) (2025-07-01)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix: add token creation fee for new token account (#5977)
|
|
23
|
+
|
|
24
|
+
* fix: remove unused gradientCoords from meta and validation (#5937)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [3.20.3](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.2...@exodus/solana-api@3.20.3) (2025-06-25)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.5",
|
|
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",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"url-join": "^4.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@exodus/asset": "^2.0.
|
|
45
|
+
"@exodus/asset": "^2.0.3",
|
|
46
46
|
"@exodus/assets-testing": "^1.0.0",
|
|
47
47
|
"@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a9e60de2523a51767c196be24865fa9d0bde7629",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
52
52
|
},
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import assert from 'minimalistic-assert'
|
|
13
13
|
|
|
14
14
|
const CU_FOR_COMPUTE_BUDGET_INSTRUCTIONS = 300
|
|
15
|
+
const TOKEN_ACCOUNT_CREATION_SIZE = 165 // size of the token account
|
|
15
16
|
|
|
16
17
|
export const createUnsignedTxForSend = async ({
|
|
17
18
|
api,
|
|
@@ -47,6 +48,7 @@ export const createUnsignedTxForSend = async ({
|
|
|
47
48
|
metadataAddress,
|
|
48
49
|
creators,
|
|
49
50
|
// </MagicEden>
|
|
51
|
+
isExchange,
|
|
50
52
|
}) => {
|
|
51
53
|
assert(api, 'api is required')
|
|
52
54
|
assert(asset, 'asset is required')
|
|
@@ -199,12 +201,22 @@ export const createUnsignedTxForSend = async ({
|
|
|
199
201
|
|
|
200
202
|
unsignedTx.txMeta.stakingParams = stakingParams
|
|
201
203
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.
|
|
207
|
-
|
|
204
|
+
// we add token account creation fee
|
|
205
|
+
let tokenCreationFee = asset.feeAsset.currency.ZERO
|
|
206
|
+
if (isToken && (!unsignedTx.txData.isAssociatedTokenAccountActive || isExchange)) {
|
|
207
|
+
tokenCreationFee = asset.feeAsset.currency.baseUnit(
|
|
208
|
+
await api.getMinimumBalanceForRentExemption(TOKEN_ACCOUNT_CREATION_SIZE)
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const fee = feeData.baseFee
|
|
213
|
+
.add(
|
|
214
|
+
asset.feeAsset.currency
|
|
215
|
+
.baseUnit(unsignedTx.txData.priorityFee ?? 0)
|
|
216
|
+
.mul(unsignedTx.txData.computeUnits ?? 0)
|
|
217
|
+
.div(1_000_000) // micro lamports to lamports
|
|
218
|
+
)
|
|
219
|
+
.add(tokenCreationFee)
|
|
208
220
|
|
|
209
221
|
// serialization friendlier
|
|
210
222
|
unsignedTx.txMeta.fee = fee.toBaseNumber()
|
|
@@ -325,7 +325,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
325
325
|
|
|
326
326
|
const staking =
|
|
327
327
|
this.isStakingEnabled() && fetchStakingInfo
|
|
328
|
-
? await this.getStakingInfo({ address, walletAccount })
|
|
328
|
+
? await this.getStakingInfo({ address, accountState, walletAccount })
|
|
329
329
|
: { ...accountState.stakingInfo, staking: this.staking }
|
|
330
330
|
|
|
331
331
|
const stakedBalance = this.asset.currency.baseUnit(staking.locked)
|
|
@@ -366,9 +366,15 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
366
366
|
return this.updateAccountState({ newData, walletAccount })
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
async getStakingInfo({ address, walletAccount }) {
|
|
369
|
+
async getStakingInfo({ address, accountState, walletAccount }) {
|
|
370
370
|
const stakingInfo = await this.api.getStakeAccountsInfo(address)
|
|
371
|
-
|
|
371
|
+
let earned = accountState.stakingInfo.earned.toBaseString()
|
|
372
|
+
try {
|
|
373
|
+
const rewards = await this.api.getRewards(address)
|
|
374
|
+
earned = rewards
|
|
375
|
+
} catch (error) {
|
|
376
|
+
console.warn(error)
|
|
377
|
+
}
|
|
372
378
|
|
|
373
379
|
return {
|
|
374
380
|
loaded: true,
|
|
@@ -380,7 +386,7 @@ export class SolanaMonitor extends BaseMonitor {
|
|
|
380
386
|
activating: this.asset.currency.baseUnit(stakingInfo.activating),
|
|
381
387
|
withdrawable: this.asset.currency.baseUnit(stakingInfo.withdrawable),
|
|
382
388
|
pending: this.asset.currency.baseUnit(stakingInfo.pending), // still undelegating (not yet available for withdraw)
|
|
383
|
-
earned: this.asset.currency.baseUnit(
|
|
389
|
+
earned: this.asset.currency.baseUnit(earned),
|
|
384
390
|
accounts: stakingInfo.accounts, // Obj
|
|
385
391
|
}
|
|
386
392
|
}
|