@exodus/solana-api 3.18.0 → 3.18.2

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,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.18.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.18.1...@exodus/solana-api@3.18.2) (2025-05-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: throw only if unitsConsumed is not returned (#5561)
13
+
14
+
15
+
16
+ ## [3.18.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.18.0...@exodus/solana-api@3.18.1) (2025-05-05)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: SOL reserve and units consumed (#5540)
23
+
24
+
25
+
6
26
  ## [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
27
 
8
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.18.0",
3
+ "version": "3.18.2",
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": "74fe0904cd863e2674e4c2e705a2e8624a8a92be",
50
+ "gitHead": "dcfc8ac65a86aad50baf92955a8cf18c0e641c4d",
51
51
  "bugs": {
52
52
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
53
53
  },
@@ -30,6 +30,7 @@ export const createUnsignedTxForSend = async ({
30
30
  // staking
31
31
  method,
32
32
  stakeAddresses,
33
+ accounts,
33
34
  seed,
34
35
  pool,
35
36
  // <MagicEden>
@@ -119,6 +120,7 @@ export const createUnsignedTxForSend = async ({
119
120
  const stakingParams = {
120
121
  method,
121
122
  stakeAddresses,
123
+ accounts,
122
124
  seed,
123
125
  pool,
124
126
  }
@@ -173,8 +175,10 @@ export const createUnsignedTxForSend = async ({
173
175
  message,
174
176
  })
175
177
  if (err) {
176
- // we don't throw error here, because we can use this method to estimate fee
177
- console.log('SOL estimate unitsConsumed err:', JSON.stringify(err))
178
+ // we use this method to compute unitsConsumed
179
+ // we can throw error here and fallback to ~0.025 SOL or estimate fee based on the method
180
+ console.log('error getting units consumed:', err)
181
+ if (!unitsConsumed) throw new Error(err)
178
182
  }
179
183
 
180
184
  return unitsConsumed + CU_FOR_COMPUTE_BUDGET_INSTRUCTIONS
package/src/get-fees.js CHANGED
@@ -3,7 +3,7 @@ import assert from 'minimalistic-assert'
3
3
 
4
4
  import { createUnsignedTxForSend } from './create-unsigned-tx-for-send.js'
5
5
 
6
- const DEFAULT_RESERVE_FEE = '0.01' // SOL
6
+ const DEFAULT_SAFE_FEE = '0.0025' // SOL (enough for rent exemption)
7
7
 
8
8
  export const getFeeAsyncFactory = ({ api }) => {
9
9
  assert(api, 'api is required')
@@ -37,16 +37,18 @@ export const getFeeAsyncFactory = ({ api }) => {
37
37
  for (const [addr, info] of Object.entries(stakingInfo.accounts || {})) {
38
38
  if (method === 'undelegate' && (info.state === 'active' || info.state === 'activating'))
39
39
  stakeAddresses.push(addr)
40
- if (method === 'withdraw' && info.state === 'inactive') stakeAddresses.push(addr)
41
40
  }
42
41
 
43
42
  rest.stakeAddresses = stakeAddresses
43
+ rest.accounts = stakingInfo.accounts
44
+
44
45
  amount =
45
46
  method === 'undelegate'
46
47
  ? stakingInfo.locked // unstake all
47
48
  : method === 'withdraw'
48
49
  ? stakingInfo.withdrawable // withdraw all
49
50
  : amount
51
+ // withdraw won't use amount, will extract it from accounts
50
52
  }
51
53
 
52
54
  try {
@@ -64,7 +66,8 @@ export const getFeeAsyncFactory = ({ api }) => {
64
66
  } catch (err) {
65
67
  console.log('error computing right SOL fee:', err)
66
68
  // simulating a tx will fail if the user has not enough balance
67
- fee = asset.feeAsset.currency.defaultUnit(DEFAULT_RESERVE_FEE)
69
+ // we fallback to a default fee (but we could leave some dust)
70
+ fee = asset.feeAsset.currency.defaultUnit(DEFAULT_SAFE_FEE)
68
71
  }
69
72
  }
70
73