@haven-fi/solauto-sdk 1.0.515 → 1.0.517

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.
@@ -12,8 +12,9 @@ export declare const PRICES: {
12
12
  time: number;
13
13
  };
14
14
  };
15
+ export declare const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
16
+ export declare const JITO_TIP_ACCOUNTS: string[];
15
17
  export declare const SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
16
18
  export declare const STANDARD_LUT_ACCOUNTS: string[];
17
- export declare const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
18
19
  export declare const BROKEN_TOKENS: string[];
19
20
  //# sourceMappingURL=solautoConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACV,MAAM,iBAAiB,CAAC;AASzB,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AACF,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AAIF,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAO,CAAC;AAE7E,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAC1E,eAAO,MAAM,qBAAqB,UAYR,CAAC;AAE3B,eAAO,MAAM,iBAAiB,0CAA0C,CAAC;AAEzE,eAAO,MAAM,aAAa,UAOzB,CAAA"}
1
+ {"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACV,MAAM,iBAAiB,CAAC;AASzB,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AACF,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AAIF,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAO,CAAC;AAE7E,eAAO,MAAM,iBAAiB,0CAA0C,CAAC;AAEzE,eAAO,MAAM,iBAAiB,UAS7B,CAAC;AAEF,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAC1E,eAAO,MAAM,qBAAqB,UAaR,CAAC;AAG3B,eAAO,MAAM,aAAa,UAOzB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BROKEN_TOKENS = exports.JITO_BLOCK_ENGINE = exports.STANDARD_LUT_ACCOUNTS = exports.SOLAUTO_LUT = exports.PRICES = exports.MIN_USD_SUPPORTED_POSITION = exports.MIN_BOOST_GAP_BPS = exports.MIN_REPAY_GAP_BPS = exports.MIN_POSITION_STATE_FRESHNESS_SECS = exports.BASIS_POINTS = exports.SOLAUTO_TEST_PROGRAM = exports.SOLAUTO_PROD_PROGRAM = void 0;
3
+ exports.BROKEN_TOKENS = exports.STANDARD_LUT_ACCOUNTS = exports.SOLAUTO_LUT = exports.JITO_TIP_ACCOUNTS = exports.JITO_BLOCK_ENGINE = exports.PRICES = exports.MIN_USD_SUPPORTED_POSITION = exports.MIN_BOOST_GAP_BPS = exports.MIN_REPAY_GAP_BPS = exports.MIN_POSITION_STATE_FRESHNESS_SECS = exports.BASIS_POINTS = exports.SOLAUTO_TEST_PROGRAM = exports.SOLAUTO_PROD_PROGRAM = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const spl_token_1 = require("@solana/spl-token");
6
6
  const generalAccounts_1 = require("./generalAccounts");
@@ -15,6 +15,17 @@ exports.MIN_REPAY_GAP_BPS = 50;
15
15
  exports.MIN_BOOST_GAP_BPS = 50;
16
16
  exports.MIN_USD_SUPPORTED_POSITION = 1000;
17
17
  exports.PRICES = {};
18
+ exports.JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
19
+ exports.JITO_TIP_ACCOUNTS = [
20
+ "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
21
+ "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
22
+ "Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
23
+ "ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
24
+ "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
25
+ "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
26
+ "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
27
+ "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
28
+ ];
18
29
  exports.SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
19
30
  exports.STANDARD_LUT_ACCOUNTS = [
20
31
  web3_js_1.PublicKey.default,
@@ -28,8 +39,9 @@ exports.STANDARD_LUT_ACCOUNTS = [
28
39
  web3_js_1.SYSVAR_RENT_PUBKEY,
29
40
  web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
30
41
  jupiter_sdk_1.JUPITER_PROGRAM_ID,
42
+ ...exports.JITO_TIP_ACCOUNTS
31
43
  ].map((x) => x.toString());
32
- exports.JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
44
+ // TODO:
33
45
  exports.BROKEN_TOKENS = [
34
46
  tokenConstants_1.JUP,
35
47
  tokenConstants_1.JLP,
@@ -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;AAMzD,OAAO,EAEL,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;AAa7D,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;AA0FD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,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AC9B,OAAO,CAAC,0BAA0B,CAAC;IA0GzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAkCxB,6BAA6B;YA4I7B,qBAAqB;YAoDrB,eAAe;YA0Df,eAAe;CA4D9B"}
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;AAMzD,OAAO,EAEL,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;AAa7D,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;AA6FD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAA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ACvB,OAAO,CAAC,0BAA0B,CAAC;YAkCxB,6BAA6B;YAgJ7B,qBAAqB;YAoDrB,eAAe;YA0Df,eAAe;CA4D9B"}
@@ -76,6 +76,9 @@ class TransactionSet {
76
76
  this.lookupTables = lookupTables;
77
77
  this.items = items;
78
78
  }
79
+ async lutInputs() {
80
+ return await this.lookupTables.getLutInputs(this.lutAddresses());
81
+ }
79
82
  async fitsWith(item) {
80
83
  if (!item.tx) {
81
84
  return true;
@@ -112,10 +115,9 @@ class TransactionSet {
112
115
  const transactions = this.items
113
116
  .filter((x) => x.tx && x.tx.getInstructions().length > 0)
114
117
  .map((x) => x.tx);
115
- const lutInputs = await this.lookupTables.getLutInputs(this.lutAddresses());
116
118
  return (0, umi_1.transactionBuilder)()
117
119
  .add(transactions)
118
- .setAddressLookupTables(lutInputs);
120
+ .setAddressLookupTables(await this.lutInputs());
119
121
  }
120
122
  lutAddresses() {
121
123
  return Array.from(new Set(this.items.map((x) => x.lookupTableAddresses).flat()));
@@ -386,8 +388,9 @@ class TransactionsManager {
386
388
  }
387
389
  let txSigs;
388
390
  let error;
391
+ const lutInputs = await Promise.all(itemSets.map(async (x) => await x.lutInputs()));
389
392
  try {
390
- txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, this.txHandler.otherSigners, transactions, this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
393
+ txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, this.txHandler.otherSigners, transactions, lutInputs.flat(), this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
391
394
  }
392
395
  catch (e) {
393
396
  error = e;
@@ -1,5 +1,5 @@
1
1
  import { Connection, PublicKey } from "@solana/web3.js";
2
- import { Signer, TransactionBuilder, Umi, TransactionMessage } from "@metaplex-foundation/umi";
2
+ import { Signer, TransactionBuilder, Umi, TransactionMessage, AddressLookupTableInput } from "@metaplex-foundation/umi";
3
3
  import { PriorityFeeSetting, TransactionRunType } from "../types";
4
4
  export declare function getRandomTipAccount(): PublicKey;
5
5
  export declare function getRequiredSigners(message: TransactionMessage): {
@@ -7,5 +7,5 @@ export declare function getRequiredSigners(message: TransactionMessage): {
7
7
  publicKey: string;
8
8
  isWritable: boolean;
9
9
  }[];
10
- export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, userSigner: Signer, otherSigners: Signer[], txs: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
10
+ export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, userSigner: Signer, otherSigners: Signer[], txs: TransactionBuilder[], lutInputs: AddressLookupTableInput[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
11
11
  //# sourceMappingURL=jitoUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAgB,mBAAmB,IAAI,SAAS,CAa/C;AA+ND,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;;;IAkB7D;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,GAAG,EAAE,kBAAkB,EAAE,EACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA8F/B"}
1
+ {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAgB,mBAAmB,IAAI,SAAS,CAG/C;AAiOD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;;;IAkB7D;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,GAAG,EAAE,kBAAkB,EAAE,EACzB,SAAS,EAAE,uBAAuB,EAAE,EACpC,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAsG/B"}
@@ -8,6 +8,7 @@ exports.getRequiredSigners = getRequiredSigners;
8
8
  exports.sendJitoBundledTransactions = sendJitoBundledTransactions;
9
9
  const web3_js_1 = require("@solana/web3.js");
10
10
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
11
+ const solautoConstants_1 = require("../constants/solautoConstants");
11
12
  const solanaUtils_1 = require("./solanaUtils");
12
13
  const generalUtils_1 = require("./generalUtils");
13
14
  const types_1 = require("../types");
@@ -16,18 +17,8 @@ const bs58_1 = __importDefault(require("bs58"));
16
17
  const transactions_1 = require("../types/transactions");
17
18
  const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
18
19
  function getRandomTipAccount() {
19
- const tipAccounts = [
20
- "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
21
- "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
22
- "Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
23
- "ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
24
- "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
25
- "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
26
- "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
27
- "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
28
- ];
29
- const randomInt = Math.floor(Math.random() * tipAccounts.length);
30
- return new web3_js_1.PublicKey(tipAccounts[randomInt]);
20
+ const randomInt = Math.floor(Math.random() * solautoConstants_1.JITO_TIP_ACCOUNTS.length);
21
+ return new web3_js_1.PublicKey(solautoConstants_1.JITO_TIP_ACCOUNTS[randomInt]);
31
22
  }
32
23
  function getTipInstruction(signer, tipLamports) {
33
24
  return (0, solanaUtils_1.systemTransferUmiIx)(signer, getRandomTipAccount(), BigInt(tipLamports));
@@ -107,9 +98,10 @@ async function simulateJitoBundle(umi, txs) {
107
98
  const transactionResults = simulationResult.transactionResults;
108
99
  return transactionResults;
109
100
  }
110
- async function umiToVersionedTransactions(umi, blockhash, userSigner, otherSigners, txs, sign, feeEstimates, computeUnitLimits) {
101
+ async function umiToVersionedTransactions(umi, blockhash, userSigner, otherSigners, txs, lutInputs, sign, feeEstimates, computeUnitLimits) {
111
102
  let builtTxs = await Promise.all(txs.map(async (tx, i) => {
112
103
  return (0, solanaUtils_1.assembleFinalTransaction)(userSigner, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined)
104
+ .setAddressLookupTables(lutInputs)
113
105
  .setBlockhash(blockhash)
114
106
  .build(umi);
115
107
  }));
@@ -198,7 +190,7 @@ function getRequiredSigners(message) {
198
190
  }
199
191
  return signersInfo;
200
192
  }
201
- async function sendJitoBundledTransactions(umi, connection, userSigner, otherSigners, txs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
193
+ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSigners, txs, lutInputs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
202
194
  if (txs.length === 1) {
203
195
  const resp = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(umi, connection, txs[0], txType, priorityFeeSetting, onAwaitingSign);
204
196
  return resp ? [bytes_1.bs58.encode(resp)] : undefined;
@@ -208,6 +200,7 @@ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSig
208
200
  (0, generalUtils_1.consoleLog)(txs.map((tx) => tx.getInstructions().map((x) => x.programId.toString())));
209
201
  (0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
210
202
  txs[0] = txs[0].prepend(getTipInstruction(userSigner, 150000));
203
+ (0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
211
204
  const feeEstimates = priorityFeeSetting !== types_1.PriorityFeeSetting.None
212
205
  ? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting, true)) ?? 1000000))
213
206
  : undefined;
@@ -215,13 +208,13 @@ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSig
215
208
  let builtTxs = [];
216
209
  let simulationResults;
217
210
  if (txType !== "skip-simulation") {
218
- builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, false, feeEstimates);
211
+ builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, lutInputs, false, feeEstimates);
219
212
  (0, generalUtils_1.consoleLog)(builtTxs.map((x) => x.message.compiledInstructions.map((y) => x.message.staticAccountKeys[y.programIdIndex].toString())));
220
213
  simulationResults = await simulateJitoBundle(umi, builtTxs);
221
214
  }
222
215
  if (txType !== "only-simulate") {
223
216
  onAwaitingSign?.();
224
- builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, true, feeEstimates, simulationResults
217
+ builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, lutInputs, true, feeEstimates, simulationResults
225
218
  ? simulationResults.map((x) => x.unitsConsumed * 1.15)
226
219
  : undefined);
227
220
  const serializedTxs = builtTxs.map((x) => x.serialize());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.515",
3
+ "version": "1.0.517",
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",
@@ -31,6 +31,19 @@ export const MIN_USD_SUPPORTED_POSITION = 1000;
31
31
 
32
32
  export const PRICES: { [key: string]: { price: number; time: number } } = {};
33
33
 
34
+ export const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
35
+
36
+ export const JITO_TIP_ACCOUNTS = [
37
+ "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
38
+ "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
39
+ "Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
40
+ "ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
41
+ "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
42
+ "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
43
+ "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
44
+ "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
45
+ ];
46
+
34
47
  export const SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
35
48
  export const STANDARD_LUT_ACCOUNTS = [
36
49
  PublicKey.default,
@@ -44,10 +57,10 @@ export const STANDARD_LUT_ACCOUNTS = [
44
57
  SYSVAR_RENT_PUBKEY,
45
58
  SYSVAR_INSTRUCTIONS_PUBKEY,
46
59
  JUPITER_PROGRAM_ID,
60
+ ...JITO_TIP_ACCOUNTS
47
61
  ].map((x) => x.toString());
48
62
 
49
- export const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
50
-
63
+ // TODO:
51
64
  export const BROKEN_TOKENS = [
52
65
  JUP,
53
66
  JLP,
@@ -123,6 +123,10 @@ class TransactionSet {
123
123
  public items: TransactionItem[] = []
124
124
  ) {}
125
125
 
126
+ async lutInputs(): Promise<AddressLookupTableInput[]> {
127
+ return await this.lookupTables.getLutInputs(this.lutAddresses());
128
+ }
129
+
126
130
  async fitsWith(item: TransactionItem): Promise<boolean> {
127
131
  if (!item.tx) {
128
132
  return true;
@@ -175,10 +179,9 @@ class TransactionSet {
175
179
  .filter((x) => x.tx && x.tx.getInstructions().length > 0)
176
180
  .map((x) => x.tx!);
177
181
 
178
- const lutInputs = await this.lookupTables.getLutInputs(this.lutAddresses());
179
182
  return transactionBuilder()
180
183
  .add(transactions)
181
- .setAddressLookupTables(lutInputs);
184
+ .setAddressLookupTables(await this.lutInputs());
182
185
  }
183
186
 
184
187
  lutAddresses(): string[] {
@@ -616,6 +619,9 @@ export class TransactionsManager {
616
619
 
617
620
  let txSigs: string[] | undefined;
618
621
  let error: Error | undefined;
622
+ const lutInputs = await Promise.all(
623
+ itemSets.map(async (x) => await x.lutInputs())
624
+ );
619
625
  try {
620
626
  txSigs = await sendJitoBundledTransactions(
621
627
  this.txHandler.umi,
@@ -623,6 +629,7 @@ export class TransactionsManager {
623
629
  this.txHandler.signer,
624
630
  this.txHandler.otherSigners,
625
631
  transactions,
632
+ lutInputs.flat(),
626
633
  this.txType,
627
634
  this.getUpdatedPriorityFeeSetting(prevError, attemptNum),
628
635
  () =>
@@ -7,13 +7,17 @@ import {
7
7
  VersionedTransaction,
8
8
  } from "@solana/web3.js";
9
9
  import { toWeb3JsTransaction } from "@metaplex-foundation/umi-web3js-adapters";
10
- import { JITO_BLOCK_ENGINE } from "../constants/solautoConstants";
10
+ import {
11
+ JITO_BLOCK_ENGINE,
12
+ JITO_TIP_ACCOUNTS,
13
+ } from "../constants/solautoConstants";
11
14
  import {
12
15
  Signer,
13
16
  TransactionBuilder,
14
17
  Umi,
15
18
  WrappedInstruction,
16
19
  TransactionMessage,
20
+ AddressLookupTableInput,
17
21
  } from "@metaplex-foundation/umi";
18
22
  import {
19
23
  assembleFinalTransaction,
@@ -29,18 +33,8 @@ import { BundleSimulationError } from "../types/transactions";
29
33
  import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
30
34
 
31
35
  export function getRandomTipAccount(): PublicKey {
32
- const tipAccounts = [
33
- "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
34
- "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
35
- "Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
36
- "ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
37
- "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
38
- "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
39
- "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
40
- "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
41
- ];
42
- const randomInt = Math.floor(Math.random() * tipAccounts.length);
43
- return new PublicKey(tipAccounts[randomInt]);
36
+ const randomInt = Math.floor(Math.random() * JITO_TIP_ACCOUNTS.length);
37
+ return new PublicKey(JITO_TIP_ACCOUNTS[randomInt]);
44
38
  }
45
39
 
46
40
  function getTipInstruction(
@@ -160,6 +154,7 @@ async function umiToVersionedTransactions(
160
154
  userSigner: Signer,
161
155
  otherSigners: Signer[],
162
156
  txs: TransactionBuilder[],
157
+ lutInputs: AddressLookupTableInput[],
163
158
  sign: boolean,
164
159
  feeEstimates?: number[],
165
160
  computeUnitLimits?: number[]
@@ -172,6 +167,7 @@ async function umiToVersionedTransactions(
172
167
  feeEstimates ? feeEstimates[i] : undefined,
173
168
  computeUnitLimits ? computeUnitLimits[i] : undefined
174
169
  )
170
+ .setAddressLookupTables(lutInputs)
175
171
  .setBlockhash(blockhash)
176
172
  .build(umi);
177
173
  })
@@ -290,6 +286,7 @@ export async function sendJitoBundledTransactions(
290
286
  userSigner: Signer,
291
287
  otherSigners: Signer[],
292
288
  txs: TransactionBuilder[],
289
+ lutInputs: AddressLookupTableInput[],
293
290
  txType?: TransactionRunType,
294
291
  priorityFeeSetting: PriorityFeeSetting = PriorityFeeSetting.Min,
295
292
  onAwaitingSign?: () => void
@@ -317,6 +314,12 @@ export async function sendJitoBundledTransactions(
317
314
  );
318
315
 
319
316
  txs[0] = txs[0].prepend(getTipInstruction(userSigner, 150_000));
317
+
318
+ consoleLog(
319
+ "Transaction sizes: ",
320
+ txs.map((x) => x.getTransactionSize(umi))
321
+ );
322
+
320
323
  const feeEstimates =
321
324
  priorityFeeSetting !== PriorityFeeSetting.None
322
325
  ? await Promise.all(
@@ -345,6 +348,7 @@ export async function sendJitoBundledTransactions(
345
348
  userSigner,
346
349
  otherSigners,
347
350
  txs,
351
+ lutInputs,
348
352
  false,
349
353
  feeEstimates
350
354
  );
@@ -367,6 +371,7 @@ export async function sendJitoBundledTransactions(
367
371
  userSigner,
368
372
  otherSigners,
369
373
  txs,
374
+ lutInputs,
370
375
  true,
371
376
  feeEstimates,
372
377
  simulationResults