@haven-fi/solauto-sdk 1.0.113 → 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
  }
@@ -414,7 +414,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
414
414
  return state;
415
415
  }
416
416
  const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, this.supplyMint, this.debtMint, this.livePositionUpdates);
417
- this.log(freshState);
417
+ this.log("Fresh state:", freshState);
418
418
  return freshState;
419
419
  }
420
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,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAMzB,QAAQ,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAExC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9D"}
@@ -39,11 +39,11 @@ declare class TransactionSet {
39
39
  name(): string;
40
40
  }
41
41
  export declare enum TransactionStatus {
42
- Skipped = "Skipped",
43
- Processing = "Processing",
44
- AwaitingSignature = "AwaitingSig",
45
- Queued = "Queued",
46
- Successful = "Successful"
42
+ Skipped = 0,
43
+ Processing = 1,
44
+ AwaitingSignature = 2,
45
+ Queued = 3,
46
+ Successful = 4
47
47
  }
48
48
  export type TransactionManagerStatuses = {
49
49
  name: string;
@@ -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,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AAA;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) {
@@ -112,11 +109,11 @@ class TransactionSet {
112
109
  }
113
110
  var TransactionStatus;
114
111
  (function (TransactionStatus) {
115
- TransactionStatus["Skipped"] = "Skipped";
116
- TransactionStatus["Processing"] = "Processing";
117
- TransactionStatus["AwaitingSignature"] = "AwaitingSig";
118
- TransactionStatus["Queued"] = "Queued";
119
- TransactionStatus["Successful"] = "Successful";
112
+ TransactionStatus[TransactionStatus["Skipped"] = 0] = "Skipped";
113
+ TransactionStatus[TransactionStatus["Processing"] = 1] = "Processing";
114
+ TransactionStatus[TransactionStatus["AwaitingSignature"] = 2] = "AwaitingSignature";
115
+ TransactionStatus[TransactionStatus["Queued"] = 3] = "Queued";
116
+ TransactionStatus[TransactionStatus["Successful"] = 4] = "Successful";
120
117
  })(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
121
118
  class TransactionsManager {
122
119
  constructor(txHandler, statusCallback, simulateOnly, mustBeAtomic, errorsToThrow) {
@@ -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]);
@@ -193,12 +192,13 @@ class TransactionsManager {
193
192
  async clientSend(items, prioritySetting) {
194
193
  const client = this.txHandler;
195
194
  const updateLookupTable = await client.updateLookupTable();
195
+ const updateLutTxName = "update lookup table";
196
196
  if (updateLookupTable &&
197
197
  updateLookupTable.updateLutTx.getInstructions().length > 0 &&
198
198
  updateLookupTable?.needsToBeIsolated) {
199
- this.updateStatus("update lookup table", TransactionStatus.Processing);
200
- await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum), 3, 150, this.errorsToThrow);
201
- this.updateStatus("update lookup table", TransactionStatus.Successful);
199
+ this.updateStatus(updateLutTxName, TransactionStatus.Processing);
200
+ await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum, prioritySetting, () => this.updateStatus(updateLutTxName, TransactionStatus.AwaitingSignature)), 3, 150, this.errorsToThrow);
201
+ this.updateStatus(updateLutTxName, TransactionStatus.Successful);
202
202
  }
203
203
  this.lookupTables.defaultLuts = client.defaultLookupTables();
204
204
  for (const item of items) {
@@ -222,7 +222,10 @@ class TransactionsManager {
222
222
  items.push(chore);
223
223
  this.txHandler.log("Chores after: ", choresAfter.getInstructions().length);
224
224
  }
225
- await this.send(items, prioritySetting, true);
225
+ await this.send(items, prioritySetting, true).catch((e) => {
226
+ client.resetLiveTxUpdates(false);
227
+ throw e;
228
+ });
226
229
  if (!this.simulateOnly) {
227
230
  await client.resetLiveTxUpdates();
228
231
  }
@@ -1 +1 @@
1
- {"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GACtB,MAAM,CAMR;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBrD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAejE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,2BAA2B,EAAE,MAAM,EACnC,gBAAgB,CAAC,EAAE,MAAM,UAW1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,2BAA2B,EAAE,MAAM,GAAG,SAAS,EAC/C,mBAAmB,EAAE,MAAM,GAC1B;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAgCA;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EAC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AuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,kBAAkB,EACtB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,sBA4D1B;AAmBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,YAAY,CAAC,EAAE,OAAO,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,GAAE,kBAA+C,EAChE,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA0DjC"}
@@ -160,6 +160,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, simulateOnly,
160
160
  console.log("Serialized transaction size: ", tx.getTransactionSize(umi));
161
161
  const feeEstimate = await getComputeUnitPriceEstimate(umi, tx, prioritySetting);
162
162
  console.log("Compute unit price: ", feeEstimate);
163
+ // TODO: we should only retry simulation if it's not a solauto error
163
164
  const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(await (await assembleFinalTransaction(umi.identity, tx, feeEstimate, 1400000).setLatestBlockhash(umi)).build(umi))), 3);
