@haven-fi/solauto-sdk 1.0.372 → 1.0.374

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.
@@ -1 +1 @@
1
- {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAmBxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAqCzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA2LjD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAoH7B;AA2LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,aAAa,oBAkDzE;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA2H5C;AAED,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAsC5C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,EA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 async function convertReferralFeesToDestination(referralManager, tokenAccount, d
439
439
  .add(swapIx);
440
440
  return { tx, lookupTableAddresses };
441
441
  }
442
+ function parseJitoErrorMessage(message) {
443
+ const regex = /Error processing Instruction (\d+): custom program error: (0x[0-9A-Fa-f]+|\d+)/;
444
+ const match = message.match(regex);
445
+ if (match) {
446
+ const instructionIndex = parseInt(match[1], 10);
447
+ let errorCode;
448
+ if (match[2].toLowerCase().startsWith("0x")) {
449
+ errorCode = parseInt(match[2], 16);
450
+ }
451
+ else {
452
+ errorCode = parseInt(match[2], 10);
453
+ }
454
+ return {
455
+ instructionIndex,
456
+ errorCode,
457
+ };
458
+ }
459
+ else {
460
+ return null;
461
+ }
462
+ }
442
463
  function getErrorInfo(umi, tx, error, simulationSuccessful) {
443
464
  let canBeIgnored = false;
444
465
  let errorName = undefined;
@@ -449,7 +470,10 @@ function getErrorInfo(umi, tx, error, simulationSuccessful) {
449
470
  const err = error["InstructionError"];
450
471
  const computeIxs = simulationSuccessful ? 2 : 1; // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
451
472
  const errIxIdx = err[0] - computeIxs;
452
- (0, generalUtils_1.consoleLog)("Transaction instructions:", tx.getInstructions().map(x => x.programId.toString()).join(","));
473
+ (0, generalUtils_1.consoleLog)("Transaction instructions:", tx
474
+ .getInstructions()
475
+ .map((x) => x.programId.toString())
476
+ .join(","));
453
477
  (0, generalUtils_1.consoleLog)("Error instruction index:", errIxIdx);
454
478
  const errIx = tx.getInstructions()[Math.max(0, errIxIdx)];
455
479
  const errCode = typeof err[1] === "object" && "Custom" in err[1]
@@ -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,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;A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AAkB,GAAE,kBAA2C,EAC/D,UAAU,GAAE,OAAe,EAC3B,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,mBAAmB;YAoBb,SAAS;IAiBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA+FzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA4BxB,6BAA6B;YAuH7B,qBAAqB;YA2CrB,cAAc;YAqCd,eAAe;CA0D9B"}
@@ -171,15 +171,14 @@ class TransactionsManager {
171
171
  let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
172
172
  item,
173
173
  ]);
174
- for (let j = i; j >= 0; j--) {
175
- if (await newSet.fitsWith(items[j])) {
176
- newSet.prepend(items[j]);
177
- i--;
178
- }
179
- else {
180
- break;
181
- }
182
- }
174
+ // for (let j = i; j >= 0; j--) {
175
+ // if (await newSet.fitsWith(items[j])) {
176
+ // newSet.prepend(items[j]);
177
+ // i--;
178
+ // } else {
179
+ // break;
180
+ // }
181
+ // }
183
182
  transactionSets.unshift(newSet);
184
183
  }
185
184
  }
@@ -319,10 +318,6 @@ class TransactionsManager {
319
318
  const itemSets = await this.assembleTransactionSets(items);
320
319
  this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
321
320
  this.txHandler.log("Initial item sets:", itemSets.length);
322
- if (this.txType === "only-simulate" && itemSets.length > 1) {
323
- this.txHandler.log("Only simulate and more than 1 transaction. Skipping...");
324
- return [];
325
- }
326
321
  if (itemSets.length > 1 && this.atomically) {
327
322
  await this.processTransactionsAtomically(itemSets);
328
323
  }
@@ -337,6 +332,7 @@ class TransactionsManager {
337
332
  }
338
333
  async processTransactionsAtomically(itemSets) {
339
334
  let num = 0;
335
+ let transactions = [];
340
336
  await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum, prevError) => {
341
337
  num = attemptNum;
342
338
  if (attemptNum > 0) {
@@ -345,7 +341,7 @@ class TransactionsManager {
345
341
  }
346
342
  itemSets = await this.assembleTransactionSets(itemSets.flatMap((x) => x.items));
347
343
  }
348
- let transactions = [];
344
+ transactions = [];
349
345
  for (const set of itemSets) {
350
346
  transactions.push(await set.getSingleTransaction());
351
347
  }
@@ -358,19 +354,30 @@ class TransactionsManager {
358
354
  let txSigs;
359
355
  let error;
360
356
  try {
361
- txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, transactions, this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
357
+ txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.signer, transactions, this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
362
358
  }
363
359
  catch (e) {
364
360
  error = e;
365
361
  }
366
- if (error || !Boolean(txSigs) || txSigs?.length === 0) {
362
+ if (error ||
363
+ (this.txType !== "only-simulate" &&
364
+ (!Boolean(txSigs) || txSigs?.length === 0))) {
367
365
  this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, undefined, error?.message);
368
366
  throw error ? error : new Error("Unknown error");
369
367
  }
370
368
  this.updateStatusForSets(itemSets, TransactionStatus.Successful, attemptNum, txSigs);
371
369
  }, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
372
- this.updateStatusForSets(itemSets, TransactionStatus.Failed, num, undefined, undefined, e.message);
373
- throw e;
370
+ this.txHandler.log("Capturing error info...");
371
+ const errorDetails = (0, transactionUtils_1.getErrorInfo)(this.txHandler.umi, (0, umi_1.transactionBuilder)().add(transactions), e, itemSets.filter((x) => this.statuses.find((y) => x.name() === y.name)?.simulationSuccessful).length === itemSets.length);
372
+ const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
373
+ this.updateStatusForSets(itemSets, errorDetails.canBeIgnored
374
+ ? TransactionStatus.Skipped
375
+ : TransactionStatus.Failed, num, undefined, undefined, errorDetails.errorName || errorDetails.errorInfo
376
+ ? errorString
377
+ : e.message);
378
+ if (!errorDetails.canBeIgnored) {
379
+ throw e;
380
+ }
374
381
  });
