@hawksightco/hawk-sdk 1.2.67 → 1.2.69

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAEpB,gBAAgB,EAChB,+BAA+B,EAChC,MAAM,UAAU,CAAC;AA2BlB,OAAO,EAEL,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAKlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAaxD,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IAEtC;;OAEG;IACI,EAAE,EAAE,iBAAiB,CAAC;IAE7B;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,IAAI,CAAC,SAAS,EAC1B,IAAI,GAAE,IAAI,CAAC,SAAqB,GAC/B,IAAI,CAAC,SAAS;IAIjB;;;;;;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G,oBAAoB,CAAC,EACzB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuB3E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuE/E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CA+DhF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
1
+ {"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAEpB,gBAAgB,EAChB,+BAA+B,EAChC,MAAM,UAAU,CAAC;AA6BlB,OAAO,EAEL,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAKlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAcxD,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO;IA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AC;IA8IvE;;;;;;OAMG;IACG,mBAAmB,CAAC,EACxB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAsH1E;;;;;;;OAOG;IACG,+BAA+B,CAAC,EACpC,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,+BAA+B,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA4HtF;;;;;;OAMG;IACG,oBAAoB,CAAC,EACzB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuB3E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2F/E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAmFhF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
@@ -56,6 +56,7 @@ const spl_token_1 = require("@solana/spl-token");
56
56
  const whirlpools_sdk_1 = require("@orca-so/whirlpools-sdk");
57
57
  const anchor = __importStar(require("@coral-xyz/anchor"));
58
58
  const RaydiumIxGenerator_1 = require("../ixGenerator/RaydiumIxGenerator");
59
+ const RaydiumSDK_1 = require("./RaydiumSDK");
59
60
  class Transactions {
60
61
  /**
61
62
  * Prohibit creating instance other than getInstance
@@ -2132,6 +2133,19 @@ class Transactions {
2132
2133
  */
2133
2134
  raydiumOpenPosition(_a) {
2134
2135
  return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
2136
+ // Load the Raydium SDK
2137
+ yield (0, RaydiumSDK_1.load)(connection);
2138
+ // Get the Raydium SDK instance
2139
+ const sdk = (0, RaydiumSDK_1.raydium)();
2140
+ // Get the pool keys (for lookup table account)
2141
+ (0, functions_1.benchmark)({ name: `raydiumOpenPosition`, msg: `sdk.clmm.getClmmPoolKeys` });
2142
+ const poolKeys = yield sdk.clmm.getClmmPoolKeys(params.poolState.toString());
2143
+ (0, functions_1.benchmark)({ name: `raydiumOpenPosition`, msg: `sdk.clmm.getClmmPoolKeys`, end: true });
2144
+ console.log("pool lookup table account:", poolKeys.lookupTableAccount);
2145
+ const addressLookupTableAddresses = [];
2146
+ if (poolKeys.lookupTableAccount) {
2147
+ addressLookupTableAddresses.push(poolKeys.lookupTableAccount);
2148
+ }
2135
2149
  const fetch = yield this.ix.raydium.raydiumFetch({
2136
2150
  poolState: params.poolState,
2137
2151
  });
@@ -2149,7 +2163,7 @@ class Transactions {
2149
2163
  toPubkey: userPdaLamport,
2150
2164
  lamports,
2151
2165
  });
2152
- const { liquidity, amount0Max: amountX, amount1Max: amountY, } = yield (0, RaydiumIxGenerator_1.getLiquidityFromAmounts)(connection, params.poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage);
2166
+ const { liquidity, amount0Max: amountX, amount1Max: amountY, } = yield (0, RaydiumIxGenerator_1.getLiquidityFromAmounts)(connection, params.poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage, true);
2153
2167
  const wrapIxs = (0, functions_1.wrapSolIfMintIsWsol)(params.userWallet, params.userWallet, [
2154
2168
  { mint: tokenMint0, amount: amountX },
2155
2169
  { mint: tokenMint1, amount: amountY },
@@ -2196,7 +2210,7 @@ class Transactions {
2196
2210
  return yield (0, functions_1.createTransactionMeta)({
2197
2211
  payer: params.userWallet,
2198
2212
  description: `Open Raydium Position`,
2199
- addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
2213
+ addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
2200
2214
  mainInstructions,
2201
2215
  });
2202
2216
  });
@@ -2214,6 +2228,19 @@ class Transactions {
2214
2228
  const fetch = yield this.ix.raydium.raydiumFetch({
2215
2229
  personalPosition: params.personalPosition,
2216
2230
  });
2231
+ // Load the Raydium SDK
2232
+ yield (0, RaydiumSDK_1.load)(connection);
2233
+ // Get the Raydium SDK instance
2234
+ const sdk = (0, RaydiumSDK_1.raydium)();
2235
+ // Get the pool keys (for lookup table account)
2236
+ (0, functions_1.benchmark)({ name: `raydiumWithdrawAndClosePosition`, msg: `sdk.clmm.getClmmPoolKeys` });
2237
+ const poolKeys = yield sdk.clmm.getClmmPoolKeys(fetch.positionInfo.poolId.toString());
2238
+ (0, functions_1.benchmark)({ name: `raydiumWithdrawAndClosePosition`, msg: `sdk.clmm.getClmmPoolKeys`, end: true });
2239
+ console.log("pool lookup table account:", poolKeys.lookupTableAccount);
2240
+ const addressLookupTableAddresses = [];
2241
+ if (poolKeys.lookupTableAccount) {
2242
+ addressLookupTableAddresses.push(poolKeys.lookupTableAccount);
2243
+ }
2217
2244
  const withdrawIx = yield this.ix.iyfMain.withdrawMultipleLamportPdaToken({
2218
2245
  userWallet: params.userWallet,
2219
2246
  withdraw: [
@@ -2239,6 +2266,13 @@ class Transactions {
2239
2266
  const mint = v;
2240
2267
  return (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(payer, associatedToken, nftOwner, mint);
2241
2268
  });
2269
+ // NOTE: Temporary fix, to be removed once main-iyf PR is merged
2270
+ const initUserAtaIxs = mints.map(v => {
2271
+ const payer = params.userWallet;
2272
+ const associatedToken = (0, functions_1.generateAta)(payer, v);
2273
+ const mint = v;
2274
+ return (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(payer, associatedToken, payer, mint);
2275
+ });
2242
2276
  const unwrapSolIx = (0, functions_1.unwrapSolIfMintIsWsol)(params.userWallet, [
2243
2277
  fetch.poolStateInfo.tokenMint0,
2244
2278
  fetch.poolStateInfo.tokenMint1
@@ -2266,13 +2300,14 @@ class Transactions {
2266
2300
  return (0, functions_1.createTransactionMeta)({
2267
2301
  payer: params.userWallet,
2268
2302
  description: `Close Raydium Position`,
2269
- addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
2303
+ addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
2270
2304
  mainInstructions,
2271
2305
  });
2272
2306
  }
2273
2307
  else {
2274
2308
  const mainInstructions = [
2275
2309
  ...initAtaIxs,
2310
+ ...initUserAtaIxs,
2276
2311
  raydiumDecreaseLiquidityIxViaHawksight,
2277
2312
  raydiumClosePositionIxViaHawksight,
2278
2313
  withdrawLamportsFromPdaIx,
@@ -2282,7 +2317,7 @@ class Transactions {
2282
2317
  return (0, functions_1.createTransactionMeta)({
2283
2318
  payer: params.userWallet,
2284
2319
  description: `Withdraw and close Raydium Position`,
2285
- addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
2320
+ addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
2286
2321
  mainInstructions,
2287
2322
  });
2288
2323
  }
@@ -2331,7 +2366,20 @@ class Transactions {
2331
2366
  });
2332
2367
  const tokenMint0 = fetch.poolStateInfo.tokenMint0;
2333
2368
  const tokenMint1 = fetch.poolStateInfo.tokenMint1;
2334
- const { liquidity, amount0Max: amountX, amount1Max: amountY, } = yield (0, RaydiumIxGenerator_1.getLiquidityFromAmounts)(connection, fetch.positionInfo.poolId, params.amountX, params.amountY, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage);
2369
+ // Load the Raydium SDK
2370
+ yield (0, RaydiumSDK_1.load)(connection);
2371
+ // Get the Raydium SDK instance
2372
+ const sdk = (0, RaydiumSDK_1.raydium)();
2373
+ // Get the pool keys (for lookup table account)
2374
+ (0, functions_1.benchmark)({ name: `raydiumIncreaseLiquidity`, msg: `sdk.clmm.getClmmPoolKeys` });
2375
+ const poolKeys = yield sdk.clmm.getClmmPoolKeys(fetch.positionInfo.poolId.toString());
2376
+ (0, functions_1.benchmark)({ name: `raydiumIncreaseLiquidity`, msg: `sdk.clmm.getClmmPoolKeys`, end: true });
2377
+ console.log("pool lookup table account:", poolKeys.lookupTableAccount);
2378
+ const addressLookupTableAddresses = [];
2379
+ if (poolKeys.lookupTableAccount) {
2380
+ addressLookupTableAddresses.push(poolKeys.lookupTableAccount);
2381
+ }
2382
+ const { liquidity, amount0Max: amountX, amount1Max: amountY, } = yield (0, RaydiumIxGenerator_1.getLiquidityFromAmounts)(connection, fetch.positionInfo.poolId, params.amountX, params.amountY, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage, true);
2335
2383
  const wrapIxs = (0, functions_1.wrapSolIfMintIsWsol)(params.userWallet, params.userWallet, [
2336
2384
  { mint: tokenMint0, amount: amountX },
2337
2385
  { mint: tokenMint1, amount: amountY },
@@ -2372,7 +2420,7 @@ class Transactions {
2372
2420
  return (0, functions_1.createTransactionMeta)({
2373
2421
  payer: params.userWallet,
2374
2422
  description: `Raydium increase liquidity`,
2375
- addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
2423
+ addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
2376
2424
  mainInstructions,
2377
2425
  });
2378
2426
  });
@@ -2389,6 +2437,19 @@ class Transactions {
2389
2437
  const fetch = yield this.ix.raydium.raydiumFetch({
2390
2438
  personalPosition: params.personalPosition,
2391
2439
  });
2440
+ // Load the Raydium SDK
2441
+ yield (0, RaydiumSDK_1.load)(connection);
2442
+ // Get the Raydium SDK instance
2443
+ const sdk = (0, RaydiumSDK_1.raydium)();
2444
+ // Get the pool keys (for lookup table account)
2445
+ (0, functions_1.benchmark)({ name: `raydiumDecreaseLiquidity`, msg: `sdk.clmm.getClmmPoolKeys` });
2446
+ const poolKeys = yield sdk.clmm.getClmmPoolKeys(fetch.positionInfo.poolId.toString());
2447
+ (0, functions_1.benchmark)({ name: `raydiumDecreaseLiquidity`, msg: `sdk.clmm.getClmmPoolKeys`, end: true });
2448
+ console.log("pool lookup table account:", poolKeys.lookupTableAccount);
2449
+ const addressLookupTableAddresses = [];
2450
+ if (poolKeys.lookupTableAccount) {
2451
+ addressLookupTableAddresses.push(poolKeys.lookupTableAccount);
2452
+ }
2392
2453
  const withdrawIx = yield this.ix.iyfMain.withdrawMultipleLamportPdaToken({
2393
2454
  userWallet: params.userWallet,
2394
2455
  withdraw: [
@@ -2432,7 +2493,7 @@ class Transactions {
2432
2493
  return (0, functions_1.createTransactionMeta)({
2433
2494
  payer: params.userWallet,
2434
2495
  description: `Raydium decrease liquidity`,
2435
- addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
2496
+ addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
2436
2497
  mainInstructions,
2437
2498
  });
2438
2499
  });
@@ -113,12 +113,12 @@ export declare class RaydiumIxGenerator {
113
113
  */
114
114
  raydiumSweepDust({ connection, params, fetch }: TxgenParams<RaydiumSweepDust, RaydiumFetch>): Promise<web3.TransactionInstruction>;
115
115
  }
116
- export declare function getLiquidityFromAmounts(connection: web3.Connection, poolId: web3.PublicKey, amountA: BN, amountB: BN, tickLower: number, tickUpper: number, slippage: number): Promise<{
116
+ export declare function getLiquidityFromAmounts(connection: web3.Connection, poolId: web3.PublicKey, amountA: BN, amountB: BN, tickLower: number, tickUpper: number, slippage: number, add: boolean): Promise<{
117
117
  liquidity: BN;
118
118
  amount0Max: BN;
119
119
  amount1Max: BN;
120
120
  }>;
121
- export declare function getAmountsFromLiquidity(connection: web3.Connection, poolId: web3.PublicKey, liquidity: BN, tickLower: number, tickUpper: number, slippage: number): Promise<{
121
+ export declare function getAmountsFromLiquidity(connection: web3.Connection, poolId: web3.PublicKey, liquidity: BN, tickLower: number, tickUpper: number, slippage: number, add: boolean): Promise<{
122
122
  amount0Min: BN;
123
123
  amount1Min: BN;
124
124
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"RaydiumIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/RaydiumIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,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AAsB,CAAC;IAqCxJ;;;;;;OAMG;IACG,kCAAkC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC,wBAAwB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAqClK;;;;;;OAMG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC,gBAAgB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;CAiCzI;AAED,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO;;;;GA+DhM;AAED,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO;;;GAwDrL"}
@@ -97,7 +97,7 @@ class RaydiumIxGenerator {
97
97
  const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(params.tickUpperIndex, fetch.poolStateInfo.tickSpacing);
98
98
  const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
99
99
  const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
100
- const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage);
100
+ const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage, true);
101
101
  console.log("liquidity", amount0Max.toString());
102
102
  console.log("amount0Max", amount0Max.toString());
103
103
  console.log("amount1Max", amount1Max.toString());
@@ -148,7 +148,7 @@ class RaydiumIxGenerator {
148
148
  const vault1Mint = fetch.poolStateInfo.tokenMint1;
149
149
  const tokenVault0 = fetch.poolStateInfo.tokenVault0;
150
150
  const tokenVault1 = fetch.poolStateInfo.tokenVault1;
151
- const { liquidity, amount0Max, amount1Max } = yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage);
151
+ const { liquidity, amount0Max, amount1Max } = yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, params.tickLowerIndex, params.tickUpperIndex, params.slippage, true);
152
152
  return yield this.iyfExtension.raydiumOpenPositionAutomation({
153
153
  connection,
154
154
  userWallet: params.userWallet,
@@ -243,7 +243,7 @@ class RaydiumIxGenerator {
243
243
  const tokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
244
244
  const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
245
245
  const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
246
- const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, tickLowerIndex, tickUpperIndex, params.slippage);
246
+ const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, tickLowerIndex, tickUpperIndex, params.slippage, true);
247
247
  const raydiumIx = yield anchor_1.Anchor.instance().raydiumProgram.methods
248
248
  .increaseLiquidityV2(liquidity, amount0Max, amount1Max, false)
249
249
  .accounts({
@@ -288,7 +288,7 @@ class RaydiumIxGenerator {
288
288
  const tokenVault1 = fetch.poolStateInfo.tokenVault1;
289
289
  const tickLowerIndex = fetch.positionInfo.tickLowerIndex;
290
290
  const tickUpperIndex = fetch.positionInfo.tickUpperIndex;
291
- const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, tickLowerIndex, tickUpperIndex, params.slippage);
291
+ const { liquidity, amount0Max, amount1Max } = params.getLiquidityFromAmounts ? params.getLiquidityFromAmounts : yield getLiquidityFromAmounts(connection, poolState, params.amountX, params.amountY, tickLowerIndex, tickUpperIndex, params.slippage, true);
292
292
  return yield this.iyfExtension.raydiumIncreaseLiquidityAutomation({
293
293
  connection,
294
294
  userWallet: params.userWallet,
@@ -323,7 +323,7 @@ class RaydiumIxGenerator {
323
323
  const vault1Mint = fetch.poolStateInfo.tokenMint1;
324
324
  const tokenVault0 = fetch.poolStateInfo.tokenVault0;
325
325
  const tokenVault1 = fetch.poolStateInfo.tokenVault1;
326
- const { amount0Min, amount1Min } = yield getAmountsFromLiquidity(connection, fetch.positionInfo.poolId, fetch.positionInfo.liquidity, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage);
326
+ const { amount0Min, amount1Min } = yield getAmountsFromLiquidity(connection, fetch.positionInfo.poolId, fetch.positionInfo.liquidity, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage, false);
327
327
  return yield this.iyfExtension.raydiumDecreaseLiquidity({
328
328
  connection,
329
329
  liquidity: params.liquidity,
@@ -360,7 +360,7 @@ class RaydiumIxGenerator {
360
360
  const vault1Mint = fetch.poolStateInfo.tokenMint1;
361
361
  const tokenVault0 = fetch.poolStateInfo.tokenVault0;
362
362
  const tokenVault1 = fetch.poolStateInfo.tokenVault1;
363
- const { amount0Min, amount1Min } = yield getAmountsFromLiquidity(connection, fetch.positionInfo.poolId, fetch.positionInfo.liquidity, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage);
363
+ const { amount0Min, amount1Min } = yield getAmountsFromLiquidity(connection, fetch.positionInfo.poolId, fetch.positionInfo.liquidity, fetch.positionInfo.tickLowerIndex, fetch.positionInfo.tickUpperIndex, params.slippage, false);
364
364
  return yield this.iyfExtension.raydiumDecreaseLiquidityAutomation({
365
365
  connection,
366
366
  liquidity: params.liquidity,
@@ -425,7 +425,7 @@ class RaydiumIxGenerator {
425
425
  }
426
426
  }
427
427
  exports.RaydiumIxGenerator = RaydiumIxGenerator;
428
- function getLiquidityFromAmounts(connection, poolId, amountA, amountB, tickLower, tickUpper, slippage) {
428
+ function getLiquidityFromAmounts(connection, poolId, amountA, amountB, tickLower, tickUpper, slippage, add) {
429
429
  return __awaiter(this, void 0, void 0, function* () {
430
430
  // Load the Raydium SDK
431
431
  yield (0, RaydiumSDK_1.load)(connection);
@@ -445,8 +445,8 @@ function getLiquidityFromAmounts(connection, poolId, amountA, amountB, tickLower
445
445
  let epochInfo = yield connection.getEpochInfo();
446
446
  // Benchmark the getEpochInfo function (end)
447
447
  (0, functions_1.benchmark)({ name: `getLiquidityFromAmounts`, msg: `getEpochInfo`, end: true });
448
- // Benchmark the getAmountsFromLiquidity function
449
- (0, functions_1.benchmark)({ name: `getLiquidityFromAmounts`, msg: `getAmountsFromLiquidity` });
448
+ // Benchmark the getLiquidityFromAmounts function
449
+ (0, functions_1.benchmark)({ name: `getLiquidityFromAmounts`, msg: `getLiquidityFromAmounts` });
450
450
  const { liquidity, amountSlippageA, amountSlippageB, amountA: _amountA, amountB: _amountB, } = (0, raydium_sdk_v2_1.getLiquidityFromAmounts)({
451
451
  poolInfo,
452
452
  tickLower,
@@ -458,8 +458,8 @@ function getLiquidityFromAmounts(connection, poolId, amountA, amountB, tickLower
458
458
  epochInfo,
459
459
  amountHasFee: false,
460
460
  });
461
- // Benchmark the getAmountsFromLiquidity function (end)
462
- (0, functions_1.benchmark)({ name: `getLiquidityFromAmounts`, msg: `getAmountsFromLiquidity`, end: true });
461
+ // Benchmark the getLiquidityFromAmounts function (end)
462
+ (0, functions_1.benchmark)({ name: `getLiquidityFromAmounts`, msg: `getLiquidityFromAmounts`, end: true });
463
463
  console.log("amountSlippageA", amountSlippageA.amount.toString());
464
464
  console.log("amountSlippageB", amountSlippageB.amount.toString());
465
465
  console.log("amountA", _amountA.amount.toString());
@@ -472,7 +472,7 @@ function getLiquidityFromAmounts(connection, poolId, amountA, amountB, tickLower
472
472
  });
473
473
  }
474
474
  exports.getLiquidityFromAmounts = getLiquidityFromAmounts;
475
- function getAmountsFromLiquidity(connection, poolId, liquidity, tickLower, tickUpper, slippage) {
475
+ function getAmountsFromLiquidity(connection, poolId, liquidity, tickLower, tickUpper, slippage, add) {
476
476
  return __awaiter(this, void 0, void 0, function* () {
477
477
  // Load the Raydium SDK
478
478
  yield (0, RaydiumSDK_1.load)(connection);
@@ -500,7 +500,7 @@ function getAmountsFromLiquidity(connection, poolId, liquidity, tickLower, tickU
500
500
  tickUpper,
501
501
  liquidity,
502
502
  slippage,
503
- add: true,
503
+ add,
504
504
  });
505
505
  // Benchmark the getAmountsFromLiquidity function (end)
506
506
  (0, functions_1.benchmark)({ name: `getAmountsFromLiquidity`, msg: `getAmountsFromLiquidity`, end: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawksightco/hawk-sdk",
3
- "version": "1.2.67",
3
+ "version": "1.2.69",
4
4
  "description": "Hawksight v2 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/ghabxph/hawk-api-client.git",