@haven-fi/solauto-sdk 1.0.644 → 1.0.645

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":"marginfiFlProvider.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/marginfiFlProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAML,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAclC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,eAAe,CAAe;IAEhC,UAAU;YAiBF,iBAAiB;IA6C/B,OAAO,CAAC,sBAAsB;IA0CxB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAyC3D,gBAAgB,IAAI,SAAS,EAAE;IAY/B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAMnB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAI7C,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IAc9D,WAAW,CACT,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IAwCrB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;IA0E3D,YAAY,CACV,eAAe,EAAE,SAAS,EAC1B,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,SAAS;CAW3B"}
1
+ {"version":3,"file":"marginfiFlProvider.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/marginfiFlProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAML,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAclC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,eAAe,CAAe;IAEhC,UAAU;YAiBF,iBAAiB;IA6C/B,OAAO,CAAC,sBAAsB;IA0CxB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAyC3D,gBAAgB,IAAI,SAAS,EAAE;IAY/B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAMnB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAI7C,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IAc9D,WAAW,CACT,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IAoCrB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;IA0E3D,YAAY,CACV,eAAe,EAAE,SAAS,EAC1B,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,SAAS;CAW3B"}
@@ -146,10 +146,6 @@ class MarginfiFlProvider extends flProviderBase_1.FlProviderBase {
146
146
  const bank = this.liquidityBank(flashLoan.liquiditySource);
147
147
  const associatedBankAccs = (0, utils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(bank.publicKey));
148
148
  const iMfiAccount = this.iMfiAccount(flashLoan.liquiditySource);
149
- (0, utils_1.consoleLog)(bank.publicKey.toString());
150
- (0, utils_1.consoleLog)(associatedBankAccs.liquidityVault.toString());
151
- (0, utils_1.consoleLog)(associatedBankAccs.vaultAuthority.toString());
152
- (0, utils_1.consoleLog)(associatedBankAccs.mint.toString());
153
149
  return (0, umi_1.transactionBuilder)()
154
150
  .add((0, marginfi_sdk_1.lendingAccountStartFlashloan)(this.umi, {
155
151
  endIndex: 0, // We set this after building the transaction
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoMarginfiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,MAAM,EACN,kBAAkB,EAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,eAAe,EAEf,SAAS,EAET,aAAa,EACb,iBAAiB,EAEjB,gCAAgC,EAOjC,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,qBAAa,qBAAsB,SAAQ,aAAa;IAC/C,eAAe,kBAA4B;IAE3C,WAAW,EAAG,uBAAuB,CAAC;IAEtC,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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G,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;IAE7B,UAAU,CAAC,IAAI,EAAE,iBAAiB;IAiExC,mBAAmB,IAAI,MAAM,EAAE;IAO/B,gBAAgB,IAAI,SAAS,EAAE;IAI/B,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,kBAAkB;IAStE,cAAc,CACZ,QAAQ,CAAC,EAAE,gCAAgC,EAC3C,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA0C9B,eAAe,IAAI,kBAAkB;IAYrC,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,kBAAkB;IAenD,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUlE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,WAAW,CACT,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,gBAAgB,GACrB,kBAAkB;CA0EtB"}
@@ -245,16 +245,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
245
245
  });
246
246
  }
247
247
  rebalanceIx(rebalanceStep, data) {
248
- const inputIsSupply = new web3_js_1.PublicKey(data.swapQuote.inputMint).equals(this.pos.supplyMint);
249
- const outputIsSupply = new web3_js_1.PublicKey(data.swapQuote.outputMint).equals(this.pos.supplyMint);
250
248
  const preSwapRebalance = rebalanceStep === generated_1.RebalanceStep.PreSwap;
251
249
  const postSwapRebalance = rebalanceStep === generated_1.RebalanceStep.PostSwap;
252
- const needSupplyAccounts = (inputIsSupply && preSwapRebalance) ||
253
- (outputIsSupply && postSwapRebalance) ||
254
- (inputIsSupply && data.flashLoan !== undefined && postSwapRebalance);
255
- const needDebtAccounts = (!inputIsSupply && preSwapRebalance) ||
256
- (!outputIsSupply && postSwapRebalance) ||
257
- (!inputIsSupply && data.flashLoan !== undefined && postSwapRebalance);
258
250
  const isFirstRebalance = (preSwapRebalance && (0, utils_1.hasFirstRebalance)(data.rebalanceType)) ||
259
251
  (postSwapRebalance &&
260
252
  data.rebalanceType === generated_1.SolautoRebalanceType.FLSwapThenRebalance);
@@ -285,24 +277,16 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
285
277
  authoritySupplyTa: addAuthorityTas
286
278
  ? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.supplyMint))
287
279
  : undefined,
288
- vaultSupplyTa: needSupplyAccounts
289
- ? (0, umi_1.publicKey)(this.marginfiSupplyAccounts.liquidityVault)
290
- : undefined,
291
- supplyVaultAuthority: needSupplyAccounts
292
- ? (0, umi_1.publicKey)(this.marginfiSupplyAccounts.vaultAuthority)
293
- : undefined,
280
+ vaultSupplyTa: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.liquidityVault),
281
+ supplyVaultAuthority: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.vaultAuthority),
294
282
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
295
283
  debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
