@lavarage/sdk 6.2.0 → 6.3.1
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.js +21 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -11
- package/dist/index.mjs.map +1 -1
- package/index.ts +21 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2563,7 +2563,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2563
2563
|
}, new Array());
|
|
2564
2564
|
});
|
|
2565
2565
|
const addressLookupTableAccounts = [];
|
|
2566
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2566
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(["5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi", ...addressLookupTableAddresses]));
|
|
2567
2567
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2568
2568
|
const tradingOpenBorrowInstruction = yield lavarageProgram.methods.tradingOpenBorrow(new BN((marginSOL.toNumber() * leverage).toFixed(0)), marginSOL).accountsStrict({
|
|
2569
2569
|
nodeWallet: offer.account.nodeWallet,
|
|
@@ -2663,7 +2663,7 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2663
2663
|
}, new Array());
|
|
2664
2664
|
});
|
|
2665
2665
|
const addressLookupTableAccounts = [];
|
|
2666
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2666
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts([...addressLookupTableAddresses, getQuoteCurrencySpecificAddressLookupTable(quoteToken.toBase58()), "5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi"]));
|
|
2667
2667
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2668
2668
|
const tradingOpenBorrowInstruction = yield lavarageProgram.methods.tradingOpenBorrow(new BN((marginSOL.toNumber() * leverage).toFixed(0)), marginSOL).accountsStrict({
|
|
2669
2669
|
nodeWallet: offer.account.nodeWallet,
|
|
@@ -2674,12 +2674,12 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2674
2674
|
systemProgram: SystemProgram.programId,
|
|
2675
2675
|
clock: SYSVAR_CLOCK_PUBKEY,
|
|
2676
2676
|
randomAccountAsId: randomSeed.publicKey.toBase58(),
|
|
2677
|
-
feeTokenAccount: getAssociatedTokenAddressSync(quoteToken, new PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF")),
|
|
2677
|
+
feeTokenAccount: getAssociatedTokenAddressSync(quoteToken, new PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"), true, quoteTokenProgram),
|
|
2678
2678
|
toTokenAccount: getAssociatedTokenAddressSync(quoteToken, lavarageProgram.provider.publicKey, true, quoteTokenProgram),
|
|
2679
|
-
tokenProgram,
|
|
2680
|
-
fromTokenAccount: getAssociatedTokenAddressSync(quoteToken, offer.account.nodeWallet, true,
|
|
2679
|
+
tokenProgram: quoteTokenProgram,
|
|
2680
|
+
fromTokenAccount: getAssociatedTokenAddressSync(quoteToken, offer.account.nodeWallet, true, quoteTokenProgram)
|
|
2681
2681
|
}).remainingAccounts(partnerFeeRecipient && partnerFeeMarkupAsPkey ? [{
|
|
2682
|
-
pubkey: partnerFeeRecipient,
|
|
2682
|
+
pubkey: getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient, false, quoteTokenProgram),
|
|
2683
2683
|
isSigner: false,
|
|
2684
2684
|
isWritable: true
|
|
2685
2685
|
}, {
|
|
@@ -2723,7 +2723,7 @@ var createTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
2723
2723
|
delegatedAccount: position.publicKey,
|
|
2724
2724
|
systemProgram: SystemProgram.programId
|
|
2725
2725
|
}).remainingAccounts(partnerFeeRecipient ? [{
|
|
2726
|
-
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient,
|
|
2726
|
+
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient, false),
|
|
2727
2727
|
isSigner: false,
|
|
2728
2728
|
isWritable: true
|
|
2729
2729
|
}] : []).instruction();
|
|
@@ -2755,7 +2755,7 @@ var modifyTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
2755
2755
|
delegatedAccount: position.publicKey,
|
|
2756
2756
|
systemProgram: SystemProgram.programId
|
|
2757
2757
|
}).remainingAccounts(partnerFeeRecipient ? [{
|
|
2758
|
-
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient,
|
|
2758
|
+
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient, false),
|
|
2759
2759
|
isSigner: false,
|
|
2760
2760
|
isWritable: true
|
|
2761
2761
|
}] : []).instruction();
|
|
@@ -2946,7 +2946,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
2946
2946
|
deserializeInstruction(swapInstructionPayload),
|
|
2947
2947
|
deserializeInstruction(cleanupInstruction)
|
|
2948
2948
|
];
|
|
2949
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2949
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(["5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi", ...addressLookupTableAddresses]));
|
|
2950
2950
|
}
|
|
2951
2951
|
const profit = new BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
|
|
2952
2952
|
const allInstructions = [
|
|
@@ -3041,7 +3041,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
3041
3041
|
toTokenAccount: getAssociatedTokenAddressSync(quoteToken, pool.account.nodeWallet, true, quoteTokenProgram),
|
|
3042
3042
|
mint: quoteToken
|
|
3043
3043
|
}).remainingAccounts(partnerFeeRecipient && partnerFeeMarkupAsPkey ? [{
|
|
3044
|
-
pubkey: partnerFeeRecipient,
|
|
3044
|
+
pubkey: getAssociatedTokenAddressSync(quoteToken, partnerFeeRecipient, false, quoteTokenProgram),
|
|
3045
3045
|
isSigner: false,
|
|
3046
3046
|
isWritable: true
|
|
3047
3047
|
}, {
|
|
@@ -3078,7 +3078,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
3078
3078
|
swapInstructionPayload ? deserializeInstruction(swapInstructionPayload) : null,
|
|
3079
3079
|
cleanupInstruction ? deserializeInstruction(cleanupInstruction) : null
|
|
3080
3080
|
].filter((i) => !!i);
|
|
3081
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
3081
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts([...addressLookupTableAddresses, getQuoteCurrencySpecificAddressLookupTable(quoteToken.toBase58()), "5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi"]));
|
|
3082
3082
|
}
|
|
3083
3083
|
const profit = new BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
|
|
3084
3084
|
const allInstructions = [
|
|
@@ -3109,6 +3109,16 @@ var getDelegateAccounts = (lavarageProgram, userPubKey) => __async(void 0, null,
|
|
|
3109
3109
|
}
|
|
3110
3110
|
}));
|
|
3111
3111
|
});
|
|
3112
|
+
var getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency) => {
|
|
3113
|
+
switch (quoteCurrency) {
|
|
3114
|
+
case "J9BcrQfX4p9D1bvLzRNCbMDv8f44a9LFdeqNE4Yk2WMD":
|
|
3115
|
+
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
3116
|
+
case "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":
|
|
3117
|
+
return "CxLE1LRaZg2eYygzFfVRhgmSACsvqzyhySDrMHq3QSab";
|
|
3118
|
+
default:
|
|
3119
|
+
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
3120
|
+
}
|
|
3121
|
+
};
|
|
3112
3122
|
export {
|
|
3113
3123
|
IDL,
|
|
3114
3124
|
lavaragev2_exports as IDLV2,
|