375
382
  }
376
383
  async processTransactionSet(itemSets, currentIndex) {
@@ -391,12 +398,7 @@ class TransactionsManager {
391
398
  await this.debugAccounts(itemSet, tx);
392
399
  await this.sendTransaction(tx, itemSet.name(), attemptNum, this.getUpdatedPriorityFeeSetting(prevError, attemptNum));
393
400
  }
394
- }, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
395
- if (itemSet) {
396
- this.updateStatus(itemSet.name(), TransactionStatus.Failed, num, undefined, undefined, e.message);
397
- }
398
- throw e;
399
- });
401
+ }, this.retries, this.retryDelay, this.errorsToThrow);
400
402
  }
401
403
  async refreshItemSet(itemSets, currentIndex, attemptNum) {
402
404
  const itemSet = itemSets[currentIndex];
@@ -423,8 +425,8 @@ class TransactionsManager {
423
425
  this.updateStatus(txName, TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
424
426
  }
425
427
  catch (e) {
426
- this.txHandler.log("Caputring error info...");
427
- const errorDetails = (0, transactionUtils_1.getErrorInfo)(this.txHandler.umi, tx, e, this.statuses.find(x => x.name === txName)?.simulationSuccessful);
428
+ this.txHandler.log("Capturing error info...");
429
+ const errorDetails = (0, transactionUtils_1.getErrorInfo)(this.txHandler.umi, tx, e, this.statuses.find((x) => x.name === txName)?.simulationSuccessful);
428
430
  const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
429
431
  this.updateStatus(txName, errorDetails.canBeIgnored
430
432
  ? TransactionStatus.Skipped
@@ -1,6 +1,6 @@
1
- import { Connection, PublicKey } from "@solana/web3.js";
1
+ import { PublicKey } from "@solana/web3.js";
2
2
  import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
3
3
  import { PriorityFeeSetting, TransactionRunType } from "../types";
4
4
  export declare function getRandomTipAccount(): Promise<PublicKey>;
5
- export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, signer: Signer, txs: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
5
+ export declare function sendJitoBundledTransactions(umi: Umi, signer: Signer, txs: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
6
6
  //# sourceMappingURL=jitoUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAoE,MAAM,iBAAiB,CAAC;AAG1H,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAKlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAyHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,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,CA+D/B"}
1
+ {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAoKD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,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,CAwE/B"}
@@ -13,7 +13,6 @@ const generalUtils_1 = require("./generalUtils");
13
13
  const types_1 = require("../types");
14
14
  const axios_1 = __importDefault(require("axios"));
15
15
  const bs58_1 = __importDefault(require("bs58"));
16
- const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
17
16
  async function getRandomTipAccount() {
18
17
  const tipAccounts = [
19
18
  "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
@@ -31,28 +30,51 @@ async function getRandomTipAccount() {
31
30
  async function getTipInstruction(signer, tipLamports) {
32
31
  return (0, solanaUtils_1.systemTransferUmiIx)(signer, await getRandomTipAccount(), BigInt(tipLamports));
33
32
  }
34
- // TODO: fix
35
- // async function simulateJitoBundle(umi: Umi, txs: VersionedTransaction[]) {
36
- // const simulationResult = await axios.post(
37
- // `${JITO_BLOCK_ENGINE}/api/v1/bundles`,
38
- // {
39
- // method: "simulateBundle",
40
- // id: 1,
41
- // jsonrpc: "2.0",
42
- // params: [
43
- // {
44
- // encodedTransactions: txs.map((x) => bs58.encode(x.serialize())),
45
- // preExecutionAccountsConfigs: txs.map((_) => ""),
46
- // postExecutionAccountsConfigs: txs.map((_) => ""),
47
- // skipSigVerify: true,
48
- // },
49
- // ],
50
- // }
51
- // );
52
- // }
53
- async function umiToVersionedTransactions(umi, signer, txs, sign, feeEstimates, computeUnitLimits) {
33
+ async function simulateJitoBundle(umi, txs) {
34
+ const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
35
+ const resp = await axios_1.default.post(umi.rpc.getEndpoint(), {
36
+ jsonrpc: "2.0",
37
+ id: 1,
38
+ method: "simulateBundle",
39
+ params: [
40
+ {
41
+ encodedTransactions: txs.map((x) => Buffer.from(x.serialize()).toString("base64")),
42
+ },
43
+ {
44
+ encoding: "base64",
45
+ commitment: "confirmed",
46
+ preExecutionAccountsConfigs: txs.map((_) => { }),
47
+ postExecutionAccountsConfigs: txs.map((_) => { }),
48
+ skipSigVerify: true,
49
+ },
50
+ ],
51
+ }, {
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ },
55
+ });
56
+ const res = resp.data.result.value;
57
+ if (res && res.summary.failed) {
58
+ const transactionResults = res.transactionResults;
59
+ transactionResults.forEach((x) => {
60
+ x.logs?.forEach((y) => {
61
+ (0, generalUtils_1.consoleLog)(y);
62
+ });
63
+ });
64
+ (0, generalUtils_1.consoleLog)(JSON.stringify(transactionResults, null, 2));
65
+ const txFailure = res.summary.failed.error.TransactionFailure;
66
+ throw new Error(txFailure ? txFailure[1] : res.summary.failed.toString());
67
+ }
68
+ return res;
69
+ });
70
+ const transactionResults = simulationResult.transactionResults;
71
+ return transactionResults;
72
+ }
73
+ async function umiToVersionedTransactions(umi, blockhash, signer, txs, sign, feeEstimates, computeUnitLimits) {
54
74
  let builtTxs = await Promise.all(txs.map(async (tx, i) => {
55
- return (await (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined).setLatestBlockhash(umi)).build(umi);
75
+ return (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined)
76
+ .setBlockhash(blockhash)
77
+ .build(umi);
56
78
  }));
57
79
  if (sign) {
58
80
  builtTxs = await signer.signAllTransactions(builtTxs);
@@ -80,7 +102,12 @@ async function pollBundleStatus(bundleId, interval = 1000, timeout = 40000) {
80
102
  (0, generalUtils_1.consoleLog)("Statuses:", statuses);
81
103
  const status = statuses.value[0].confirmation_status;
82
104
  if (status === "confirmed") {
83
- return statuses?.value[0].transactions;
105
+ return statuses.value[0].transactions;
106
+ }
107
+ const err = statuses.value[0].err;
108
+ if (err) {
109
+ (0, generalUtils_1.consoleLog)("Jito bundle err:", JSON.stringify(err, null, 2));
110
+ throw new Error(err);
84
111
  }
85
112
  }
86
113
  }
@@ -109,32 +136,30 @@ async function sendJitoBundle(transactions) {
109
136
  (0, generalUtils_1.consoleLog)("Bundle ID:", bundleId);
110
137
  return bundleId ? await pollBundleStatus(bundleId) : [];
111
138
  }
112
- async function sendJitoBundledTransactions(umi, connection, signer, txs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
113
- if (txs.length === 1) {
114
- const res = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(umi, connection, txs[0], txType, priorityFeeSetting);
115
- return res ? [bytes_1.bs58.encode(res)] : undefined;
116
- }
139
+ async function sendJitoBundledTransactions(umi, signer, txs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
117
140
  (0, generalUtils_1.consoleLog)("Sending Jito bundle...");
118
141
  (0, generalUtils_1.consoleLog)("Transactions: ", txs.length);
119
142
  (0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
143
+ // consoleLog(txs.map((x) => x.getInstructions().map((x) => x.programId)));
120
144
  txs[0] = txs[0].prepend(await getTipInstruction(signer, 150000));
121
145
  const feeEstimates = priorityFeeSetting !== types_1.PriorityFeeSetting.None
122
146
  ? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting)) ??
123
147
  1000000))
124
148
  : undefined;
125
- let builtTxs = await umiToVersionedTransactions(umi, signer, txs, true, // false if simulating first and rebuilding later
126
- feeEstimates);
127
- // const simulationResults = await simulateJitoBundle(umi, builtTxs);
149
+ const latestBlockhash = (await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })).blockhash;
150
+ let builtTxs;
151
+ let simulationResults;
152
+ if (txType !== "skip-simulation") {
153
+ builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, false, feeEstimates);
154
+ (0, generalUtils_1.consoleLog)(builtTxs.map((x) => x.message.compiledInstructions.map((y) => x.message.staticAccountKeys[y.programIdIndex].toString())));
155
+ simulationResults = await simulateJitoBundle(umi, builtTxs);
156
+ }
128
157
  if (txType !== "only-simulate") {
129
- // let builtTxs = await umiToVersionedTransactions(
130
- // client.signer,
131
- // txs,
132
- // true,
133
- // feeEstimates,
134
- // simulationResults.map((x) => x.unitsConsumed! * 1.15)
135
- // );
158
+ builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
159
+ ? simulationResults.map((x) => x.unitsConsumed * 1.15)
160
+ : undefined);
136
161
  const serializedTxs = builtTxs.map((x) => x.serialize());
137
- if (serializedTxs.find(x => x.length > 1232)) {
162
+ if (serializedTxs.find((x) => x.length > 1232)) {
138
163
  throw new Error("A transaction is too large");
139
164
  }
140
165
  onAwaitingSign?.();
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAGJ,eAAe,EAGhB,MAAM,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e,CAAA;CAAE,EAC1D,aAAa,CAAC,EAAE,SAAS,EACzB,MAAM,CAAC,EAAE,aAAa,EACtB,IAAI,CAAC,EAAE,aAAa,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAwLpC;AA+DD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,oBAU7C;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBnE;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,eAAe,WASpE"}
@@ -229,9 +229,13 @@ async function getMarginfiAccountPositionState(umi, protocolAccount, marginfiGro
229
229
  if (!supplyUsage) {
230
230
  supplyUsage = await getTokenUsage(supplyBank, true, 0, livePositionUpdates?.supplyAdjustment);
231
231
  }
232
- if (debtBank === null ||
233
- (!constants_1.TOKEN_INFO[supplyBank.mint.toString()].isStableCoin &&
234
- !constants_1.TOKEN_INFO[debtBank.mint.toString()].isStableCoin)) {
232
+ if (debtBank === null) {
233
+ return undefined;
234
+ }
235
+ const supplyMint = constants_1.TOKEN_INFO[supplyBank.mint.toString()];
236
+ const debtMint = constants_1.TOKEN_INFO[debtBank.mint.toString()];
237
+ if ((!supplyMint.isStableCoin && !debtMint.isStableCoin) ||
238
+ (supplyMint.isStableCoin && debtMint.isStableCoin)) {
235
239
  return undefined;
236
240
  }
237
241
  if (!debtUsage) {
@@ -179,7 +179,7 @@ async function getComputeUnitPriceEstimate(umi, tx, prioritySetting) {
179
179
  feeEstimate = Math.round(resp.priorityFeeEstimate);
180
180
  }
181
181
  catch (e) {
182
- console.error(e);
182
+ // console.error(e);
183
183
  }
184
184
  }
185
185
  return feeEstimate;
@@ -230,7 +230,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prior
230
230
  const blockhash = await connection.getLatestBlockhash("confirmed");
231
231
  let computeUnitLimit = undefined;
232
232
  if (txType !== "skip-simulation") {
233
- const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(umi, connection, await assembleFinalTransaction(umi.identity, tx, undefined, 1400000).setBlockhash(blockhash)), 3);
233
+ const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(umi, connection, assembleFinalTransaction(umi.identity, tx, undefined, 1400000).setBlockhash(blockhash)), 3);
234
234
  simulationResult.value.err;
235
235
  computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.15);
236
236
  (0, generalUtils_1.consoleLog)("Compute unit limit: ", computeUnitLimit);
@@ -0,0 +1,21 @@
1
+ import {
2
+ buildHeliusApiUrl,
3
+ getSolanaRpcConnection,
4
+ getSolautoManagedPositions,
5
+ SOLAUTO_PROD_PROGRAM,
6
+ } from "../src";
7
+
8
+ async function main() {
9
+ const [_, umi] = getSolanaRpcConnection(
10
+ buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
11
+ SOLAUTO_PROD_PROGRAM
12
+ );
13
+ const positions = await getSolautoManagedPositions(umi);
14
+ // TODO: filter out certain wallet authorities using an env variable
15
+
16
+ console.log(positions);
17
+ console.log("Total positions:", positions.length);
18
+ // TODO: log net worth / balances
19
+ }
20
+
21
+ main().then((x) => x);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.372",
3
+ "version": "1.0.374",
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",
@@ -10,11 +10,7 @@
10
10
  "build": "rm -rf dist && npx tsc",
11
11
  "test:txs": "ts-mocha -p ./tsconfig.json -t 1000000 tests/transactions/**/*.ts",
12
12
  "test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts",
13
- "test:all": "pnpm test:unit && pnpm test:txs",
14
- "update-lut:solauto": "npx ts-node local/updateSolautoLUT.ts",
15
- "update-lut:marginfi": "npx ts-node local/updateMarginfiLUT.ts",
16
- "create-ism-accounts": "npx ts-node local/createISMAccounts.ts",
17
- "create-token-accounts": "npx ts-node local/createTokenAccounts.ts"
13
+ "test:all": "pnpm test:unit && pnpm test:txs"
18
14
  },
19
15
  "dependencies": {
20
16
  "@coral-xyz/anchor": "^0.30.1",
@@ -637,7 +637,10 @@ export async function requiresRefreshBeforeRebalance(client: SolautoClient) {
637
637
  client.livePositionUpdates.debtAdjustment === BigInt(0) &&
638
638
  utilizationRateDiff >= 10
639
639
  ) {
640
- client.log("Choosing to refresh before rebalance. Utilization rate diff:", utilizationRateDiff);
640
+ client.log(
641
+ "Choosing to refresh before rebalance. Utilization rate diff:",
642
+ utilizationRateDiff
643
+ );
641
644
  return true;
642
645
  }
643
646
  }
@@ -821,7 +824,36 @@ export async function convertReferralFeesToDestination(
821
824
  return { tx, lookupTableAddresses };
822
825
  }
823
826
 
824
- export function getErrorInfo(umi: Umi, tx: TransactionBuilder, error: any, simulationSuccessful?: boolean) {
827
+ function parseJitoErrorMessage(message: string) {
828
+ const regex =
829
+ /Error processing Instruction (\d+): custom program error: (0x[0-9A-Fa-f]+|\d+)/;
830
+ const match = message.match(regex);
831
+
832
+ if (match) {
833
+ const instructionIndex = parseInt(match[1], 10);
834
+
835
+ let errorCode: number;
836
+ if (match[2].toLowerCase().startsWith("0x")) {
837
+ errorCode = parseInt(match[2], 16);
838
+ } else {
839
+ errorCode = parseInt(match[2], 10);
840
+ }
841
+
842
+ return {
843
+ instructionIndex,
844
+ errorCode,
845
+ };
846
+ } else {
847
+ return null;
848
+ }
849
+ }
850
+
851
+ export function getErrorInfo(
852
+ umi: Umi,
853
+ tx: TransactionBuilder,
854
+ error: any,
855
+ simulationSuccessful?: boolean
856
+ ) {
825
857
  let canBeIgnored = false;
826
858
  let errorName: string | undefined = undefined;
827
859
  let errorInfo: string | undefined = undefined;
@@ -835,7 +867,13 @@ export function getErrorInfo(umi: Umi, tx: TransactionBuilder, error: any, simul
835
867
  const computeIxs = simulationSuccessful ? 2 : 1; // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
836
868
  const errIxIdx = err[0] - computeIxs;
837
869
 
838
- consoleLog("Transaction instructions:", tx.getInstructions().map(x => x.programId.toString()).join(","));
870
+ consoleLog(
871
+ "Transaction instructions:",
872
+ tx
873
+ .getInstructions()
874
+ .map((x) => x.programId.toString())
875
+ .join(",")
876
+ );
839
877
  consoleLog("Error instruction index:", errIxIdx);
840
878
 
841
879
  const errIx = tx.getInstructions()[Math.max(0, errIxIdx)];
@@ -263,14 +263,14 @@ export class TransactionsManager {
263
263
  let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
264
264
  item,
265
265
  ]);
266
- for (let j = i; j >= 0; j--) {
267
- if (await newSet.fitsWith(items[j])) {
268
- newSet.prepend(items[j]);
269
- i--;
270
- } else {
271
- break;
272
- }
273
- }
266
+ // for (let j = i; j >= 0; j--) {
267
+ // if (await newSet.fitsWith(items[j])) {
268
+ // newSet.prepend(items[j]);
269
+ // i--;
270
+ // } else {
271
+ // break;
272
+ // }
273
+ // }
274
274
  transactionSets.unshift(newSet);
275
275
  }
276
276
  }
@@ -510,13 +510,6 @@ export class TransactionsManager {
510
510
  this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
511
511
  this.txHandler.log("Initial item sets:", itemSets.length);
512
512
 
513
- if (this.txType === "only-simulate" && itemSets.length > 1) {
514
- this.txHandler.log(
515
- "Only simulate and more than 1 transaction. Skipping..."
516
- );
517
- return [];
518
- }
519
-
520
513
  if (itemSets.length > 1 && this.atomically) {
521
514
  await this.processTransactionsAtomically(itemSets);
522
515
  } else {
@@ -532,6 +525,7 @@ export class TransactionsManager {
532
525
 
533
526
  private async processTransactionsAtomically(itemSets: TransactionSet[]) {
534
527
  let num = 0;
528
+ let transactions: TransactionBuilder[] = [];
535
529
 
536
530
  await retryWithExponentialBackoff(
537
531
  async (attemptNum, prevError) => {
@@ -546,7 +540,7 @@ export class TransactionsManager {
546
540
  );
547
541
  }
548
542
 
549
- let transactions = [];
543
+ transactions = [];
550
544
  for (const set of itemSets) {
551
545
  transactions.push(await set.getSingleTransaction());
552
546
  }
@@ -573,7 +567,6 @@ export class TransactionsManager {
573
567
  try {
574
568
  txSigs = await sendJitoBundledTransactions(
575
569
  this.txHandler.umi,
576
- this.txHandler.connection,
577
570
  this.txHandler.signer,
578
571
  transactions,
579
572
  this.txType,
@@ -591,7 +584,11 @@ export class TransactionsManager {
591
584
  error = e as Error;
592
585
  }
593
586
 
594
- if (error || !Boolean(txSigs) || txSigs?.length === 0) {
587
+ if (
588
+ error ||
589
+ (this.txType !== "only-simulate" &&
590
+ (!Boolean(txSigs) || txSigs?.length === 0))
591
+ ) {
595
592
  this.updateStatusForSets(
596
593
  itemSets,
597
594
  TransactionStatus.Failed,
@@ -614,15 +611,34 @@ export class TransactionsManager {
614
611
  this.retryDelay,
615
612
  this.errorsToThrow
616
613
  ).catch((e: Error) => {
614
+ this.txHandler.log("Capturing error info...");
615
+ const errorDetails = getErrorInfo(
616
+ this.txHandler.umi,
617
+ transactionBuilder().add(transactions),
618
+ e,
619
+ itemSets.filter(
620
+ (x) =>
621
+ this.statuses.find((y) => x.name() === y.name)?.simulationSuccessful
622
+ ).length === itemSets.length
623
+ );
624
+
625
+ const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
617
626
  this.updateStatusForSets(
618
627
  itemSets,
619
- TransactionStatus.Failed,
628
+ errorDetails.canBeIgnored
629
+ ? TransactionStatus.Skipped
630
+ : TransactionStatus.Failed,
620
631
  num,
621
632
  undefined,
622
633
  undefined,
623
- e.message
634
+ errorDetails.errorName || errorDetails.errorInfo
635
+ ? errorString
636
+ : e.message
624
637
  );
625
- throw e;
638
+
639
+ if (!errorDetails.canBeIgnored) {
640
+ throw e;
641
+ }
626
642
  });
627
643
  }
628
644
 
@@ -666,19 +682,7 @@ export class TransactionsManager {
666
682
  this.retries,
667
683
  this.retryDelay,
668
684
  this.errorsToThrow
669
- ).catch((e: Error) => {
670
- if (itemSet) {
671
- this.updateStatus(
672
- itemSet.name(),
673
- TransactionStatus.Failed,
674
- num,
675
- undefined,
676
- undefined,
677
- e.message
678
- );
679
- }
680
- throw e;
681
- });
685
+ );
682
686
  }
683
687
 
684
688
  private async refreshItemSet(
@@ -749,8 +753,13 @@ export class TransactionsManager {
749
753
  txSig ? bs58.encode(txSig) : undefined
750
754
  );
751
755
  } catch (e: any) {
752
- this.txHandler.log("Caputring error info...");
753
- const errorDetails = getErrorInfo(this.txHandler.umi, tx, e, this.statuses.find(x => x.name === txName)?.simulationSuccessful);
756
+ this.txHandler.log("Capturing error info...");
757
+ const errorDetails = getErrorInfo(
758
+ this.txHandler.umi,
759
+ tx,
760
+ e,
761
+ this.statuses.find((x) => x.name === txName)?.simulationSuccessful
762
+ );
754
763
 
755
764
  const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
756
765
  this.updateStatus(
@@ -1,4 +1,9 @@
1
- import { Connection, PublicKey, TransactionExpiredBlockheightExceededError, VersionedTransaction } from "@solana/web3.js";
1
+ import {
2
+ PublicKey,
3
+ SimulatedTransactionResponse,
4
+ TransactionExpiredBlockheightExceededError,
5
+ VersionedTransaction,
6
+ } from "@solana/web3.js";
2
7
  import { toWeb3JsTransaction } from "@metaplex-foundation/umi-web3js-adapters";
3
8
  import { JITO_BLOCK_ENGINE } from "../constants/solautoConstants";
4
9
  import {
@@ -9,16 +14,13 @@ import {
9
14
  } from "@metaplex-foundation/umi";
10
15
  import {
11
16
  assembleFinalTransaction,
12
- buildIronforgeApiUrl,
13
17
  getComputeUnitPriceEstimate,
14
- sendSingleOptimizedTransaction,
15
18
  systemTransferUmiIx,
16
19
  } from "./solanaUtils";
17
- import { consoleLog } from "./generalUtils";
20
+ import { consoleLog, retryWithExponentialBackoff } from "./generalUtils";
18
21
  import { PriorityFeeSetting, TransactionRunType } from "../types";
19
22
  import axios from "axios";
20
23
  import base58 from "bs58";
21
- import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
22
24
 
23
25
  export async function getRandomTipAccount(): Promise<PublicKey> {
24
26
  const tipAccounts = [
@@ -46,28 +48,64 @@ async function getTipInstruction(
46
48
  );
47
49
  }
48
50
 
49
- // TODO: fix
50
- // async function simulateJitoBundle(umi: Umi, txs: VersionedTransaction[]) {
51
- // const simulationResult = await axios.post(
52
- // `${JITO_BLOCK_ENGINE}/api/v1/bundles`,
53
- // {
54
- // method: "simulateBundle",
55
- // id: 1,
56
- // jsonrpc: "2.0",
57
- // params: [
58
- // {
59
- // encodedTransactions: txs.map((x) => bs58.encode(x.serialize())),
60
- // preExecutionAccountsConfigs: txs.map((_) => ""),
61
- // postExecutionAccountsConfigs: txs.map((_) => ""),
62
- // skipSigVerify: true,
63
- // },
64
- // ],
65
- // }
66
- // );
67
- // }
51
+ async function simulateJitoBundle(umi: Umi, txs: VersionedTransaction[]) {
52
+ const simulationResult = await retryWithExponentialBackoff(async () => {
53
+ const resp = await axios.post(
54
+ umi.rpc.getEndpoint(),
55
+ {
56
+ jsonrpc: "2.0",
57
+ id: 1,
58
+ method: "simulateBundle",
59
+ params: [
60
+ {
61
+ encodedTransactions: txs.map((x) =>
62
+ Buffer.from(x.serialize()).toString("base64")
63
+ ),
64
+ },
65
+ {
66
+ encoding: "base64",
67
+ commitment: "confirmed",
68
+ preExecutionAccountsConfigs: txs.map((_) => {}),
69
+ postExecutionAccountsConfigs: txs.map((_) => {}),
70
+ skipSigVerify: true,
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ headers: {
76
+ "Content-Type": "application/json",
77
+ },
78
+ }
79
+ );
80
+
81
+ const res = resp.data.result.value as any;
82
+
83
+ if (res && res.summary.failed) {
84
+ const transactionResults =
85
+ res.transactionResults as SimulatedTransactionResponse[];
86
+ transactionResults.forEach((x) => {
87
+ x.logs?.forEach((y) => {
88
+ consoleLog(y);
89
+ });
90
+ });
91
+
92
+ consoleLog(JSON.stringify(transactionResults, null, 2));
93
+ const txFailure = res.summary.failed.error.TransactionFailure;
94
+ throw new Error(txFailure ? txFailure[1] : res.summary.failed.toString());
95
+ }
96
+
97
+ return res;
98
+ });
99
+
100
+ const transactionResults =
101
+ simulationResult.transactionResults as SimulatedTransactionResponse[];
102
+
103
+ return transactionResults;
104
+ }
68
105
 
69
106
  async function umiToVersionedTransactions(
70
107
  umi: Umi,
108
+ blockhash: string,
71
109
  signer: Signer,
72
110
  txs: TransactionBuilder[],
73
111
  sign: boolean,
@@ -76,14 +114,14 @@ async function umiToVersionedTransactions(
76
114
  ): Promise<VersionedTransaction[]> {
77
115
  let builtTxs = await Promise.all(
78
116
  txs.map(async (tx, i) => {
79
- return (
80
- await assembleFinalTransaction(
81
- signer,
82
- tx,
83
- feeEstimates ? feeEstimates[i] : undefined,
84
- computeUnitLimits ? computeUnitLimits[i] : undefined
85
- ).setLatestBlockhash(umi)
86
- ).build(umi);
117
+ return assembleFinalTransaction(
118
+ signer,
119
+ tx,
120
+ feeEstimates ? feeEstimates[i] : undefined,
121
+ computeUnitLimits ? computeUnitLimits[i] : undefined
122
+ )
123
+ .setBlockhash(blockhash)
124
+ .build(umi);
87
125
  })
88
126
  );
89
127
 
@@ -121,11 +159,18 @@ async function pollBundleStatus(
121
159
  consoleLog("Statuses:", statuses);
122
160
  const status = statuses.value[0].confirmation_status;
123
161
  if (status === "confirmed") {
124
- return statuses?.value[0].transactions as string[];
162
+ return statuses.value[0].transactions as string[];
163
+ }
164
+ const err = statuses.value[0].err;
165
+ if (err) {
166
+ consoleLog("Jito bundle err:", JSON.stringify(err, null, 2));
167
+ throw new Error(err);
125
168
  }
126
169
  }
127
170
  }
128
- throw new TransactionExpiredBlockheightExceededError("Unable to confirm transaction. Try a higher priority fee.");
171
+ throw new TransactionExpiredBlockheightExceededError(
172
+ "Unable to confirm transaction. Try a higher priority fee."
173
+ );
129
174
  }
130
175
 
131
176
  async function sendJitoBundle(transactions: string[]): Promise<string[]> {
@@ -156,30 +201,19 @@ async function sendJitoBundle(transactions: string[]): Promise<string[]> {
156
201
 
157
202
  export async function sendJitoBundledTransactions(
158
203
  umi: Umi,
159
- connection: Connection,
160
204
  signer: Signer,
161
205
  txs: TransactionBuilder[],
162
206
  txType?: TransactionRunType,
163
207
  priorityFeeSetting: PriorityFeeSetting = PriorityFeeSetting.Min,
164
208
  onAwaitingSign?: () => void
165
209
  ): Promise<string[] | undefined> {
166
- if (txs.length === 1) {
167
- const res = await sendSingleOptimizedTransaction(
168
- umi,
169
- connection,
170
- txs[0],
171
- txType,
172
- priorityFeeSetting
173
- );
174
- return res ? [bs58.encode(res)] : undefined;
175
- }
176
-
177
210
  consoleLog("Sending Jito bundle...");
178
211
  consoleLog("Transactions: ", txs.length);
179
212
  consoleLog(
180
213
  "Transaction sizes: ",
181
214
  txs.map((x) => x.getTransactionSize(umi))
182
215
  );
216
+ // consoleLog(txs.map((x) => x.getInstructions().map((x) => x.programId)));
183
217
 
184
218
  txs[0] = txs[0].prepend(await getTipInstruction(signer, 150_000));
185
219
  const feeEstimates =
@@ -193,27 +227,46 @@ export async function sendJitoBundledTransactions(
193
227
  )
194
228
  : undefined;
195
229
 
196
- let builtTxs = await umiToVersionedTransactions(
197
- umi,
198
- signer,
199
- txs,
200
- true, // false if simulating first and rebuilding later
201
- feeEstimates
202
- );
230
+ const latestBlockhash = (
231
+ await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })
232
+ ).blockhash;
203
233
 
204
- // const simulationResults = await simulateJitoBundle(umi, builtTxs);
234
+ let builtTxs: VersionedTransaction[];
235
+ let simulationResults: SimulatedTransactionResponse[] | undefined;
236
+ if (txType !== "skip-simulation") {
237
+ builtTxs = await umiToVersionedTransactions(
238
+ umi,
239
+ latestBlockhash,
240
+ signer,
241
+ txs,
242
+ false,
243
+ feeEstimates
244
+ );
245
+ consoleLog(
246
+ builtTxs.map((x) =>
247
+ x.message.compiledInstructions.map((y) =>
248
+ x.message.staticAccountKeys[y.programIdIndex].toString()
249
+ )
250
+ )
251
+ );
252
+ simulationResults = await simulateJitoBundle(umi, builtTxs);
253
+ }
205
254
 
206
255
  if (txType !== "only-simulate") {
207
- // let builtTxs = await umiToVersionedTransactions(
208
- // client.signer,
209
- // txs,
210
- // true,
211
- // feeEstimates,
212
- // simulationResults.map((x) => x.unitsConsumed! * 1.15)
213
- // );
256
+ builtTxs = await umiToVersionedTransactions(
257
+ umi,
258
+ latestBlockhash,
259
+ signer,
260
+ txs,
261
+ true,
262
+ feeEstimates,
263
+ simulationResults
264
+ ? simulationResults.map((x) => x.unitsConsumed! * 1.15)
265
+ : undefined
266
+ );
214
267
 
215
268
  const serializedTxs = builtTxs.map((x) => x.serialize());
216
- if (serializedTxs.find(x => x.length > 1232)) {
269
+ if (serializedTxs.find((x) => x.length > 1232)) {
217
270
  throw new Error("A transaction is too large");
218
271
  }
219
272
 
@@ -134,7 +134,11 @@ export async function getMarginfiMaxLtvAndLiqThreshold(
134
134
  return [0, 0];
135
135
  }
136
136
 
137
- return calcMarginfiMaxLtvAndLiqThreshold(supply.bank!, debt.bank, supplyPrice);
137
+ return calcMarginfiMaxLtvAndLiqThreshold(
138
+ supply.bank!,
139
+ debt.bank,
140
+ supplyPrice
141
+ );
138
142
  }
139
143
 
140
144
  export async function getAllMarginfiAccountsByAuthority(
@@ -412,10 +416,16 @@ export async function getMarginfiAccountPositionState(
412
416
  );
413
417
  }
414
418
 
419
+ if (debtBank === null) {
420
+ return undefined;
421
+ }
422
+
423
+ const supplyMint = TOKEN_INFO[supplyBank.mint.toString()];
424
+ const debtMint = TOKEN_INFO[debtBank.mint.toString()];
425
+
415
426
  if (
416
- debtBank === null ||
417
- (!TOKEN_INFO[supplyBank.mint.toString()].isStableCoin &&
418
- !TOKEN_INFO[debtBank.mint.toString()].isStableCoin)
427
+ (!supplyMint.isStableCoin && !debtMint.isStableCoin) ||
428
+ (supplyMint.isStableCoin && debtMint.isStableCoin)
419
429
  ) {
420
430
  return undefined;
421
431
  }
@@ -319,7 +319,7 @@ export async function getComputeUnitPriceEstimate(
319
319
  ]);
320
320
  feeEstimate = Math.round((resp as any).priorityFeeEstimate as number);
321
321
  } catch (e) {
322
- console.error(e);
322
+ // console.error(e);
323
323
  }
324
324
  }
325
325
 
@@ -402,7 +402,7 @@ export async function sendSingleOptimizedTransaction(
402
402
  await simulateTransaction(
403
403
  umi,
404
404
  connection,
405
- await assembleFinalTransaction(
405
+ assembleFinalTransaction(
406
406
  umi.identity,
407
407
  tx,
408
408
  undefined,
@@ -1,12 +1,9 @@
1
1
  import { describe, it } from "mocha";
2
- import {
3
- none,
4
- publicKey,
5
- some,
6
- } from "@metaplex-foundation/umi";
2
+ import { none, publicKey, some, transactionBuilder } from "@metaplex-foundation/umi";
7
3
  import { setupTest } from "../shared";
8
4
  import { SolautoMarginfiClient } from "../../src/clients/solautoMarginfiClient";
9
5
  import {
6
+ PositionType,
10
7
  safeFetchSolautoPosition,
11
8
  solautoAction,
12
9
  SolautoSettingsParametersInpArgs,
@@ -29,23 +26,21 @@ import {
29
26
  SOLAUTO_TEST_PROGRAM,
30
27
  USDC,
31
28
  } from "../../src/constants";
32
- import {
33
- buildHeliusApiUrl,
34
- getSolautoManagedPositions,
35
- } from "../../src/utils";
29
+ import { buildHeliusApiUrl, getAllPositionsByAuthority, getSolautoManagedPositions } from "../../src/utils";
36
30
  import { PriorityFeeSetting } from "../../src/types";
31
+ import { buildIronforgeApiUrl, TransactionManagerStatuses } from "../../dist";
37
32
 
38
33
  describe("Solauto Marginfi tests", async () => {
39
- // const signer = setupTest();
40
- const signer = setupTest("solauto-manager");
34
+ const signer = setupTest();
35
+ // const signer = setupTest("solauto-manager");
41
36
 
42
37
  const payForTransactions = false;
43
- const testProgram = false;
38
+ const testProgram = true;
44
39
  const positionId = 1;
45
40
 
46
41
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
47
42
  const client = new SolautoMarginfiClient(
48
- buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
43
+ buildIronforgeApiUrl(process.env.IRONFORGE_API_KEY!),
49
44
  true,
50
45
  testProgram ? SOLAUTO_TEST_PROGRAM : SOLAUTO_PROD_PROGRAM
51
46
  );
@@ -57,7 +52,7 @@ describe("Solauto Marginfi tests", async () => {
57
52
  // await client.initialize({
58
53
  // signer,
59
54
  // positionId,
60
- // authority: new PublicKey("5FALSVLRjuRZHSmQVdT2RUZC6KadCuDmxY7gaQFWFBxf"),
55
+ // authority: new PublicKey("rC5dMP5dmSsfQ66rynzfFzuc122Eex9h1RJHVDkeH6D"),
61
56
  // // new: true,
62
57
  // // marginfiAccount: new PublicKey(
63
58
  // // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
@@ -67,7 +62,7 @@ describe("Solauto Marginfi tests", async () => {
67
62
  // // debtMint: new PublicKey(USDC),
68
63
  // });
69
64
 
70
- console.log(await getSolautoManagedPositions(client.umi));
65
+ console.log(await getSolautoManagedPositions(client.umi, new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"), PositionType.Leverage));
71
66
 
72
67
  const transactionItems: TransactionItem[] = [];
73
68
  // const settingParams: SolautoSettingsParametersInpArgs = {
@@ -100,7 +95,17 @@ describe("Solauto Marginfi tests", async () => {
100
95
  // // const [supplyPrice] = await fetchTokenPrices([supply]);
101
96
  // return {
102
97
  // tx: client.protocolInteraction(
103
- // solautoAction("Deposit", [toBaseUnit(300, supplyDecimals)])
98
+ // solautoAction("Deposit", [toBaseUnit(0.05, supplyDecimals)])
99
+ // ),
100
+ // };
101
+ // }, "deposit")
102
+ // );
103
+ // transactionItems.push(
104
+ // new TransactionItem(async () => {
105
+ // // const [supplyPrice] = await fetchTokenPrices([supply]);
106
+ // return {
107
+ // tx: client.protocolInteraction(
108
+ // solautoAction("Deposit", [toBaseUnit(0.05, supplyDecimals)])
104
109
  // ),
105
110
  // };
106
111
  // }, "deposit")
@@ -127,13 +132,13 @@ describe("Solauto Marginfi tests", async () => {
127
132
  // )
128
133
  // );
129
134
 
130
- transactionItems.push(
131
- new TransactionItem(
132
- async (attemptNum) =>
133
- await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
134
- "rebalance"
135
- )
136
- );
135
+ // transactionItems.push(
136
+ // new TransactionItem(
137
+ // async (attemptNum) =>
138
+ // await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
139
+ // "rebalance"
140
+ // )
141
+ // );
137
142
 
138
143
  // transactionItems.push(
139
144
  // new TransactionItem(
@@ -147,12 +152,61 @@ describe("Solauto Marginfi tests", async () => {
147
152
  // new TransactionItem(
148
153
  // async () => ({
149
154
  // tx: client.protocolInteraction(
150
- // solautoAction("Withdraw", [{ __kind: "All" }])
155
+ // solautoAction("Withdraw", [{ __kind: "Some", fields: [toBaseUnit(0.03, 9)] }])
151
156
  // ),
152
157
  // }),
153
158
  // "withdraw"
154
159
  // )
155
160
  // );
161
+ // transactionItems.push(
162
+ // new TransactionItem(
163
+ // async () => ({
164
+ // tx: client.protocolInteraction(
165
+ // solautoAction("Withdraw", [{ __kind: "Some", fields: [toBaseUnit(0.03, 9)] }])
166
+ // ),
167
+ // }),
168
+ // "withdraw"
169
+ // )
170
+ // );
171
+
172
+ transactionItems.push(
173
+ new TransactionItem(
174
+ async () => ({
175
+ tx: transactionBuilder()
176
+ .add(
177
+ client.protocolInteraction(
178
+ solautoAction("Withdraw", [
179
+ { __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
180
+ ])
181
+ )
182
+ )
183
+ }),
184
+ "withdraw"
185
+ )
186
+ );
187
+
188
+ transactionItems.push(
189
+ new TransactionItem(
190
+ async () => ({
191
+ tx: transactionBuilder()
192
+ .add(
193
+ client.protocolInteraction(
194
+ solautoAction("Withdraw", [
195
+ { __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
196
+ ])
197
+ )
198
+ )
199
+ .add(
200
+ client.protocolInteraction(
201
+ solautoAction("Withdraw", [
202
+ { __kind: "Some", fields: [toBaseUnit(300, 9)] },
203
+ ])
204
+ )
205
+ )
206
+ }),
207
+ "withdraw"
208
+ )
209
+ );
156
210
 
157
211
  // transactionItems.push(
158
212
  // new TransactionItem(
@@ -163,8 +217,12 @@ describe("Solauto Marginfi tests", async () => {
163
217
  // )
164
218
  // );
165
219
 
220
+ // const temp = (statuses: TransactionManagerStatuses) =>
221
+ // console.log(statuses);
222
+
166
223
  // const statuses = await new TransactionsManager(
167
224
  // client,
225
+ // // temp,
168
226
  // undefined,
169
227
  // !payForTransactions ? "only-simulate" : "normal",
170
228
  // PriorityFeeSetting.Low,