296
284
  positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
297
285
  authorityDebtTa: addAuthorityTas
298
286
  ? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.debtMint))
299
287
  : undefined,
300
- vaultDebtTa: needDebtAccounts
301
- ? (0, umi_1.publicKey)(this.marginfiDebtAccounts.liquidityVault)
302
- : undefined,
303
- debtVaultAuthority: needDebtAccounts
304
- ? (0, umi_1.publicKey)(this.marginfiDebtAccounts.vaultAuthority)
305
- : undefined,
288
+ vaultDebtTa: (0, umi_1.publicKey)(this.marginfiDebtAccounts.liquidityVault),
289
+ debtVaultAuthority: (0, umi_1.publicKey)(this.marginfiDebtAccounts.vaultAuthority),
306
290
  rebalanceType: data.rebalanceType,
307
291
  targetLiqUtilizationRateBps: data.targetLiqUtilizationRateBps ?? null,
308
292
  swapInAmountBaseUnit: isFirstRebalance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.644",
3
+ "version": "1.0.645",
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",
@@ -253,10 +253,6 @@ export class MarginfiFlProvider extends FlProviderBase {
253
253
  );
254
254
  const iMfiAccount = this.iMfiAccount(flashLoan.liquiditySource)!;
255
255
 
256
- consoleLog(bank.publicKey.toString());
257
- consoleLog(associatedBankAccs.liquidityVault.toString());
258
- consoleLog(associatedBankAccs.vaultAuthority.toString());
259
- consoleLog(associatedBankAccs.mint.toString());
260
256
  return transactionBuilder()
261
257
  .add(
262
258
  lendingAccountStartFlashloan(this.umi, {
@@ -360,25 +360,9 @@ export class SolautoMarginfiClient extends SolautoClient {
360
360
  rebalanceStep: RebalanceStep,
361
361
  data: RebalanceDetails
362
362
  ): TransactionBuilder {
363
- const inputIsSupply = new PublicKey(data.swapQuote.inputMint).equals(
364
- this.pos.supplyMint
365
- );
366
- const outputIsSupply = new PublicKey(data.swapQuote.outputMint).equals(
367
- this.pos.supplyMint
368
- );
369
-
370
363
  const preSwapRebalance = rebalanceStep === RebalanceStep.PreSwap;
371
364
  const postSwapRebalance = rebalanceStep === RebalanceStep.PostSwap;
372
365
 
373
- const needSupplyAccounts =
374
- (inputIsSupply && preSwapRebalance) ||
375
- (outputIsSupply && postSwapRebalance) ||
376
- (inputIsSupply && data.flashLoan !== undefined && postSwapRebalance);
377
- const needDebtAccounts =
378
- (!inputIsSupply && preSwapRebalance) ||
379
- (!outputIsSupply && postSwapRebalance) ||
380
- (!inputIsSupply && data.flashLoan !== undefined && postSwapRebalance);
381
-
382
366
  const isFirstRebalance =
383
367
  (preSwapRebalance && hasFirstRebalance(data.rebalanceType)) ||
384
368
  (postSwapRebalance &&
@@ -423,24 +407,16 @@ export class SolautoMarginfiClient extends SolautoClient {
423
407
  authoritySupplyTa: addAuthorityTas
424
408
  ? publicKey(getTokenAccount(this.authority, this.pos.supplyMint))
425
409
  : undefined,
426
- vaultSupplyTa: needSupplyAccounts
427
- ? publicKey(this.marginfiSupplyAccounts.liquidityVault)
428
- : undefined,
429
- supplyVaultAuthority: needSupplyAccounts
430
- ? publicKey(this.marginfiSupplyAccounts.vaultAuthority)
431
- : undefined,
410
+ vaultSupplyTa: publicKey(this.marginfiSupplyAccounts.liquidityVault),
411
+ supplyVaultAuthority: publicKey(this.marginfiSupplyAccounts.vaultAuthority),
432
412
  debtBank: publicKey(this.marginfiDebtAccounts.bank),
433
413
  debtPriceOracle: publicKey(this.debtPriceOracle),
434
414
  positionDebtTa: publicKey(this.positionDebtTa),
435
415
  authorityDebtTa: addAuthorityTas
436
416
  ? publicKey(getTokenAccount(this.authority, this.pos.debtMint))
437
417
  : undefined,
438
- vaultDebtTa: needDebtAccounts
439
- ? publicKey(this.marginfiDebtAccounts.liquidityVault)
440
- : undefined,
441
- debtVaultAuthority: needDebtAccounts
442
- ? publicKey(this.marginfiDebtAccounts.vaultAuthority)
443
- : undefined,
418
+ vaultDebtTa: publicKey(this.marginfiDebtAccounts.liquidityVault),
419
+ debtVaultAuthority: publicKey(this.marginfiDebtAccounts.vaultAuthority),
444
420
  rebalanceType: data.rebalanceType,
445
421
  targetLiqUtilizationRateBps: data.targetLiqUtilizationRateBps ?? null,
446
422
  swapInAmountBaseUnit: isFirstRebalance