@haven-fi/solauto-sdk 1.0.114 → 1.0.115

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ export declare class ReferralStateManager extends TxHandler {
20
20
  defaultLookupTables(): string[];
21
21
  updateReferralStatesIx(destFeesMint?: PublicKey, referredBy?: PublicKey, lookupTable?: PublicKey): TransactionBuilder;
22
22
  claimReferralFeesIx(destFeesMint?: PublicKey): TransactionBuilder;
23
- resetLiveTxUpdates(): Promise<void>;
23
+ resetLiveTxUpdates(success?: boolean): Promise<void>;
24
24
  }
25
25
  export {};
26
26
  //# sourceMappingURL=referralStateManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAa,MAAM,EAAkB,kBAAkB,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAEtG,OAAO,EAAE,aAAa,EAAyB,MAAM,iDAAiD,CAAC;AACvG,OAAO,EAA2C,aAAa,EAAgD,MAAM,cAAc,CAAC;AAEpI,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,UAAU,wBAAwB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,iBAAiB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAQN,SAAS,CAAC,EAAE,OAAO;IAPrD,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,MAAM,CAAC;IAEhB,iBAAiB,EAAG,SAAS,CAAC;IAC9B,aAAa,EAAG,SAAS,CAAC;IAC1B,iBAAiB,EAAG,aAAa,GAAG,IAAI,CAAC;gBAEpC,YAAY,EAAE,MAAM,EAAS,SAAS,CAAC,EAAE,OAAO,YAAA;IAStD,UAAU,CAAC,IAAI,EAAE,wBAAwB;IA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AC,EAAE,SAAS,GAAG,kBAAkB;IAiBrH,mBAAmB,CAAC,YAAY,CAAC,EAAE,SAAS,GAAG,kBAAkB;IAwB3D,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC7D"}
@@ -64,6 +64,6 @@ class ReferralStateManager extends txHandler_1.TxHandler {
64
64
  feesDestinationTa,
65
65
  });
66
66
  }
67
- async resetLiveTxUpdates() { }
67
+ async resetLiveTxUpdates(success) { }
68
68
  }
69
69
  exports.ReferralStateManager = ReferralStateManager;
@@ -43,7 +43,7 @@ export declare abstract class SolautoClient extends TxHandler {
43
43
  livePositionUpdates: LivePositionUpdates;
44
44
  constructor(heliusApiKey: string, localTest?: boolean | undefined);
45
45
  initialize(args: SolautoClientArgs, lendingPlatform: LendingPlatform): Promise<void>;
46
- resetLiveTxUpdates(): Promise<void>;
46
+ resetLiveTxUpdates(success?: boolean): Promise<void>;
47
47
  abstract protocolAccount(): PublicKey;
48
48
  defaultLookupTables(): string[];
49
49
  lutAccountsToAdd(): PublicKey[];
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAOnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EAMvB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAA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AG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAuBrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IA2DlE,eAAe,IAAI,kBAAkB;IAYrC,WAAW,IAAI,kBAAkB;IA4BjC,QAAQ,CAAC,OAAO,IAAI,kBAAkB;IAEtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
@@ -87,20 +87,22 @@ class SolautoClient extends txHandler_1.TxHandler {
87
87
  ? this.solautoPositionData?.position?.dca
88
88
  : undefined);
89
89
  }
