@exodus/solana-lib 3.21.0 → 3.21.1
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 +8 -0
- package/package.json +2 -2
- package/src/tx/instruction-utils.js +32 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.21.0...@exodus/solana-lib@3.21.1) (2026-03-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/solana-lib
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [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
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-lib",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.1",
|
|
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": "
|
|
51
|
+
"gitHead": "1c57290eed9f84bfd28f25948796f52f94e8a52f"
|
|
52
52
|
}
|
|
@@ -1,57 +1,62 @@
|
|
|
1
|
-
import { COMPUTE_BUDGET_PROGRAM_ID } from '../constants.js'
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '../
|
|
2
|
+
COMPUTE_BUDGET_PROGRAM_ID,
|
|
3
|
+
SYSTEM_PROGRAM_ID,
|
|
4
|
+
TOKEN_2022_PROGRAM_ID,
|
|
5
|
+
TOKEN_PROGRAM_ID,
|
|
6
|
+
} from '../constants.js'
|
|
7
|
+
import { TOKEN_INSTRUCTION_LAYOUTS, TRANSFER_FEE_SUB_INSTRUCTIONS } from '../vendor/index.js'
|
|
8
8
|
import { toBuffer } from '../vendor/utils/to-buffer.js'
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export function isTokenProgramInstruction(instruction, accountKeys) {
|
|
16
|
-
return TokenInstruction.isProgramInstruction(instruction, accountKeys)
|
|
10
|
+
export function isTokenProgramInstruction(instruction) {
|
|
11
|
+
const programId = instruction?.programId
|
|
12
|
+
if (!programId) return false
|
|
13
|
+
return programId.equals(TOKEN_PROGRAM_ID) || programId.equals(TOKEN_2022_PROGRAM_ID)
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
export function isSystemTransferInstruction(instruction
|
|
20
|
-
|
|
16
|
+
export function isSystemTransferInstruction(instruction) {
|
|
17
|
+
const programId = instruction?.programId
|
|
18
|
+
if (!programId || !programId.equals(SYSTEM_PROGRAM_ID)) return false
|
|
19
|
+
if (!Array.isArray(instruction.keys) || instruction.keys.length !== 2) return false
|
|
20
|
+
if (!instruction.data) return false
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
return
|
|
22
|
+
const buffer = toBuffer(instruction.data)
|
|
23
|
+
if (buffer.length < 12) return false
|
|
24
|
+
return buffer.readUInt32LE(0) === 2
|
|
24
25
|
} catch {
|
|
25
26
|
return false
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export function isComputeBudgetInstruction(instruction
|
|
30
|
-
const programId =
|
|
30
|
+
export function isComputeBudgetInstruction(instruction) {
|
|
31
|
+
const programId = instruction?.programId
|
|
31
32
|
if (!programId) return false
|
|
32
33
|
return programId.equals(COMPUTE_BUDGET_PROGRAM_ID)
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export function isSetAuthorityInstruction(instruction
|
|
36
|
-
if (!isTokenProgramInstruction(instruction
|
|
36
|
+
export function isSetAuthorityInstruction(instruction) {
|
|
37
|
+
if (!isTokenProgramInstruction(instruction)) return false
|
|
38
|
+
if (!instruction.data) return false
|
|
37
39
|
const buffer = toBuffer(instruction.data)
|
|
38
40
|
return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.SetAuthority.index
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
export function isTransferInstruction(instruction
|
|
42
|
-
if (!isTokenProgramInstruction(instruction
|
|
43
|
+
export function isTransferInstruction(instruction) {
|
|
44
|
+
if (!isTokenProgramInstruction(instruction)) return false
|
|
45
|
+
if (!instruction.data) return false
|
|
43
46
|
const buffer = toBuffer(instruction.data)
|
|
44
47
|
return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.Transfer.index
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
export function isTransferCheckedInstruction(instruction
|
|
48
|
-
if (!isTokenProgramInstruction(instruction
|
|
50
|
+
export function isTransferCheckedInstruction(instruction) {
|
|
51
|
+
if (!isTokenProgramInstruction(instruction)) return false
|
|
52
|
+
if (!instruction.data) return false
|
|
49
53
|
const buffer = toBuffer(instruction.data)
|
|
50
54
|
return buffer.length > 0 && buffer[0] === TOKEN_INSTRUCTION_LAYOUTS.TransferChecked.index
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
export function isTransferCheckedWithFeeInstruction(instruction
|
|
54
|
-
if (!isTokenProgramInstruction(instruction
|
|
57
|
+
export function isTransferCheckedWithFeeInstruction(instruction) {
|
|
58
|
+
if (!isTokenProgramInstruction(instruction)) return false
|
|
59
|
+
if (!instruction.data) return false
|
|
55
60
|
const buffer = toBuffer(instruction.data)
|
|
56
61
|
return (
|
|
57
62
|
buffer.length >= 2 &&
|