@hawksightco/hawk-sdk 1.3.264 → 1.3.265

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.
Files changed (181) hide show
  1. package/package.json +1 -1
  2. package/dist/src/addresses.d.ts +0 -37
  3. package/dist/src/addresses.d.ts.map +0 -1
  4. package/dist/src/addresses.js +0 -84
  5. package/dist/src/anchor.d.ts +0 -22
  6. package/dist/src/anchor.d.ts.map +0 -1
  7. package/dist/src/anchor.js +0 -121
  8. package/dist/src/classes/AltStorage.d.ts +0 -29
  9. package/dist/src/classes/AltStorage.d.ts.map +0 -1
  10. package/dist/src/classes/AltStorage.js +0 -58
  11. package/dist/src/classes/Atomicity.d.ts +0 -34
  12. package/dist/src/classes/Atomicity.d.ts.map +0 -1
  13. package/dist/src/classes/Atomicity.js +0 -110
  14. package/dist/src/classes/Client.d.ts +0 -35
  15. package/dist/src/classes/Client.d.ts.map +0 -1
  16. package/dist/src/classes/Client.js +0 -66
  17. package/dist/src/classes/CombineTransactions.d.ts +0 -11
  18. package/dist/src/classes/CombineTransactions.d.ts.map +0 -1
  19. package/dist/src/classes/CombineTransactions.js +0 -58
  20. package/dist/src/classes/CreateTxMetadata.d.ts +0 -100
  21. package/dist/src/classes/CreateTxMetadata.d.ts.map +0 -1
  22. package/dist/src/classes/CreateTxMetadata.js +0 -415
  23. package/dist/src/classes/General.d.ts +0 -87
  24. package/dist/src/classes/General.d.ts.map +0 -1
  25. package/dist/src/classes/General.js +0 -176
  26. package/dist/src/classes/GeneralUtility.d.ts +0 -79
  27. package/dist/src/classes/GeneralUtility.d.ts.map +0 -1
  28. package/dist/src/classes/GeneralUtility.js +0 -121
  29. package/dist/src/classes/HawkAPI.d.ts +0 -122
  30. package/dist/src/classes/HawkAPI.d.ts.map +0 -1
  31. package/dist/src/classes/HawkAPI.js +0 -169
  32. package/dist/src/classes/Health.d.ts +0 -29
  33. package/dist/src/classes/Health.d.ts.map +0 -1
  34. package/dist/src/classes/Health.js +0 -48
  35. package/dist/src/classes/JupiterAlts.d.ts +0 -37
  36. package/dist/src/classes/JupiterAlts.d.ts.map +0 -1
  37. package/dist/src/classes/JupiterAlts.js +0 -114
  38. package/dist/src/classes/JupiterSwap.d.ts +0 -21
  39. package/dist/src/classes/JupiterSwap.d.ts.map +0 -1
  40. package/dist/src/classes/JupiterSwap.js +0 -40
  41. package/dist/src/classes/Logging.d.ts +0 -13
  42. package/dist/src/classes/Logging.d.ts.map +0 -1
  43. package/dist/src/classes/Logging.js +0 -50
  44. package/dist/src/classes/MultiTransaction.d.ts +0 -75
  45. package/dist/src/classes/MultiTransaction.d.ts.map +0 -1
  46. package/dist/src/classes/MultiTransaction.js +0 -296
  47. package/dist/src/classes/RaydiumSDK.d.ts +0 -67
  48. package/dist/src/classes/RaydiumSDK.d.ts.map +0 -1
  49. package/dist/src/classes/RaydiumSDK.js +0 -206
  50. package/dist/src/classes/Search.d.ts +0 -100
  51. package/dist/src/classes/Search.d.ts.map +0 -1
  52. package/dist/src/classes/Search.js +0 -216
  53. package/dist/src/classes/SimpleIxGenerator.d.ts +0 -57
  54. package/dist/src/classes/SimpleIxGenerator.d.ts.map +0 -1
  55. package/dist/src/classes/SimpleIxGenerator.js +0 -62
  56. package/dist/src/classes/SimplePdaGenerator.d.ts +0 -28
  57. package/dist/src/classes/SimplePdaGenerator.d.ts.map +0 -1
  58. package/dist/src/classes/SimplePdaGenerator.js +0 -33
  59. package/dist/src/classes/Transaction.d.ts +0 -229
  60. package/dist/src/classes/Transaction.d.ts.map +0 -1
  61. package/dist/src/classes/Transaction.js +0 -643
  62. package/dist/src/classes/Transaction2.d.ts +0 -107
  63. package/dist/src/classes/Transaction2.d.ts.map +0 -1
  64. package/dist/src/classes/Transaction2.js +0 -249
  65. package/dist/src/classes/Transaction3.d.ts +0 -165
  66. package/dist/src/classes/Transaction3.d.ts.map +0 -1
  67. package/dist/src/classes/Transaction3.js +0 -416
  68. package/dist/src/classes/TransactionBatchExecute.d.ts +0 -163
  69. package/dist/src/classes/TransactionBatchExecute.d.ts.map +0 -1
  70. package/dist/src/classes/TransactionBatchExecute.js +0 -466
  71. package/dist/src/classes/TransactionBatchExecute2.d.ts +0 -99
  72. package/dist/src/classes/TransactionBatchExecute2.d.ts.map +0 -1
  73. package/dist/src/classes/TransactionBatchExecute2.js +0 -357
  74. package/dist/src/classes/Transactions.d.ts +0 -586
  75. package/dist/src/classes/Transactions.d.ts.map +0 -1
  76. package/dist/src/classes/Transactions.js +0 -7658
  77. package/dist/src/classes/TxGenerator.d.ts +0 -350
  78. package/dist/src/classes/TxGenerator.d.ts.map +0 -1
  79. package/dist/src/classes/TxGenerator.js +0 -1957
  80. package/dist/src/classes/TxGeneratorAutomations.d.ts +0 -186
  81. package/dist/src/classes/TxGeneratorAutomations.d.ts.map +0 -1
  82. package/dist/src/classes/TxGeneratorAutomations.js +0 -897
  83. package/dist/src/classes/Util.d.ts +0 -87
  84. package/dist/src/classes/Util.d.ts.map +0 -1
  85. package/dist/src/classes/Util.js +0 -148
  86. package/dist/src/classes/account-cache/AccountCache.d.ts +0 -54
  87. package/dist/src/classes/account-cache/AccountCache.d.ts.map +0 -1
  88. package/dist/src/classes/account-cache/AccountCache.js +0 -143
  89. package/dist/src/classes/account-cache/MintCache.d.ts +0 -33
  90. package/dist/src/classes/account-cache/MintCache.d.ts.map +0 -1
  91. package/dist/src/classes/account-cache/MintCache.js +0 -47
  92. package/dist/src/classes/account-cache/TokenCache.d.ts +0 -33
  93. package/dist/src/classes/account-cache/TokenCache.d.ts.map +0 -1
  94. package/dist/src/classes/account-cache/TokenCache.js +0 -47
  95. package/dist/src/errors.d.ts +0 -13
  96. package/dist/src/errors.d.ts.map +0 -1
  97. package/dist/src/errors.js +0 -96
  98. package/dist/src/functions.d.ts +0 -514
  99. package/dist/src/functions.d.ts.map +0 -1
  100. package/dist/src/functions.js +0 -1636
  101. package/dist/src/hawksight.d.ts +0 -53
  102. package/dist/src/hawksight.d.ts.map +0 -1
  103. package/dist/src/hawksight.js +0 -328
  104. package/dist/src/hsToMeteora.d.ts +0 -31
  105. package/dist/src/hsToMeteora.d.ts.map +0 -1
  106. package/dist/src/hsToMeteora.js +0 -3175
  107. package/dist/src/idl/iyf-extension-idl.d.ts +0 -14583
  108. package/dist/src/idl/iyf-extension-idl.d.ts.map +0 -1
  109. package/dist/src/idl/iyf-extension-idl.js +0 -14578
  110. package/dist/src/idl/iyf-extension-wrapper.d.ts +0 -112
  111. package/dist/src/idl/iyf-extension-wrapper.d.ts.map +0 -1
  112. package/dist/src/idl/iyf-extension-wrapper.js +0 -2
  113. package/dist/src/idl/iyf-main-idl.d.ts +0 -11329
  114. package/dist/src/idl/iyf-main-idl.d.ts.map +0 -1
  115. package/dist/src/idl/iyf-main-idl.js +0 -11324
  116. package/dist/src/idl/iyf-main-wrapper.d.ts +0 -112
  117. package/dist/src/idl/iyf-main-wrapper.d.ts.map +0 -1
  118. package/dist/src/idl/iyf-main-wrapper.js +0 -2
  119. package/dist/src/idl/jupiter-idl.d.ts +0 -3063
  120. package/dist/src/idl/jupiter-idl.d.ts.map +0 -1
  121. package/dist/src/idl/jupiter-idl.js +0 -3061
  122. package/dist/src/idl/meteora-idl.d.ts +0 -7371
  123. package/dist/src/idl/meteora-idl.d.ts.map +0 -1
  124. package/dist/src/idl/meteora-idl.js +0 -7372
  125. package/dist/src/idl/orca-idl.d.ts +0 -3833
  126. package/dist/src/idl/orca-idl.d.ts.map +0 -1
  127. package/dist/src/idl/orca-idl.js +0 -3834
  128. package/dist/src/idl/raydium-idl.d.ts +0 -3054
  129. package/dist/src/idl/raydium-idl.d.ts.map +0 -1
  130. package/dist/src/idl/raydium-idl.js +0 -3055
  131. package/dist/src/index.d.ts +0 -9
  132. package/dist/src/index.d.ts.map +0 -1
  133. package/dist/src/index.js +0 -31
  134. package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts +0 -126
  135. package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts.map +0 -1
  136. package/dist/src/ixGenerator/IyfExtensionIxGenerator.js +0 -467
  137. package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +0 -330
  138. package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +0 -1
  139. package/dist/src/ixGenerator/IyfMainIxGenerator.js +0 -1239
  140. package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +0 -685
  141. package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +0 -1
  142. package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +0 -3005
  143. package/dist/src/ixGenerator/OrcaIxGenerator.d.ts +0 -119
  144. package/dist/src/ixGenerator/OrcaIxGenerator.d.ts.map +0 -1
  145. package/dist/src/ixGenerator/OrcaIxGenerator.js +0 -438
  146. package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts +0 -99
  147. package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts.map +0 -1
  148. package/dist/src/ixGenerator/RaydiumIxGenerator.js +0 -558
  149. package/dist/src/ixGenerator/UtilIxGenerator.d.ts +0 -20
  150. package/dist/src/ixGenerator/UtilIxGenerator.d.ts.map +0 -1
  151. package/dist/src/ixGenerator/UtilIxGenerator.js +0 -25
  152. package/dist/src/meteora/index.d.ts +0 -2
  153. package/dist/src/meteora/index.d.ts.map +0 -1
  154. package/dist/src/meteora/index.js +0 -17
  155. package/dist/src/meteora/liquidityStrategy.d.ts +0 -408
  156. package/dist/src/meteora/liquidityStrategy.d.ts.map +0 -1
  157. package/dist/src/meteora/liquidityStrategy.js +0 -1325
  158. package/dist/src/meteora.d.ts +0 -669
  159. package/dist/src/meteora.d.ts.map +0 -1
  160. package/dist/src/meteora.js +0 -1932
  161. package/dist/src/orca.d.ts +0 -57
  162. package/dist/src/orca.d.ts.map +0 -1
  163. package/dist/src/orca.js +0 -123
  164. package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts +0 -29
  165. package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +0 -1
  166. package/dist/src/pdaGenerator/HawksightPdaGenerator.js +0 -75
  167. package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +0 -76
  168. package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +0 -1
  169. package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +0 -166
  170. package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +0 -23
  171. package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +0 -1
  172. package/dist/src/pdaGenerator/OrcaPdaGenerator.js +0 -68
  173. package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts +0 -49
  174. package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts.map +0 -1
  175. package/dist/src/pdaGenerator/RaydiumPdaGenerator.js +0 -114
  176. package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts +0 -8
  177. package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts.map +0 -1
  178. package/dist/src/pdaGenerator/UtilPdaGenerator.js +0 -51
  179. package/dist/src/types.d.ts +0 -1100
  180. package/dist/src/types.d.ts.map +0 -1
  181. package/dist/src/types.js +0 -95
