@exodus/solana-api 3.20.6 → 3.20.8
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 +3 -3
- package/src/api.js +10 -4
- package/src/connection.js +3 -1
- package/src/create-unsigned-tx-for-send.js +2 -1
- package/src/get-balances.js +2 -1
- package/src/get-fees.js +2 -1
- package/src/get-stake-activation/index.js +2 -1
- package/src/tx-send.js +17 -7
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.20.8](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.7...@exodus/solana-api@3.20.8) (2025-09-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: SOL coinAmount for staking (regression) (#6476)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.20.7](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.6...@exodus/solana-api@3.20.7) (2025-08-12)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix(solana): do not use coinAmount for staking txs (#6243)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.20.6](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.5...@exodus/solana-api@3.20.6) (2025-07-18)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.8",
|
|
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.2.0",
|
|
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": "b94e40bcbccd75eab27cd08988ea039a597b0c42",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
52
52
|
},
|
package/src/api.js
CHANGED
|
@@ -795,8 +795,9 @@ export class Api {
|
|
|
795
795
|
preTokenBalances.length === 0 &&
|
|
796
796
|
postTokenBalances.length === 0 &&
|
|
797
797
|
!Array.isArray(tokenAccountsByOwner)
|
|
798
|
-
)
|
|
798
|
+
) {
|
|
799
799
|
return []
|
|
800
|
+
}
|
|
800
801
|
|
|
801
802
|
const tokenTxs = []
|
|
802
803
|
|
|
@@ -806,10 +807,13 @@ export class Api {
|
|
|
806
807
|
if (isSplTransferInstruction({ program, type })) {
|
|
807
808
|
let tokenAccount = lodash.find(tokenAccountsByOwner, { tokenAccountAddress: source })
|
|
808
809
|
const isSending = !!tokenAccount
|
|
809
|
-
if (!isSending)
|
|
810
|
+
if (!isSending) {
|
|
811
|
+
// receiving
|
|
810
812
|
tokenAccount = lodash.find(tokenAccountsByOwner, {
|
|
811
813
|
tokenAccountAddress: destination,
|
|
812
|
-
})
|
|
814
|
+
})
|
|
815
|
+
}
|
|
816
|
+
|
|
813
817
|
if (!tokenAccount) return // no transfers with our addresses involved
|
|
814
818
|
|
|
815
819
|
const owner = isSending ? ownerAddress : null
|
|
@@ -966,8 +970,10 @@ export class Api {
|
|
|
966
970
|
if (
|
|
967
971
|
tokenName === 'unknown' ||
|
|
968
972
|
(filterByTokens.length > 0 && !filterByTokens.includes(tokenName))
|
|
969
|
-
)
|
|
973
|
+
) {
|
|
970
974
|
return acc // filter by supported tokens only
|
|
975
|
+
}
|
|
976
|
+
|
|
971
977
|
if (acc[tokenName]) {
|
|
972
978
|
acc[tokenName] += Number(balance)
|
|
973
979
|
}
|
package/src/connection.js
CHANGED
|
@@ -54,8 +54,10 @@ export class Connection {
|
|
|
54
54
|
console.log(`solana ws: reply timeout (${method}) - ${JSON.stringify(params)} - ${id}`)
|
|
55
55
|
resolve(null)
|
|
56
56
|
}, TIMEOUT)
|
|
57
|
-
if (typeof this.rpcQueue[id].timeout.unref === 'function')
|
|
57
|
+
if (typeof this.rpcQueue[id].timeout.unref === 'function') {
|
|
58
58
|
this.rpcQueue[id].timeout.unref()
|
|
59
|
+
}
|
|
60
|
+
|
|
59
61
|
this.ws.send(JSON.stringify({ jsonrpc: '2.0', method, params, id }))
|
|
60
62
|
})
|
|
61
63
|
},
|
|
@@ -254,7 +254,7 @@ export const createUnsignedTxForSend = async ({
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
export const extractTxLogData = async ({ unsignedTx, api }) => {
|
|
257
|
-
if (!unsignedTx.txData.transactionBuffer)
|
|
257
|
+
if (!unsignedTx.txData.transactionBuffer) {
|
|
258
258
|
return {
|
|
259
259
|
method: unsignedTx.txData.method,
|
|
260
260
|
from: unsignedTx.txData.from,
|
|
@@ -264,6 +264,7 @@ export const extractTxLogData = async ({ unsignedTx, api }) => {
|
|
|
264
264
|
usedFeePayer: unsignedTx.txMeta.usedFeePayer,
|
|
265
265
|
fee: unsignedTx.txMeta.fee,
|
|
266
266
|
}
|
|
267
|
+
}
|
|
267
268
|
|
|
268
269
|
const txData = await parseTxBuffer(unsignedTx.txData.transactionBuffer, api)
|
|
269
270
|
return {
|
package/src/get-balances.js
CHANGED
|
@@ -109,7 +109,8 @@ const fixBalances = ({
|
|
|
109
109
|
// staking tx
|
|
110
110
|
switch (tx.data.staking?.method) {
|
|
111
111
|
case 'delegate':
|
|
112
|
-
|
|
112
|
+
const stakeAmount = asset.currency.baseUnit(tx.data.staking?.stake || '0')
|
|
113
|
+
activating = activating.add(stakeAmount.abs())
|
|
113
114
|
break
|
|
114
115
|
case 'withdraw':
|
|
115
116
|
withdrawable = asset.currency.ZERO
|
package/src/get-fees.js
CHANGED
|
@@ -35,8 +35,9 @@ export const getFeeAsyncFactory = ({ api }) => {
|
|
|
35
35
|
|
|
36
36
|
const stakeAddresses = []
|
|
37
37
|
for (const [addr, info] of Object.entries(stakingInfo.accounts || {})) {
|
|
38
|
-
if (method === 'undelegate' && (info.state === 'active' || info.state === 'activating'))
|
|
38
|
+
if (method === 'undelegate' && (info.state === 'active' || info.state === 'activating')) {
|
|
39
39
|
stakeAddresses.push(addr)
|
|
40
|
+
}
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
rest.stakeAddresses = stakeAddresses
|
|
@@ -21,12 +21,13 @@ export async function getStakeActivation(api, stakeAddress) {
|
|
|
21
21
|
})(),
|
|
22
22
|
])
|
|
23
23
|
|
|
24
|
-
if (!stakeAccount)
|
|
24
|
+
if (!stakeAccount) {
|
|
25
25
|
return {
|
|
26
26
|
status: 'inactive',
|
|
27
27
|
active: 0,
|
|
28
28
|
inactive: 0,
|
|
29
29
|
}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
32
|
const rentExemptReserve = stakeAccount.data.parsed.info.meta.rentExemptReserve
|
|
32
33
|
if (stakeAccount.data.parsed.discriminant === 1) {
|
package/src/tx-send.js
CHANGED
|
@@ -62,17 +62,27 @@ export const createAndBroadcastTXFactory =
|
|
|
62
62
|
: asset.feeAsset.currency.baseUnit(txLogData.fee)
|
|
63
63
|
|
|
64
64
|
const isStakingTx = ['delegate', 'undelegate', 'withdraw'].includes(method)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
let coinAmount = asset.currency.ZERO
|
|
66
|
+
|
|
67
|
+
if (amount) {
|
|
68
|
+
const absoluteAmount = amount.abs()
|
|
69
|
+
if (isStakingTx) {
|
|
70
|
+
coinAmount = absoluteAmount
|
|
71
|
+
} else if (!selfSend) {
|
|
72
|
+
coinAmount = absoluteAmount.negate()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let data = Object.create(null)
|
|
68
77
|
|
|
69
|
-
let data
|
|
70
78
|
if (isStakingTx) {
|
|
71
79
|
data = {
|
|
72
|
-
staking: {
|
|
80
|
+
staking: {
|
|
81
|
+
...txLogData.stakingParams,
|
|
82
|
+
stake: coinAmount.toBaseNumber(),
|
|
83
|
+
},
|
|
73
84
|
}
|
|
74
|
-
|
|
75
|
-
data = Object.create(null)
|
|
85
|
+
coinAmount = asset.currency.ZERO
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
const tx = {
|