@exodus/solana-lib 3.20.0 → 3.21.0

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,24 @@
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.21.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.20.1...@exodus/solana-lib@3.21.0) (2026-03-10)
7
+
8
+
9
+ ### Features
10
+
11
+
12
+ * feat: Solana add sponsored fee-payer tagging and instruction helpers (#7522)
13
+
14
+
15
+
16
+ ## [3.20.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.20.0...@exodus/solana-lib@3.20.1) (2026-02-03)
17
+
18
+ **Note:** Version bump only for package @exodus/solana-lib
19
+
20
+
21
+
22
+
23
+
6
24
  ## [3.20.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.19.3...@exodus/solana-lib@3.20.0) (2026-02-02)
7
25
 
8
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-lib",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Solana utils, such as for cryptography, address encoding/decoding, transaction building, etc.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -48,5 +48,5 @@
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/ExodusMovement/assets.git"
50
50
  },
51
- "gitHead": "3cea3bc89ff5c4aaa461ac148e384ea24dbe2d38"
51
+ "gitHead": "7da7b29b3177ad6155d5018c297e795cd4d3bda8"
52
52
  }
package/src/constants.js CHANGED
@@ -43,6 +43,8 @@ export const SOL_DECIMAL = Math.log10(LAMPORTS_PER_SOL)
43
43
 
44
44
  export const SUPPORTED_TRANSACTION_VERSIONS = new Set(['legacy', 0])
45
45
 
46
+ export const EXOD_SHARES_MINT_ADDRESS = '3DBudkWQNbXGAjzEAtpjMKorb76sjozcHCzc8ZtkHDAQ' // EXOD on Solana as a token2022
47
+
46
48
  export const SPL_TOKEN_AUTHORITY_TYPE = {
47
49
  MINT_TOKENS: 0,
48
50
  FREEZE_ACCOUNT: 1,
package/src/tx/index.js CHANGED
@@ -9,4 +9,5 @@ export * from './sign-hardware.js'
9
9
  export * from './prepare-for-signing.js'
10
10
  export * from './verify-only-fee-payer-changed.js'
11
11
  export * from './parse-tx-buffer.js'
12
+ export * from './instruction-utils.js'
12
13
  export { transactionToBase58, deserializeTransaction } from './common.js'
@@ -0,0 +1,61 @@
1
+ import { COMPUTE_BUDGET_PROGRAM_ID } from '../constants.js'
2
+ import {
3
+ SystemInstruction,
4
+ TOKEN_INSTRUCTION_LAYOUTS,
5
+ TokenInstruction,
6
+ TRANSFER_FEE_SUB_INSTRUCTIONS,
7
+ } from '../vendor/index.js'
8
+ import { toBuffer } from '../vendor/utils/to-buffer.js'
9
+
10
+ function getProgramId(instruction, accountKeys) {
11
+ if (!instruction || instruction.programIdIndex === undefined) return null
12
+ return accountKeys[instruction.programIdIndex]
13
+ }
14
+
15
+ export function isTokenProgramInstruction(instruction, accountKeys) {
16
+ return TokenInstruction.isProgramInstruction(instruction, accountKeys)
17
+ }
18
+
19
+ export function isSystemTransferInstruction(instruction, accountKeys) {
20
+ if (!SystemInstruction.isProgramInstruction(instruction, accountKeys)) return false
21
+ try {
22
+ SystemInstruction.validateInstruction(instruction)
23
+ return true
24
+ } catch {
25
+ return false
26
+ }
27
+ }
28
+
29
+ export function isComputeBudgetInstruction(instruction, accountKeys) {
30
+ const programId = getProgramId(instruction, accountKeys)
31
+ if (!programId) return false
32
+ return programId.equals(COMPUTE_BUDGET_PROGRAM_ID)
33
+ }
34
+
35
+ export function isSetAuthorityInstruction(instruction, accountKeys) {
36
+ if (!isTokenProgramInstruction(instruction, accountKeys)) return false
37
+ const buffer = toBuffer(instruction.data)
38
+ return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.SetAuthority.index
39
+ }
40
+
41
+ export function isTransferInstruction(instruction, accountKeys) {
42
+ if (!isTokenProgramInstruction(instruction, accountKeys)) return false
43
+ const buffer = toBuffer(instruction.data)
44
+ return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.Transfer.index
45
+ }
46
+
47
+ export function isTransferCheckedInstruction(instruction, accountKeys) {
48
+ if (!isTokenProgramInstruction(instruction, accountKeys)) return false
49
+ const buffer = toBuffer(instruction.data)
50
+ return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.TransferChecked.index
51
+ }
52
+
53
+ export function isTransferCheckedWithFeeInstruction(instruction, accountKeys) {
54
+ if (!isTokenProgramInstruction(instruction, accountKeys)) return false
55
+ const buffer = toBuffer(instruction.data)
56
+ return (
57
+ buffer.length >= 2 &&
58
+ buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.TransferFeeExtension.index &&
59
+ buffer[1] === TRANSFER_FEE_SUB_INSTRUCTIONS.TransferCheckedWithFee
60
+ )
61
+ }
@@ -40,7 +40,7 @@ function getStakedAmountFromCreateWithSeed(stakeAddress, instructions, accountKe
40
40
 
41
41
  // TODO: Unify with parseTransaction in solana-api and use there as well?
42
42
  // TODO: add support for swap instructions
43
- export async function parseTxBuffer(buffer, api) {
43
+ export async function parseTxBuffer(buffer, api, options = Object.create(null)) {
44
44
  const transaction = deserializeTransaction(buffer)
45
45
  const { message } = transaction
46
46
 
@@ -51,6 +51,10 @@ export async function parseTxBuffer(buffer, api) {
51
51
  throw new TypeError('Invalid transaction structure')
52
52
  }
53
53
 
54
+ const feePayerAddress = accountKeys[0]?.toBase58()
55
+ const { sponsors } = options
56
+ const isSponsoredBy = sponsors?.[feePayerAddress]
57
+
54
58
  const decodedEntries = []
55
59
 
56
60
  for (const [index, instruction] of instructions.entries()) {
@@ -75,7 +79,13 @@ export async function parseTxBuffer(buffer, api) {
75
79
  api,
76
80
  instructions,
77
81
  })
78
- if (parsed) parsedInstructions.push(parsed)
82
+ if (parsed) {
83
+ parsedInstructions.push({
84
+ ...parsed,
85
+ feePayerAddress,
86
+ ...(isSponsoredBy && { isSponsoredBy }),
87
+ })
88
+ }
79
89
  }
80
90
 
81
91
  if (parsedInstructions.length === 0) {