90
- async resetLiveTxUpdates() {
91
- if (!this.solautoPositionData) {
92
- this.solautoPositionData = await (0, generated_1.safeFetchSolautoPosition)(this.umi, (0, umi_1.publicKey)(this.solautoPosition));
93
- }
94
- else {
95
- if (this.livePositionUpdates.activeDca) {
96
- this.solautoPositionData.position.dca =
97
- this.livePositionUpdates.activeDca;
90
+ async resetLiveTxUpdates(success) {
91
+ if (success) {
92
+ if (!this.solautoPositionData) {
93
+ this.solautoPositionData = await (0, generated_1.safeFetchSolautoPosition)(this.umi, (0, umi_1.publicKey)(this.solautoPosition));
98
94
  }
99
- if (this.livePositionUpdates.settings) {
100
- this.solautoPositionData.position.settingParams =
101
- this.livePositionUpdates.settings;
95
+ else {
96
+ if (this.livePositionUpdates.activeDca) {
97
+ this.solautoPositionData.position.dca =
98
+ this.livePositionUpdates.activeDca;
99
+ }
100
+ if (this.livePositionUpdates.settings) {
101
+ this.solautoPositionData.position.settingParams =
102
+ this.livePositionUpdates.settings;
103
+ }
104
+ // All other live position updates can be derived by getting a fresh position state, so we don't need to do anything else form livePositionUpdates
102
105
  }
103
- // All other live position updates can be derived by getting a fresh position state, so we don't need to do anything else form livePositionUpdates
104
106
  }
105
107
  this.livePositionUpdates.reset();
106
108
  }
@@ -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,EACb,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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IAC1C,2BAA2B,CAAC,EAAE,eAAe,CAAC;IAE/C,UAAU,CAAC,IAAI,EAAE,yBAAyB;IAkE1C,8BAA8B;IA0CpC,eAAe,IAAI,SAAS;IAI5B,mBAAmB,IAAI,MAAM,EAAE;IAI/B,gBAAgB,IAAI,SAAS,EAAE;IAU/B,yBAAyB,IAAI,kBAAkB;IAS/C,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA6C9B,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,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA2DrB,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;CAiBlE"}
@@ -413,11 +413,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
413
413
  if (state) {
414
414
  return state;
415
415
  }
416
- this.log("Live position updates:");
417
- this.log(this.livePositionUpdates);
418
416
  const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, this.supplyMint, this.debtMint, this.livePositionUpdates);
419
- this.log("Fresh state:");
420
- this.log(freshState);
417
+ this.log("Fresh state:", freshState);
421
418
  return freshState;
422
419
  }
423
420
  }
@@ -8,6 +8,6 @@ export declare abstract class TxHandler {
8
8
  constructor(heliusApiKey: string, localTest?: boolean | undefined);
9
9
  log(...args: any[]): void;
10
10
  abstract defaultLookupTables(): string[];
11
- abstract resetLiveTxUpdates(): Promise<void>;
11
+ abstract resetLiveTxUpdates(success?: boolean): Promise<void>;
12
12
  }
13
13
  //# sourceMappingURL=txHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,8BAAsB,SAAS;IAMpB,SAAS,CAAC,EAAE,OAAO;IALrB,YAAY,EAAG,MAAM,CAAC;IACtB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;gBAEnB,YAAY,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,OAAO,YAAA;IAO5B,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAMzB,QAAQ,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAExC,QAAQ,CAAC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;CAC7C"}
1
+ {"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,8BAAsB,SAAS;IAMpB,SAAS,CAAC,EAAE,OAAO;IALrB,YAAY,EAAG,MAAM,CAAC;IACtB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;gBAEnB,YAAY,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,OAAO,YAAA;IAO5B,GAAG,CAAC,GAA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vB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IARxB,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,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,aAAa,CAAC,EAAE,aAAa,YAAA;YAQzB,uBAAuB;IAwCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAiB9D,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,kBAAkB;IAoB7D,UAAU,CACd,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB;IAmFhC,IAAI,CACR,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB,EACpC,WAAW,CAAC,EAAE,OAAO;CA+GxB"}
@@ -17,10 +17,7 @@ class LookupTables {
17
17
  this.cache = [];
18
18
  }
19
19
  async getLutInputs(additionalAddresses) {
20
- const addresses = [
21
- ...this.defaultLuts,
22
- ...additionalAddresses,
23
- ];
20
+ const addresses = [...this.defaultLuts, ...additionalAddresses];
24
21
  const currentCacheAddresses = this.cache.map((x) => x.publicKey.toString());
25
22
  const missingAddresses = addresses.filter((x) => !currentCacheAddresses.includes(x));
26
23
  if (missingAddresses) {
@@ -142,7 +139,9 @@ class TransactionsManager {
142
139
  throw new Error(`Transaction exceeds max transaction size (${transaction.getTransactionSize(this.txHandler.umi)})`);
143
140
  }
144
141
  else {
145
- let newSet = new TransactionSet(this.txHandler, this.lookupTables, [item]);
142
+ let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
143
+ item,
144
+ ]);
146
145
  for (let j = i; j < items.length; j++) {
147
146
  if (await newSet.fitsWith(items[j])) {
148
147
  newSet.add(items[j]);
@@ -223,7 +222,10 @@ class TransactionsManager {
223
222
  items.push(chore);
224
223
  this.txHandler.log("Chores after: ", choresAfter.getInstructions().length);
225
224
  }
226
- await this.send(items, prioritySetting, true);
225
+ await this.send(items, prioritySetting, true).catch((e) => {
226
+ client.resetLiveTxUpdates(false);
227
+ throw e;
228
+ });
227
229
  if (!this.simulateOnly) {
228
230
  await client.resetLiveTxUpdates();
229
231
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rebalanceUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/rebalanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,WAAW,EAEX,aAAa,EAEb,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAkJjD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,yBAAyB,GAAG,SAAS,EAC/C,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,CA0EjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IAC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wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,aAAa,GACtB,gBAAgB,GAAG,SAAS,CAmE9B;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAkChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.114",
3
+ "version": "1.0.115",
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",
@@ -90,5 +90,5 @@ export class ReferralStateManager extends TxHandler {
90
90
  });
91
91
  }
92
92
 
93
- async resetLiveTxUpdates(): Promise<void> { }
93
+ async resetLiveTxUpdates(success?: boolean): Promise<void> { }
94
94
  }
@@ -218,22 +218,24 @@ export abstract class SolautoClient extends TxHandler {
218
218
  );
219
219
  }
220
220
 
221
- async resetLiveTxUpdates() {
222
- if (!this.solautoPositionData) {
223
- this.solautoPositionData = await safeFetchSolautoPosition(
224
- this.umi,
225
- publicKey(this.solautoPosition)
226
- );
227
- } else {
228
- if (this.livePositionUpdates.activeDca) {
229
- this.solautoPositionData.position.dca =
230
- this.livePositionUpdates.activeDca;
231
- }
232
- if (this.livePositionUpdates.settings) {
233
- this.solautoPositionData.position.settingParams =
234
- this.livePositionUpdates.settings;
221
+ async resetLiveTxUpdates(success?: boolean) {
222
+ if (success) {
223
+ if (!this.solautoPositionData) {
224
+ this.solautoPositionData = await safeFetchSolautoPosition(
225
+ this.umi,
226
+ publicKey(this.solautoPosition)
227
+ );
228
+ } else {
229
+ if (this.livePositionUpdates.activeDca) {
230
+ this.solautoPositionData.position.dca =
231
+ this.livePositionUpdates.activeDca;
232
+ }
233
+ if (this.livePositionUpdates.settings) {
234
+ this.solautoPositionData.position.settingParams =
235
+ this.livePositionUpdates.settings;
236
+ }
237
+ // All other live position updates can be derived by getting a fresh position state, so we don't need to do anything else form livePositionUpdates
235
238
  }
236
- // All other live position updates can be derived by getting a fresh position state, so we don't need to do anything else form livePositionUpdates
237
239
  }
238
240
  this.livePositionUpdates.reset();
239
241
  }
@@ -618,8 +618,6 @@ export class SolautoMarginfiClient extends SolautoClient {
618
618
  return state;
619
619
  }
620
620
 
621
- this.log("Live position updates:");
622
- this.log(this.livePositionUpdates);
623
621
  const freshState = await getMarginfiAccountPositionState(
624
622
  this.umi,
625
623
  this.marginfiAccountPk,
@@ -627,8 +625,7 @@ export class SolautoMarginfiClient extends SolautoClient {
627
625
  this.debtMint,
628
626
  this.livePositionUpdates
629
627
  );
630
- this.log("Fresh state:");
631
- this.log(freshState);
628
+ this.log("Fresh state:", freshState);
632
629
 
633
630
  return freshState;
634
631
  }
@@ -24,5 +24,5 @@ export abstract class TxHandler {
24
24
 
25
25
  abstract defaultLookupTables(): string[];
26
26
 
27
- abstract resetLiveTxUpdates(): Promise<void>;
27
+ abstract resetLiveTxUpdates(success?: boolean): Promise<void>;
28
28
  }
@@ -22,16 +22,15 @@ import { ReferralStateManager, TxHandler } from "../clients";
22
22
  class LookupTables {
23
23
  cache: AddressLookupTableInput[] = [];
24
24
 
25
- constructor(public defaultLuts: string[], private umi: Umi) {
26
- }
25
+ constructor(
26
+ public defaultLuts: string[],
27
+ private umi: Umi
28
+ ) {}
27
29
 
28
30
  async getLutInputs(
29
31
  additionalAddresses: string[]
30
32
  ): Promise<AddressLookupTableInput[]> {
31
- const addresses = [
32
- ...this.defaultLuts,
33
- ...additionalAddresses,
34
- ];
33
+ const addresses = [...this.defaultLuts, ...additionalAddresses];
35
34
  const currentCacheAddresses = this.cache.map((x) => x.publicKey.toString());
36
35
 
37
36
  const missingAddresses = addresses.filter(
@@ -60,7 +59,7 @@ export class TransactionItem {
60
59
  { tx: TransactionBuilder; lookupTableAddresses?: string[] } | undefined
61
60
  >,
62
61
  public name?: string
63
- ) { }
62
+ ) {}
64
63
 
65
64
  async initialize() {
66
65
  await this.refetch(0);
@@ -91,7 +90,7 @@ class TransactionSet {
91
90
  private txHandler: TxHandler,
92
91
  public lookupTables: LookupTables,
93
92
  public items: TransactionItem[] = []
94
- ) { }
93
+ ) {}
95
94
 
96
95
  async fitsWith(item: TransactionItem): Promise<boolean> {
97
96
  if (!item.tx) {
@@ -189,7 +188,10 @@ export class TransactionsManager {
189
188
  private mustBeAtomic?: boolean,
190
189
  private errorsToThrow?: ErrorsToThrow
191
190
  ) {
192
- this.lookupTables = new LookupTables(this.txHandler.defaultLookupTables(), this.txHandler.umi);
191
+ this.lookupTables = new LookupTables(
192
+ this.txHandler.defaultLookupTables(),
193
+ this.txHandler.umi
194
+ );
193
195
  }
194
196
 
195
197
  private async assembleTransactionSets(
@@ -198,7 +200,7 @@ export class TransactionsManager {
198
200
  let transactionSets: TransactionSet[] = [];
199
201
  this.txHandler.log(`Reassembling ${items.length} items`);
200
202
 
201
- for (let i = 0; i < items.length;) {
203
+ for (let i = 0; i < items.length; ) {
202
204
  let item = items[i];
203
205
  i++;
204
206
 
@@ -214,7 +216,9 @@ export class TransactionsManager {
214
216
  `Transaction exceeds max transaction size (${transaction.getTransactionSize(this.txHandler.umi)})`
215
217
  );
216
218
  } else {
217
- let newSet = new TransactionSet(this.txHandler, this.lookupTables, [item]);
219
+ let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
220
+ item,
221
+ ]);
218
222
  for (let j = i; j < items.length; j++) {
219
223
  if (await newSet.fitsWith(items[j])) {
220
224
  newSet.add(items[j]);
@@ -255,7 +259,9 @@ export class TransactionsManager {
255
259
  const accountsNotInLut = ixAccounts.filter(
256
260
  (x) => !lutAccounts.includes(x)
257
261
  );
258
- this.txHandler.log(`Program ${ix.programId}, data len: ${ix.data.length}, LUT accounts data: ${ix.keys.filter((x) => lutAccounts.includes(x.pubkey)).length * 3}`);
262
+ this.txHandler.log(
263
+ `Program ${ix.programId}, data len: ${ix.data.length}, LUT accounts data: ${ix.keys.filter((x) => lutAccounts.includes(x.pubkey)).length * 3}`
264
+ );
259
265
  if (accountsNotInLut.length > 0) {
260
266
  this.txHandler.log(`${accountsNotInLut.length} accounts not in LUT:`);
261
267
  for (const key of accountsNotInLut) {
@@ -265,7 +271,10 @@ export class TransactionsManager {
265
271
  }
266
272
  }
267
273
 
268
- async clientSend(items: TransactionItem[], prioritySetting?: PriorityFeeSetting) {
274
+ async clientSend(
275
+ items: TransactionItem[],
276
+ prioritySetting?: PriorityFeeSetting
277
+ ) {
269
278
  const client = this.txHandler as SolautoClient;
270
279
 
271
280
  const updateLookupTable = await client.updateLookupTable();
@@ -285,7 +294,11 @@ export class TransactionsManager {
285
294
  this.simulateOnly,
286
295
  attemptNum,
287
296
  prioritySetting,
288
- () => this.updateStatus(updateLutTxName, TransactionStatus.AwaitingSignature)
297
+ () =>
298
+ this.updateStatus(
299
+ updateLutTxName,
300
+ TransactionStatus.AwaitingSignature
301
+ )
289
302
  ),
290
303
  3,
291
304
  150,
@@ -318,23 +331,36 @@ export class TransactionsManager {
318
331
  );
319
332
  await chore.initialize();
320
333
  items.unshift(chore);
321
- this.txHandler.log("Chores before: ", choresBefore.getInstructions().length);
334
+ this.txHandler.log(
335
+ "Chores before: ",
336
+ choresBefore.getInstructions().length
337
+ );
322
338
  }
323
339
  if (choresAfter.getInstructions().length > 0) {
324
340
  const chore = new TransactionItem(async () => ({ tx: choresAfter }));
325
341
  await chore.initialize();
326
342
  items.push(chore);
327
- this.txHandler.log("Chores after: ", choresAfter.getInstructions().length);
343
+ this.txHandler.log(
344
+ "Chores after: ",
345
+ choresAfter.getInstructions().length
346
+ );
328
347
  }
329
348
 
330
- await this.send(items, prioritySetting, true);
349
+ await this.send(items, prioritySetting, true).catch((e) => {
350
+ client.resetLiveTxUpdates(false);
351
+ throw e;
352
+ });
331
353
 
332
354
  if (!this.simulateOnly) {
333
355
  await client.resetLiveTxUpdates();
334
356
  }
335
357
  }
336
358
 
337
- async send(items: TransactionItem[], prioritySetting?: PriorityFeeSetting, initialized?: boolean) {
359
+ async send(
360
+ items: TransactionItem[],
361
+ prioritySetting?: PriorityFeeSetting,
362
+ initialized?: boolean
363
+ ) {
338
364
  if (!initialized) {
339
365
  for (const item of items) {
340
366
  await item.initialize();
@@ -424,7 +450,11 @@ export class TransactionsManager {
424
450
  this.simulateOnly,
425
451
  attemptNum,
426
452
  prioritySetting,
427
- () => this.updateStatus(itemSet!.name(), TransactionStatus.AwaitingSignature)
453
+ () =>
454
+ this.updateStatus(
455
+ itemSet!.name(),
456
+ TransactionStatus.AwaitingSignature
457
+ )
428
458
  );
429
459
  this.updateStatus(
430
460
  itemSet.name(),
@@ -2,7 +2,6 @@ import { PublicKey } from "@solana/web3.js";
2
2
  import { SolautoClient } from "../../clients/solautoClient";
3
3
  import {
4
4
  DCASettings,
5
- FeeType,
6
5
  PositionState,
7
6
  PositionTokenUsage,
8
7
  SolautoSettingsParameters,
@@ -1,15 +1,18 @@
1
1
  import { describe, it } from "mocha";
2
2
  import { none, publicKey, some } from "@metaplex-foundation/umi";
3
3
  import { setupTest } from "../shared";
4
- import {
5
- SolautoMarginfiClient,
6
- } from "../../src/clients/solautoMarginfiClient";
4
+ import { SolautoMarginfiClient } from "../../src/clients/solautoMarginfiClient";
7
5
  import {
8
6
  solautoAction,
9
7
  SolautoSettingsParametersInpArgs,
10
8
  } from "../../src/generated";
11
9
  import { buildSolautoRebalanceTransaction } from "../../src/transactions/transactionUtils";
12
- import { maxBoostToBps, maxRepayFromBps, maxRepayToBps, toBaseUnit } from "../../src/utils/numberUtils";
10
+ import {
11
+ maxBoostToBps,
12
+ maxRepayFromBps,
13
+ maxRepayToBps,
14
+ toBaseUnit,
15
+ } from "../../src/utils/numberUtils";
13
16
  import { NATIVE_MINT } from "@solana/spl-token";
14
17
  import { getTokenPrices } from "../../src/utils/generalUtils";
15
18
  import {
@@ -28,25 +31,22 @@ describe("Solauto Marginfi tests", async () => {
28
31
  const positionId = 1;
29
32
 
30
33
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
31
-
32
34
  const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
33
35
 
34
36
  const supply = NATIVE_MINT;
35
37
  const supplyDecimals = 9;
36
38
  const debtDecimals = 6;
37
39
 
38
- await client.initialize(
39
- {
40
- signer,
41
- positionId,
42
- // authority: new PublicKey("92xmP49BQycn3t2HkGxLAweN3jjrExxSNpywA3xF7mYY")
43
- // marginfiAccount: new PublicKey(
44
- // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
45
- // ),
46
- // supplyMint: NATIVE_MINT,
47
- // debtMint: new PublicKey(USDC_MINT),
48
- }
49
- );
40
+ await client.initialize({
41
+ signer,
42
+ positionId,
43
+ // authority: new PublicKey("92xmP49BQycn3t2HkGxLAweN3jjrExxSNpywA3xF7mYY")
44
+ // marginfiAccount: new PublicKey(
45
+ // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
46
+ // ),
47
+ // supplyMint: NATIVE_MINT,
48
+ // debtMint: new PublicKey(USDC_MINT),
49
+ });
50
50
 
51
51
  const transactionItems: TransactionItem[] = [];
52
52
  const settingParams: SolautoSettingsParametersInpArgs = {
@@ -67,19 +67,19 @@ describe("Solauto Marginfi tests", async () => {
67
67
  // }, "open position")
68
68
  // );
69
69
 
70
- // const initialSupplyUsd = 150;
71
- // transactionItems.push(
72
- // new TransactionItem(async () => {
73
- // const [supplyPrice] = await getTokenPrices([supply]);
74
- // return {
75
- // tx: client.protocolInteraction(
76
- // solautoAction("Deposit", [
77
- // toBaseUnit(initialSupplyUsd / supplyPrice, supplyDecimals),
78
- // ])
79
- // ),
80
- // };
81
- // }, "deposit")
82
- // );
70
+ const initialSupplyUsd = 150;
71
+ transactionItems.push(
72
+ new TransactionItem(async () => {
73
+ const [supplyPrice] = await getTokenPrices([supply]);
74
+ return {
75
+ tx: client.protocolInteraction(
76
+ solautoAction("Deposit", [
77
+ toBaseUnit(initialSupplyUsd / supplyPrice, supplyDecimals),
78
+ ])
79
+ ),
80
+ };
81
+ }, "deposit")
82
+ );
83
83
  // }
84
84
 
85
85
  // const maxLtvBps = client.solautoPositionState!.maxLtvBps;
@@ -120,13 +120,13 @@ describe("Solauto Marginfi tests", async () => {
120
120
  // }, "deposit")
121
121
  // );
122
122
 
123
- transactionItems.push(
124
- new TransactionItem(
125
- async (attemptNum) =>
126
- await buildSolautoRebalanceTransaction(client, 1500, attemptNum),
127
- "rebalance"
128
- )
129
- );
123
+ // transactionItems.push(
124
+ // new TransactionItem(
125
+ // async (attemptNum) =>
126
+ // await buildSolautoRebalanceTransaction(client, 1500, attemptNum),
127
+ // "rebalance"
128
+ // )
129
+ // );
130
130
 
131
131
  // transactionItems.push(
132
132
  // new TransactionItem(
@@ -161,6 +161,5 @@ describe("Solauto Marginfi tests", async () => {
161
161
  !payForTransactions,
162
162
  useJitoBundle
163
163
  ).clientSend(transactionItems);
164
-
165
164
  });
166
165
  });