@lavarage/sdk 7.5.14 → 7.5.15
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 +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +98 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3947,13 +3947,23 @@ var IDL3 = {
|
|
|
3947
3947
|
},
|
|
3948
3948
|
{
|
|
3949
3949
|
"name": "toTokenAccount",
|
|
3950
|
-
"isMut":
|
|
3950
|
+
"isMut": true,
|
|
3951
3951
|
"isSigner": false
|
|
3952
3952
|
},
|
|
3953
3953
|
{
|
|
3954
3954
|
"name": "randomAccountAsId",
|
|
3955
3955
|
"isMut": false,
|
|
3956
3956
|
"isSigner": false
|
|
3957
|
+
},
|
|
3958
|
+
{
|
|
3959
|
+
"name": "tokenProgram",
|
|
3960
|
+
"isMut": false,
|
|
3961
|
+
"isSigner": false
|
|
3962
|
+
},
|
|
3963
|
+
{
|
|
3964
|
+
"name": "associatedTokenProgram",
|
|
3965
|
+
"isMut": false,
|
|
3966
|
+
"isSigner": false
|
|
3957
3967
|
}
|
|
3958
3968
|
],
|
|
3959
3969
|
"args": [
|
|
@@ -4020,6 +4030,11 @@ var IDL3 = {
|
|
|
4020
4030
|
"name": "randomAccountAsId",
|
|
4021
4031
|
"isMut": false,
|
|
4022
4032
|
"isSigner": false
|
|
4033
|
+
},
|
|
4034
|
+
{
|
|
4035
|
+
"name": "associatedTokenProgram",
|
|
4036
|
+
"isMut": false,
|
|
4037
|
+
"isSigner": false
|
|
4023
4038
|
}
|
|
4024
4039
|
],
|
|
4025
4040
|
"args": []
|
|
@@ -4713,6 +4728,57 @@ var IDL3 = {
|
|
|
4713
4728
|
"type": "string"
|
|
4714
4729
|
}
|
|
4715
4730
|
]
|
|
4731
|
+
},
|
|
4732
|
+
{
|
|
4733
|
+
"name": "rescueStuckTokens",
|
|
4734
|
+
"accounts": [
|
|
4735
|
+
{
|
|
4736
|
+
"name": "position",
|
|
4737
|
+
"isMut": true,
|
|
4738
|
+
"isSigner": false
|
|
4739
|
+
},
|
|
4740
|
+
{
|
|
4741
|
+
"name": "pool",
|
|
4742
|
+
"isMut": true,
|
|
4743
|
+
"isSigner": false
|
|
4744
|
+
},
|
|
4745
|
+
{
|
|
4746
|
+
"name": "nodeWallet",
|
|
4747
|
+
"isMut": true,
|
|
4748
|
+
"isSigner": false
|
|
4749
|
+
},
|
|
4750
|
+
{
|
|
4751
|
+
"name": "positionTokenAccount",
|
|
4752
|
+
"isMut": true,
|
|
4753
|
+
"isSigner": false
|
|
4754
|
+
},
|
|
4755
|
+
{
|
|
4756
|
+
"name": "traderTokenAccount",
|
|
4757
|
+
"isMut": true,
|
|
4758
|
+
"isSigner": false
|
|
4759
|
+
},
|
|
4760
|
+
{
|
|
4761
|
+
"name": "positionMint",
|
|
4762
|
+
"isMut": true,
|
|
4763
|
+
"isSigner": false
|
|
4764
|
+
},
|
|
4765
|
+
{
|
|
4766
|
+
"name": "admin",
|
|
4767
|
+
"isMut": true,
|
|
4768
|
+
"isSigner": true
|
|
4769
|
+
},
|
|
4770
|
+
{
|
|
4771
|
+
"name": "tokenProgram",
|
|
4772
|
+
"isMut": false,
|
|
4773
|
+
"isSigner": false
|
|
4774
|
+
}
|
|
4775
|
+
],
|
|
4776
|
+
"args": [
|
|
4777
|
+
{
|
|
4778
|
+
"name": "amount",
|
|
4779
|
+
"type": "u64"
|
|
4780
|
+
}
|
|
4781
|
+
]
|
|
4716
4782
|
}
|
|
4717
4783
|
],
|
|
4718
4784
|
"accounts": [
|
|
@@ -5580,14 +5646,15 @@ var borrowV2 = (lavarageProgram, offer, marginSOL, leverage, randomSeed, quoteTo
|
|
|
5580
5646
|
toTokenAccount: toTokenAccount.account.address,
|
|
5581
5647
|
systemProgram: SystemProgram2.programId,
|
|
5582
5648
|
positionAccount,
|
|
5583
|
-
randomAccountAsId: randomSeed.publicKey.toBase58()
|
|
5649
|
+
randomAccountAsId: randomSeed.publicKey.toBase58(),
|
|
5650
|
+
tokenProgram,
|
|
5651
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID
|
|
5584
5652
|
}).instruction();
|
|
5585
5653
|
const computeFeeIx = ComputeBudgetProgram2.setComputeUnitPrice({
|
|
5586
5654
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5587
5655
|
});
|
|
5588
5656
|
const allInstructions = [
|
|
5589
5657
|
fromTokenAccount.instruction,
|
|
5590
|
-
toTokenAccount.instruction,
|
|
5591
5658
|
partnerFeeRecipientVaultCreateIx,
|
|
5592
5659
|
partnerFeeRecipientTokenAccountCreateIx,
|
|
5593
5660
|
tradingOpenBorrowInstruction,
|
|
@@ -5921,6 +5988,12 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5921
5988
|
let partnerFeeRecipientVaultCreateIx;
|
|
5922
5989
|
let partnerFeeRecipientTokenAccountCreateIx;
|
|
5923
5990
|
let userVaultPda;
|
|
5991
|
+
const partnerDirectAta = partnerFeeRecipient ? getAssociatedTokenAddressSync2(
|
|
5992
|
+
quoteToken,
|
|
5993
|
+
partnerFeeRecipient,
|
|
5994
|
+
true,
|
|
5995
|
+
quoteTokenProgram
|
|
5996
|
+
) : void 0;
|
|
5924
5997
|
if (partnerFeeRecipient && partnerFeeMarkupAsPkey && referralVaultProgram) {
|
|
5925
5998
|
[userVaultPda] = PublicKey2.findProgramAddressSync(
|
|
5926
5999
|
[Buffer.from("user_vault"), new PublicKey2(partnerFeeRecipient).toBuffer()],
|
|
@@ -5955,13 +6028,21 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5955
6028
|
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
5956
6029
|
);
|
|
5957
6030
|
}
|
|
6031
|
+
} else if (partnerFeeRecipient && partnerDirectAta) {
|
|
6032
|
+
const [partnerDirectAtaInfo] = yield lavarageProgram.provider.connection.getMultipleAccountsInfo([
|
|
6033
|
+
partnerDirectAta
|
|
6034
|
+
]);
|
|
6035
|
+
if (!partnerDirectAtaInfo) {
|
|
6036
|
+
partnerFeeRecipientTokenAccountCreateIx = createAssociatedTokenAccountIdempotentInstruction2(
|
|
6037
|
+
lavarageProgram.provider.publicKey,
|
|
6038
|
+
partnerDirectAta,
|
|
6039
|
+
partnerFeeRecipient,
|
|
6040
|
+
quoteToken,
|
|
6041
|
+
quoteTokenProgram,
|
|
6042
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6043
|
+
);
|
|
6044
|
+
}
|
|
5958
6045
|
}
|
|
5959
|
-
const partnerDirectAta = partnerFeeRecipient ? getAssociatedTokenAddressSync2(
|
|
5960
|
-
quoteToken,
|
|
5961
|
-
partnerFeeRecipient,
|
|
5962
|
-
true,
|
|
5963
|
-
quoteTokenProgram
|
|
5964
|
-
) : void 0;
|
|
5965
6046
|
const tradingOpenBorrowInstruction = useReferral ? yield lavarageProgram.methods.tradingOpenBorrowWithReferral(
|
|
5966
6047
|
new BN2((marginSOL.toNumber() * leverage).toFixed(0)),
|
|
5967
6048
|
marginSOL,
|
|
@@ -6061,7 +6142,9 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
6061
6142
|
toTokenAccount: toTokenAccount.account.address,
|
|
6062
6143
|
systemProgram: SystemProgram2.programId,
|
|
6063
6144
|
positionAccount,
|
|
6064
|
-
randomAccountAsId: randomSeed.publicKey.toBase58()
|
|
6145
|
+
randomAccountAsId: randomSeed.publicKey.toBase58(),
|
|
6146
|
+
tokenProgram,
|
|
6147
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6065
6148
|
}).instruction();
|
|
6066
6149
|
const jupiterIxs = [
|
|
6067
6150
|
...setupInstructions.map(deserializeInstruction),
|
|
@@ -6073,7 +6156,6 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
6073
6156
|
if (splitTransactions) {
|
|
6074
6157
|
const setUpInstructions = [
|
|
6075
6158
|
fromTokenAccount.instruction,
|
|
6076
|
-
toTokenAccount.instruction,
|
|
6077
6159
|
partnerFeeRecipientVaultCreateIx,
|
|
6078
6160
|
partnerFeeRecipientTokenAccountCreateIx,
|
|
6079
6161
|
...setupInstructions.map(deserializeInstruction)
|
|
@@ -6101,7 +6183,6 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
6101
6183
|
}
|
|
6102
6184
|
const allInstructions = [
|
|
6103
6185
|
fromTokenAccount.instruction,
|
|
6104
|
-
toTokenAccount.instruction,
|
|
6105
6186
|
partnerFeeRecipientVaultCreateIx,
|
|
6106
6187
|
partnerFeeRecipientTokenAccountCreateIx,
|
|
6107
6188
|
tradingOpenBorrowInstruction,
|
|
@@ -6680,7 +6761,8 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6680
6761
|
systemProgram: SystemProgram2.programId,
|
|
6681
6762
|
trader: lavarageProgram.provider.publicKey,
|
|
6682
6763
|
tokenProgram,
|
|
6683
|
-
randomAccountAsId: position.account.seed
|
|
6764
|
+
randomAccountAsId: position.account.seed,
|
|
6765
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6684
6766
|
}).instruction();
|
|
6685
6767
|
let repaySolIx = null;
|
|
6686
6768
|
let jupiterIxs = [];
|
|
@@ -6914,8 +6996,8 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6914
6996
|
const setUpInstructions = [
|
|
6915
6997
|
partnerFeeRecipientVaultCreateIx,
|
|
6916
6998
|
partnerFeeRecipientTokenAccountCreateIx,
|
|
6917
|
-
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null
|
|
6918
|
-
|
|
6999
|
+
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null
|
|
7000
|
+
//createAssociatedTokenAccountInstruction,
|
|
6919
7001
|
].filter((i) => !!i);
|
|
6920
7002
|
const allInstructions2 = [
|
|
6921
7003
|
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? deserializeInstruction(
|
|
@@ -6944,7 +7026,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
6944
7026
|
partnerFeeRecipientVaultCreateIx,
|
|
6945
7027
|
partnerFeeRecipientTokenAccountCreateIx,
|
|
6946
7028
|
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
6947
|
-
|
|
7029
|
+
//createAssociatedTokenAccountInstruction,
|
|
6948
7030
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
6949
7031
|
jupInstruction.instructions.tokenLedgerInstruction
|
|
6950
7032
|
) : null,
|