@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.js
CHANGED
|
@@ -2608,7 +2608,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2608
2608
|
}, new Array());
|
|
2609
2609
|
});
|
|
2610
2610
|
const addressLookupTableAccounts = [];
|
|
2611
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2611
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(["5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi", ...addressLookupTableAddresses]));
|
|
2612
2612
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2613
2613
|
const tradingOpenBorrowInstruction = yield lavarageProgram.methods.tradingOpenBorrow(new import_anchor.BN((marginSOL.toNumber() * leverage).toFixed(0)), marginSOL).accountsStrict({
|
|
2614
2614
|
nodeWallet: offer.account.nodeWallet,
|
|
@@ -2708,7 +2708,7 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2708
2708
|
}, new Array());
|
|
2709
2709
|
});
|
|
2710
2710
|
const addressLookupTableAccounts = [];
|
|
2711
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2711
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts([...addressLookupTableAddresses, getQuoteCurrencySpecificAddressLookupTable(quoteToken.toBase58()), "5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi"]));
|
|
2712
2712
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2713
2713
|
const tradingOpenBorrowInstruction = yield lavarageProgram.methods.tradingOpenBorrow(new import_anchor.BN((marginSOL.toNumber() * leverage).toFixed(0)), marginSOL).accountsStrict({
|
|
2714
2714
|
nodeWallet: offer.account.nodeWallet,
|
|
@@ -2719,12 +2719,12 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
2719
2719
|
systemProgram: import_web3.SystemProgram.programId,
|
|
2720
2720
|
clock: import_web3.SYSVAR_CLOCK_PUBKEY,
|
|
2721
2721
|
randomAccountAsId: randomSeed.publicKey.toBase58(),
|
|
2722
|
-
feeTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, new import_web3.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF")),
|
|
2722
|
+
feeTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, new import_web3.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"), true, quoteTokenProgram),
|
|
2723
2723
|
toTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, lavarageProgram.provider.publicKey, true, quoteTokenProgram),
|
|
2724
|
-
tokenProgram,
|
|
2725
|
-
fromTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, offer.account.nodeWallet, true,
|
|
2724
|
+
tokenProgram: quoteTokenProgram,
|
|
2725
|
+
fromTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, offer.account.nodeWallet, true, quoteTokenProgram)
|
|
2726
2726
|
}).remainingAccounts(partnerFeeRecipient && partnerFeeMarkupAsPkey ? [{
|
|
2727
|
-
pubkey: partnerFeeRecipient,
|
|
2727
|
+
pubkey: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient, false, quoteTokenProgram),
|
|
2728
2728
|
isSigner: false,
|
|
2729
2729
|
isWritable: true
|
|
2730
2730
|
}, {
|
|
@@ -2768,7 +2768,7 @@ var createTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
2768
2768
|
delegatedAccount: position.publicKey,
|
|
2769
2769
|
systemProgram: import_web3.SystemProgram.programId
|
|
2770
2770
|
}).remainingAccounts(partnerFeeRecipient ? [{
|
|
2771
|
-
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient,
|
|
2771
|
+
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient, false),
|
|
2772
2772
|
isSigner: false,
|
|
2773
2773
|
isWritable: true
|
|
2774
2774
|
}] : []).instruction();
|
|
@@ -2800,7 +2800,7 @@ var modifyTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
2800
2800
|
delegatedAccount: position.publicKey,
|
|
2801
2801
|
systemProgram: import_web3.SystemProgram.programId
|
|
2802
2802
|
}).remainingAccounts(partnerFeeRecipient ? [{
|
|
2803
|
-
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient,
|
|
2803
|
+
pubkey: quoteToken.toBase58() == "So11111111111111111111111111111111111111112" ? partnerFeeRecipient : (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient, false),
|
|
2804
2804
|
isSigner: false,
|
|
2805
2805
|
isWritable: true
|
|
2806
2806
|
}] : []).instruction();
|
|
@@ -2991,7 +2991,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
2991
2991
|
deserializeInstruction(swapInstructionPayload),
|
|
2992
2992
|
deserializeInstruction(cleanupInstruction)
|
|
2993
2993
|
];
|
|
2994
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
2994
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(["5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi", ...addressLookupTableAddresses]));
|
|
2995
2995
|
}
|
|
2996
2996
|
const profit = new import_anchor.BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
|
|
2997
2997
|
const allInstructions = [
|
|
@@ -3086,7 +3086,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
3086
3086
|
toTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, pool.account.nodeWallet, true, quoteTokenProgram),
|
|
3087
3087
|
mint: quoteToken
|
|
3088
3088
|
}).remainingAccounts(partnerFeeRecipient && partnerFeeMarkupAsPkey ? [{
|
|
3089
|
-
pubkey: partnerFeeRecipient,
|
|
3089
|
+
pubkey: (0, import_spl_token.getAssociatedTokenAddressSync)(quoteToken, partnerFeeRecipient, false, quoteTokenProgram),
|
|
3090
3090
|
isSigner: false,
|
|
3091
3091
|
isWritable: true
|
|
3092
3092
|
}, {
|
|
@@ -3123,7 +3123,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
3123
3123
|
swapInstructionPayload ? deserializeInstruction(swapInstructionPayload) : null,
|
|
3124
3124
|
cleanupInstruction ? deserializeInstruction(cleanupInstruction) : null
|
|
3125
3125
|
].filter((i) => !!i);
|
|
3126
|
-
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
|
|
3126
|
+
addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts([...addressLookupTableAddresses, getQuoteCurrencySpecificAddressLookupTable(quoteToken.toBase58()), "5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi"]));
|
|
3127
3127
|
}
|
|
3128
3128
|
const profit = new import_anchor.BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
|
|
3129
3129
|
const allInstructions = [
|
|
@@ -3154,6 +3154,16 @@ var getDelegateAccounts = (lavarageProgram, userPubKey) => __async(void 0, null,
|
|
|
3154
3154
|
}
|
|
3155
3155
|
}));
|
|
3156
3156
|
});
|
|
3157
|
+
var getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency) => {
|
|
3158
|
+
switch (quoteCurrency) {
|
|
3159
|
+
case "J9BcrQfX4p9D1bvLzRNCbMDv8f44a9LFdeqNE4Yk2WMD":
|
|
3160
|
+
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
3161
|
+
case "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":
|
|
3162
|
+
return "CxLE1LRaZg2eYygzFfVRhgmSACsvqzyhySDrMHq3QSab";
|
|
3163
|
+
default:
|
|
3164
|
+
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
3165
|
+
}
|
|
3166
|
+
};
|
|
3157
3167
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3158
3168
|
0 && (module.exports = {
|
|
3159
3169
|
IDL,
|