@exodus/solana-api 3.24.1 → 3.25.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 +20 -0
- package/package.json +2 -2
- package/src/create-unsigned-tx-for-send.js +25 -22
- package/src/get-fees.js +4 -4
- package/src/tx-log/clarity-monitor.js +18 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.25.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.25.0...@exodus/solana-api@3.25.1) (2025-11-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix(SOL): Fix mint address key mapping in clarity monitor balance aggregation (#6839)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.25.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.24.1...@exodus/solana-api@3.25.0) (2025-10-30)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* feat: Solana skip rent validation when usedFeePayer and update fee check logic (#6797)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.24.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.24.0...@exodus/solana-api@3.24.1) (2025-10-29)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.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",
|
|
@@ -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": "a87798a8db1f3ffceb94684a842f22b35025d549",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
55
55
|
},
|
|
@@ -296,36 +296,39 @@ export const createTxFactory = ({ assetClientInterface, api, feePayerClient }) =
|
|
|
296
296
|
)
|
|
297
297
|
.add(tokenCreationFee)
|
|
298
298
|
|
|
299
|
-
// serialization friendlier
|
|
300
299
|
unsignedTx.txMeta.fee = fee.toBaseNumber()
|
|
301
300
|
|
|
302
|
-
const rentExemptValue = await api.getRentExemptionMinAmount(toAddress)
|
|
303
|
-
const rentExemptAmount = baseAsset.currency.baseUnit(rentExemptValue)
|
|
304
|
-
|
|
305
|
-
// differentiate between SOL and Solana token
|
|
306
|
-
let isEnoughForRent = false
|
|
307
|
-
if (asset.name === baseAsset.name && !nft) {
|
|
308
|
-
// sending SOL
|
|
309
|
-
isEnoughForRent = amount.gte(rentExemptAmount)
|
|
310
|
-
} else {
|
|
311
|
-
// sending token/nft
|
|
312
|
-
const baseAssetBalance = await api.getBalance(fromAddress)
|
|
313
|
-
isEnoughForRent = baseAsset.currency
|
|
314
|
-
.baseUnit(baseAssetBalance)
|
|
315
|
-
.sub(fee || asset.feeAsset.currency.ZERO)
|
|
316
|
-
.gte(rentExemptAmount)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
301
|
const tx = await maybeAddFeePayerWithAuth({
|
|
320
302
|
unsignedTx,
|
|
321
303
|
feePayerClient,
|
|
322
304
|
enableFeePayer: feeData.enableFeePayer,
|
|
323
305
|
})
|
|
324
306
|
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
307
|
+
if (tx.txMeta.usedFeePayer) {
|
|
308
|
+
tx.txMeta.fee = asset.feeAsset.currency.ZERO
|
|
309
|
+
} else {
|
|
310
|
+
const rentExemptValue = await api.getRentExemptionMinAmount(toAddress)
|
|
311
|
+
const rentExemptAmount = baseAsset.currency.baseUnit(rentExemptValue)
|
|
312
|
+
|
|
313
|
+
// differentiate between SOL and Solana token
|
|
314
|
+
let isEnoughForRent = false
|
|
315
|
+
if (asset.name === baseAsset.name && !nft) {
|
|
316
|
+
// sending SOL
|
|
317
|
+
isEnoughForRent = amount.gte(rentExemptAmount)
|
|
318
|
+
} else {
|
|
319
|
+
// sending token/nft
|
|
320
|
+
const baseAssetBalance = await api.getBalance(fromAddress)
|
|
321
|
+
isEnoughForRent = baseAsset.currency
|
|
322
|
+
.baseUnit(baseAssetBalance)
|
|
323
|
+
.sub(fee || asset.feeAsset.currency.ZERO)
|
|
324
|
+
.gte(rentExemptAmount)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (!isEnoughForRent) {
|
|
328
|
+
const err = new Error('Sending SOL amount is too low to cover the rent exemption fee.')
|
|
329
|
+
err.rentExemptAmount = true
|
|
330
|
+
throw err
|
|
331
|
+
}
|
|
329
332
|
}
|
|
330
333
|
|
|
331
334
|
return tx
|
package/src/get-fees.js
CHANGED
|
@@ -64,15 +64,15 @@ export const getFeeAsyncFactory = ({ createTx }) => {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
if (unsignedTx?.txMeta?.fee) {
|
|
67
|
+
if (unsignedTx?.txMeta?.fee === undefined) {
|
|
68
|
+
fee = asset.feeAsset.currency.defaultUnit(DEFAULT_SAFE_FEE)
|
|
69
|
+
} else {
|
|
68
70
|
fee = unsignedTx.txMeta.usedFeePayer
|
|
69
71
|
? asset.feeAsset.currency.ZERO
|
|
70
72
|
: asset.feeAsset.currency.baseUnit(unsignedTx.txMeta.fee)
|
|
71
|
-
} else {
|
|
72
|
-
fee = asset.feeAsset.currency.defaultUnit(DEFAULT_SAFE_FEE)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
return { fee, unsignedTx }
|
|
75
|
+
return { fee, unsignedTx, usedFeePayer: unsignedTx?.txMeta?.usedFeePayer }
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -298,12 +298,9 @@ export class SolanaClarityMonitor extends BaseMonitor {
|
|
|
298
298
|
} else {
|
|
299
299
|
delegatedBalances[mintAddress] = fullBalanceCurrency
|
|
300
300
|
}
|
|
301
|
-
}
|
|
302
301
|
|
|
303
|
-
// Store delegated amounts separately for the account state
|
|
304
|
-
if (this.assets[tokenName]) {
|
|
305
302
|
const delegatedAmountCurrency = this.assets[tokenName].currency.baseUnit(delegatedAmount)
|
|
306
|
-
if (!delegatedAmountCurrency.
|
|
303
|
+
if (!delegatedAmountCurrency.equals(this.assets[tokenName].currency.ZERO)) {
|
|
307
304
|
if (!delegatedTokenAmounts[tokenName]) {
|
|
308
305
|
delegatedTokenAmounts[tokenName] = {}
|
|
309
306
|
}
|
|
@@ -316,8 +313,23 @@ export class SolanaClarityMonitor extends BaseMonitor {
|
|
|
316
313
|
}
|
|
317
314
|
}
|
|
318
315
|
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
const combinedBalances = {}
|
|
317
|
+
|
|
318
|
+
const tokenNameToMintAddress = {}
|
|
319
|
+
for (const account of ownedTokenAccounts || []) {
|
|
320
|
+
if (account.tokenName && account.mintAddress) {
|
|
321
|
+
tokenNameToMintAddress[account.tokenName] = account.mintAddress
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
for (const [tokenName, balance] of Object.entries(splBalances)) {
|
|
326
|
+
const mintAddress = tokenNameToMintAddress[tokenName]
|
|
327
|
+
|
|
328
|
+
if (mintAddress) {
|
|
329
|
+
combinedBalances[mintAddress] = balance
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
321
333
|
for (const [mintAddress, delegatedBalanceCurrency] of Object.entries(delegatedBalances)) {
|
|
322
334
|
const tokenName = this.api.tokens.get(mintAddress)?.name
|
|
323
335
|
if (tokenName && this.assets[tokenName]) {
|