@haven-fi/solauto-sdk 1.0.255 → 1.0.256

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAK7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IARtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACjB,WAAW,EAAE,OAAO,CAAS;gBAG3B,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAKV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAA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pB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA8CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IAyDzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA+BxB,qBAAqB;YAiDrB,cAAc;YAyBd,eAAe;CAkD9B"}
@@ -11,7 +11,6 @@ const generalUtils_1 = require("../utils/generalUtils");
11
11
  const transactionUtils_1 = require("./transactionUtils");
12
12
  const types_1 = require("../types");
13
13
  const web3_js_1 = require("@solana/web3.js");
14
- const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
15
14
  // import { sendJitoBundledTransactions } from "../utils/jitoUtils";
16
15
  class TransactionTooLargeError extends Error {
17
16
  constructor(message) {
@@ -247,33 +246,17 @@ class TransactionsManager {
247
246
  const items = [...transactions];
248
247
  const client = this.txHandler;
249
248
  const updateLookupTable = await client.updateLookupTable();
250
- let isolatedLutTx = updateLookupTable?.new;
251
- if (updateLookupTable && !isolatedLutTx) {
252
- for (const item of items) {
253
- await item.initialize();
254
- }
255
- const txAccounts = items.flatMap((x) => x.tx.getInstructions().flatMap((x) => x.keys.map((x) => x.pubkey)));
256
- const newAccountsUsage = txAccounts.reduce((count, pk) => {
257
- return updateLookupTable.accountsToAdd.find((x) => x.equals((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(pk)))
258
- ? count + 1
259
- : count;
260
- }, 0);
261
- isolatedLutTx = Boolean(newAccountsUsage);
262
- }
263
- this.txHandler.log(updateLookupTable?.accountsToAdd.map(x => x.toString()));
264
- if (updateLookupTable && isolatedLutTx) {
249
+ if (updateLookupTable && updateLookupTable?.new) {
265
250
  await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
266
251
  }
267
252
  this.lookupTables.defaultLuts = client.defaultLookupTables();
268
- if (!items[0].initialized || (updateLookupTable && isolatedLutTx)) {
269
- for (const item of items) {
270
- await item.initialize();
271
- }
253
+ for (const item of items) {
254
+ await item.initialize();
272
255
  }
273
256
  const [choresBefore, choresAfter] = await (0, transactionUtils_1.getTransactionChores)(client, (0, umi_1.transactionBuilder)().add(items
274
257
  .filter((x) => x.tx && x.tx.getInstructions().length > 0)
275
258
  .map((x) => x.tx)));
276
- if (updateLookupTable && !isolatedLutTx) {
259
+ if (updateLookupTable && !updateLookupTable?.new) {
277
260
  choresBefore.prepend(updateLookupTable.tx);
278
261
  }
279
262
  if (choresBefore.getInstructions().length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.255",
3
+ "version": "1.0.256",
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",
@@ -366,33 +366,13 @@ export class TransactionsManager {
366
366
 
367
367
  const updateLookupTable = await client.updateLookupTable();
368
368
 
369
- let isolatedLutTx = updateLookupTable?.new;
370
- if (updateLookupTable && !isolatedLutTx) {
371
- for (const item of items) {
372
- await item.initialize();
373
- }
374
- const txAccounts = items.flatMap((x) =>
375
- x.tx!.getInstructions().flatMap((x) => x.keys.map((x) => x.pubkey))
376
- );
377
- const newAccountsUsage = txAccounts.reduce((count, pk) => {
378
- return updateLookupTable.accountsToAdd.find((x) =>
379
- x.equals(toWeb3JsPublicKey(pk))
380
- )
381
- ? count + 1
382
- : count;
383
- }, 0);
384
- isolatedLutTx = Boolean(newAccountsUsage);
385
- }
386
- this.txHandler.log(updateLookupTable?.accountsToAdd.map(x => x.toString()));
387
- if (updateLookupTable && isolatedLutTx) {
369
+ if (updateLookupTable && updateLookupTable?.new) {
388
370
  await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
389
371
  }
390
372
  this.lookupTables.defaultLuts = client.defaultLookupTables();
391
373
 
392
- if (!items[0].initialized || (updateLookupTable && isolatedLutTx)) {
393
- for (const item of items) {
394
- await item.initialize();
395
- }
374
+ for (const item of items) {
375
+ await item.initialize();
396
376
  }
397
377
 
398
378
  const [choresBefore, choresAfter] = await getTransactionChores(
@@ -403,7 +383,7 @@ export class TransactionsManager {
403
383
  .map((x) => x.tx!)
404
384
  )
405
385
  );
406
- if (updateLookupTable && !isolatedLutTx) {
386
+ if (updateLookupTable && !updateLookupTable?.new) {
407
387
  choresBefore.prepend(updateLookupTable.tx);
408
388
  }
409
389
  if (choresBefore.getInstructions().length > 0) {