@exodus/solana-lib 3.4.2 → 3.5.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 ADDED
@@ -0,0 +1,219 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [3.5.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.5.0...@exodus/solana-lib@3.5.1) (2024-08-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * SOL lint ([#2953](https://github.com/ExodusMovement/assets/issues/2953)) ([3f1b3b8](https://github.com/ExodusMovement/assets/commit/3f1b3b8c9a1544ca7d41ac883c06e465d6928b32))
12
+
13
+
14
+
15
+ ## [3.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.4.2...@exodus/solana-lib@3.5.0) (2024-06-19)
16
+
17
+
18
+ ### Features
19
+
20
+ * **solana-lib:** support signing legacy transaction from buffer ([#2604](https://github.com/ExodusMovement/assets/issues/2604)) ([b08a818](https://github.com/ExodusMovement/assets/commit/b08a8187916dc4a874eabb6b29e79014c63f835b))
21
+
22
+
23
+
24
+ ## [3.4.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.4.1...@exodus/solana-lib@3.4.2) (2024-06-06)
25
+
26
+ **Note:** Version bump only for package @exodus/solana-lib
27
+
28
+
29
+
30
+
31
+
32
+ ## [3.4.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.4.0...@exodus/solana-lib@3.4.1) (2024-05-28)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * support using keychain private keys ([#2399](https://github.com/ExodusMovement/assets/issues/2399)) ([b900ad3](https://github.com/ExodusMovement/assets/commit/b900ad3b5bdf363f8c83175a5297333375a27529))
38
+
39
+
40
+
41
+ ## [3.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.3.1...@exodus/solana-lib@3.4.0) (2024-05-23)
42
+
43
+
44
+ ### Features
45
+
46
+ * **solana-lib:** recreate a Web3.js transaction if `transactionBuffer` supplied ([#2351](https://github.com/ExodusMovement/assets/issues/2351)) ([8ab56db](https://github.com/ExodusMovement/assets/commit/8ab56dbd120380cd7f89a4954c5d0f765156dbe3))
47
+
48
+
49
+
50
+ ## [3.3.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.3.0...@exodus/solana-lib@3.3.1) (2024-05-15)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * **solana-plugin:** supply a proper Web3 Transaction instance to simulation ([#2288](https://github.com/ExodusMovement/assets/issues/2288)) ([5316cc0](https://github.com/ExodusMovement/assets/commit/5316cc0ce23643da8e9926adfd8e0db904b704e4))
56
+
57
+
58
+
59
+ ## [3.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.2.2...@exodus/solana-lib@3.3.0) (2024-05-10)
60
+
61
+
62
+ ### Features
63
+
64
+ * `signatureType` to external signer ([#2244](https://github.com/ExodusMovement/assets/issues/2244)) ([ba0f522](https://github.com/ExodusMovement/assets/commit/ba0f522acd0b0ef744c82405ba9e67d5f90ac9c3))
65
+
66
+
67
+
68
+ ## [3.2.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.2.1...@exodus/solana-lib@3.2.2) (2024-05-08)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * provide `assetName` to createGetKeyIdentifier ([#2191](https://github.com/ExodusMovement/assets/issues/2191)) ([55e5171](https://github.com/ExodusMovement/assets/commit/55e5171b142fd72ff88b645f02f0ad358b93ccf8))
74
+
75
+
76
+
77
+ ## [3.2.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.2.0...@exodus/solana-lib@3.2.1) (2024-04-26)
78
+
79
+
80
+ ### Bug Fixes
81
+
82
+ * handle decode staking tx crash ([#2161](https://github.com/ExodusMovement/assets/issues/2161)) ([970ef7c](https://github.com/ExodusMovement/assets/commit/970ef7ca4abc393826716702c4d4e56d13ee7914))
83
+
84
+
85
+
86
+ ## [3.2.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.1.1...@exodus/solana-lib@3.2.0) (2024-04-24)
87
+
88
+
89
+ ### Features
90
+
91
+ * support external signer for solana message signing ([#2151](https://github.com/ExodusMovement/assets/issues/2151)) ([a58921c](https://github.com/ExodusMovement/assets/commit/a58921c6d2020fd67a99dc4c17129c04e346eb8b))
92
+
93
+
94
+
95
+ ## [3.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.1.0...@exodus/solana-lib@3.1.1) (2024-04-22)
96
+
97
+ **Note:** Version bump only for package @exodus/solana-lib
98
+
99
+
100
+
101
+
102
+
103
+ ## [3.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.0.1...@exodus/solana-lib@3.1.0) (2024-04-20)
104
+
105
+
106
+ ### Features
107
+
108
+ * add compute budget instruction ([#2006](https://github.com/ExodusMovement/assets/issues/2006)) ([f1479ac](https://github.com/ExodusMovement/assets/commit/f1479aca619370da573f442ef4526e6d21db14d2))
109
+
110
+
111
+
112
+ ## [3.0.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.0.0...@exodus/solana-lib@3.0.1) (2024-04-17)
113
+
114
+ **Note:** Version bump only for package @exodus/solana-lib
115
+
116
+
117
+
118
+
119
+
120
+ ## [3.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@2.4.0...@exodus/solana-lib@3.0.0) (2024-04-12)
121
+
122
+
123
+ ### ⚠ BREAKING CHANGES
124
+
125
+ * **solana:** transaction signing (#2017)
126
+
127
+ ### Bug Fixes
128
+
129
+ * replace serum with fork ([#2037](https://github.com/ExodusMovement/assets/issues/2037)) ([d7fdbae](https://github.com/ExodusMovement/assets/commit/d7fdbae87cfa605afeff8f2b836a5a2839105f78))
130
+ * **solana:** transaction signing ([#2017](https://github.com/ExodusMovement/assets/issues/2017)) ([78393f9](https://github.com/ExodusMovement/assets/commit/78393f96c5102636dab62e1cf0b368475c8b038e))
131
+
132
+
133
+
134
+ ## [2.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@2.3.0...@exodus/solana-lib@2.4.0) (2024-04-08)
135
+
136
+
137
+ ### Features
138
+
139
+ * **solana:** add signMessage ([#1980](https://github.com/ExodusMovement/assets/issues/1980)) ([fd0b28c](https://github.com/ExodusMovement/assets/commit/fd0b28ce0c86249ec8a5d32ee0a3e542513c6d47))
140
+
141
+
142
+
143
+ ## [2.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@2.2.0...@exodus/solana-lib@2.3.0) (2024-04-04)
144
+
145
+
146
+ ### Features
147
+
148
+ * implement helius priority fee ([#1799](https://github.com/ExodusMovement/assets/issues/1799)) ([e681ee7](https://github.com/ExodusMovement/assets/commit/e681ee7f52526bc8a77ab9917d57fb5c2fca2fd4))
149
+
150
+
151
+
152
+ ## [2.2.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@2.1.0...@exodus/solana-lib@2.2.0) (2024-04-04)
153
+
154
+
155
+ ### Features
156
+
157
+ * add support for external signer for Solana ([#1952](https://github.com/ExodusMovement/assets/issues/1952)) ([70424fe](https://github.com/ExodusMovement/assets/commit/70424fe54c4bcf6be897a182761746b1e02475f3))
158
+
159
+
160
+
161
+ ## [2.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@2.0.0...@exodus/solana-lib@2.1.0) (2024-03-27)
162
+
163
+
164
+ ### Features
165
+
166
+ * add new Solana token 2022 program ([#1808](https://github.com/ExodusMovement/assets/issues/1808)) ([90747bc](https://github.com/ExodusMovement/assets/commit/90747bc97fba0e629a1eaba5878dd06f834b0d72))
167
+
168
+
169
+ ### Bug Fixes
170
+
171
+ * support token-2022 program for metaplex transfer ([#1894](https://github.com/ExodusMovement/assets/issues/1894)) ([31f712a](https://github.com/ExodusMovement/assets/commit/31f712a8fda681969b1c3dbe6f4c5e3d250f3062))
172
+
173
+
174
+
175
+ ## [2.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@1.8.2...@exodus/solana-lib@2.0.0) (2024-03-21)
176
+
177
+
178
+ ### ⚠ BREAKING CHANGES
179
+
180
+ * decouple solana-lib from solana-meta (#1810)
181
+
182
+ ### Features
183
+
184
+ * decouple solana-lib from solana-meta ([#1810](https://github.com/ExodusMovement/assets/issues/1810)) ([50db597](https://github.com/ExodusMovement/assets/commit/50db59734b1e48f8616f5de1ff61bfac356685a3))
185
+
186
+
187
+
188
+ ## [1.8.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@1.8.1...@exodus/solana-lib@1.8.2) (2024-03-18)
189
+
190
+
191
+ ### Bug Fixes
192
+
193
+ * accurately calculate solana priority fee ([#1777](https://github.com/ExodusMovement/assets/issues/1777)) ([aa72d65](https://github.com/ExodusMovement/assets/commit/aa72d65d0117e7ff418967c019c1f3cb865961eb))
194
+
195
+
196
+
197
+
198
+
199
+ ## [1.8.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@1.8.0...@exodus/solana-lib@1.8.1) (2024-03-16)
200
+
201
+ **Note:** Version bump only for package @exodus/solana-lib
202
+
203
+
204
+
205
+
206
+
207
+ # [1.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@1.7.5...@exodus/solana-lib@1.8.0) (2024-03-12)
208
+
209
+
210
+ ### Bug Fixes
211
+
212
+ * increase SOL fee boundary check ([#1717](https://github.com/ExodusMovement/assets/issues/1717)) ([6ae954e](https://github.com/ExodusMovement/assets/commit/6ae954e2314acf0a84ea6dea07b89e5bba96e5b1))
213
+ * solana test case ([#1602](https://github.com/ExodusMovement/assets/issues/1602)) ([00b8ddd](https://github.com/ExodusMovement/assets/commit/00b8ddd7726d50bbfe227ddacced7e388c2af283))
214
+
215
+
216
+ ### Features
217
+
218
+ * add SOL prioritization fee ([#1682](https://github.com/ExodusMovement/assets/issues/1682)) ([f199ef5](https://github.com/ExodusMovement/assets/commit/f199ef52dc9047768c5a8f4ccb75cd5f82a13e2e))
219
+ * **solana:** migrate some implementations and remove `@exodus/solana-spl-tokan` usage. ([#1669](https://github.com/ExodusMovement/assets/issues/1669)) ([ee75e1f](https://github.com/ExodusMovement/assets/commit/ee75e1fbf5c276aafc91260dee9ad6e44e5c8b8b))
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@exodus/solana-lib",
3
- "version": "3.4.2",
3
+ "version": "3.5.1",
4
4
  "description": "Exodus internal Solana low-level library",
5
5
  "main": "src/index.js",
6
6
  "files": [
7
- "src/",
7
+ "src",
8
+ "CHANGELOG.md",
8
9
  "!src/**/__tests__"
9
10
  ],
10
- "author": "Exodus",
11
+ "author": "Exodus Movement, Inc.",
11
12
  "license": "ISC",
12
13
  "publishConfig": {
13
14
  "access": "restricted"
14
15
  },
15
16
  "scripts": {
16
- "test": "run -T jest",
17
- "lint": "run -T eslint ./src",
17
+ "test": "run -T exodus-test --jest --esbuild",
18
+ "lint": "run -T eslint .",
18
19
  "lint:fix": "yarn lint --fix"
19
20
  },
20
21
  "dependencies": {
@@ -23,8 +24,7 @@
23
24
  "@exodus/currency": "^2.3.2",
24
25
  "@exodus/key-utils": "^3.1.0",
25
26
  "@exodus/models": "^10.1.0",
26
- "@exodus/project-serum-serum": "0.13.64-exodus.0",
27
- "@exodus/solana-web3.js": "^1.63.1-exodus.3",
27
+ "@exodus/solana-web3.js": "^1.63.1-exodus.9-rc1",
28
28
  "bn.js": "^5.2.1",
29
29
  "borsh": "^0.7.0",
30
30
  "bs58": "^4.0.1",
@@ -34,11 +34,18 @@
34
34
  "tweetnacl": "^1.0.3"
35
35
  },
36
36
  "devDependencies": {
37
- "@exodus/key-identifier": "1.0.0",
38
- "@exodus/keychain": "^6.2.0",
37
+ "@exodus/key-identifier": "^1.2.1",
38
+ "@exodus/keychain": "^6.7.0",
39
39
  "@exodus/solana-meta": "^1.1.0",
40
- "@solana/web3.js": "^1.90.0",
41
40
  "bip39": "^2.6.0"
42
41
  },
43
- "gitHead": "9d24eb58422692fc1acdcb834061d02b2632801d"
42
+ "bugs": {
43
+ "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-lib"
44
+ },
45
+ "homepage": "https://github.com/ExodusMovement/assets/tree/master/solana/solana-lib",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/ExodusMovement/assets.git"
49
+ },
50
+ "gitHead": "31e84436880a97a8cc17043ccd319e376578d7f4"
44
51
  }
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PublicKey, SystemProgram, StakeProgram } from './vendor'
1
+ import { PublicKey, StakeProgram, SystemProgram } from './vendor'
2
2
 
3
3
  export const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = new PublicKey(
4
4
  'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'
package/src/encode.js CHANGED
@@ -1,16 +1,17 @@
1
1
  import assert from 'assert'
2
- import { PublicKey, StakeProgram } from './vendor'
2
+ import BN from 'bn.js'
3
+ import { deserializeUnchecked } from 'borsh'
4
+ import bs58 from 'bs58'
5
+
3
6
  import {
7
+ MPL_TOKEN_METADATA_PROGRAM_ID,
8
+ SEED,
4
9
  SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID,
5
10
  TOKEN_PROGRAM_ID,
6
- SEED,
7
- MPL_TOKEN_METADATA_PROGRAM_ID,
8
11
  } from './constants'
9
- import { getPublicKey, getKeyPairFromPrivateKey } from './keypair'
10
- import bs58 from 'bs58'
11
- import BN from 'bn.js'
12
12
  import { Metadata, METADATA_SCHEMA } from './helpers/metadata-schema'
13
- import { deserializeUnchecked } from 'borsh'
13
+ import { getKeyPairFromPrivateKey, getPublicKey } from './keypair'
14
+ import { PublicKey, StakeProgram } from './vendor'
14
15
 
15
16
  export function getAddressFromPublicKey(publicKey) {
16
17
  return bs58.encode(Buffer.from(publicKey, 'hex'))
@@ -1,7 +1,7 @@
1
1
  // metadata structs: https://github.com/metaplex-foundation/metaplex/blob/master/js/packages/common/src/actions/metadata.ts
2
2
 
3
- import bs58 from 'bs58'
4
3
  import { BinaryReader, BinaryWriter } from 'borsh'
4
+ import bs58 from 'bs58'
5
5
 
6
6
  BinaryReader.prototype.readPubkeyAsString = function () {
7
7
  const array = this.readFixedArray(32)
@@ -1,20 +1,19 @@
1
1
  import * as BufferLayout from '@exodus/buffer-layout'
2
2
 
3
- import { Transaction, PublicKey, TransactionInstruction } from '../vendor'
4
3
  import {
5
4
  MPL_TOKEN_METADATA_PROGRAM_ID,
6
5
  SYSTEM_PROGRAM_ID,
7
6
  SYSVAR_INSTRUCTIONS_PUBKEY,
8
7
  TOKEN_PROGRAM_ID,
9
8
  } from '../constants'
10
-
11
- import { ASSOCIATED_TOKEN_PROGRAM_ID } from './spl-token'
12
9
  import {
13
10
  findAssociatedTokenAddress,
14
11
  getMasterEditionPDA,
15
12
  getMetadataAccount,
16
13
  getTokenRecordPDA,
17
14
  } from '../encode'
15
+ import { PublicKey, Transaction, TransactionInstruction } from '../vendor'
16
+ import { ASSOCIATED_TOKEN_PROGRAM_ID } from './spl-token'
18
17
 
19
18
  const TRANSFER_INSTRUCTION_DISCRIMINATOR = 49
20
19
  const TOKEN_AUTH_RULES_ID = new PublicKey('auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg')
@@ -1,6 +1,7 @@
1
- import { PublicKey, TransactionInstruction } from '../vendor'
2
1
  import { struct, u8 } from '@exodus/buffer-layout'
3
2
  import * as BufferLayout from '@exodus/buffer-layout'
3
+
4
+ import { PublicKey, TransactionInstruction } from '../vendor'
4
5
  import { U64 } from './spl-token'
5
6
 
6
7
  /**
@@ -60,7 +61,7 @@ export const transferCheckedWithFeeInstructionData = struct([
60
61
  * @param fee The expected fee assesed on this transfer, calculated off-chain based on the transferFeeBasisPoints and maximumFee of the mint.
61
62
  * @param programId SPL Token program account
62
63
  *
63
- * @return Instruction to add to a transaction
64
+ * @returns Instruction to add to a transaction
64
65
  */
65
66
  export function createTransferCheckedWithFeeInstruction(
66
67
  source, // PublicKey
@@ -111,7 +112,7 @@ export function createTransferCheckedWithFeeInstruction(
111
112
  * @param instruction Transaction instruction to decode
112
113
  * @param programId SPL Token program account
113
114
  *
114
- * @return Decoded, valid instruction
115
+ * @returns Decoded, valid instruction
115
116
  */
116
117
  export function decodeTransferCheckedWithFeeInstruction(
117
118
  instruction, // TransactionInstruction
@@ -151,7 +152,7 @@ export function decodeTransferCheckedWithFeeInstruction(
151
152
  *
152
153
  * @param instruction Transaction instruction to decode
153
154
  *
154
- * @return Decoded, non-validated instruction
155
+ * @returns Decoded, non-validated instruction
155
156
  */
156
157
  export function decodeTransferCheckedWithFeeInstructionUnchecked({
157
158
  programId,
@@ -1,7 +1,8 @@
1
+ import * as BufferLayout from '@exodus/buffer-layout'
1
2
  import assert from 'assert'
2
3
  import BN from 'bn.js'
3
- import * as BufferLayout from '@exodus/buffer-layout'
4
- import { PublicKey, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from '../vendor'
4
+
5
+ import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '../vendor'
5
6
  import * as Layout from '../vendor/utils/layout'
6
7
 
7
8
  // Extracted from https://github.com/ExodusMovement/solana-spl-token/blob/master/src/index.js#L263
@@ -64,7 +65,7 @@ const uint64 = (property = 'uint64') => {
64
65
  /**
65
66
  * Unfortunately, BufferLayout.encode uses an `instanceof` check for `Buffer`
66
67
  * which fails when using `publicKey.toBuffer()` directly because the bundled `Buffer`
67
- * class in `@solana/web3.js` is different from the bundled `Buffer` class in this package
68
+ * class in `@exodus/solana-web3.js` is different from the bundled `Buffer` class in this package
68
69
  */
69
70
  const pubkeyToBuffer = (publicKey) => {
70
71
  return Buffer.from(publicKey.toBuffer())
@@ -1,7 +1,7 @@
1
- import { Token } from './spl-token'
2
- import { PublicKey, TransactionInstruction, SystemProgram, SYSVAR_RENT_PUBKEY } from '../vendor'
3
1
  import { SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants'
4
2
  import { findAssociatedTokenAddress } from '../encode'
3
+ import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '../vendor'
4
+ import { Token } from './spl-token'
5
5
 
6
6
  // https://github.com/paul-schaaf/spl-token-ui/blob/main/src/solana/token/associatedToken.ts#L59
7
7
  export const createAssociatedTokenAccount = (
@@ -1,8 +1,8 @@
1
- import assert from 'minimalistic-assert'
2
1
  import {
3
2
  createGetKeyIdentifier as _createGetKeyIdentifier,
4
3
  unhardenDerivationIndex,
5
4
  } from '@exodus/key-utils'
5
+ import assert from 'minimalistic-assert'
6
6
 
7
7
  export const getSupportedPurposes = () => [44]
8
8
 
package/src/keypair.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import nacl from 'tweetnacl'
2
+
2
3
  import { PublicKey } from './vendor/publickey'
3
4
 
4
5
  export function getKeyPairFromPrivateKey(privateKey) {
@@ -1,5 +1,5 @@
1
+ import { MAGIC_EDEN_ESCROW_PROGRAM_ID, SYSTEM_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants'
1
2
  import { PublicKey, Transaction } from '../vendor'
2
- import { SYSTEM_PROGRAM_ID, TOKEN_PROGRAM_ID, MAGIC_EDEN_ESCROW_PROGRAM_ID } from '../constants'
3
3
  import { encodeData } from './coders'
4
4
 
5
5
  const PLATFORM_FEES_PROGRAM_ID = new PublicKey('2NZukH2TXpcuZP4htiuT8CFxcaQSWzkkR6kepSWnZ24Q')
@@ -1,9 +1,9 @@
1
1
  import assert from 'assert'
2
- import nacl from 'tweetnacl'
3
2
  import bs58 from 'bs58'
3
+ import nacl from 'tweetnacl'
4
4
 
5
- import { isTransactionMessage } from './validation'
6
5
  import { getKeyPairFromPrivateKey } from '../keypair'
6
+ import { isTransactionMessage } from './validation'
7
7
 
8
8
  /**
9
9
  * @deprecated please use messageSigner
@@ -3,27 +3,27 @@ import BN from 'bn.js'
3
3
  import bs58 from 'bs58'
4
4
  import { get } from 'lodash'
5
5
 
6
- import { getKeyPairFromPrivateKey } from './keypair'
7
- import { findAssociatedTokenAddress, createStakeAddress } from './encode'
6
+ import { MEMO_PROGRAM_ID, SEED, STAKE_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } from './constants'
7
+ import { createStakeAddress, findAssociatedTokenAddress } from './encode'
8
+ import { createTransferCheckedWithFeeInstruction } from './helpers/spl-token-2022'
8
9
  import {
9
10
  createAssociatedTokenAccount,
10
- createTokenTransferInstruction,
11
11
  createCloseAccountInstruction,
12
+ createTokenTransferInstruction,
12
13
  } from './helpers/tokenTransfer'
13
- import { createTransferCheckedWithFeeInstruction } from './helpers/spl-token-2022'
14
+ import { getKeyPairFromPrivateKey } from './keypair'
15
+ import { MagicEdenEscrowProgram } from './magiceden/escrow-program'
14
16
  import {
15
- PublicKey,
16
17
  Account,
17
- Transaction,
18
- SystemProgram,
19
- StakeProgram,
20
- StakeInstruction,
21
18
  Authorized,
22
19
  Lockup,
20
+ PublicKey,
21
+ StakeInstruction,
22
+ StakeProgram,
23
+ SystemProgram,
24
+ Transaction,
23
25
  TransactionInstruction,
24
26
  } from './vendor'
25
- import { MagicEdenEscrowProgram } from './magiceden/escrow-program'
26
- import { MEMO_PROGRAM_ID, SEED, STAKE_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } from './constants'
27
27
 
28
28
  class Tx {
29
29
  constructor({
@@ -1,4 +1,5 @@
1
1
  import * as nacl from 'tweetnacl'
2
+
2
3
  import { PACKET_DATA_SIZE } from '../vendor'
3
4
 
4
5
  // Copied from:
package/src/tx/common.js CHANGED
@@ -22,16 +22,8 @@ export function getTxId(tx) {
22
22
  }
23
23
 
24
24
  function getFirstSignature(tx) {
25
- if (isVersionedTransaction(tx)) {
26
- // Versioned
27
- if (tx.signatures.length > 0) {
28
- return tx.signatures[0]
29
- }
30
- } else {
31
- // Legacy
32
- if (tx.signatures.length > 0) {
33
- return tx.signatures[0].signature
34
- }
25
+ if (tx.signatures.length > 0) {
26
+ return tx.signatures[0]
35
27
  }
36
28
 
37
29
  return null
@@ -1,9 +1,10 @@
1
- import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../helpers/spl-token'
2
- import { MARKETS, TokenInstructions } from '@exodus/project-serum-serum'
3
1
  import * as BufferLayout from '@exodus/buffer-layout'
2
+ import bs58 from 'bs58'
4
3
 
4
+ import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../helpers/spl-token'
5
5
  import { SystemInstruction, SystemProgram } from './../vendor'
6
- import bs58 from 'bs58'
6
+ import * as TokenInstructions from './token-instructions'
7
+ import { MARKETS } from './tokens-and-markets'
7
8
 
8
9
  const INSTRUCTION_LAYOUT = BufferLayout.union(BufferLayout.u8('instruction'))
9
10
  INSTRUCTION_LAYOUT.addVariant(
@@ -0,0 +1,20 @@
1
+ import { Blob } from '@exodus/buffer-layout'
2
+ import { PublicKey } from '@exodus/solana-web3.js'
3
+
4
+ class PublicKeyLayout extends Blob {
5
+ constructor(property) {
6
+ super(32, property)
7
+ }
8
+
9
+ decode(b, offset) {
10
+ return new PublicKey(super.decode(b, offset))
11
+ }
12
+
13
+ encode(src, b, offset) {
14
+ return super.encode(src.toBuffer(), b, offset)
15
+ }
16
+ }
17
+
18
+ export function publicKeyLayout(property) {
19
+ return new PublicKeyLayout(property)
20
+ }