164
165
  const computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.1);
165
166
  console.log("Compute unit limit: ", computeUnitLimit);
@@ -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,E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,EACL,WAAW,EACX,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;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,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.113",
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
  }
@@ -625,7 +625,7 @@ export class SolautoMarginfiClient extends SolautoClient {
625
625
  this.debtMint,
626
626
  this.livePositionUpdates
627
627
  );
628
- this.log(freshState);
628
+ this.log("Fresh state:", freshState);
629
629
 
630
630
  return freshState;
631
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) {
@@ -165,11 +164,11 @@ class TransactionSet {
165
164
  }
166
165
 
167
166
  export enum TransactionStatus {
168
- Skipped = "Skipped",
169
- Processing = "Processing",
170
- AwaitingSignature = "AwaitingSig",
171
- Queued = "Queued",
172
- Successful = "Successful",
167
+ Skipped,
168
+ Processing,
169
+ AwaitingSignature,
170
+ Queued,
171
+ Successful,
173
172
  }
174
173
 
175
174
  export type TransactionManagerStatuses = {
@@ -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,16 +271,20 @@ 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();
281
+ const updateLutTxName = "update lookup table";
272
282
  if (
273
283
  updateLookupTable &&
274
284
  updateLookupTable.updateLutTx.getInstructions().length > 0 &&
275
285
  updateLookupTable?.needsToBeIsolated
276
286
  ) {
277
- this.updateStatus("update lookup table", TransactionStatus.Processing);
287
+ this.updateStatus(updateLutTxName, TransactionStatus.Processing);
278
288
  await retryWithExponentialBackoff(
279
289
  async (attemptNum) =>
280
290
  await sendSingleOptimizedTransaction(
@@ -282,13 +292,19 @@ export class TransactionsManager {
282
292
  this.txHandler.connection,
283
293
  updateLookupTable.updateLutTx,
284
294
  this.simulateOnly,
285
- attemptNum
295
+ attemptNum,
296
+ prioritySetting,
297
+ () =>
298
+ this.updateStatus(
299
+ updateLutTxName,
300
+ TransactionStatus.AwaitingSignature
301
+ )
286
302
  ),
287
303
  3,
288
304
  150,
289
305
  this.errorsToThrow
290
306
  );
291
- this.updateStatus("update lookup table", TransactionStatus.Successful);
307
+ this.updateStatus(updateLutTxName, TransactionStatus.Successful);
292
308
  }
293
309
 
294
310
  this.lookupTables.defaultLuts = client.defaultLookupTables();
@@ -315,23 +331,36 @@ export class TransactionsManager {
315
331
  );
316
332
  await chore.initialize();
317
333
  items.unshift(chore);
318
- this.txHandler.log("Chores before: ", choresBefore.getInstructions().length);
334
+ this.txHandler.log(
335
+ "Chores before: ",
336
+ choresBefore.getInstructions().length
337
+ );
319
338
  }
320
339
  if (choresAfter.getInstructions().length > 0) {
321
340
  const chore = new TransactionItem(async () => ({ tx: choresAfter }));
322
341
  await chore.initialize();
323
342
  items.push(chore);
324
- this.txHandler.log("Chores after: ", choresAfter.getInstructions().length);
343
+ this.txHandler.log(
344
+ "Chores after: ",
345
+ choresAfter.getInstructions().length
346
+ );
325
347
  }
326
348
 
327
- await this.send(items, prioritySetting, true);
349
+ await this.send(items, prioritySetting, true).catch((e) => {
350
+ client.resetLiveTxUpdates(false);
351
+ throw e;
352
+ });
328
353
 
329
354
  if (!this.simulateOnly) {
330
355
  await client.resetLiveTxUpdates();
331
356
  }
332
357
  }
333
358
 
334
- async send(items: TransactionItem[], prioritySetting?: PriorityFeeSetting, initialized?: boolean) {
359
+ async send(
360
+ items: TransactionItem[],
361
+ prioritySetting?: PriorityFeeSetting,
362
+ initialized?: boolean
363
+ ) {
335
364
  if (!initialized) {
336
365
  for (const item of items) {
337
366
  await item.initialize();
@@ -421,7 +450,11 @@ export class TransactionsManager {
421
450
  this.simulateOnly,
422
451
  attemptNum,
423
452
  prioritySetting,
424
- () => this.updateStatus(itemSet!.name(), TransactionStatus.AwaitingSignature)
453
+ () =>
454
+ this.updateStatus(
455
+ itemSet!.name(),
456
+ TransactionStatus.AwaitingSignature
457
+ )
425
458
  );
426
459
  this.updateStatus(
427
460
  itemSet.name(),
@@ -1,5 +1,4 @@
1
1
  import { BASIS_POINTS, MIN_REPAY_GAP_BPS } from "../constants";
2
- import { FeeType } from "../generated";
3
2
 
4
3
  export function getLiqUtilzationRateBps(
5
4
  supplyUsd: number,
@@ -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
  });