@lavarage/sdk 6.4.1 → 6.4.2
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 +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -4
- package/dist/index.mjs.map +1 -1
- package/idl/lavaragev2.ts +54 -4
- package/index.ts +13 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2157,11 +2157,31 @@ var IDL2 = {
|
|
|
2157
2157
|
{
|
|
2158
2158
|
"name": "newPositionOne",
|
|
2159
2159
|
"isMut": true,
|
|
2160
|
-
"isSigner":
|
|
2160
|
+
"isSigner": false
|
|
2161
2161
|
},
|
|
2162
2162
|
{
|
|
2163
2163
|
"name": "newPositionTwo",
|
|
2164
2164
|
"isMut": true,
|
|
2165
|
+
"isSigner": false
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
"name": "mint",
|
|
2169
|
+
"isMut": false,
|
|
2170
|
+
"isSigner": false
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
"name": "originalPositionTokenAccount",
|
|
2174
|
+
"isMut": false,
|
|
2175
|
+
"isSigner": false
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
"name": "newPositionTokenAccountOne",
|
|
2179
|
+
"isMut": true,
|
|
2180
|
+
"isSigner": true
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
"name": "newPositionTokenAccountTwo",
|
|
2184
|
+
"isMut": true,
|
|
2165
2185
|
"isSigner": true
|
|
2166
2186
|
},
|
|
2167
2187
|
{
|
|
@@ -2169,6 +2189,11 @@ var IDL2 = {
|
|
|
2169
2189
|
"isMut": true,
|
|
2170
2190
|
"isSigner": true
|
|
2171
2191
|
},
|
|
2192
|
+
{
|
|
2193
|
+
"name": "tokenProgram",
|
|
2194
|
+
"isMut": false,
|
|
2195
|
+
"isSigner": false
|
|
2196
|
+
},
|
|
2172
2197
|
{
|
|
2173
2198
|
"name": "systemProgram",
|
|
2174
2199
|
"isMut": false,
|
|
@@ -2206,7 +2231,7 @@ var IDL2 = {
|
|
|
2206
2231
|
{
|
|
2207
2232
|
"name": "mergedPosition",
|
|
2208
2233
|
"isMut": true,
|
|
2209
|
-
"isSigner":
|
|
2234
|
+
"isSigner": false
|
|
2210
2235
|
},
|
|
2211
2236
|
{
|
|
2212
2237
|
"name": "trader",
|
|
@@ -3350,15 +3375,26 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
3350
3375
|
const newPosition2Seed = Keypair.generate().publicKey;
|
|
3351
3376
|
const newPosition1AccountPDA = getPositionAccountPDA(lavarageProgram, offer, newPosition1Seed);
|
|
3352
3377
|
const newPosition2AccountPDA = getPositionAccountPDA(lavarageProgram, offer, newPosition2Seed);
|
|
3378
|
+
const mintAccount = yield lavarageProgram.provider.connection.getAccountInfo(offer.account.collateralType);
|
|
3379
|
+
const tokenProgram = mintAccount == null ? void 0 : mintAccount.owner;
|
|
3353
3380
|
const ix = yield lavarageProgram.methods.tradingManagementSplitPosition(new BN(propotionBps), newPosition1Seed, newPosition2Seed).accountsStrict({
|
|
3354
3381
|
originalPosition: positionAccountPDA,
|
|
3355
3382
|
newPositionOne: newPosition1AccountPDA,
|
|
3356
3383
|
newPositionTwo: newPosition2AccountPDA,
|
|
3357
3384
|
trader: lavarageProgram.provider.publicKey,
|
|
3358
|
-
systemProgram: SystemProgram.programId
|
|
3385
|
+
systemProgram: SystemProgram.programId,
|
|
3386
|
+
mint: offer.account.collateralType,
|
|
3387
|
+
tokenProgram,
|
|
3388
|
+
originalPositionTokenAccount: getAssociatedTokenAddressSync(offer.account.collateralType, positionAccountPDA, true, tokenProgram),
|
|
3389
|
+
newPositionTokenAccountOne: getAssociatedTokenAddressSync(offer.account.collateralType, newPosition1AccountPDA, true, tokenProgram),
|
|
3390
|
+
newPositionTokenAccountTwo: getAssociatedTokenAddressSync(offer.account.collateralType, newPosition2AccountPDA, true, tokenProgram)
|
|
3359
3391
|
}).instruction();
|
|
3392
|
+
const computeBudgetIx = ComputeBudgetProgram.setComputeUnitPrice({
|
|
3393
|
+
microLamports: 1e5
|
|
3394
|
+
});
|
|
3360
3395
|
const allInstructions = [
|
|
3361
|
-
ix
|
|
3396
|
+
ix,
|
|
3397
|
+
computeBudgetIx
|
|
3362
3398
|
].filter((i) => !!i);
|
|
3363
3399
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
3364
3400
|
const messageV0 = new TransactionMessage({
|