@lavarage/sdk 7.5.7 → 7.5.8
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/.DS_Store +0 -0
- package/dist/index.d.mts +147 -1
- package/dist/index.d.ts +147 -1
- package/dist/index.js +287 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -3
- package/dist/index.mjs.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/functions/borrowV1.html +1 -0
- package/docs/functions/borrowV2.html +1 -0
- package/docs/functions/closePositionEvm.html +9 -0
- package/docs/functions/closeTradeV1.html +17 -0
- package/docs/functions/closeTradeV2.html +18 -0
- package/docs/functions/createTpDelegate.html +17 -0
- package/docs/functions/getActiveLoanCountEvm.html +8 -0
- package/docs/functions/getActiveLoansBatchEvm.html +10 -0
- package/docs/functions/getAllPositions.html +17 -0
- package/docs/functions/getAvailableExposureEvm.html +9 -0
- package/docs/functions/getClosedPositions.html +7 -0
- package/docs/functions/getClosedPositionsEvm.html +9 -0
- package/docs/functions/getCollateralExposureEvm.html +9 -0
- package/docs/functions/getCollateralInfoEvm.html +9 -0
- package/docs/functions/getDelegateAccounts.html +13 -0
- package/docs/functions/getLiquidatedPositions.html +13 -0
- package/docs/functions/getLiquidatedPositionsEvm.html +9 -0
- package/docs/functions/getLoanEvm.html +9 -0
- package/docs/functions/getLoansByBorrowerEvm.html +9 -0
- package/docs/functions/getOffers.html +7 -0
- package/docs/functions/getOffersEvm.html +9 -0
- package/docs/functions/getOpenPositions.html +11 -0
- package/docs/functions/getOpeningFeeEvm.html +8 -0
- package/docs/functions/getPda.html +8 -0
- package/docs/functions/getPositionAccountPDA.html +9 -0
- package/docs/functions/getPositionsEvm.html +8 -0
- package/docs/functions/getProfitFeeEvm.html +8 -0
- package/docs/functions/getTokenBalanceEvm.html +8 -0
- package/docs/functions/getUserLoansEvm.html +9 -0
- package/docs/functions/lending.addToWithdrawalAccessList.html +1 -0
- package/docs/functions/lending.createOffer.html +15 -0
- package/docs/functions/lending.depositFunds.html +17 -0
- package/docs/functions/lending.getNodeWalletPDA.html +9 -0
- package/docs/functions/lending.getTradingPoolPDA.html +9 -0
- package/docs/functions/lending.getWithdrawalAccessList.html +1 -0
- package/docs/functions/lending.getWithdrawalAccessListPDA.html +1 -0
- package/docs/functions/lending.removeFromWithdrawalAccessList.html +1 -0
- package/docs/functions/lending.updateInterestRate.html +13 -0
- package/docs/functions/lending.updateMaxBorrow.html +13 -0
- package/docs/functions/lending.updateMaxExposure.html +13 -0
- package/docs/functions/lending.updateOffer.html +19 -0
- package/docs/functions/lending.withdrawFunds.html +20 -0
- package/docs/functions/lending.withdrawFundsV1.html +16 -0
- package/docs/functions/lending.withdrawFundsV2.html +19 -0
- package/docs/functions/liquidatePositionEvm.html +6 -0
- package/docs/functions/mergePositionV2.html +13 -0
- package/docs/functions/modifyTpDelegate.html +17 -0
- package/docs/functions/openPositionEvm.html +9 -0
- package/docs/functions/openTradeV1.html +26 -0
- package/docs/functions/openTradeV2.html +29 -0
- package/docs/functions/partialRepayV1.html +10 -0
- package/docs/functions/partialRepayV2.html +10 -0
- package/docs/functions/removeTpDelegate.html +13 -0
- package/docs/functions/splitPositionV2.html +13 -0
- package/docs/functions/updateMaxLendPerTokenBatchEvm.html +9 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +3 -0
- package/docs/modules/IDLV2.html +2 -0
- package/docs/modules/lending.html +1 -0
- package/docs/modules.html +4 -0
- package/docs/types/IDLV2.Lavarage.html +8 -0
- package/docs/types/Lavarage.html +8 -0
- package/docs/variables/IDL.html +1 -0
- package/docs/variables/IDLV2.IDL.html +1 -0
- package/idl/lavarage.ts +126 -0
- package/idl/lavaragev2.ts +166 -0
- package/index.ts +282 -112
- package/package.json +2 -2
package/.DS_Store
ADDED
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -692,6 +692,69 @@ type Lavarage$1 = {
|
|
|
692
692
|
}
|
|
693
693
|
];
|
|
694
694
|
},
|
|
695
|
+
{
|
|
696
|
+
"name": "tradingCloseRepaySolWithReferral";
|
|
697
|
+
"accounts": [
|
|
698
|
+
{
|
|
699
|
+
"name": "positionAccount";
|
|
700
|
+
"isMut": true;
|
|
701
|
+
"isSigner": false;
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"name": "trader";
|
|
705
|
+
"isMut": true;
|
|
706
|
+
"isSigner": true;
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "tradingPool";
|
|
710
|
+
"isMut": true;
|
|
711
|
+
"isSigner": false;
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"name": "nodeWallet";
|
|
715
|
+
"isMut": true;
|
|
716
|
+
"isSigner": false;
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"name": "systemProgram";
|
|
720
|
+
"isMut": false;
|
|
721
|
+
"isSigner": false;
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"name": "clock";
|
|
725
|
+
"isMut": false;
|
|
726
|
+
"isSigner": false;
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "randomAccountAsId";
|
|
730
|
+
"isMut": false;
|
|
731
|
+
"isSigner": false;
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "feeReceipient";
|
|
735
|
+
"isMut": true;
|
|
736
|
+
"isSigner": false;
|
|
737
|
+
}
|
|
738
|
+
];
|
|
739
|
+
"args": [
|
|
740
|
+
{
|
|
741
|
+
"name": "closingPositionSize";
|
|
742
|
+
"type": "u64";
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"name": "closeType";
|
|
746
|
+
"type": "u64";
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "discountBps";
|
|
750
|
+
"type": "u64";
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"name": "referralBps";
|
|
754
|
+
"type": "u64";
|
|
755
|
+
}
|
|
756
|
+
];
|
|
757
|
+
},
|
|
695
758
|
{
|
|
696
759
|
"name": "tradingClosePartialRepaySol";
|
|
697
760
|
"accounts": [
|
|
@@ -2371,6 +2434,89 @@ type Lavarage = {
|
|
|
2371
2434
|
}
|
|
2372
2435
|
];
|
|
2373
2436
|
},
|
|
2437
|
+
{
|
|
2438
|
+
"name": "tradingCloseRepaySolWithReferral";
|
|
2439
|
+
"accounts": [
|
|
2440
|
+
{
|
|
2441
|
+
"name": "positionAccount";
|
|
2442
|
+
"isMut": true;
|
|
2443
|
+
"isSigner": false;
|
|
2444
|
+
},
|
|
2445
|
+
{
|
|
2446
|
+
"name": "trader";
|
|
2447
|
+
"isMut": true;
|
|
2448
|
+
"isSigner": true;
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
"name": "tradingPool";
|
|
2452
|
+
"isMut": true;
|
|
2453
|
+
"isSigner": false;
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
"name": "nodeWallet";
|
|
2457
|
+
"isMut": true;
|
|
2458
|
+
"isSigner": false;
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
"name": "systemProgram";
|
|
2462
|
+
"isMut": false;
|
|
2463
|
+
"isSigner": false;
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
"name": "clock";
|
|
2467
|
+
"isMut": false;
|
|
2468
|
+
"isSigner": false;
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
"name": "randomAccountAsId";
|
|
2472
|
+
"isMut": false;
|
|
2473
|
+
"isSigner": false;
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
"name": "mint";
|
|
2477
|
+
"isMut": false;
|
|
2478
|
+
"isSigner": false;
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
"name": "fromTokenAccount";
|
|
2482
|
+
"isMut": true;
|
|
2483
|
+
"isSigner": false;
|
|
2484
|
+
},
|
|
2485
|
+
{
|
|
2486
|
+
"name": "toTokenAccount";
|
|
2487
|
+
"isMut": true;
|
|
2488
|
+
"isSigner": false;
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"name": "feeTokenAccount";
|
|
2492
|
+
"isMut": true;
|
|
2493
|
+
"isSigner": false;
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
"name": "tokenProgram";
|
|
2497
|
+
"isMut": false;
|
|
2498
|
+
"isSigner": false;
|
|
2499
|
+
}
|
|
2500
|
+
];
|
|
2501
|
+
"args": [
|
|
2502
|
+
{
|
|
2503
|
+
"name": "closingPositionSize";
|
|
2504
|
+
"type": "u64";
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
"name": "closeType";
|
|
2508
|
+
"type": "u64";
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
"name": "discountBps";
|
|
2512
|
+
"type": "u64";
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
"name": "referralBps";
|
|
2516
|
+
"type": "u64";
|
|
2517
|
+
}
|
|
2518
|
+
];
|
|
2519
|
+
},
|
|
2374
2520
|
{
|
|
2375
2521
|
"name": "tradingPartialRepaySol";
|
|
2376
2522
|
"accounts": [
|
|
@@ -5096,7 +5242,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
5096
5242
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
5097
5243
|
};
|
|
5098
5244
|
quoteResponse: any;
|
|
5099
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
5245
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
5100
5246
|
/**
|
|
5101
5247
|
* Retrieves delegate accounts for automated position management
|
|
5102
5248
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -692,6 +692,69 @@ type Lavarage$1 = {
|
|
|
692
692
|
}
|
|
693
693
|
];
|
|
694
694
|
},
|
|
695
|
+
{
|
|
696
|
+
"name": "tradingCloseRepaySolWithReferral";
|
|
697
|
+
"accounts": [
|
|
698
|
+
{
|
|
699
|
+
"name": "positionAccount";
|
|
700
|
+
"isMut": true;
|
|
701
|
+
"isSigner": false;
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"name": "trader";
|
|
705
|
+
"isMut": true;
|
|
706
|
+
"isSigner": true;
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "tradingPool";
|
|
710
|
+
"isMut": true;
|
|
711
|
+
"isSigner": false;
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"name": "nodeWallet";
|
|
715
|
+
"isMut": true;
|
|
716
|
+
"isSigner": false;
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"name": "systemProgram";
|
|
720
|
+
"isMut": false;
|
|
721
|
+
"isSigner": false;
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"name": "clock";
|
|
725
|
+
"isMut": false;
|
|
726
|
+
"isSigner": false;
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "randomAccountAsId";
|
|
730
|
+
"isMut": false;
|
|
731
|
+
"isSigner": false;
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "feeReceipient";
|
|
735
|
+
"isMut": true;
|
|
736
|
+
"isSigner": false;
|
|
737
|
+
}
|
|
738
|
+
];
|
|
739
|
+
"args": [
|
|
740
|
+
{
|
|
741
|
+
"name": "closingPositionSize";
|
|
742
|
+
"type": "u64";
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"name": "closeType";
|
|
746
|
+
"type": "u64";
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "discountBps";
|
|
750
|
+
"type": "u64";
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"name": "referralBps";
|
|
754
|
+
"type": "u64";
|
|
755
|
+
}
|
|
756
|
+
];
|
|
757
|
+
},
|
|
695
758
|
{
|
|
696
759
|
"name": "tradingClosePartialRepaySol";
|
|
697
760
|
"accounts": [
|
|
@@ -2371,6 +2434,89 @@ type Lavarage = {
|
|
|
2371
2434
|
}
|
|
2372
2435
|
];
|
|
2373
2436
|
},
|
|
2437
|
+
{
|
|
2438
|
+
"name": "tradingCloseRepaySolWithReferral";
|
|
2439
|
+
"accounts": [
|
|
2440
|
+
{
|
|
2441
|
+
"name": "positionAccount";
|
|
2442
|
+
"isMut": true;
|
|
2443
|
+
"isSigner": false;
|
|
2444
|
+
},
|
|
2445
|
+
{
|
|
2446
|
+
"name": "trader";
|
|
2447
|
+
"isMut": true;
|
|
2448
|
+
"isSigner": true;
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
"name": "tradingPool";
|
|
2452
|
+
"isMut": true;
|
|
2453
|
+
"isSigner": false;
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
"name": "nodeWallet";
|
|
2457
|
+
"isMut": true;
|
|
2458
|
+
"isSigner": false;
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
"name": "systemProgram";
|
|
2462
|
+
"isMut": false;
|
|
2463
|
+
"isSigner": false;
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
"name": "clock";
|
|
2467
|
+
"isMut": false;
|
|
2468
|
+
"isSigner": false;
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
"name": "randomAccountAsId";
|
|
2472
|
+
"isMut": false;
|
|
2473
|
+
"isSigner": false;
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
"name": "mint";
|
|
2477
|
+
"isMut": false;
|
|
2478
|
+
"isSigner": false;
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
"name": "fromTokenAccount";
|
|
2482
|
+
"isMut": true;
|
|
2483
|
+
"isSigner": false;
|
|
2484
|
+
},
|
|
2485
|
+
{
|
|
2486
|
+
"name": "toTokenAccount";
|
|
2487
|
+
"isMut": true;
|
|
2488
|
+
"isSigner": false;
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"name": "feeTokenAccount";
|
|
2492
|
+
"isMut": true;
|
|
2493
|
+
"isSigner": false;
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
"name": "tokenProgram";
|
|
2497
|
+
"isMut": false;
|
|
2498
|
+
"isSigner": false;
|
|
2499
|
+
}
|
|
2500
|
+
];
|
|
2501
|
+
"args": [
|
|
2502
|
+
{
|
|
2503
|
+
"name": "closingPositionSize";
|
|
2504
|
+
"type": "u64";
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
"name": "closeType";
|
|
2508
|
+
"type": "u64";
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
"name": "discountBps";
|
|
2512
|
+
"type": "u64";
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
"name": "referralBps";
|
|
2516
|
+
"type": "u64";
|
|
2517
|
+
}
|
|
2518
|
+
];
|
|
2519
|
+
},
|
|
2374
2520
|
{
|
|
2375
2521
|
"name": "tradingPartialRepaySol";
|
|
2376
2522
|
"accounts": [
|
|
@@ -5096,7 +5242,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
5096
5242
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
5097
5243
|
};
|
|
5098
5244
|
quoteResponse: any;
|
|
5099
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
5245
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
5100
5246
|
/**
|
|
5101
5247
|
* Retrieves delegate accounts for automated position management
|
|
5102
5248
|
*
|
package/dist/index.js
CHANGED
|
@@ -2428,6 +2428,69 @@ var IDL2 = {
|
|
|
2428
2428
|
}
|
|
2429
2429
|
]
|
|
2430
2430
|
},
|
|
2431
|
+
{
|
|
2432
|
+
"name": "tradingCloseRepaySolWithReferral",
|
|
2433
|
+
"accounts": [
|
|
2434
|
+
{
|
|
2435
|
+
"name": "positionAccount",
|
|
2436
|
+
"isMut": true,
|
|
2437
|
+
"isSigner": false
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
"name": "trader",
|
|
2441
|
+
"isMut": true,
|
|
2442
|
+
"isSigner": true
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
"name": "tradingPool",
|
|
2446
|
+
"isMut": true,
|
|
2447
|
+
"isSigner": false
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
"name": "nodeWallet",
|
|
2451
|
+
"isMut": true,
|
|
2452
|
+
"isSigner": false
|
|
2453
|
+
},
|
|
2454
|
+
{
|
|
2455
|
+
"name": "systemProgram",
|
|
2456
|
+
"isMut": false,
|
|
2457
|
+
"isSigner": false
|
|
2458
|
+
},
|
|
2459
|
+
{
|
|
2460
|
+
"name": "clock",
|
|
2461
|
+
"isMut": false,
|
|
2462
|
+
"isSigner": false
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
"name": "randomAccountAsId",
|
|
2466
|
+
"isMut": false,
|
|
2467
|
+
"isSigner": false
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
"name": "feeReceipient",
|
|
2471
|
+
"isMut": true,
|
|
2472
|
+
"isSigner": false
|
|
2473
|
+
}
|
|
2474
|
+
],
|
|
2475
|
+
"args": [
|
|
2476
|
+
{
|
|
2477
|
+
"name": "closingPositionSize",
|
|
2478
|
+
"type": "u64"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
"name": "closeType",
|
|
2482
|
+
"type": "u64"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
"name": "discountBps",
|
|
2486
|
+
"type": "u64"
|
|
2487
|
+
},
|
|
2488
|
+
{
|
|
2489
|
+
"name": "referralBps",
|
|
2490
|
+
"type": "u64"
|
|
2491
|
+
}
|
|
2492
|
+
]
|
|
2493
|
+
},
|
|
2431
2494
|
{
|
|
2432
2495
|
"name": "tradingClosePartialRepaySol",
|
|
2433
2496
|
"accounts": [
|
|
@@ -4111,6 +4174,89 @@ var IDL3 = {
|
|
|
4111
4174
|
}
|
|
4112
4175
|
]
|
|
4113
4176
|
},
|
|
4177
|
+
{
|
|
4178
|
+
"name": "tradingCloseRepaySolWithReferral",
|
|
4179
|
+
"accounts": [
|
|
4180
|
+
{
|
|
4181
|
+
"name": "positionAccount",
|
|
4182
|
+
"isMut": true,
|
|
4183
|
+
"isSigner": false
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
"name": "trader",
|
|
4187
|
+
"isMut": true,
|
|
4188
|
+
"isSigner": true
|
|
4189
|
+
},
|
|
4190
|
+
{
|
|
4191
|
+
"name": "tradingPool",
|
|
4192
|
+
"isMut": true,
|
|
4193
|
+
"isSigner": false
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
"name": "nodeWallet",
|
|
4197
|
+
"isMut": true,
|
|
4198
|
+
"isSigner": false
|
|
4199
|
+
},
|
|
4200
|
+
{
|
|
4201
|
+
"name": "systemProgram",
|
|
4202
|
+
"isMut": false,
|
|
4203
|
+
"isSigner": false
|
|
4204
|
+
},
|
|
4205
|
+
{
|
|
4206
|
+
"name": "clock",
|
|
4207
|
+
"isMut": false,
|
|
4208
|
+
"isSigner": false
|
|
4209
|
+
},
|
|
4210
|
+
{
|
|
4211
|
+
"name": "randomAccountAsId",
|
|
4212
|
+
"isMut": false,
|
|
4213
|
+
"isSigner": false
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
"name": "mint",
|
|
4217
|
+
"isMut": false,
|
|
4218
|
+
"isSigner": false
|
|
4219
|
+
},
|
|
4220
|
+
{
|
|
4221
|
+
"name": "fromTokenAccount",
|
|
4222
|
+
"isMut": true,
|
|
4223
|
+
"isSigner": false
|
|
4224
|
+
},
|
|
4225
|
+
{
|
|
4226
|
+
"name": "toTokenAccount",
|
|
4227
|
+
"isMut": true,
|
|
4228
|
+
"isSigner": false
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
"name": "feeTokenAccount",
|
|
4232
|
+
"isMut": true,
|
|
4233
|
+
"isSigner": false
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
"name": "tokenProgram",
|
|
4237
|
+
"isMut": false,
|
|
4238
|
+
"isSigner": false
|
|
4239
|
+
}
|
|
4240
|
+
],
|
|
4241
|
+
"args": [
|
|
4242
|
+
{
|
|
4243
|
+
"name": "closingPositionSize",
|
|
4244
|
+
"type": "u64"
|
|
4245
|
+
},
|
|
4246
|
+
{
|
|
4247
|
+
"name": "closeType",
|
|
4248
|
+
"type": "u64"
|
|
4249
|
+
},
|
|
4250
|
+
{
|
|
4251
|
+
"name": "discountBps",
|
|
4252
|
+
"type": "u64"
|
|
4253
|
+
},
|
|
4254
|
+
{
|
|
4255
|
+
"name": "referralBps",
|
|
4256
|
+
"type": "u64"
|
|
4257
|
+
}
|
|
4258
|
+
]
|
|
4259
|
+
},
|
|
4114
4260
|
{
|
|
4115
4261
|
"name": "tradingPartialRepaySol",
|
|
4116
4262
|
"accounts": [
|
|
@@ -6353,9 +6499,10 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
6353
6499
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
6354
6500
|
return tx;
|
|
6355
6501
|
});
|
|
6356
|
-
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions) => __async(void 0, null, function* () {
|
|
6502
|
+
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions, discountBps, referralBps) => __async(void 0, null, function* () {
|
|
6357
6503
|
var _a, _b;
|
|
6358
6504
|
let partnerFeeMarkupAsPkey;
|
|
6505
|
+
const referralVaultProgram = new import_anchor2.Program(IDL, REFFERAL_VAULT_PROGRAM_ID, lavarageProgram.provider);
|
|
6359
6506
|
if (partnerFeeMarkup) {
|
|
6360
6507
|
const feeBuffer = Buffer.alloc(8);
|
|
6361
6508
|
feeBuffer.writeBigUInt64LE(BigInt(partnerFeeMarkup));
|
|
@@ -6425,6 +6572,45 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6425
6572
|
});
|
|
6426
6573
|
const addressLookupTableAccounts = [];
|
|
6427
6574
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
6575
|
+
const useReferral = discountBps !== void 0 && referralBps !== void 0;
|
|
6576
|
+
let partnerFeeRecipientVaultCreateIx;
|
|
6577
|
+
let partnerFeeRecipientTokenAccountCreateIx;
|
|
6578
|
+
let userVaultPda;
|
|
6579
|
+
if (partnerFeeRecipient && partnerFeeMarkupAsPkey && referralVaultProgram) {
|
|
6580
|
+
[userVaultPda] = import_web32.PublicKey.findProgramAddressSync(
|
|
6581
|
+
[Buffer.from("user_vault"), new import_web32.PublicKey(partnerFeeRecipient).toBuffer()],
|
|
6582
|
+
referralVaultProgram.programId
|
|
6583
|
+
);
|
|
6584
|
+
const vaultTokenAccount = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6585
|
+
quoteToken,
|
|
6586
|
+
userVaultPda,
|
|
6587
|
+
true,
|
|
6588
|
+
// allowOwnerOffCurve for PDA
|
|
6589
|
+
quoteTokenProgram
|
|
6590
|
+
);
|
|
6591
|
+
const [vaultAccountInfo, vaultTokenAccountInfo] = yield lavarageProgram.provider.connection.getMultipleAccountsInfo([
|
|
6592
|
+
userVaultPda,
|
|
6593
|
+
vaultTokenAccount
|
|
6594
|
+
]);
|
|
6595
|
+
if (!vaultAccountInfo) {
|
|
6596
|
+
partnerFeeRecipientVaultCreateIx = yield referralVaultProgram.methods.initializeVault().accountsStrict({
|
|
6597
|
+
userVault: userVaultPda,
|
|
6598
|
+
user: partnerFeeRecipient,
|
|
6599
|
+
funder: lavarageProgram.provider.publicKey,
|
|
6600
|
+
systemProgram: import_web32.SystemProgram.programId
|
|
6601
|
+
}).instruction();
|
|
6602
|
+
}
|
|
6603
|
+
if (!vaultTokenAccountInfo) {
|
|
6604
|
+
partnerFeeRecipientTokenAccountCreateIx = (0, import_spl_token2.createAssociatedTokenAccountIdempotentInstruction)(
|
|
6605
|
+
lavarageProgram.provider.publicKey,
|
|
6606
|
+
vaultTokenAccount,
|
|
6607
|
+
userVaultPda,
|
|
6608
|
+
quoteToken,
|
|
6609
|
+
quoteTokenProgram,
|
|
6610
|
+
import_spl_token2.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6611
|
+
);
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6428
6614
|
const closePositionIx = yield lavarageProgram.methods.tradingCloseBorrowCollateral().accountsStrict({
|
|
6429
6615
|
tradingPool: poolPubKey,
|
|
6430
6616
|
instructions: import_web32.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
@@ -6441,7 +6627,54 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6441
6627
|
let repaySolIx = null;
|
|
6442
6628
|
let jupiterIxs = [];
|
|
6443
6629
|
if (jupInstruction.instructions == void 0) {
|
|
6444
|
-
repaySolIx = yield lavarageProgram.methods.
|
|
6630
|
+
repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
|
|
6631
|
+
new import_anchor2.BN(jupInstruction.quoteResponse.outAmount),
|
|
6632
|
+
new import_anchor2.BN(9997),
|
|
6633
|
+
new import_anchor2.BN(discountBps),
|
|
6634
|
+
new import_anchor2.BN(referralBps)
|
|
6635
|
+
).accountsStrict({
|
|
6636
|
+
nodeWallet: pool.account.nodeWallet,
|
|
6637
|
+
positionAccount: positionAccountPDA,
|
|
6638
|
+
tradingPool: poolPubKey,
|
|
6639
|
+
trader: lavarageProgram.provider.publicKey,
|
|
6640
|
+
systemProgram: import_web32.SystemProgram.programId,
|
|
6641
|
+
clock: import_web32.SYSVAR_CLOCK_PUBKEY,
|
|
6642
|
+
randomAccountAsId: position.account.seed,
|
|
6643
|
+
feeTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6644
|
+
quoteToken,
|
|
6645
|
+
new import_web32.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"),
|
|
6646
|
+
false,
|
|
6647
|
+
quoteTokenProgram
|
|
6648
|
+
),
|
|
6649
|
+
fromTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6650
|
+
quoteToken,
|
|
6651
|
+
lavarageProgram.provider.publicKey,
|
|
6652
|
+
false,
|
|
6653
|
+
quoteTokenProgram
|
|
6654
|
+
),
|
|
6655
|
+
tokenProgram: quoteTokenProgram,
|
|
6656
|
+
toTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6657
|
+
quoteToken,
|
|
6658
|
+
pool.account.nodeWallet,
|
|
6659
|
+
true,
|
|
6660
|
+
quoteTokenProgram
|
|
6661
|
+
),
|
|
6662
|
+
mint: quoteToken
|
|
6663
|
+
}).remainingAccounts(
|
|
6664
|
+
partnerFeeRecipient && partnerFeeMarkupAsPkey && userVaultPda ? [
|
|
6665
|
+
{
|
|
6666
|
+
pubkey: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6667
|
+
quoteToken,
|
|
6668
|
+
userVaultPda,
|
|
6669
|
+
true,
|
|
6670
|
+
// allowOwnerOffCurve for PDA
|
|
6671
|
+
quoteTokenProgram
|
|
6672
|
+
),
|
|
6673
|
+
isSigner: false,
|
|
6674
|
+
isWritable: true
|
|
6675
|
+
}
|
|
6676
|
+
] : []
|
|
6677
|
+
).instruction() : yield lavarageProgram.methods.tradingCloseRepaySol(
|
|
6445
6678
|
new import_anchor2.BN(jupInstruction.quoteResponse.outAmount),
|
|
6446
6679
|
new import_anchor2.BN(9997)
|
|
6447
6680
|
).accountsStrict({
|
|
@@ -6492,7 +6725,54 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6492
6725
|
] : []
|
|
6493
6726
|
).instruction();
|
|
6494
6727
|
} else {
|
|
6495
|
-
repaySolIx = yield lavarageProgram.methods.
|
|
6728
|
+
repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
|
|
6729
|
+
new import_anchor2.BN(jupInstruction.quoteResponse.outAmount),
|
|
6730
|
+
new import_anchor2.BN(9998),
|
|
6731
|
+
new import_anchor2.BN(discountBps),
|
|
6732
|
+
new import_anchor2.BN(referralBps)
|
|
6733
|
+
).accountsStrict({
|
|
6734
|
+
nodeWallet: pool.account.nodeWallet,
|
|
6735
|
+
positionAccount: positionAccountPDA,
|
|
6736
|
+
tradingPool: poolPubKey,
|
|
6737
|
+
trader: lavarageProgram.provider.publicKey,
|
|
6738
|
+
systemProgram: import_web32.SystemProgram.programId,
|
|
6739
|
+
clock: import_web32.SYSVAR_CLOCK_PUBKEY,
|
|
6740
|
+
randomAccountAsId: position.account.seed,
|
|
6741
|
+
feeTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6742
|
+
quoteToken,
|
|
6743
|
+
new import_web32.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"),
|
|
6744
|
+
false,
|
|
6745
|
+
quoteTokenProgram
|
|
6746
|
+
),
|
|
6747
|
+
fromTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6748
|
+
quoteToken,
|
|
6749
|
+
lavarageProgram.provider.publicKey,
|
|
6750
|
+
false,
|
|
6751
|
+
quoteTokenProgram
|
|
6752
|
+
),
|
|
6753
|
+
tokenProgram: quoteTokenProgram,
|
|
6754
|
+
toTokenAccount: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6755
|
+
quoteToken,
|
|
6756
|
+
pool.account.nodeWallet,
|
|
6757
|
+
true,
|
|
6758
|
+
quoteTokenProgram
|
|
6759
|
+
),
|
|
6760
|
+
mint: quoteToken
|
|
6761
|
+
}).remainingAccounts(
|
|
6762
|
+
partnerFeeRecipient && partnerFeeMarkupAsPkey && userVaultPda ? [
|
|
6763
|
+
{
|
|
6764
|
+
pubkey: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
6765
|
+
quoteToken,
|
|
6766
|
+
userVaultPda,
|
|
6767
|
+
true,
|
|
6768
|
+
// allowOwnerOffCurve for PDA
|
|
6769
|
+
quoteTokenProgram
|
|
6770
|
+
),
|
|
6771
|
+
isSigner: false,
|
|
6772
|
+
isWritable: true
|
|
6773
|
+
}
|
|
6774
|
+
] : []
|
|
6775
|
+
).instruction() : yield lavarageProgram.methods.tradingCloseRepaySol(
|
|
6496
6776
|
new import_anchor2.BN(jupInstruction.quoteResponse.outAmount),
|
|
6497
6777
|
new import_anchor2.BN(9998)
|
|
6498
6778
|
).accountsStrict({
|
|
@@ -6574,6 +6854,8 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6574
6854
|
});
|
|
6575
6855
|
if (splitTransactions) {
|
|
6576
6856
|
const setUpInstructions = [
|
|
6857
|
+
partnerFeeRecipientVaultCreateIx,
|
|
6858
|
+
partnerFeeRecipientTokenAccountCreateIx,
|
|
6577
6859
|
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
6578
6860
|
createAssociatedTokenAccountInstruction2
|
|
6579
6861
|
].filter((i) => !!i);
|
|
@@ -6601,6 +6883,8 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6601
6883
|
return [tx2, tx22];
|
|
6602
6884
|
}
|
|
6603
6885
|
const allInstructions = [
|
|
6886
|
+
partnerFeeRecipientVaultCreateIx,
|
|
6887
|
+
partnerFeeRecipientTokenAccountCreateIx,
|
|
6604
6888
|
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
6605
6889
|
createAssociatedTokenAccountInstruction2,
|
|
6606
6890
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|