@exodus/solana-api 3.20.6 → 3.20.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 CHANGED
@@ -3,6 +3,16 @@
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.7](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.20.6...@exodus/solana-api@3.20.7) (2025-08-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix(solana): do not use coinAmount for staking txs (#6243)
13
+
14
+
15
+
6
16
  ## [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
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.20.6",
3
+ "version": "3.20.7",
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",
@@ -46,7 +46,7 @@
46
46
  "@exodus/assets-testing": "^1.0.0",
47
47
  "@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
48
48
  },
49
- "gitHead": "a7ce3c50e11f41e17cdf980d9ec0756c756beb93",
49
+ "gitHead": "baa995bca5eb4f7c45041158f680e6b8859996e8",
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
- }) // receiving
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-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
- const coinAmount =
66
- (isStakingTx ? amount?.abs() : selfSend ? asset.currency.ZERO : amount?.abs().negate()) ||
67
- asset.currency.ZERO
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: { ...txLogData.stakingParams, stake: coinAmount.toBaseNumber() },
80
+ staking: {
81
+ ...txLogData.stakingParams,
82
+ stake: coinAmount.toBaseNumber(),
83
+ },
73
84
  }
74
- } else {
75
- data = Object.create(null)
85
+ coinAmount = asset.currency.ZERO
76
86
  }
77
87
 
78
88
  const tx = {