@stabbleorg/mclmm-sdk 0.3.0 → 0.3.1
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/lib/index.js +24 -12
- package/lib/index.mjs +24 -12
- package/lib/position-manager.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7941,17 +7941,8 @@ var PositionManager = class {
|
|
|
7941
7941
|
];
|
|
7942
7942
|
}
|
|
7943
7943
|
buildUnwrapSolInstruction(params) {
|
|
7944
|
-
const {
|
|
7944
|
+
const { owner, destination, ata } = params;
|
|
7945
7945
|
return [
|
|
7946
|
-
// There's a chance user might have deleted the ATA - create it with idempotent just to be sure.
|
|
7947
|
-
(0, import_token4.getCreateAssociatedTokenIdempotentInstruction)({
|
|
7948
|
-
payer,
|
|
7949
|
-
ata,
|
|
7950
|
-
owner,
|
|
7951
|
-
mint: (0, import_kit53.address)(NATIVE_MINT.toString()),
|
|
7952
|
-
tokenProgram: import_token4.TOKEN_PROGRAM_ADDRESS,
|
|
7953
|
-
systemProgram: SYSTEM_PROGRAM_ID
|
|
7954
|
-
}),
|
|
7955
7946
|
(0, import_token4.getCloseAccountInstruction)({
|
|
7956
7947
|
account: ata,
|
|
7957
7948
|
destination,
|
|
@@ -8349,6 +8340,24 @@ var PositionManager = class {
|
|
|
8349
8340
|
);
|
|
8350
8341
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolState.address) : void 0;
|
|
8351
8342
|
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: import_kit53.AccountRole.WRITABLE }] : [];
|
|
8343
|
+
const createRecipientAta0Ix = (0, import_token4.getCreateAssociatedTokenIdempotentInstruction)(
|
|
8344
|
+
{
|
|
8345
|
+
payer: ownerInfo.wallet,
|
|
8346
|
+
ata: ownerInfo.tokenAccountA,
|
|
8347
|
+
owner: ownerInfo.wallet.address,
|
|
8348
|
+
mint: poolState.data.tokenMint0,
|
|
8349
|
+
tokenProgram: import_token4.TOKEN_PROGRAM_ADDRESS
|
|
8350
|
+
}
|
|
8351
|
+
);
|
|
8352
|
+
const createRecipientAta1Ix = (0, import_token4.getCreateAssociatedTokenIdempotentInstruction)(
|
|
8353
|
+
{
|
|
8354
|
+
payer: ownerInfo.wallet,
|
|
8355
|
+
ata: ownerInfo.tokenAccountB,
|
|
8356
|
+
owner: ownerInfo.wallet.address,
|
|
8357
|
+
mint: poolState.data.tokenMint1,
|
|
8358
|
+
tokenProgram: import_token4.TOKEN_PROGRAM_ADDRESS
|
|
8359
|
+
}
|
|
8360
|
+
);
|
|
8352
8361
|
const instruction = getDecreaseLiquidityV2Instruction({
|
|
8353
8362
|
nftOwner: ownerInfo.wallet,
|
|
8354
8363
|
nftAccount: positionNftAccount,
|
|
@@ -8371,7 +8380,11 @@ var PositionManager = class {
|
|
|
8371
8380
|
...instruction,
|
|
8372
8381
|
accounts: [...instruction.accounts, ...remAccounts]
|
|
8373
8382
|
};
|
|
8374
|
-
const instructions = [
|
|
8383
|
+
const instructions = [
|
|
8384
|
+
createRecipientAta0Ix,
|
|
8385
|
+
createRecipientAta1Ix,
|
|
8386
|
+
ixWithRemAccounts
|
|
8387
|
+
];
|
|
8375
8388
|
if (isNative) {
|
|
8376
8389
|
const destination = ownerInfo.wallet.address;
|
|
8377
8390
|
const isFullWithdrawal = liquidity === ownerPosition.liquidity;
|
|
@@ -8380,7 +8393,6 @@ var PositionManager = class {
|
|
|
8380
8393
|
const amount = isTokenANative ? amountMinA : amountMinB;
|
|
8381
8394
|
if (isFullWithdrawal) {
|
|
8382
8395
|
const unwrapIxs = this.buildUnwrapSolInstruction({
|
|
8383
|
-
payer: ownerInfo.wallet,
|
|
8384
8396
|
ata: wsolAta,
|
|
8385
8397
|
owner: ownerInfo.wallet.address,
|
|
8386
8398
|
destination
|
package/lib/index.mjs
CHANGED
|
@@ -8520,17 +8520,8 @@ var PositionManager = class {
|
|
|
8520
8520
|
];
|
|
8521
8521
|
}
|
|
8522
8522
|
buildUnwrapSolInstruction(params) {
|
|
8523
|
-
const {
|
|
8523
|
+
const { owner, destination, ata } = params;
|
|
8524
8524
|
return [
|
|
8525
|
-
// There's a chance user might have deleted the ATA - create it with idempotent just to be sure.
|
|
8526
|
-
getCreateAssociatedTokenIdempotentInstruction({
|
|
8527
|
-
payer,
|
|
8528
|
-
ata,
|
|
8529
|
-
owner,
|
|
8530
|
-
mint: address4(NATIVE_MINT.toString()),
|
|
8531
|
-
tokenProgram: TOKEN_PROGRAM_ADDRESS3,
|
|
8532
|
-
systemProgram: SYSTEM_PROGRAM_ID
|
|
8533
|
-
}),
|
|
8534
8525
|
getCloseAccountInstruction({
|
|
8535
8526
|
account: ata,
|
|
8536
8527
|
destination,
|
|
@@ -8928,6 +8919,24 @@ var PositionManager = class {
|
|
|
8928
8919
|
);
|
|
8929
8920
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolState.address) : void 0;
|
|
8930
8921
|
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: AccountRole2.WRITABLE }] : [];
|
|
8922
|
+
const createRecipientAta0Ix = getCreateAssociatedTokenIdempotentInstruction(
|
|
8923
|
+
{
|
|
8924
|
+
payer: ownerInfo.wallet,
|
|
8925
|
+
ata: ownerInfo.tokenAccountA,
|
|
8926
|
+
owner: ownerInfo.wallet.address,
|
|
8927
|
+
mint: poolState.data.tokenMint0,
|
|
8928
|
+
tokenProgram: TOKEN_PROGRAM_ADDRESS3
|
|
8929
|
+
}
|
|
8930
|
+
);
|
|
8931
|
+
const createRecipientAta1Ix = getCreateAssociatedTokenIdempotentInstruction(
|
|
8932
|
+
{
|
|
8933
|
+
payer: ownerInfo.wallet,
|
|
8934
|
+
ata: ownerInfo.tokenAccountB,
|
|
8935
|
+
owner: ownerInfo.wallet.address,
|
|
8936
|
+
mint: poolState.data.tokenMint1,
|
|
8937
|
+
tokenProgram: TOKEN_PROGRAM_ADDRESS3
|
|
8938
|
+
}
|
|
8939
|
+
);
|
|
8931
8940
|
const instruction = getDecreaseLiquidityV2Instruction({
|
|
8932
8941
|
nftOwner: ownerInfo.wallet,
|
|
8933
8942
|
nftAccount: positionNftAccount,
|
|
@@ -8950,7 +8959,11 @@ var PositionManager = class {
|
|
|
8950
8959
|
...instruction,
|
|
8951
8960
|
accounts: [...instruction.accounts, ...remAccounts]
|
|
8952
8961
|
};
|
|
8953
|
-
const instructions = [
|
|
8962
|
+
const instructions = [
|
|
8963
|
+
createRecipientAta0Ix,
|
|
8964
|
+
createRecipientAta1Ix,
|
|
8965
|
+
ixWithRemAccounts
|
|
8966
|
+
];
|
|
8954
8967
|
if (isNative) {
|
|
8955
8968
|
const destination = ownerInfo.wallet.address;
|
|
8956
8969
|
const isFullWithdrawal = liquidity === ownerPosition.liquidity;
|
|
@@ -8959,7 +8972,6 @@ var PositionManager = class {
|
|
|
8959
8972
|
const amount = isTokenANative ? amountMinA : amountMinB;
|
|
8960
8973
|
if (isFullWithdrawal) {
|
|
8961
8974
|
const unwrapIxs = this.buildUnwrapSolInstruction({
|
|
8962
|
-
payer: ownerInfo.wallet,
|
|
8963
8975
|
ata: wsolAta,
|
|
8964
8976
|
owner: ownerInfo.wallet.address,
|
|
8965
8977
|
destination
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-manager.d.ts","sourceRoot":"","sources":["../src/position-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAEZ,KAAK,iBAAiB,EAKvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAOL,qBAAqB,EACrB,SAAS,EACV,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,YAAY,EACb,MAAM,SAAS,CAAC;AAgCjB,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAElD,OAAO,CAAC,wBAAwB;IAyBhC,OAAO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