@haven-fi/solauto-sdk 1.0.154 → 1.0.156

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EAEb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAWnE,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,WAAW,CAAkB;IAE9B,eAAe,EAAG,SAAS,CAAC;IAE5B,sBAAsB,EAAE,MAAM,CAAa;IAC3C,eAAe,EAAG,SAAS,GAAG,MAAM,CAAC;IACrC,iBAAiB,EAAG,SAAS,CAAC;IAC9B,aAAa,EAAG,SAAS,CAAC;IAE1B,sBAAsB,EAAG,qBAAqB,CAAC;IAC/C,oBAAoB,EAAG,qBAAqB,CAAC;IAE7C,iBAAiB,EAAG,SAAS,CAAC;IAC9B,eAAe,EAAG,SAAS,CAAC;IAG5B,iCAAiC,CAAC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AC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA+C9B,OAAO,IAAI,kBAAkB;IAc7B,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUhE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA4DrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAoFlE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CA4BlE"}
@@ -415,7 +415,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
415
415
  if (state) {
416
416
  return state;
417
417
  }
418
- const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, this.supplyMint, this.debtMint, this.livePositionUpdates);
418
+ const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, undefined, undefined, this.livePositionUpdates);
419
419
  if (freshState) {
420
420
  this.log("Fresh state", freshState);
421
421
  const supplyPrice = (0, generalUtils_1.safeGetPrice)(freshState?.supply.mint);
@@ -1,16 +1,8 @@
1
- import { AddressLookupTableInput, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
1
+ import { TransactionBuilder } from "@metaplex-foundation/umi";
2
2
  import { SolautoClient } from "../clients/solautoClient";
3
3
  import { ErrorsToThrow } from "../utils/generalUtils";
4
4
  import { PriorityFeeSetting, TransactionRunType } from "../types";
5
- import { ReferralStateManager, TxHandler } from "../clients";
6
- declare class LookupTables {
7
- defaultLuts: string[];
8
- private umi;
9
- cache: AddressLookupTableInput[];
10
- constructor(defaultLuts: string[], umi: Umi);
11
- getLutInputs(additionalAddresses: string[]): Promise<AddressLookupTableInput[]>;
12
- reset(): void;
13
- }
5
+ import { ReferralStateManager } from "../clients";
14
6
  export declare class TransactionItem {
15
7
  fetchTx: (attemptNum: number) => Promise<{
16
8
  tx: TransactionBuilder;
@@ -27,18 +19,6 @@ export declare class TransactionItem {
27
19
  refetch(attemptNum: number): Promise<void>;
28
20
  uniqueAccounts(): string[];
29
21
  }
30
- declare class TransactionSet {
31
- private txHandler;
32
- lookupTables: LookupTables;
33
- items: TransactionItem[];
34
- constructor(txHandler: TxHandler, lookupTables: LookupTables, items?: TransactionItem[]);
35
- fitsWith(item: TransactionItem): Promise<boolean>;
36
- add(...items: TransactionItem[]): void;
37
- refetchAll(attemptNum: number): Promise<void>;
38
- getSingleTransaction(): Promise<TransactionBuilder>;
39
- lutAddresses(): string[];
40
- name(): string;
41
- }
42
22
  export declare enum TransactionStatus {
43
23
  Skipped = "Skipped",
44
24
  Processing = "Processing",
@@ -49,6 +29,7 @@ export declare enum TransactionStatus {
49
29
  export type TransactionManagerStatuses = {
50
30
  name: string;
51
31
  status: TransactionStatus;
32
+ simulationSuccessful?: boolean;
52
33
  txSig?: string;
53
34
  attemptNum: number;
54
35
  }[];
@@ -64,10 +45,10 @@ export declare class TransactionsManager {
64
45
  private lookupTables;
65
46
  constructor(txHandler: SolautoClient | ReferralStateManager, statusCallback?: ((statuses: TransactionManagerStatuses) => void) | undefined, txType?: TransactionRunType | undefined, mustBeAtomic?: boolean | undefined, errorsToThrow?: ErrorsToThrow | undefined, retries?: number, retryDelay?: number);
66
47
  private assembleTransactionSets;
67
- updateStatus(name: string, status: TransactionStatus, attemptNum: number, txSig?: string): void;
68
- debugAccounts(itemSet: TransactionSet, tx: TransactionBuilder): Promise<void>;
48
+ private updateStatus;
49
+ private debugAccounts;
69
50
  clientSend(transactions: TransactionItem[], prioritySetting?: PriorityFeeSetting): Promise<TransactionManagerStatuses>;
70
51
  send(items: TransactionItem[], prioritySetting?: PriorityFeeSetting, initialized?: boolean): Promise<TransactionManagerStatuses>;
52
+ private sendTransaction;
71
53
  }
72
- export {};
73
54
  //# sourceMappingURL=transactionsManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG7D,cAAM,YAAY;IAIP,WAAW,EAAE,MAAM,EAAE;IAC5B,OAAO,CAAC,GAAG;IAJb,KAAK,EAAE,uBAAuB,EAAE,CAAM;gBAG7B,WAAW,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,GAAG;IAGZ,YAAY,CAChB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAkBrC,KAAK;CAKN;AAED,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,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I,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YAwCN,aAAa;IAoBd,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,EAC/B,eAAe,CAAC,EAAE,kBAAkB,GACnC,OAAO,CAAC,0BAA0B,CAAC;IAyEzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB,EACpC,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,0BAA0B,CAAC;YA0GxB,eAAe;CAmC9B"}
@@ -161,18 +161,33 @@ class TransactionsManager {
161
161
  }
162
162
  return transactionSets;
163
163
  }
164
- updateStatus(name, status, attemptNum, txSig) {
164
+ updateStatus(name, status, attemptNum, txSig, simulationSuccessful) {
165
165
  if (!this.statuses.filter((x) => x.name === name)) {
166
- this.statuses.push({ name, status, txSig, attemptNum });
166
+ this.statuses.push({
167
+ name,
168
+ status,
169
+ txSig,
170
+ attemptNum,
171
+ simulationSuccessful,
172
+ });
167
173
  }
168
174
  else {
169
175
  const idx = this.statuses.findIndex((x) => x.name === name && x.attemptNum === attemptNum);
170
176
  if (idx !== -1) {
171
177
  this.statuses[idx].status = status;
172
178
  this.statuses[idx].txSig = txSig;
179
+ if (simulationSuccessful) {
180
+ this.statuses[idx].simulationSuccessful = simulationSuccessful;
181
+ }
173
182
  }
174
183
  else {
175
- this.statuses.push({ name, status, txSig, attemptNum });
184
+ this.statuses.push({
185
+ name,
186
+ status,
187
+ txSig,
188
+ attemptNum,
189
+ simulationSuccessful,
190
+ });
176
191
  }
177
192
  }
178
193
  this.txHandler.log(`${name} is ${status.toString().toLowerCase()}`);
@@ -202,17 +217,7 @@ class TransactionsManager {
202
217
  if (updateLookupTable &&
203
218
  updateLookupTable.updateLutTx.getInstructions().length > 0 &&
204
219
  updateLookupTable?.needsToBeIsolated) {
205
- await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => {
206
- this.updateStatus(updateLutTxName, TransactionStatus.Processing, attemptNum);
207
- try {
208
- const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, updateLookupTable.updateLutTx, this.txType, attemptNum, prioritySetting);
209
- this.updateStatus(updateLutTxName, TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
210
- }
211
- catch (e) {
212
- this.updateStatus(updateLutTxName, TransactionStatus.Failed, attemptNum);
213
- throw e;
214
- }
215
- }, 3, 150, this.errorsToThrow);
220
+ await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => this.sendTransaction(updateLookupTable.updateLutTx, updateLutTxName, attemptNum, prioritySetting), 3, 150, this.errorsToThrow);
216
221
  }
217
222
  this.lookupTables.defaultLuts = client.defaultLookupTables();
218
223
  for (const item of items) {
@@ -309,23 +314,26 @@ class TransactionsManager {
309
314
  this.updateStatus(itemSet.name(), TransactionStatus.Skipped, attemptNum);
310
315
  }
311
316
  else {
312
- this.updateStatus(itemSet.name(), TransactionStatus.Processing, attemptNum);
313
317
  if (this.txHandler.localTest) {
314
318
  await this.debugAccounts(itemSet, tx);
315
319
  }
316
- try {
317
- const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType, attemptNum, prioritySetting);
318
- this.updateStatus(itemSet.name(), TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
319
- }
320
- catch (e) {
321
- this.updateStatus(itemSet.name(), TransactionStatus.Failed, attemptNum);
322
- throw e;
323
- }
320
+ this.sendTransaction(tx, itemSet.name(), attemptNum, prioritySetting);
324
321
  }
325
322
  }, this.retries, this.retryDelay, this.errorsToThrow);
326
323
  }
327
324
  }
328
325
  return this.statuses;
329
326
  }
327
+ async sendTransaction(tx, txName, attemptNum, prioritySetting) {
328
+ this.updateStatus(txName, TransactionStatus.Processing, attemptNum);
329
+ try {
330
+ const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType, attemptNum, prioritySetting, () => this.updateStatus(txName, TransactionStatus.Processing, attemptNum, undefined, true));
331
+ this.updateStatus(txName, TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
332
+ }
333
+ catch (e) {
334
+ this.updateStatus(txName, TransactionStatus.Failed, attemptNum);
335
+ throw e;
336
+ }
337
+ }
330
338
  }
331
339
  exports.TransactionsManager = TransactionsManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.154",
3
+ "version": "1.0.156",
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",
@@ -56,7 +56,6 @@ import {
56
56
  getMaxLtvAndLiqThreshold,
57
57
  } from "../utils/marginfiUtils";
58
58
  import { bytesToI80F48, fromBaseUnit, toBps } from "../utils/numberUtils";
59
- import { PRICES, SOLAUTO_MANAGER } from "../constants";
60
59
  import { createFakePositionState } from "../utils";
61
60
 
62
61
  export interface SolautoMarginfiClientArgs extends SolautoClientArgs {
@@ -627,8 +626,8 @@ export class SolautoMarginfiClient extends SolautoClient {
627
626
  const freshState = await getMarginfiAccountPositionState(
628
627
  this.umi,
629
628
  this.marginfiAccountPk,
630
- this.supplyMint,
631
- this.debtMint,
629
+ undefined,
630
+ undefined,
632
631
  this.livePositionUpdates
633
632
  );
634
633
 
@@ -180,6 +180,7 @@ export enum TransactionStatus {
180
180
  export type TransactionManagerStatuses = {
181
181
  name: string;
182
182
  status: TransactionStatus;
183
+ simulationSuccessful?: boolean;
183
184
  txSig?: string;
184
185
  attemptNum: number;
185
186
  }[];
@@ -243,14 +244,21 @@ export class TransactionsManager {
243
244
  return transactionSets;
244
245
  }
245
246
 
246
- updateStatus(
247
+ private updateStatus(
247
248
  name: string,
248
249
  status: TransactionStatus,
249
250
  attemptNum: number,
250
- txSig?: string
251
+ txSig?: string,
252
+ simulationSuccessful?: boolean
251
253
  ) {
252
254
  if (!this.statuses.filter((x) => x.name === name)) {
253
- this.statuses.push({ name, status, txSig, attemptNum });
255
+ this.statuses.push({
256
+ name,
257
+ status,
258
+ txSig,
259
+ attemptNum,
260
+ simulationSuccessful,
261
+ });
254
262
  } else {
255
263
  const idx = this.statuses.findIndex(
256
264
  (x) => x.name === name && x.attemptNum === attemptNum
@@ -258,8 +266,17 @@ export class TransactionsManager {
258
266
  if (idx !== -1) {
259
267
  this.statuses[idx].status = status;
260
268
  this.statuses[idx].txSig = txSig;
269
+ if (simulationSuccessful) {
270
+ this.statuses[idx].simulationSuccessful = simulationSuccessful;
271
+ }
261
272
  } else {
262
- this.statuses.push({ name, status, txSig, attemptNum });
273
+ this.statuses.push({
274
+ name,
275
+ status,
276
+ txSig,
277
+ attemptNum,
278
+ simulationSuccessful,
279
+ });
263
280
  }
264
281
  }
265
282
  this.txHandler.log(`${name} is ${status.toString().toLowerCase()}`);
@@ -267,7 +284,7 @@ export class TransactionsManager {
267
284
  }
268
285
 
269
286
  // TODO remove me
270
- async debugAccounts(itemSet: TransactionSet, tx: TransactionBuilder) {
287
+ private async debugAccounts(itemSet: TransactionSet, tx: TransactionBuilder) {
271
288
  const lutInputs = await itemSet.lookupTables.getLutInputs([]);
272
289
  const lutAccounts = lutInputs.map((x) => x.addresses).flat();
273
290
  for (const ix of tx.getInstructions()) {
@@ -287,7 +304,7 @@ export class TransactionsManager {
287
304
  }
288
305
  }
289
306
 
290
- async clientSend(
307
+ public async clientSend(
291
308
  transactions: TransactionItem[],
292
309
  prioritySetting?: PriorityFeeSetting
293
310
  ): Promise<TransactionManagerStatuses> {
@@ -302,36 +319,13 @@ export class TransactionsManager {
302
319
  updateLookupTable?.needsToBeIsolated
303
320
  ) {
304
321
  await retryWithExponentialBackoff(
305
- async (attemptNum) => {
306
- this.updateStatus(
322
+ async (attemptNum) =>
323
+ this.sendTransaction(
324
+ updateLookupTable.updateLutTx,
307
325
  updateLutTxName,
308
- TransactionStatus.Processing,
309
- attemptNum
310
- );
311
- try {
312
- const txSig = await sendSingleOptimizedTransaction(
313
- this.txHandler.umi,
314
- this.txHandler.connection,
315
- updateLookupTable.updateLutTx,
316
- this.txType,
317
- attemptNum,
318
- prioritySetting
319
- );
320
- this.updateStatus(
321
- updateLutTxName,
322
- TransactionStatus.Successful,
323
- attemptNum,
324
- txSig ? bs58.encode(txSig) : undefined
325
- );
326
- } catch (e) {
327
- this.updateStatus(
328
- updateLutTxName,
329
- TransactionStatus.Failed,
330
- attemptNum
331
- );
332
- throw e;
333
- }
334
- },
326
+ attemptNum,
327
+ prioritySetting
328
+ ),
335
329
  3,
336
330
  150,
337
331
  this.errorsToThrow
@@ -386,7 +380,7 @@ export class TransactionsManager {
386
380
  return result;
387
381
  }
388
382
 
389
- async send(
383
+ public async send(
390
384
  items: TransactionItem[],
391
385
  prioritySetting?: PriorityFeeSetting,
392
386
  initialized?: boolean
@@ -475,39 +469,15 @@ export class TransactionsManager {
475
469
  attemptNum
476
470
  );
477
471
  } else {
478
- this.updateStatus(
479
- itemSet.name(),
480
- TransactionStatus.Processing,
481
- attemptNum
482
- );
483
-
484
472
  if (this.txHandler.localTest) {
485
473
  await this.debugAccounts(itemSet, tx);
486
474
  }
487
-
488
- try {
489
- const txSig = await sendSingleOptimizedTransaction(
490
- this.txHandler.umi,
491
- this.txHandler.connection,
492
- tx,
493
- this.txType,
494
- attemptNum,
495
- prioritySetting
496
- );
497
- this.updateStatus(
498
- itemSet.name(),
499
- TransactionStatus.Successful,
500
- attemptNum,
501
- txSig ? bs58.encode(txSig) : undefined
502
- );
503
- } catch (e) {
504
- this.updateStatus(
505
- itemSet.name(),
506
- TransactionStatus.Failed,
507
- attemptNum
508
- );
509
- throw e;
510
- }
475
+ this.sendTransaction(
476
+ tx,
477
+ itemSet.name(),
478
+ attemptNum,
479
+ prioritySetting
480
+ );
511
481
  }
512
482
  },
513
483
  this.retries,
@@ -519,4 +489,40 @@ export class TransactionsManager {
519
489
 
520
490
  return this.statuses;
521
491
  }
492
+
493
+ private async sendTransaction(
494
+ tx: TransactionBuilder,
495
+ txName: string,
496
+ attemptNum: number,
497
+ prioritySetting?: PriorityFeeSetting
498
+ ) {
499
+ this.updateStatus(txName, TransactionStatus.Processing, attemptNum);
500
+ try {
501
+ const txSig = await sendSingleOptimizedTransaction(
502
+ this.txHandler.umi,
503
+ this.txHandler.connection,
504
+ tx,
505
+ this.txType,
506
+ attemptNum,
507
+ prioritySetting,
508
+ () =>
509
+ this.updateStatus(
510
+ txName,
511
+ TransactionStatus.Processing,
512
+ attemptNum,
513
+ undefined,
514
+ true
515
+ )
516
+ );
517
+ this.updateStatus(
518
+ txName,
519
+ TransactionStatus.Successful,
520
+ attemptNum,
521
+ txSig ? bs58.encode(txSig) : undefined
522
+ );
523
+ } catch (e) {
524
+ this.updateStatus(txName, TransactionStatus.Failed, attemptNum);
525
+ throw e;
526
+ }
527
+ }
522
528
  }