@meteora-ag/zap-sdk 1.0.4 → 1.0.5-rc.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.js +10 -19
- package/dist/index.mjs +11 -22
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -460,24 +460,15 @@ var getOrCreateATAInstruction = (connection, tokenMint, owner, payer, allowOwner
|
|
|
460
460
|
allowOwnerOffCurve,
|
|
461
461
|
tokenProgram
|
|
462
462
|
);
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
tokenMint,
|
|
473
|
-
tokenProgram
|
|
474
|
-
);
|
|
475
|
-
return { ataPubkey: toAccount, ix };
|
|
476
|
-
} else {
|
|
477
|
-
console.error("Error::getOrCreateATAInstruction", e);
|
|
478
|
-
throw e;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
463
|
+
yield (0, import_spl_token3.getAccount)(connection, toAccount);
|
|
464
|
+
const ix = (0, import_spl_token3.createAssociatedTokenAccountIdempotentInstruction)(
|
|
465
|
+
payer,
|
|
466
|
+
toAccount,
|
|
467
|
+
owner,
|
|
468
|
+
tokenMint,
|
|
469
|
+
tokenProgram
|
|
470
|
+
);
|
|
471
|
+
return { ataPubkey: toAccount, ix };
|
|
481
472
|
});
|
|
482
473
|
function unwrapSOLInstruction(owner, receiver, allowOwnerOffCurve = true) {
|
|
483
474
|
const wSolATAAccount = (0, import_spl_token3.getAssociatedTokenAddressSync)(
|
|
@@ -902,7 +893,7 @@ var Zap = class {
|
|
|
902
893
|
]);
|
|
903
894
|
inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
|
|
904
895
|
outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
|
|
905
|
-
if (inputMint.
|
|
896
|
+
if ([inputMint, outputMint].includes(import_spl_token5.NATIVE_MINT)) {
|
|
906
897
|
const wrapIxs = wrapSOLInstruction(
|
|
907
898
|
user,
|
|
908
899
|
inputTokenAccount,
|
package/dist/index.mjs
CHANGED
|
@@ -401,9 +401,7 @@ import {
|
|
|
401
401
|
getAccount,
|
|
402
402
|
getAssociatedTokenAddressSync,
|
|
403
403
|
NATIVE_MINT as NATIVE_MINT2,
|
|
404
|
-
TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID3
|
|
405
|
-
TokenAccountNotFoundError,
|
|
406
|
-
TokenInvalidAccountOwnerError
|
|
404
|
+
TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID3
|
|
407
405
|
} from "@solana/spl-token";
|
|
408
406
|
import {
|
|
409
407
|
SystemProgram,
|
|
@@ -416,24 +414,15 @@ var getOrCreateATAInstruction = (connection, tokenMint, owner, payer, allowOwner
|
|
|
416
414
|
allowOwnerOffCurve,
|
|
417
415
|
tokenProgram
|
|
418
416
|
);
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
tokenMint,
|
|
429
|
-
tokenProgram
|
|
430
|
-
);
|
|
431
|
-
return { ataPubkey: toAccount, ix };
|
|
432
|
-
} else {
|
|
433
|
-
console.error("Error::getOrCreateATAInstruction", e);
|
|
434
|
-
throw e;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
417
|
+
yield getAccount(connection, toAccount);
|
|
418
|
+
const ix = createAssociatedTokenAccountIdempotentInstruction(
|
|
419
|
+
payer,
|
|
420
|
+
toAccount,
|
|
421
|
+
owner,
|
|
422
|
+
tokenMint,
|
|
423
|
+
tokenProgram
|
|
424
|
+
);
|
|
425
|
+
return { ataPubkey: toAccount, ix };
|
|
437
426
|
});
|
|
438
427
|
function unwrapSOLInstruction(owner, receiver, allowOwnerOffCurve = true) {
|
|
439
428
|
const wSolATAAccount = getAssociatedTokenAddressSync(
|
|
@@ -871,7 +860,7 @@ var Zap = class {
|
|
|
871
860
|
]);
|
|
872
861
|
inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
|
|
873
862
|
outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
|
|
874
|
-
if (inputMint.
|
|
863
|
+
if ([inputMint, outputMint].includes(NATIVE_MINT3)) {
|
|
875
864
|
const wrapIxs = wrapSOLInstruction(
|
|
876
865
|
user,
|
|
877
866
|
inputTokenAccount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meteora-ag/zap-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5-rc.2",
|
|
4
4
|
"description": "A Typescript SDK for interacting with the Zap program on Meteora.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist/**"
|
|
19
19
|
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rm -rf dist && tsup src/index.ts --format esm,cjs --dts",
|
|
22
|
+
"clean": "rm -rf dist && rm -rf node_modules rm -rf pnpm-lock.yaml",
|
|
23
|
+
"test": "ts-node -r dotenv/config examples/removeDlmmLiquidityAndZapOut.ts"
|
|
24
|
+
},
|
|
20
25
|
"exports": {
|
|
21
26
|
".": {
|
|
22
27
|
"types": "./dist/index.d.ts",
|
|
@@ -42,9 +47,5 @@
|
|
|
42
47
|
"bn.js": "^5.2.2",
|
|
43
48
|
"decimal.js": "^10.4.2",
|
|
44
49
|
"jito-ts": "^4.2.0"
|
|
45
|
-
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"build": "rm -rf dist && tsup src/index.ts --format esm,cjs --dts",
|
|
48
|
-
"clean": "rm -rf dist && rm -rf node_modules rm -rf pnpm-lock.yaml"
|
|
49
50
|
}
|
|
50
|
-
}
|
|
51
|
+
}
|