@exodus/solana-api 3.27.7 → 3.27.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 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.27.8](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.27.7...@exodus/solana-api@3.27.8) (2026-01-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: Solana Normalize Clarity API responses for contract compatibility (#7334)
13
+
14
+
15
+
6
16
  ## [3.27.7](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.27.6...@exodus/solana-api@3.27.7) (2026-01-26)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.27.7",
3
+ "version": "3.27.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",
@@ -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": "5194ac4148f9b6d08ec0b9b14ae1e111af04ae1a",
52
+ "gitHead": "8975d39bf67554be2555effb3d3cd9d9e0b2d84b",
53
53
  "bugs": {
54
54
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
55
55
  },
@@ -13,6 +13,8 @@ const cleanQuery = (obj) => omitBy(obj, (v) => v === undefined)
13
13
 
14
14
  // Tokens + SOL api support
15
15
  export class ClarityApi extends RpcApi {
16
+ // NOTE: getTokenByAddress(mint) is inherited from RpcApi (uses this.tokens Map)
17
+
16
18
  getSupply = memoize(async (mintAddress) => {
17
19
  // cached getSupply
18
20
  return this.request(`/util/get-token-supply/${encodeURIComponent(mintAddress)}`)
@@ -45,7 +47,7 @@ export class ClarityApi extends RpcApi {
45
47
  }
46
48
 
47
49
  async getTransactions(address, { cursor, limit, includeUnparsed = false } = Object.create(null)) {
48
- return this.request(`/addresses/${encodeURIComponent(address)}/transactions`)
50
+ const result = await this.request(`/addresses/${encodeURIComponent(address)}/transactions`)
49
51
  .query(
50
52
  cleanQuery({
51
53
  cursor,
@@ -55,6 +57,33 @@ export class ClarityApi extends RpcApi {
55
57
  )
56
58
  .get()
57
59
  .json()
60
+
61
+ // Normalize token metadata: fill in tokenName, ticker, decimals from assets registry if missing.
62
+ // This ensures compatibility with consumers that expect these fields populated.
63
+ let transactions
64
+ if (Array.isArray(result?.transactions)) {
65
+ transactions = result.transactions.map((tx) => {
66
+ const mintAddress = tx?.token?.mintAddress
67
+ if (!mintAddress) return tx
68
+
69
+ const token = this.getTokenByAddress(mintAddress)
70
+ if (!token) return tx
71
+
72
+ return {
73
+ ...tx,
74
+ token: {
75
+ ...tx.token,
76
+ tokenName: tx.token.tokenName ?? token.name,
77
+ ticker: tx.token.ticker ?? token.ticker,
78
+ decimals: tx.token.decimals ?? token.decimals,
79
+ },
80
+ }
81
+ })
82
+ } else {
83
+ transactions = result?.transactions
84
+ }
85
+
86
+ return { ...result, transactions }
58
87
  }
59
88
 
60
89
  async getTransactionById(txId) {
@@ -63,10 +92,55 @@ export class ClarityApi extends RpcApi {
63
92
  .json()
64
93
  }
65
94
 
66
- async getTokensBalancesAndAccounts({ address }) {
67
- return this.request(`/addresses/${encodeURIComponent(address)}/tokens-balance`)
95
+ async getTokensBalancesAndAccounts({ address, filterByTokens } = Object.create(null)) {
96
+ const result = await this.request(`/addresses/${encodeURIComponent(address)}/tokens-balance`)
68
97
  .get()
69
98
  .json()
99
+
100
+ const rawAccounts = Array.isArray(result?.accounts) ? result.accounts : []
101
+ const rawBalances =
102
+ result?.balances && typeof result.balances === 'object' ? result.balances : {}
103
+
104
+ // Normalize accounts: add tokenName, ticker, decimals, and standard field names.
105
+ const accounts = rawAccounts.map((account) => {
106
+ const mintAddress = account?.mintAddress ?? account?.mint
107
+ const token = mintAddress ? this.getTokenByAddress(mintAddress) : null
108
+ const tokenProgram =
109
+ account?.tokenProgram ??
110
+ account?.program ??
111
+ token?.tokenProgram ??
112
+ TOKEN_PROGRAM_ID.toBase58()
113
+
114
+ return {
115
+ tokenAccountAddress: account?.tokenAccountAddress ?? account?.address ?? account?.pubkey,
116
+ owner: account?.owner ?? address,
117
+ tokenName: token?.name ?? 'unknown',
118
+ ticker: token?.ticker ?? 'UNKNOWN',
119
+ balance: account?.balance ?? account?.amount ?? rawBalances[mintAddress] ?? '0',
120
+ mintAddress,
121
+ tokenProgram,
122
+ decimals: token?.decimals ?? 0,
123
+ feeBasisPoints: account?.feeBasisPoints ?? 0,
124
+ maximumFee: account?.maximumFee ?? 0,
125
+ }
126
+ })
127
+
128
+ // Normalize balances: map from mint address keys to asset name keys.
129
+ // This ensures compatibility with existing callers that expect `{ serum: 100 }` shape.
130
+ const balances = Object.create(null)
131
+ for (const [mintAddress, amount] of Object.entries(rawBalances)) {
132
+ const token = this.getTokenByAddress(mintAddress)
133
+ if (!token) continue
134
+ balances[token.name] = Number(amount)
135
+ }
136
+
137
+ if (Array.isArray(filterByTokens) && filterByTokens.length > 0) {
138
+ for (const key of Object.keys(balances)) {
139
+ if (!filterByTokens.includes(key)) delete balances[key]
140
+ }
141
+ }
142
+
143
+ return { balances, accounts }
70
144
  }
71
145
 
72
146
  async getTokenAccountsByOwner(address, tokenTicker) {