@lavarage/sdk 6.6.0 → 6.7.0

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.
package/dist/index.d.mts CHANGED
@@ -2845,7 +2845,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
2845
2845
  swapInstruction: Record<string, unknown>;
2846
2846
  addressLookupTableAddresses: string[];
2847
2847
  };
2848
- }, marginSOL: BN, leverage: number, randomSeed: Keypair, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2848
+ }, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2849
2849
  declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
2850
2850
  nodeWallet: PublicKey;
2851
2851
  interestRate: number;
@@ -2856,7 +2856,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
2856
2856
  swapInstruction: Record<string, unknown>;
2857
2857
  addressLookupTableAddresses: string[];
2858
2858
  };
2859
- }, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2859
+ }, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2860
2860
  declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
2861
2861
  pool: PublicKey;
2862
2862
  seed: PublicKey;
package/dist/index.d.ts CHANGED
@@ -2845,7 +2845,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
2845
2845
  swapInstruction: Record<string, unknown>;
2846
2846
  addressLookupTableAddresses: string[];
2847
2847
  };
2848
- }, marginSOL: BN, leverage: number, randomSeed: Keypair, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2848
+ }, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2849
2849
  declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
2850
2850
  nodeWallet: PublicKey;
2851
2851
  interestRate: number;
@@ -2856,7 +2856,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
2856
2856
  swapInstruction: Record<string, unknown>;
2857
2857
  addressLookupTableAddresses: string[];
2858
2858
  };
2859
- }, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2859
+ }, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
2860
2860
  declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
2861
2861
  pool: PublicKey;
2862
2862
  seed: PublicKey;
package/dist/index.js CHANGED
@@ -3515,7 +3515,8 @@ function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 42960
3515
3515
  loanId,
3516
3516
  openingPositionSize,
3517
3517
  collateralAmount,
3518
- initialMargin
3518
+ initialMargin,
3519
+ transactionHash: event.transactionHash
3519
3520
  };
3520
3521
  });
3521
3522
  });
@@ -3530,19 +3531,14 @@ function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
3530
3531
  const filter = contract.filters.Sell();
3531
3532
  const events = yield contract.queryFilter(filter, fromBlock);
3532
3533
  return events.map((event) => {
3533
- const {
3534
- buyer,
3535
- tokenCollateral,
3536
- loanId,
3537
- closingPositionSize,
3538
- profit
3539
- } = event.args;
3534
+ const { buyer, tokenCollateral, loanId, closingPositionSize, profit } = event.args;
3540
3535
  return {
3541
3536
  trader: buyer,
3542
3537
  tokenCollateral,
3543
3538
  loanId,
3544
3539
  closingPositionSize,
3545
- profit
3540
+ profit,
3541
+ transactionHash: event.transactionHash
3546
3542
  };
3547
3543
  });
3548
3544
  });
@@ -3569,7 +3565,8 @@ function getLiquidatedPositionsEvm(provider, borrowerOpsContractAddress, fromBlo
3569
3565
  tokenCollateral,
3570
3566
  loanId,
3571
3567
  closingPositionSize,
3572
- liquidatorRepaidAmount
3568
+ liquidatorRepaidAmount,
3569
+ transactionHash: event.transactionHash
3573
3570
  };
3574
3571
  });
3575
3572
  });
@@ -3745,7 +3742,7 @@ var getLiquidatedPositions = (lavarageProgram) => {
3745
3742
  var getAllPositions = (lavarageProgram) => {
3746
3743
  return lavarageProgram.account.position.all([{ dataSize: 178 }]);
3747
3744
  };
3748
- var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3745
+ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3749
3746
  let partnerFeeMarkupAsPkey;
3750
3747
  if (partnerFeeMarkup) {
3751
3748
  const feeBuffer = Buffer.alloc(8);
@@ -3759,10 +3756,6 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
3759
3756
  offer,
3760
3757
  randomSeed.publicKey
3761
3758
  );
3762
- const mintAccount = yield lavarageProgram.provider.connection.getAccountInfo(
3763
- offer.account.collateralType
3764
- );
3765
- const tokenProgram = mintAccount == null ? void 0 : mintAccount.owner;
3766
3759
  const fromTokenAccount = yield getTokenAccountOrCreateIfNotExists(
3767
3760
  lavarageProgram,
3768
3761
  lavarageProgram.provider.publicKey,
@@ -3880,7 +3873,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
3880
3873
  const tx = new import_web3.VersionedTransaction(messageV0);
3881
3874
  return tx;
3882
3875
  });
3883
- var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3876
+ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3884
3877
  let partnerFeeMarkupAsPkey;
3885
3878
  if (partnerFeeMarkup) {
3886
3879
  const feeBuffer = Buffer.alloc(8);
@@ -3894,10 +3887,6 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
3894
3887
  offer,
3895
3888
  randomSeed.publicKey
3896
3889
  );
3897
- const mintAccount = yield lavarageProgram.provider.connection.getAccountInfo(
3898
- offer.account.collateralType
3899
- );
3900
- const tokenProgram = mintAccount == null ? void 0 : mintAccount.owner;
3901
3890
  const quoteMintAccount = yield lavarageProgram.provider.connection.getAccountInfo(quoteToken);
3902
3891
  const quoteTokenProgram = quoteMintAccount == null ? void 0 : quoteMintAccount.owner;
3903
3892
  const fromTokenAccount = yield getTokenAccountOrCreateIfNotExists(