@meteora-ag/zap-sdk 1.0.3 → 1.0.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.js CHANGED
@@ -902,6 +902,16 @@ var Zap = class {
902
902
  ]);
903
903
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
904
904
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
905
+ if (inputMint.equals(import_spl_token5.NATIVE_MINT)) {
906
+ const wrapIxs = wrapSOLInstruction(
907
+ user,
908
+ inputTokenAccount,
909
+ BigInt(maxSwapAmount.toString())
910
+ );
911
+ if (wrapIxs) {
912
+ preInstructions.push(...wrapIxs);
913
+ }
914
+ }
905
915
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
906
916
  const remainingAccounts = jupiterSwapResponse.swapInstruction.accounts.map(
907
917
  (account) => {
@@ -994,6 +1004,16 @@ var Zap = class {
994
1004
  ]);
995
1005
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
996
1006
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
1007
+ if (inputMint.equals(import_spl_token5.NATIVE_MINT)) {
1008
+ const wrapIxs = wrapSOLInstruction(
1009
+ user,
1010
+ inputTokenAccount,
1011
+ BigInt(maxSwapAmount.toString())
1012
+ );
1013
+ if (wrapIxs) {
1014
+ preInstructions.push(...wrapIxs);
1015
+ }
1016
+ }
997
1017
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
998
1018
  const remainingAccounts = yield getDammV2RemainingAccounts(
999
1019
  poolAddress,
@@ -1082,6 +1102,16 @@ var Zap = class {
1082
1102
  ]);
1083
1103
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
1084
1104
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
1105
+ if (inputMint.equals(import_spl_token5.NATIVE_MINT)) {
1106
+ const wrapIxs = wrapSOLInstruction(
1107
+ user,
1108
+ inputTokenAccount,
1109
+ BigInt(maxSwapAmount.toString())
1110
+ );
1111
+ if (wrapIxs) {
1112
+ preInstructions.push(...wrapIxs);
1113
+ }
1114
+ }
1085
1115
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
1086
1116
  const { remainingAccounts, remainingAccountsInfo } = yield getDlmmRemainingAccounts(
1087
1117
  this.connection,
package/dist/index.mjs CHANGED
@@ -871,6 +871,16 @@ var Zap = class {
871
871
  ]);
872
872
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
873
873
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
874
+ if (inputMint.equals(NATIVE_MINT3)) {
875
+ const wrapIxs = wrapSOLInstruction(
876
+ user,
877
+ inputTokenAccount,
878
+ BigInt(maxSwapAmount.toString())
879
+ );
880
+ if (wrapIxs) {
881
+ preInstructions.push(...wrapIxs);
882
+ }
883
+ }
874
884
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
875
885
  const remainingAccounts = jupiterSwapResponse.swapInstruction.accounts.map(
876
886
  (account) => {
@@ -963,6 +973,16 @@ var Zap = class {
963
973
  ]);
964
974
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
965
975
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
976
+ if (inputMint.equals(NATIVE_MINT3)) {
977
+ const wrapIxs = wrapSOLInstruction(
978
+ user,
979
+ inputTokenAccount,
980
+ BigInt(maxSwapAmount.toString())
981
+ );
982
+ if (wrapIxs) {
983
+ preInstructions.push(...wrapIxs);
984
+ }
985
+ }
966
986
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
967
987
  const remainingAccounts = yield getDammV2RemainingAccounts(
968
988
  poolAddress,
@@ -1051,6 +1071,16 @@ var Zap = class {
1051
1071
  ]);
1052
1072
  inputTokenAccountIx && preInstructions.push(inputTokenAccountIx);
1053
1073
  outputTokenAccountIx && preInstructions.push(outputTokenAccountIx);
1074
+ if (inputMint.equals(NATIVE_MINT3)) {
1075
+ const wrapIxs = wrapSOLInstruction(
1076
+ user,
1077
+ inputTokenAccount,
1078
+ BigInt(maxSwapAmount.toString())
1079
+ );
1080
+ if (wrapIxs) {
1081
+ preInstructions.push(...wrapIxs);
1082
+ }
1083
+ }
1054
1084
  const preUserTokenBalance = inputTokenAccountIx ? "0" : yield getTokenAccountBalance(this.connection, inputTokenAccount);
1055
1085
  const { remainingAccounts, remainingAccountsInfo } = yield getDlmmRemainingAccounts(
1056
1086
  this.connection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteora-ag/zap-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
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",
@@ -27,8 +27,8 @@
27
27
  "devDependencies": {
28
28
  "@types/bn.js": "^5.1.0",
29
29
  "@types/bun": "latest",
30
- "tsx": "^4.20.3",
31
- "tsup": "^8.4.0"
30
+ "tsup": "^8.4.0",
31
+ "tsx": "^4.20.3"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "typescript": "^5"
@@ -40,7 +40,8 @@
40
40
  "@solana/spl-token": "^0.4.13",
41
41
  "@solana/web3.js": "^1.98.2",
42
42
  "bn.js": "^5.2.2",
43
- "decimal.js": "^10.4.2"
43
+ "decimal.js": "^10.4.2",
44
+ "jito-ts": "^4.2.0"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "rm -rf dist && tsup src/index.ts --format esm,cjs --dts",