@lavarage/sdk 6.4.2 → 6.4.3
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 +20 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -2
- package/dist/index.mjs.map +1 -1
- package/index.ts +23 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3424,6 +3424,22 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
3424
3424
|
const newPosition2AccountPDA = getPositionAccountPDA(lavarageProgram, offer, newPosition2Seed);
|
|
3425
3425
|
const mintAccount = yield lavarageProgram.provider.connection.getAccountInfo(offer.account.collateralType);
|
|
3426
3426
|
const tokenProgram = mintAccount == null ? void 0 : mintAccount.owner;
|
|
3427
|
+
const newPosition1TokenAccount = (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, newPosition1AccountPDA, true, tokenProgram);
|
|
3428
|
+
const newPosition2TokenAccount = (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, newPosition2AccountPDA, true, tokenProgram);
|
|
3429
|
+
const createNewPosition1TokenAccountIx = (0, import_spl_token.createAssociatedTokenAccountInstruction)(
|
|
3430
|
+
lavarageProgram.provider.publicKey,
|
|
3431
|
+
newPosition1TokenAccount,
|
|
3432
|
+
newPosition1AccountPDA,
|
|
3433
|
+
offer.account.collateralType,
|
|
3434
|
+
tokenProgram
|
|
3435
|
+
);
|
|
3436
|
+
const createNewPosition2TokenAccountIx = (0, import_spl_token.createAssociatedTokenAccountInstruction)(
|
|
3437
|
+
lavarageProgram.provider.publicKey,
|
|
3438
|
+
newPosition2TokenAccount,
|
|
3439
|
+
newPosition2AccountPDA,
|
|
3440
|
+
offer.account.collateralType,
|
|
3441
|
+
tokenProgram
|
|
3442
|
+
);
|
|
3427
3443
|
const ix = yield lavarageProgram.methods.tradingManagementSplitPosition(new import_anchor.BN(propotionBps), newPosition1Seed, newPosition2Seed).accountsStrict({
|
|
3428
3444
|
originalPosition: positionAccountPDA,
|
|
3429
3445
|
newPositionOne: newPosition1AccountPDA,
|
|
@@ -3433,13 +3449,15 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
3433
3449
|
mint: offer.account.collateralType,
|
|
3434
3450
|
tokenProgram,
|
|
3435
3451
|
originalPositionTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(offer.account.collateralType, positionAccountPDA, true, tokenProgram),
|
|
3436
|
-
newPositionTokenAccountOne:
|
|
3437
|
-
newPositionTokenAccountTwo:
|
|
3452
|
+
newPositionTokenAccountOne: newPosition1TokenAccount,
|
|
3453
|
+
newPositionTokenAccountTwo: newPosition2TokenAccount
|
|
3438
3454
|
}).instruction();
|
|
3439
3455
|
const computeBudgetIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
3440
3456
|
microLamports: 1e5
|
|
3441
3457
|
});
|
|
3442
3458
|
const allInstructions = [
|
|
3459
|
+
createNewPosition1TokenAccountIx,
|
|
3460
|
+
createNewPosition2TokenAccountIx,
|
|
3443
3461
|
ix,
|
|
3444
3462
|
computeBudgetIx
|
|
3445
3463
|
].filter((i) => !!i);
|