@lavarage/sdk 6.9.2 → 6.9.4

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/index.ts CHANGED
@@ -195,7 +195,8 @@ export const openTradeV1 = async (
195
195
  randomSeed: Keypair,
196
196
  tokenProgram: PublicKey,
197
197
  partnerFeeRecipient?: PublicKey,
198
- partnerFeeMarkup?: number
198
+ partnerFeeMarkup?: number,
199
+ computeBudgetMicroLamports?: number
199
200
  ) => {
200
201
  let partnerFeeMarkupAsPkey;
201
202
  if (partnerFeeMarkup) {
@@ -345,13 +346,18 @@ export const openTradeV1 = async (
345
346
  deserializeInstruction(swapInstructionPayload),
346
347
  ];
347
348
 
349
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
350
+ microLamports: computeBudgetMicroLamports ?? 100000,
351
+ });
352
+
348
353
  const allInstructions = [
349
354
  fromTokenAccount.instruction!,
350
355
  toTokenAccount.instruction!,
351
356
  tradingOpenBorrowInstruction!,
352
357
  ...jupiterIxs,
353
358
  openAddCollateralInstruction!,
354
- ].filter(Boolean);
359
+ computeBudgetMicroLamports ? computeFeeIx : undefined,
360
+ ].filter(Boolean) as TransactionInstruction[];
355
361
 
356
362
  const messageV0 = new TransactionMessage({
357
363
  payerKey: lavarageProgram.provider.publicKey!,
@@ -384,7 +390,8 @@ export const openTradeV2 = async (
384
390
  quoteToken: PublicKey,
385
391
  tokenProgram: PublicKey,
386
392
  partnerFeeRecipient?: PublicKey,
387
- partnerFeeMarkup?: number
393
+ partnerFeeMarkup?: number,
394
+ computeBudgetMicroLamports?: number
388
395
  ) => {
389
396
  let partnerFeeMarkupAsPkey;
390
397
  if (partnerFeeMarkup) {
@@ -562,13 +569,18 @@ export const openTradeV2 = async (
562
569
  deserializeInstruction(swapInstructionPayload),
563
570
  ];
564
571
 
572
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
573
+ microLamports: computeBudgetMicroLamports ?? 100000,
574
+ });
575
+
565
576
  const allInstructions = [
566
577
  fromTokenAccount.instruction!,
567
578
  toTokenAccount.instruction!,
568
579
  tradingOpenBorrowInstruction!,
569
580
  ...jupiterIxs,
570
581
  openAddCollateralInstruction!,
571
- ].filter(Boolean);
582
+ computeBudgetMicroLamports ? computeFeeIx : undefined,
583
+ ].filter(Boolean) as TransactionInstruction[];
572
584
 
573
585
  const messageV0 = new TransactionMessage({
574
586
  payerKey: lavarageProgram.provider.publicKey!,
@@ -872,7 +884,8 @@ export const closeTradeV1 = async (
872
884
  quoteResponse: any;
873
885
  },
874
886
  partnerFeeRecipient?: PublicKey,
875
- partnerFeeMarkup?: number
887
+ partnerFeeMarkup?: number,
888
+ computeBudgetMicroLamports?: number
876
889
  ) => {
877
890
  let partnerFeeMarkupAsPkey;
878
891
  if (partnerFeeMarkup) {
@@ -1039,6 +1052,8 @@ export const closeTradeV1 = async (
1039
1052
  : []
1040
1053
  )
1041
1054
  .instruction();
1055
+
1056
+
1042
1057
  const {
1043
1058
  setupInstructions,
1044
1059
  swapInstruction: swapInstructionPayload,
@@ -1069,6 +1084,11 @@ export const closeTradeV1 = async (
1069
1084
  offer.account.collateralType,
1070
1085
  tokenProgram!
1071
1086
  );
1087
+
1088
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
1089
+ microLamports: computeBudgetMicroLamports ?? 100000,
1090
+ });
1091
+
1072
1092
  const allInstructions = [
1073
1093
  jupInstruction.instructions?.tokenLedgerInstruction
1074
1094
  ? createAssociatedTokenAccountInstruction
@@ -1082,6 +1102,7 @@ export const closeTradeV1 = async (
1082
1102
  closePositionIx,
1083
1103
  ...jupiterIxs,
1084
1104
  repaySolIx,
1105
+ computeBudgetMicroLamports ? computeFeeIx : undefined,
1085
1106
  ].filter((i) => !!i);
1086
1107
 
1087
1108
  const messageV0 = new TransactionMessage({
@@ -1120,7 +1141,8 @@ export const closeTradeV2 = async (
1120
1141
  },
1121
1142
  quoteToken: PublicKey,
1122
1143
  partnerFeeRecipient?: PublicKey,
1123
- partnerFeeMarkup?: number
1144
+ partnerFeeMarkup?: number,
1145
+ computeBudgetMicroLamports?: number
1124
1146
  ) => {
1125
1147
  let partnerFeeMarkupAsPkey;
1126
1148
  if (partnerFeeMarkup) {
@@ -1367,6 +1389,11 @@ export const closeTradeV2 = async (
1367
1389
  offer.account.collateralType,
1368
1390
  tokenProgram!
1369
1391
  );
1392
+
1393
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
1394
+ microLamports: computeBudgetMicroLamports ?? 100000,
1395
+ });
1396
+
1370
1397
  const allInstructions = [
1371
1398
  jupInstruction.instructions?.tokenLedgerInstruction
1372
1399
  ? createAssociatedTokenAccountInstruction
@@ -1380,6 +1407,7 @@ export const closeTradeV2 = async (
1380
1407
  closePositionIx,
1381
1408
  ...jupiterIxs,
1382
1409
  repaySolIx,
1410
+ computeBudgetMicroLamports ? computeFeeIx : undefined,
1383
1411
  ].filter((i) => !!i);
1384
1412
 
1385
1413
  const messageV0 = new TransactionMessage({
@@ -1430,7 +1458,7 @@ const getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency: string) => {
1430
1458
  };
1431
1459
 
1432
1460
  export const splitPositionV2 = async (
1433
- lavarageProgram: Program<LavarageV2>,
1461
+ lavarageProgram: Program<LavarageV2> | Program<Lavarage>,
1434
1462
  position: ProgramAccount<{
1435
1463
  pool: PublicKey;
1436
1464
  seed: PublicKey;
package/lending.ts CHANGED
@@ -583,7 +583,7 @@ export async function updateMaxBorrow(
583
583
 
584
584
  const instruction = await lavarageProgram.methods
585
585
  .lpOperatorUpdateMaxBorrow(new BN(params.maxBorrow))
586
- .accounts({
586
+ .accountsStrict({
587
587
  tradingPool: params.tradingPool,
588
588
  nodeWallet: new PublicKey(params.nodeWallet),
589
589
  operator: params.oracle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lavarage/sdk",
3
- "version": "6.9.2",
3
+ "version": "6.9.4",
4
4
  "description": "Lavarage SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",