@lavarage/sdk 6.4.4 → 6.4.5
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 +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -2
- package/dist/index.mjs.map +1 -1
- package/idl/lavaragev2.ts +50 -0
- package/index.ts +24 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2190,6 +2190,31 @@ type Lavarage = {
|
|
|
2190
2190
|
"name": "systemProgram";
|
|
2191
2191
|
"isMut": false;
|
|
2192
2192
|
"isSigner": false;
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
"name": "tokenProgram";
|
|
2196
|
+
"isMut": false;
|
|
2197
|
+
"isSigner": false;
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
"name": "mint";
|
|
2201
|
+
"isMut": false;
|
|
2202
|
+
"isSigner": false;
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
"name": "positionOneTokenAccount";
|
|
2206
|
+
"isMut": true;
|
|
2207
|
+
"isSigner": false;
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
"name": "positionTwoTokenAccount";
|
|
2211
|
+
"isMut": true;
|
|
2212
|
+
"isSigner": false;
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
"name": "mergedPositionTokenAccount";
|
|
2216
|
+
"isMut": true;
|
|
2217
|
+
"isSigner": false;
|
|
2193
2218
|
}
|
|
2194
2219
|
];
|
|
2195
2220
|
"args": [
|
package/dist/index.d.ts
CHANGED
|
@@ -2190,6 +2190,31 @@ type Lavarage = {
|
|
|
2190
2190
|
"name": "systemProgram";
|
|
2191
2191
|
"isMut": false;
|
|
2192
2192
|
"isSigner": false;
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
"name": "tokenProgram";
|
|
2196
|
+
"isMut": false;
|
|
2197
|
+
"isSigner": false;
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
"name": "mint";
|
|
2201
|
+
"isMut": false;
|
|
2202
|
+
"isSigner": false;
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
"name": "positionOneTokenAccount";
|
|
2206
|
+
"isMut": true;
|
|
2207
|
+
"isSigner": false;
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
"name": "positionTwoTokenAccount";
|
|
2211
|
+
"isMut": true;
|
|
2212
|
+
"isSigner": false;
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
"name": "mergedPositionTokenAccount";
|
|
2216
|
+
"isMut": true;
|
|
2217
|
+
"isSigner": false;
|
|
2193
2218
|
}
|
|
2194
2219
|
];
|
|
2195
2220
|
"args": [
|
package/dist/index.js
CHANGED
|
@@ -2289,6 +2289,31 @@ var IDL2 = {
|
|
|
2289
2289
|
"name": "systemProgram",
|
|
2290
2290
|
"isMut": false,
|
|
2291
2291
|
"isSigner": false
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
"name": "tokenProgram",
|
|
2295
|
+
"isMut": false,
|
|
2296
|
+
"isSigner": false
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
"name": "mint",
|
|
2300
|
+
"isMut": false,
|
|
2301
|
+
"isSigner": false
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
"name": "positionOneTokenAccount",
|
|
2305
|
+
"isMut": true,
|
|
2306
|
+
"isSigner": false
|
|
2307
|
+
},
|
|
2308
|
+
{
|
|
2309
|
+
"name": "positionTwoTokenAccount",
|
|
2310
|
+
"isMut": true,
|
|
2311
|
+
"isSigner": false
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
"name": "mergedPositionTokenAccount",
|
|
2315
|
+
"isMut": true,
|
|
2316
|
+
"isSigner": false
|
|
2292
2317
|
}
|
|
2293
2318
|
],
|
|
2294
2319
|
"args": [
|
|
@@ -3475,15 +3500,35 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
3475
3500
|
const positionAccountPDA2 = position2.publicKey;
|
|
3476
3501
|
const newPositionSeed = import_web3.Keypair.generate().publicKey;
|
|
3477
3502
|
const newPositionAccountPDA = getPositionAccountPDA(lavarageProgram, offer, newPositionSeed);
|
|
3503
|
+
const mintAccount = yield lavarageProgram.provider.connection.getAccountInfo(offer.account.collateralType);
|
|
3504
|
+
const tokenProgram = mintAccount == null ? void 0 : mintAccount.owner;
|
|
3505
|
+
const newPositionTokenAccount = (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, newPositionAccountPDA, true, tokenProgram);
|
|
3506
|
+
const createNewPositionTokenAccountIx = (0, import_spl_token.createAssociatedTokenAccountInstruction)(
|
|
3507
|
+
lavarageProgram.provider.publicKey,
|
|
3508
|
+
newPositionTokenAccount,
|
|
3509
|
+
newPositionAccountPDA,
|
|
3510
|
+
offer.account.collateralType,
|
|
3511
|
+
tokenProgram
|
|
3512
|
+
);
|
|
3478
3513
|
const ix = yield lavarageProgram.methods.tradingManagementMergePositions(newPositionSeed).accountsStrict({
|
|
3479
3514
|
mergedPosition: newPositionAccountPDA,
|
|
3480
3515
|
positionOne: positionAccountPDA1,
|
|
3481
3516
|
positionTwo: positionAccountPDA2,
|
|
3482
3517
|
trader: lavarageProgram.provider.publicKey,
|
|
3483
|
-
systemProgram: import_web3.SystemProgram.programId
|
|
3518
|
+
systemProgram: import_web3.SystemProgram.programId,
|
|
3519
|
+
mint: offer.account.collateralType,
|
|
3520
|
+
tokenProgram,
|
|
3521
|
+
positionOneTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, positionAccountPDA1, true, tokenProgram),
|
|
3522
|
+
positionTwoTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, positionAccountPDA2, true, tokenProgram),
|
|
3523
|
+
mergedPositionTokenAccount: newPositionTokenAccount
|
|
3484
3524
|
}).instruction();
|
|
3525
|
+
const computeBudgetIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
3526
|
+
microLamports: 1e5
|
|
3527
|
+
});
|
|
3485
3528
|
const allInstructions = [
|
|
3486
|
-
|
|
3529
|
+
createNewPositionTokenAccountIx,
|
|
3530
|
+
ix,
|
|
3531
|
+
computeBudgetIx
|
|
3487
3532
|
].filter((i) => !!i);
|
|
3488
3533
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
3489
3534
|
const messageV0 = new import_web3.TransactionMessage({
|