@exodus/solana-api 3.13.4 → 3.13.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 CHANGED
@@ -3,6 +3,20 @@
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.13.5](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.13.4...@exodus/solana-api@3.13.5) (2025-02-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: check ATA address ownership change (#4865)
13
+
14
+ * fix: retry when getSignaturesForAddress (#4979)
15
+
16
+ * fix: SOL integration tests (#4980)
17
+
18
+
19
+
6
20
  ## [3.13.4](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.13.3...@exodus/solana-api@3.13.4) (2025-01-22)
7
21
 
8
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.13.4",
3
+ "version": "3.13.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",
@@ -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": "c02457a2ad2142debd460a2b2263e84a2d8748a8",
50
+ "gitHead": "84efbc1abdb6e85b5250a304cbea2e7d76d11501",
51
51
  "bugs": {
52
52
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
53
53
  },
package/src/api.js CHANGED
@@ -32,6 +32,11 @@ const RPC_URL = 'https://solana.a.exodus.io' // https://vip-api.mainnet-beta.sol
32
32
  const WS_ENDPOINT = 'wss://solana.a.exodus.io/ws' // not standard across all node providers (we're compatible only with Quicknode)
33
33
  const FORCE_HTTP = true // use https over ws
34
34
 
35
+ const errorMessagesToRetry = [
36
+ 'Blockhash not found',
37
+ 'Failed to query long-term storage; please try again',
38
+ ]
39
+
35
40
  // Tokens + SOL api support
36
41
  export class Api {
37
42
  constructor({ rpcUrl, wsUrl, assets, txsLimit, tokenAssetType = 'SOLANA_TOKEN' }) {
@@ -206,7 +211,30 @@ export class Api {
206
211
 
207
212
  async getSignaturesForAddress(address, { until, before, limit } = {}) {
208
213
  until = until || undefined
209
- return this.rpcCall('getSignaturesForAddress', [address, { until, before, limit }], { address })
214
+
215
+ const fetchRetry = retry(
216
+ async () => {
217
+ try {
218
+ return this.rpcCall('getSignaturesForAddress', [address, { until, before, limit }], {
219
+ address,
220
+ })
221
+ } catch (error) {
222
+ if (
223
+ error.message &&
224
+ !errorMessagesToRetry.some((errorMessage) => error.message.includes(errorMessage))
225
+ ) {
226
+ error.finalError = true
227
+ }
228
+
229
+ console.warn(`Error getting signatures. Retrying...`, error)
230
+
231
+ throw error
232
+ }
233
+ },
234
+ { delayTimesMs: ['8s', '10s', '15s'] }
235
+ )
236
+
237
+ return fetchRetry()
210
238
  }
211
239
 
212
240
  /**
@@ -790,6 +818,12 @@ export class Api {
790
818
  }
791
819
  }
792
820
 
821
+ async ataOwnershipChanged(address, tokenAddress) {
822
+ const value = await this.getAccountInfo(tokenAddress)
823
+ const owner = value?.data?.parsed?.info?.owner
824
+ return owner && owner !== address
825
+ }
826
+
793
827
  // Returns account balance of a SPL Token account.
794
828
  async getTokenBalance(tokenAddress) {
795
829
  const result = await this.rpcCall('getTokenAccountBalance', [tokenAddress])
@@ -965,7 +999,6 @@ export class Api {
965
999
  const defaultOptions = { encoding: 'base64', preflightCommitment: 'confirmed' }
966
1000
 
967
1001
  const params = [signedTx, { ...defaultOptions, ...options }]
968
- const errorMessagesToRetry = ['Blockhash not found']
969
1002
 
970
1003
  const broadcastTxWithRetry = retry(
971
1004
  async () => {
package/src/tx-send.js CHANGED
@@ -94,6 +94,13 @@ export const createAndBroadcastTXFactory =
94
94
  api.getTokenAccountsByOwner(from),
95
95
  ])
96
96
 
97
+ const changedOwnership = await api.ataOwnershipChanged(address, tokenAddress)
98
+ if (changedOwnership) {
99
+ const err = new Error('Destination ATA changed ownership')
100
+ err.reason = { ownershipChanged: true }
101
+ throw err
102
+ }
103
+
97
104
  const fromTokenAddresses = fromTokenAccountAddresses.filter(
98
105
  ({ mintAddress }) => mintAddress === tokenMintAddress
99
106
  )