@@ -1,357 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var _a;
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.TransactionBatchExecute2 = void 0;
47
- const web3 = __importStar(require("@solana/web3.js"));
48
- const TransactionBatchExecute_1 = require("./TransactionBatchExecute");
49
- const MultiTransaction_1 = require("./MultiTransaction");
50
- const functions_1 = require("../functions");
51
- /**
52
- * Executes transactions in batches
53
- */
54
- class TransactionBatchExecute2 extends TransactionBatchExecute_1.TransactionBatchExecute {
55
- /**
56
- * Creates an instance of TransactionExecute class
57
- *
58
- * @param lookupTableAddresses Address lookup table addresses to be used by batch of transactions
59
- * @param instructions Array of instructions to be batched into transactions
60
- * @param payer Payer that will pay for the batch of transactions
61
- * @param connection Connection to mainnet
62
- */
63
- constructor(lookupTableAddresses, instructions, connection, createTxMetadataInstance, latestBlockhash, payerKey) {
64
- super(lookupTableAddresses, instructions, new web3.Keypair(), // unused
65
- connection, []);
66
- this.lookupTableAddresses = lookupTableAddresses;
67
- this.instructions = instructions;
68
- this.connection = connection;
69
- this.createTxMetadataInstance = createTxMetadataInstance;
70
- this.latestBlockhash = latestBlockhash;
71
- this.payerKey = payerKey;
72
- this._insertNonceAt = {};
73
- }
74
- ;
75
- /**
76
- * Download all jupiter alts (overridable)
77
- */
78
- jupiterDownloadAlts() {
79
- return __awaiter(this, void 0, void 0, function* () { });
80
- }
81
- /**
82
- * Find alt by pubkeys (overridable)
83
- */
84
- jupiterFindAltByPubkeys(pubkeys) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- return yield _a.jupiterFindAltByPubkeysFn(pubkeys);
87
- });
88
- }
89
- /**
90
- * Downoad address lookup table from given cluster
91
- */
92
- downloadAlts2(lookupTableAddresses) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- const pubkeyStr = lookupTableAddresses.map(pubkey => pubkey.toString());
95
- const alts = yield this.createTxMetadataInstance.stringToAlt(pubkeyStr);
96
- this.alts.push(...alts);
97
- });
98
- }
99
- /**
100
- * Option to include nonce advance instruction
101
- *
102
- * @param opt
103
- */
104
- insertNonceAt(opt) {
105
- this._insertNonceAt = opt;
106
- }
107
- /**
108
- * Builds a batch of executable transaction instructions
109
- */
110
- buildBatch() {
111
- return __awaiter(this, void 0, void 0, function* () {
112
- // Download address lookup table from given cluster
113
- yield this.downloadAlts();
114
- // Generate dummy instructions for batch calculation
115
- const [simulationIxs, dummySigners] = this.generateSimulationIxs();
116
- // Split simulation ixs
117
- const dummyBatches = yield this.splitToTransactions(simulationIxs, dummySigners);
118
- // Batch of actual instructions
119
- const batch = [];
120
- let index = 0;
121
- let i = 0;
122
- const lastIndex = dummyBatches.length - 1;
123
- for (const dummyIxs of dummyBatches) {
124
- const isLastIndex = i == lastIndex;
125
- const currentBatch = [];
126
- for (const ix of dummyIxs) {
127
- // If program id is compute budget, ignore
128
- if (ix.programId.equals(web3.ComputeBudgetProgram.programId))
129
- continue;
130
- // Otherwise, include in batch
131
- currentBatch.push(this.instructions[index++]);
132
- }
133
- if (isLastIndex && this._insertNonceAt.onlyEndOfTx) {
134
- currentBatch.push(yield this.generateNonceAdvanceIx(i));
135
- }
136
- batch.push(currentBatch);
137
- i++;
138
- }
139
- return batch;
140
- });
141
- }
142
- /**
143
- * Builds a batch of executable transaction instructions
144
- */
145
- buildBatchWithAlts(description, generalUtility) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- // Download address lookup table from given cluster
148
- yield this.downloadAlts();
149
- // Generate dummy instructions for batch calculation
150
- const [simulationIxs, dummySigners] = this.generateSimulationIxs();
151
- // Split simulation ixs
152
- const dummyBatches = yield this.splitToTransactions(simulationIxs, dummySigners);
153
- // Batch of actual instructions
154
- const batch = new MultiTransaction_1.MultiTransaction(description, generalUtility, this.latestBlockhash, this.payerKey);
155
- let index = 0;
156
- let i = 0;
157
- const lastIndex = dummyBatches.length - 1;
158
- for (const dummyIxs of dummyBatches) {
159
- const isLastIndex = i == lastIndex;
160
- const currentBatch = [];
161
- for (const ix of dummyIxs) {
162
- // If program id is compute budget, ignore
163
- if (ix.programId.equals(web3.ComputeBudgetProgram.programId))
164
- continue;
165
- // Otherwise, include in batch
166
- currentBatch.push(this.instructions[index++]);
167
- }
168
- if (lastIndex !== 0 && isLastIndex && this._insertNonceAt.onlyEndOfTx) {
169
- currentBatch.push(yield this.generateNonceAdvanceIx(i));
170
- }
171
- const alts = this.findRequiredAltsForBatch2(currentBatch);
172
- batch.push(alts, currentBatch);
173
- i++;
174
- }
175
- return batch;
176
- });
177
- }
178
- /**
179
- * Split transactions
180
- *
181
- * @param simulationIxs
182
- * @param dummySigners
183
- * @returns
184
- */
185
- splitToTransactions(simulationIxs, dummySigners) {
186
- return __awaiter(this, void 0, void 0, function* () {
187
- // Create dummy priority fee instructions for the transaction (to account for total tx size)
188
- const preIxs = [
189
- web3.ComputeBudgetProgram.setComputeUnitLimit({
190
- units: 1400000, // dummy value
191
- }),
192
- web3.ComputeBudgetProgram.setComputeUnitPrice({
193
- microLamports: 1000000, // dummy value
194
- }),
195
- ];
196
- // Run simulation
197
- let batch = [];
198
- let result = [];
199
- for (const ix of simulationIxs) {
200
- // Include dummy ix to transaction
201
- batch.push(ix);
202
- // Calculate transaction size
203
- try {
204
- const estimateTxSize = this.getEstimateSize([...preIxs, ...batch]);
205
- if (estimateTxSize < this.MAX_SIZE)
206
- continue;
207
- // Generate dummy nonce advance (anticipation)
208
- const nonceAdvance = this._insertNonceAt.onlyEndOfTx ? [yield this.generateNonceAdvanceIx(result.length)] : [];
209
- const txSize = this.calculateTransactionSize(this.latestBlockhash, [...preIxs, ...nonceAdvance, ...batch], dummySigners);
210
- if (txSize > this.MAX_SIZE) {
211
- batch.pop();
212
- result.push([...preIxs, ...batch]);
213
- batch = [ix];
214
- }
215
- }
216
- catch (_b) {
217
- batch.pop();
218
- result.push([...preIxs, ...batch]);
219
- batch = [ix];
220
- }
221
- }
222
- if (batch.length > 0 && simulationIxs.length !== 0) {
223
- result.push([...preIxs, ...batch]);
224
- }
225
- return result;
226
- });
227
- }
228
- /**
229
- * Generate nonde advance instruction (dummy instruction)
230
- */
231
- generateNonceAdvanceIx(index) {
232
- return __awaiter(this, void 0, void 0, function* () {
233
- const noncePubkey = yield (0, functions_1.generateNonceAddressFromIndex)(this.payerKey, index);
234
- // Generate dummy nonce ix
235
- return web3.SystemProgram.nonceAdvance({
236
- /** Nonce account */
237
- noncePubkey,
238
- /** Public key of the nonce authority */
239
- authorizedPubkey: this.payerKey,
240
- });
241
- });
242
- }
243
- getEstimateSize(ixs) {
244
- let length = 0;
245
- const alts = {};
246
- ixs.map(ix => {
247
- length += ix.data.length + ix.programId.toBuffer().length;
248
- ix.keys.map(meta => {
249
- const alt = this.pubkeyToAlt[meta.pubkey.toString()];
250
- if (!!alt) {
251
- alts[alt.key.toString()] = alt;
252
- length += 3;
253
- }
254
- else {
255
- length += 34;
256
- }
257
- });
258
- });
259
- for (const _ in alts) {
260
- length += 32;
261
- }
262
- return length;
263
- }
264
- /**
265
- * Find required signers from instructions
266
- *
267
- * @param ixs
268
- * @param dummySigners
269
- */
270
- findRequiredSignersFromIxs(ixs) {
271
- const signers = [];
272
- signers.push(this.payerKey);
273
- for (const instruction of ixs) {
274
- const _signers = instruction.keys
275
- .filter(meta => meta.isSigner)
276
- .map(meta => meta.pubkey);
277
- if (_signers.length > 0) {
278
- signers.push(..._signers);
279
- }
280
- }
281
- const uniqueSigners = {};
282
- for (const signer of signers) {
283
- uniqueSigners[signer.toBase58()] = signer;
284
- }
285
- const result = [];
286
- for (const id in uniqueSigners) {
287
- result.push(uniqueSigners[id]);
288
- }
289
- return result;
290
- }
291
- /**
292
- * Calculate transaction size
293
- *
294
- * @param batch
295
- */
296
- calculateTransactionSize(latestBlockhash, batch, dummySigners) {
297
- const alts = this.findRequiredAltsForBatch2(batch);
298
- const messageV0 = new web3.TransactionMessage({
299
- payerKey: dummySigners[this.payerKey.toString()].publicKey,
300
- instructions: batch,
301
- recentBlockhash: latestBlockhash.blockhash,
302
- }).compileToV0Message(alts);
303
- const versionedTx = new web3.VersionedTransaction(messageV0);
304
- const signers = this.findRequiredSignersFromBatch2(batch, dummySigners);
305
- versionedTx.sign(signers);
306
- const bytes = versionedTx.serialize();
307
- return bytes.length;
308
- }
309
- /**
310
- * Find required address lookup table addresses for given batch of instructions
311
- *
312
- * @param batch
313
- */
314
- findRequiredAltsForBatch2(batch) {
315
- const pubkeys = [];
316
- batch.map(ix => {
317
- pubkeys.push(...ix.keys.map(meta => meta.pubkey));
318
- });
319
- const alts = {};
320
- for (const pubkey of pubkeys) {
321
- const alt = this.pubkeyToAlt[pubkey.toString()];
322
- if (!!alt) {
323
- alts[alt.key.toString()] = alt;
324
- }
325
- }
326
- const result = [];
327
- for (const key in alts) {
328
- result.push(alts[key]);
329
- }
330
- return result;
331
- }
332
- /**
333
- * Find required signers from batch
334
- *
335
- * @param ixs
336
- * @param dummySigners
337
- */
338
- findRequiredSignersFromBatch2(batch, dummySigners) {
339
- const signers = this.findRequiredSignersFromIxs(batch);
340
- const result = [];
341
- for (const signer of signers) {
342
- const key = signer.toString();
343
- result.push(dummySigners[key]);
344
- }
345
- return result;
346
- }
347
- }
348
- exports.TransactionBatchExecute2 = TransactionBatchExecute2;
349
- _a = TransactionBatchExecute2;
350
- /**
351
- * Find alt by pubkeys (overridable)
352
- *
353
- * @param pubkeys
354
- */
355
- TransactionBatchExecute2.jupiterFindAltByPubkeysFn = () => __awaiter(void 0, void 0, void 0, function* () {
356
- return [];
357
- });