@lavarage/sdk 6.4.2 → 6.4.4
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/idl/lavaragev2.ts +6 -6
- package/index.ts +23 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2119,18 +2119,18 @@ type Lavarage = {
|
|
|
2119
2119
|
},
|
|
2120
2120
|
{
|
|
2121
2121
|
"name": "originalPositionTokenAccount";
|
|
2122
|
-
"isMut":
|
|
2122
|
+
"isMut": true;
|
|
2123
2123
|
"isSigner": false;
|
|
2124
2124
|
},
|
|
2125
2125
|
{
|
|
2126
2126
|
"name": "newPositionTokenAccountOne";
|
|
2127
2127
|
"isMut": true;
|
|
2128
|
-
"isSigner":
|
|
2128
|
+
"isSigner": false;
|
|
2129
2129
|
},
|
|
2130
2130
|
{
|
|
2131
2131
|
"name": "newPositionTokenAccountTwo";
|
|
2132
2132
|
"isMut": true;
|
|
2133
|
-
"isSigner":
|
|
2133
|
+
"isSigner": false;
|
|
2134
2134
|
},
|
|
2135
2135
|
{
|
|
2136
2136
|
"name": "trader";
|
package/dist/index.d.ts
CHANGED
|
@@ -2119,18 +2119,18 @@ type Lavarage = {
|
|
|
2119
2119
|
},
|
|
2120
2120
|
{
|
|
2121
2121
|
"name": "originalPositionTokenAccount";
|
|
2122
|
-
"isMut":
|
|
2122
|
+
"isMut": true;
|
|
2123
2123
|
"isSigner": false;
|
|
2124
2124
|
},
|
|
2125
2125
|
{
|
|
2126
2126
|
"name": "newPositionTokenAccountOne";
|
|
2127
2127
|
"isMut": true;
|
|
2128
|
-
"isSigner":
|
|
2128
|
+
"isSigner": false;
|
|
2129
2129
|
},
|
|
2130
2130
|
{
|
|
2131
2131
|
"name": "newPositionTokenAccountTwo";
|
|
2132
2132
|
"isMut": true;
|
|
2133
|
-
"isSigner":
|
|
2133
|
+
"isSigner": false;
|
|
2134
2134
|
},
|
|
2135
2135
|
{
|
|
2136
2136
|
"name": "trader";
|
package/dist/index.js
CHANGED
|
@@ -2218,18 +2218,18 @@ var IDL2 = {
|
|
|
2218
2218
|
},
|
|
2219
2219
|
{
|
|
2220
2220
|
"name": "originalPositionTokenAccount",
|
|
2221
|
-
"isMut":
|
|
2221
|
+
"isMut": true,
|
|
2222
2222
|
"isSigner": false
|
|
2223
2223
|
},
|
|
2224
2224
|
{
|
|
2225
2225
|
"name": "newPositionTokenAccountOne",
|
|
2226
2226
|
"isMut": true,
|
|
2227
|
-
"isSigner":
|
|
2227
|
+
"isSigner": false
|
|
2228
2228
|
},
|
|
2229
2229
|
{
|
|
2230
2230
|
"name": "newPositionTokenAccountTwo",
|
|
2231
2231
|
"isMut": true,
|
|
2232
|
-
"isSigner":
|
|
2232
|
+
"isSigner": false
|
|
2233
2233
|
},
|
|
2234
2234
|
{
|
|
2235
2235
|
"name": "trader",
|
|
@@ -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);
|