@lavarage/sdk 7.5.4 → 7.5.6
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 +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +44 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -17
- package/dist/index.mjs.map +1 -1
- package/idl/referralVault.ts +10 -0
- package/index.ts +46 -17
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Program, ProgramAccount, BN } from '@coral-xyz/anchor';
|
|
2
|
-
import { PublicKey, VersionedTransaction, Keypair } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, VersionedTransaction, Keypair, AccountInfo } from '@solana/web3.js';
|
|
3
3
|
import { Provider, BigNumberish, ContractTransaction } from 'ethers';
|
|
4
4
|
|
|
5
5
|
type Lavarage$1 = {
|
|
@@ -3306,6 +3306,11 @@ type UserVault = {
|
|
|
3306
3306
|
{
|
|
3307
3307
|
"name": "user";
|
|
3308
3308
|
"isMut": true;
|
|
3309
|
+
"isSigner": false;
|
|
3310
|
+
},
|
|
3311
|
+
{
|
|
3312
|
+
"name": "funder";
|
|
3313
|
+
"isMut": true;
|
|
3309
3314
|
"isSigner": true;
|
|
3310
3315
|
},
|
|
3311
3316
|
{
|
|
@@ -3766,6 +3771,12 @@ declare namespace lending {
|
|
|
3766
3771
|
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessList as getWithdrawalAccessList, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3767
3772
|
}
|
|
3768
3773
|
|
|
3774
|
+
type OptionalRPCResults = {
|
|
3775
|
+
addressLookupTableAccounts?: AccountInfo<Buffer>[];
|
|
3776
|
+
latestBlockhash?: string;
|
|
3777
|
+
tokenAccountConfirmCreatedAddresses?: PublicKey[];
|
|
3778
|
+
quoteMintAccountInfo?: AccountInfo<Buffer>;
|
|
3779
|
+
};
|
|
3769
3780
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
3770
3781
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
3771
3782
|
|
|
@@ -3853,7 +3864,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3853
3864
|
swapInstruction: Record<string, unknown>;
|
|
3854
3865
|
addressLookupTableAddresses: string[];
|
|
3855
3866
|
};
|
|
3856
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3867
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number, optionalRPCResults?: OptionalRPCResults) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3857
3868
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3858
3869
|
nodeWallet: PublicKey;
|
|
3859
3870
|
interestRate: number;
|
|
@@ -3864,7 +3875,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3864
3875
|
swapInstruction: Record<string, unknown>;
|
|
3865
3876
|
addressLookupTableAddresses: string[];
|
|
3866
3877
|
};
|
|
3867
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3878
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number, optionalRPCResults?: OptionalRPCResults) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3868
3879
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3869
3880
|
pool: PublicKey;
|
|
3870
3881
|
seed: PublicKey;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Program, ProgramAccount, BN } from '@coral-xyz/anchor';
|
|
2
|
-
import { PublicKey, VersionedTransaction, Keypair } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, VersionedTransaction, Keypair, AccountInfo } from '@solana/web3.js';
|
|
3
3
|
import { Provider, BigNumberish, ContractTransaction } from 'ethers';
|
|
4
4
|
|
|
5
5
|
type Lavarage$1 = {
|
|
@@ -3306,6 +3306,11 @@ type UserVault = {
|
|
|
3306
3306
|
{
|
|
3307
3307
|
"name": "user";
|
|
3308
3308
|
"isMut": true;
|
|
3309
|
+
"isSigner": false;
|
|
3310
|
+
},
|
|
3311
|
+
{
|
|
3312
|
+
"name": "funder";
|
|
3313
|
+
"isMut": true;
|
|
3309
3314
|
"isSigner": true;
|
|
3310
3315
|
},
|
|
3311
3316
|
{
|
|
@@ -3766,6 +3771,12 @@ declare namespace lending {
|
|
|
3766
3771
|
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessList as getWithdrawalAccessList, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3767
3772
|
}
|
|
3768
3773
|
|
|
3774
|
+
type OptionalRPCResults = {
|
|
3775
|
+
addressLookupTableAccounts?: AccountInfo<Buffer>[];
|
|
3776
|
+
latestBlockhash?: string;
|
|
3777
|
+
tokenAccountConfirmCreatedAddresses?: PublicKey[];
|
|
3778
|
+
quoteMintAccountInfo?: AccountInfo<Buffer>;
|
|
3779
|
+
};
|
|
3769
3780
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
3770
3781
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
3771
3782
|
|
|
@@ -3853,7 +3864,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3853
3864
|
swapInstruction: Record<string, unknown>;
|
|
3854
3865
|
addressLookupTableAddresses: string[];
|
|
3855
3866
|
};
|
|
3856
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3867
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number, optionalRPCResults?: OptionalRPCResults) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3857
3868
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3858
3869
|
nodeWallet: PublicKey;
|
|
3859
3870
|
interestRate: number;
|
|
@@ -3864,7 +3875,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3864
3875
|
swapInstruction: Record<string, unknown>;
|
|
3865
3876
|
addressLookupTableAddresses: string[];
|
|
3866
3877
|
};
|
|
3867
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3878
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean, discountBps?: number, referralBps?: number, optionalRPCResults?: OptionalRPCResults) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3868
3879
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3869
3880
|
pool: PublicKey;
|
|
3870
3881
|
seed: PublicKey;
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,11 @@ var IDL = {
|
|
|
130
130
|
{
|
|
131
131
|
"name": "user",
|
|
132
132
|
"isMut": true,
|
|
133
|
+
"isSigner": false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "funder",
|
|
137
|
+
"isMut": true,
|
|
133
138
|
"isSigner": true
|
|
134
139
|
},
|
|
135
140
|
{
|
|
@@ -5036,7 +5041,7 @@ function getPositionAccountPDA(lavarageProgram, offer, seed) {
|
|
|
5036
5041
|
lavarageProgram.programId
|
|
5037
5042
|
);
|
|
5038
5043
|
}
|
|
5039
|
-
function getTokenAccountOrCreateIfNotExists(lavarageProgram, ownerPublicKey, tokenAddress, tokenProgram) {
|
|
5044
|
+
function getTokenAccountOrCreateIfNotExists(lavarageProgram, ownerPublicKey, tokenAddress, tokenProgram, confirmCreatedAddresses) {
|
|
5040
5045
|
return __async(this, null, function* () {
|
|
5041
5046
|
const associatedTokenAddress = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
5042
5047
|
tokenAddress,
|
|
@@ -5045,6 +5050,14 @@ function getTokenAccountOrCreateIfNotExists(lavarageProgram, ownerPublicKey, tok
|
|
|
5045
5050
|
tokenProgram,
|
|
5046
5051
|
import_spl_token2.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
5047
5052
|
);
|
|
5053
|
+
if (confirmCreatedAddresses == null ? void 0 : confirmCreatedAddresses.includes(associatedTokenAddress)) {
|
|
5054
|
+
return {
|
|
5055
|
+
account: {
|
|
5056
|
+
address: associatedTokenAddress
|
|
5057
|
+
},
|
|
5058
|
+
instruction: void 0
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5048
5061
|
const instruction = (0, import_spl_token2.createAssociatedTokenAccountIdempotentInstruction)(
|
|
5049
5062
|
lavarageProgram.provider.publicKey,
|
|
5050
5063
|
associatedTokenAddress,
|
|
@@ -5171,7 +5184,8 @@ var borrowV1 = (lavarageProgram, offer, marginSOL, leverage, randomSeed, tokenPr
|
|
|
5171
5184
|
if (!vaultAccountInfo) {
|
|
5172
5185
|
partnerFeeRecipientCreateIx = yield referralVaultProgram.methods.initializeVault().accountsStrict({
|
|
5173
5186
|
userVault: userVaultPda,
|
|
5174
|
-
user:
|
|
5187
|
+
user: partnerFeeRecipient,
|
|
5188
|
+
funder: lavarageProgram.provider.publicKey,
|
|
5175
5189
|
systemProgram: import_web32.SystemProgram.programId
|
|
5176
5190
|
}).instruction();
|
|
5177
5191
|
}
|
|
@@ -5306,7 +5320,8 @@ var borrowV2 = (lavarageProgram, offer, marginSOL, leverage, randomSeed, quoteTo
|
|
|
5306
5320
|
if (!vaultAccountInfo) {
|
|
5307
5321
|
partnerFeeRecipientVaultCreateIx = yield referralVaultProgram.methods.initializeVault().accountsStrict({
|
|
5308
5322
|
userVault: userVaultPda,
|
|
5309
|
-
user:
|
|
5323
|
+
user: partnerFeeRecipient,
|
|
5324
|
+
funder: lavarageProgram.provider.publicKey,
|
|
5310
5325
|
systemProgram: import_web32.SystemProgram.programId
|
|
5311
5326
|
}).instruction();
|
|
5312
5327
|
}
|
|
@@ -5448,7 +5463,8 @@ var borrowV2 = (lavarageProgram, offer, marginSOL, leverage, randomSeed, quoteTo
|
|
|
5448
5463
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5449
5464
|
return tx;
|
|
5450
5465
|
});
|
|
5451
|
-
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions, discountBps, referralBps) => __async(void 0, null, function* () {
|
|
5466
|
+
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions, discountBps, referralBps, optionalRPCResults) => __async(void 0, null, function* () {
|
|
5467
|
+
var _a;
|
|
5452
5468
|
let partnerFeeMarkupAsPkey;
|
|
5453
5469
|
const referralVaultProgram = new import_anchor2.Program(IDL, REFFERAL_VAULT_PROGRAM_ID, lavarageProgram.provider);
|
|
5454
5470
|
if (partnerFeeMarkup) {
|
|
@@ -5467,19 +5483,22 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5467
5483
|
lavarageProgram,
|
|
5468
5484
|
lavarageProgram.provider.publicKey,
|
|
5469
5485
|
offer.account.collateralType,
|
|
5470
|
-
tokenProgram
|
|
5486
|
+
tokenProgram,
|
|
5487
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5471
5488
|
);
|
|
5472
5489
|
const toTokenAccount = yield getTokenAccountOrCreateIfNotExists(
|
|
5473
5490
|
lavarageProgram,
|
|
5474
5491
|
positionAccount,
|
|
5475
5492
|
offer.account.collateralType,
|
|
5476
|
-
tokenProgram
|
|
5493
|
+
tokenProgram,
|
|
5494
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5477
5495
|
);
|
|
5478
5496
|
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
5479
5497
|
lavarageProgram,
|
|
5480
5498
|
platformFeeRecipient,
|
|
5481
5499
|
offer.account.collateralType,
|
|
5482
|
-
tokenProgram
|
|
5500
|
+
tokenProgram,
|
|
5501
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5483
5502
|
) : void 0;
|
|
5484
5503
|
const tokenAccountCreationTx = new import_web32.Transaction();
|
|
5485
5504
|
if (fromTokenAccount.instruction) {
|
|
@@ -5509,7 +5528,8 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5509
5528
|
});
|
|
5510
5529
|
};
|
|
5511
5530
|
const getAddressLookupTableAccounts = (keys) => __async(void 0, null, function* () {
|
|
5512
|
-
|
|
5531
|
+
var _a2;
|
|
5532
|
+
const addressLookupTableAccountInfos = (_a2 = optionalRPCResults == null ? void 0 : optionalRPCResults.addressLookupTableAccounts) != null ? _a2 : yield lavarageProgram.provider.connection.getMultipleAccountsInfo(
|
|
5513
5533
|
keys.map((key) => new import_web32.PublicKey(key))
|
|
5514
5534
|
);
|
|
5515
5535
|
return addressLookupTableAccountInfos.reduce((acc, accountInfo, index) => {
|
|
@@ -5533,7 +5553,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5533
5553
|
...addressLookupTableAddresses
|
|
5534
5554
|
])
|
|
5535
5555
|
);
|
|
5536
|
-
const
|
|
5556
|
+
const blockhash = (_a = optionalRPCResults == null ? void 0 : optionalRPCResults.latestBlockhash) != null ? _a : (yield lavarageProgram.provider.connection.getLatestBlockhash("finalized")).blockhash;
|
|
5537
5557
|
const useReferral = discountBps !== void 0 && referralBps !== void 0;
|
|
5538
5558
|
let partnerFeeRecipientCreateIx;
|
|
5539
5559
|
let userVaultPda;
|
|
@@ -5546,7 +5566,8 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5546
5566
|
if (!vaultAccountInfo) {
|
|
5547
5567
|
partnerFeeRecipientCreateIx = yield referralVaultProgram.methods.initializeVault().accountsStrict({
|
|
5548
5568
|
userVault: userVaultPda,
|
|
5549
|
-
user:
|
|
5569
|
+
user: partnerFeeRecipient,
|
|
5570
|
+
funder: lavarageProgram.provider.publicKey,
|
|
5550
5571
|
systemProgram: import_web32.SystemProgram.programId
|
|
5551
5572
|
}).instruction();
|
|
5552
5573
|
}
|
|
@@ -5662,7 +5683,8 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5662
5683
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5663
5684
|
return tx;
|
|
5664
5685
|
});
|
|
5665
|
-
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions, discountBps, referralBps) => __async(void 0, null, function* () {
|
|
5686
|
+
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions, discountBps, referralBps, optionalRPCResults) => __async(void 0, null, function* () {
|
|
5687
|
+
var _a;
|
|
5666
5688
|
let partnerFeeMarkupAsPkey;
|
|
5667
5689
|
const referralVaultProgram = new import_anchor2.Program(IDL, REFFERAL_VAULT_PROGRAM_ID, lavarageProgram.provider);
|
|
5668
5690
|
if (partnerFeeMarkup) {
|
|
@@ -5677,25 +5699,28 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5677
5699
|
offer,
|
|
5678
5700
|
randomSeed.publicKey
|
|
5679
5701
|
);
|
|
5680
|
-
const quoteMintAccount = yield lavarageProgram.provider.connection.getAccountInfo(quoteToken);
|
|
5702
|
+
const quoteMintAccount = (_a = optionalRPCResults == null ? void 0 : optionalRPCResults.quoteMintAccountInfo) != null ? _a : yield lavarageProgram.provider.connection.getAccountInfo(quoteToken);
|
|
5681
5703
|
const quoteTokenProgram = quoteMintAccount == null ? void 0 : quoteMintAccount.owner;
|
|
5682
5704
|
const fromTokenAccount = yield getTokenAccountOrCreateIfNotExists(
|
|
5683
5705
|
lavarageProgram,
|
|
5684
5706
|
lavarageProgram.provider.publicKey,
|
|
5685
5707
|
offer.account.collateralType,
|
|
5686
|
-
tokenProgram
|
|
5708
|
+
tokenProgram,
|
|
5709
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5687
5710
|
);
|
|
5688
5711
|
const toTokenAccount = yield getTokenAccountOrCreateIfNotExists(
|
|
5689
5712
|
lavarageProgram,
|
|
5690
5713
|
positionAccount,
|
|
5691
5714
|
offer.account.collateralType,
|
|
5692
|
-
tokenProgram
|
|
5715
|
+
tokenProgram,
|
|
5716
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5693
5717
|
);
|
|
5694
5718
|
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
5695
5719
|
lavarageProgram,
|
|
5696
5720
|
platformFeeRecipient,
|
|
5697
5721
|
offer.account.collateralType,
|
|
5698
|
-
tokenProgram
|
|
5722
|
+
tokenProgram,
|
|
5723
|
+
optionalRPCResults == null ? void 0 : optionalRPCResults.tokenAccountConfirmCreatedAddresses
|
|
5699
5724
|
) : void 0;
|
|
5700
5725
|
const tokenAccountCreationTx = new import_web32.Transaction();
|
|
5701
5726
|
if (fromTokenAccount.instruction) {
|
|
@@ -5725,7 +5750,8 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5725
5750
|
});
|
|
5726
5751
|
};
|
|
5727
5752
|
const getAddressLookupTableAccounts = (keys) => __async(void 0, null, function* () {
|
|
5728
|
-
|
|
5753
|
+
var _a2;
|
|
5754
|
+
const addressLookupTableAccountInfos = (_a2 = optionalRPCResults == null ? void 0 : optionalRPCResults.addressLookupTableAccounts) != null ? _a2 : yield lavarageProgram.provider.connection.getMultipleAccountsInfo(
|
|
5729
5755
|
keys.map((key) => new import_web32.PublicKey(key))
|
|
5730
5756
|
);
|
|
5731
5757
|
return addressLookupTableAccountInfos.reduce((acc, accountInfo, index) => {
|
|
@@ -5774,7 +5800,8 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5774
5800
|
if (!vaultAccountInfo) {
|
|
5775
5801
|
partnerFeeRecipientVaultCreateIx = yield referralVaultProgram.methods.initializeVault().accountsStrict({
|
|
5776
5802
|
userVault: userVaultPda,
|
|
5777
|
-
user:
|
|
5803
|
+
user: partnerFeeRecipient,
|
|
5804
|
+
funder: lavarageProgram.provider.publicKey,
|
|
5778
5805
|
systemProgram: import_web32.SystemProgram.programId
|
|
5779
5806
|
}).instruction();
|
|
5780
5807
|
}
|