@haven-fi/solauto-sdk 1.0.408 → 1.0.410

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.
@@ -108,7 +108,7 @@ async function simulateJitoBundle(umi, txs) {
108
108
  return transactionResults;
109
109
  }
110
110
  async function umiToVersionedTransactions(umi, blockhash, signer, txs, sign, feeEstimates, computeUnitLimits) {
111
- let builtTxs = await Promise.all(txs.map(async (tx, i) => {
111
+ let builtTxs = await Promise.all([...txs].map(async (tx, i) => {
112
112
  return (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined)
113
113
  .setBlockhash(blockhash)
114
114
  .build(umi);
@@ -191,12 +191,12 @@ async function sendJitoBundledTransactions(umi, connection, signer, txs, txType,
191
191
  let builtTxs;
192
192
  let simulationResults;
193
193
  if (txType !== "skip-simulation") {
194
- builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, // REVERT ME
195
- feeEstimates);
194
+ builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, false, feeEstimates);
196
195
  (0, generalUtils_1.consoleLog)(builtTxs.map((x) => x.message.compiledInstructions.map((y) => x.message.staticAccountKeys[y.programIdIndex].toString())));
197
196
  simulationResults = await simulateJitoBundle(umi, builtTxs);
198
197
  }
199
198
  if (txType !== "only-simulate") {
199
+ onAwaitingSign?.();
200
200
  builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
201
201
  ? simulationResults.map((x) => x.unitsConsumed * 1.15)
202
202
  : undefined);
@@ -204,7 +204,6 @@ async function sendJitoBundledTransactions(umi, connection, signer, txs, txType,
204
204
  if (serializedTxs.find((x) => x.length > 1232)) {
205
205
  throw new Error("A transaction is too large");
206
206
  }
207
- onAwaitingSign?.();
208
207
  const txSigs = await sendJitoBundle(umi, serializedTxs.map((x) => bs58_1.default.encode(x)));
209
208
  return txSigs.length > 0 ? txSigs : undefined;
210
209
  }
@@ -14,14 +14,14 @@ import {
14
14
  TOKEN_INFO,
15
15
  USD_DECIMALS,
16
16
  } from "../src";
17
- import { PublicKey } from "@solana/web3.js";
17
+ import { PublicKey, VersionedTransaction } from "@solana/web3.js";
18
18
  import { NATIVE_MINT } from "@solana/spl-token";
19
19
  import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
20
20
  import { fromBaseUnit } from "../dist";
21
- import path from 'path';
22
- import { config } from 'dotenv';
21
+ import path from "path";
22
+ import { config } from "dotenv";
23
23
 
24
- config({ path: path.join(__dirname, '.env') });
24
+ config({ path: path.join(__dirname, ".env") });
25
25
 
26
26
  function getBatches<T>(items: T[], batchSize: number): T[][] {
27
27
  const batches: T[][] = [];
@@ -221,5 +221,35 @@ async function main(filterWhitelist: boolean) {
221
221
  console.log(`Total TVL: $${formatNumber(tvl, 2, 10000, 2)}`);
222
222
  }
223
223
 
224
- const filterWhitelist = true;
225
- main(filterWhitelist).then((x) => x);
224
+ import { Transaction } from "@solana/web3.js";
225
+ import * as bs58 from "bs58";
226
+
227
+ function decodeVersionedTx(base58Tx: string) {
228
+ // 1) Decode base58 into raw bytes
229
+ const txBuffer = bs58.decode(base58Tx);
230
+
231
+ // 2) Parse as versioned transaction
232
+ const versionedTx = VersionedTransaction.deserialize(txBuffer);
233
+
234
+ // 3) Extract signatures or do other things with `versionedTx`
235
+ const signatures = versionedTx.signatures.map((sigBytes, index) => ({
236
+ index,
237
+ signature: bs58.encode(sigBytes), // convert signature bytes to base58 string
238
+ }));
239
+
240
+ return { versionedTx, signatures };
241
+ }
242
+
243
+ // const filterWhitelist = true;
244
+ // main(filterWhitelist).then((x) => x);
245
+
246
+ console.log(
247
+ decodeVersionedTx(
248
+ "2APHUzQFJw5DtKwyYLEpzLazJHHgpF2XBWtghsb5MpZp1hEcdYvUvkrURPtAvf187t2TMNQPiuA1aQ6iMmT76xGUbNXAoNHjnyp8sJsLfMw3e9o8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XawA8xJbZ5HCbyXJi6no8W4VWcG3sgyZKHBRKTUTzY2BmgrKDQDbViSrxyteGtpV47RYm5czX29VmQJTMQNKQWYmLrdbrf8ZQWcZKK1HgbQvBr1VvQCMMMkw9J6b7VBxYxBx"
254
+ )
255
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.408",
3
+ "version": "1.0.410",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -162,7 +162,7 @@ async function umiToVersionedTransactions(
162
162
  computeUnitLimits?: number[]
163
163
  ): Promise<VersionedTransaction[]> {
164
164
  let builtTxs = await Promise.all(
165
- txs.map(async (tx, i) => {
165
+ [...txs].map(async (tx, i) => {
166
166
  return assembleFinalTransaction(
167
167
  signer,
168
168
  tx,
@@ -308,7 +308,7 @@ export async function sendJitoBundledTransactions(
308
308
  latestBlockhash,
309
309
  signer,
310
310
  txs,
311
- true, // REVERT ME
311
+ false,
312
312
  feeEstimates
313
313
  );
314
314
  consoleLog(
@@ -322,6 +322,7 @@ export async function sendJitoBundledTransactions(
322
322
  }
323
323
 
324
324
  if (txType !== "only-simulate") {
325
+ onAwaitingSign?.();
325
326
  builtTxs = await umiToVersionedTransactions(
326
327
  umi,
327
328
  latestBlockhash,
@@ -339,7 +340,6 @@ export async function sendJitoBundledTransactions(
339
340
  throw new Error("A transaction is too large");
340
341
  }
341
342
 
342
- onAwaitingSign?.();
343
343
  const txSigs = await sendJitoBundle(
344
344
  umi,
345
345
  serializedTxs.map((x) => base58.encode(x))