@hawksightco/hawk-sdk 1.2.68 → 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;
|
|
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,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;;;;;;;OAOG;IACG,eAAe,CAAC,EACpB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAmOnE;;;;;;;OAOG;IACG,gBAAgB,CAAC,EACrB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;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,12 +2133,19 @@ class Transactions {
|
|
|
2132
2133
|
*/
|
|
2133
2134
|
raydiumOpenPosition(_a) {
|
|
2134
2135
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
2135
|
-
//
|
|
2136
|
-
|
|
2137
|
-
//
|
|
2138
|
-
|
|
2139
|
-
//
|
|
2140
|
-
|
|
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
|
+
}
|
|
2141
2149
|
const fetch = yield this.ix.raydium.raydiumFetch({
|
|
2142
2150
|
poolState: params.poolState,
|
|
2143
2151
|
});
|
|
@@ -2202,7 +2210,7 @@ class Transactions {
|
|
|
2202
2210
|
return yield (0, functions_1.createTransactionMeta)({
|
|
2203
2211
|
payer: params.userWallet,
|
|
2204
2212
|
description: `Open Raydium Position`,
|
|
2205
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
2213
|
+
addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
|
|
2206
2214
|
mainInstructions,
|
|
2207
2215
|
});
|
|
2208
2216
|
});
|
|
@@ -2220,6 +2228,19 @@ class Transactions {
|
|
|
2220
2228
|
const fetch = yield this.ix.raydium.raydiumFetch({
|
|
2221
2229
|
personalPosition: params.personalPosition,
|
|
2222
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
|
+
}
|
|
2223
2244
|
const withdrawIx = yield this.ix.iyfMain.withdrawMultipleLamportPdaToken({
|
|
2224
2245
|
userWallet: params.userWallet,
|
|
2225
2246
|
withdraw: [
|
|
@@ -2279,7 +2300,7 @@ class Transactions {
|
|
|
2279
2300
|
return (0, functions_1.createTransactionMeta)({
|
|
2280
2301
|
payer: params.userWallet,
|
|
2281
2302
|
description: `Close Raydium Position`,
|
|
2282
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
2303
|
+
addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
|
|
2283
2304
|
mainInstructions,
|
|
2284
2305
|
});
|
|
2285
2306
|
}
|
|
@@ -2296,7 +2317,7 @@ class Transactions {
|
|
|
2296
2317
|
return (0, functions_1.createTransactionMeta)({
|
|
2297
2318
|
payer: params.userWallet,
|
|
2298
2319
|
description: `Withdraw and close Raydium Position`,
|
|
2299
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
2320
|
+
addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
|
|
2300
2321
|
mainInstructions,
|
|
2301
2322
|
});
|
|
2302
2323
|
}
|
|
@@ -2345,6 +2366,19 @@ class Transactions {
|
|
|
2345
2366
|
});
|
|
2346
2367
|
const tokenMint0 = fetch.poolStateInfo.tokenMint0;
|
|
2347
2368
|
const tokenMint1 = fetch.poolStateInfo.tokenMint1;
|
|
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
|
+
}
|
|
2348
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);
|
|
2349
2383
|
const wrapIxs = (0, functions_1.wrapSolIfMintIsWsol)(params.userWallet, params.userWallet, [
|
|
2350
2384
|
{ mint: tokenMint0, amount: amountX },
|
|
@@ -2386,7 +2420,7 @@ class Transactions {
|
|
|
2386
2420
|
return (0, functions_1.createTransactionMeta)({
|
|
2387
2421
|
payer: params.userWallet,
|
|
2388
2422
|
description: `Raydium increase liquidity`,
|
|
2389
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
2423
|
+
addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
|
|
2390
2424
|
mainInstructions,
|
|
2391
2425
|
});
|
|
2392
2426
|
});
|
|
@@ -2403,6 +2437,19 @@ class Transactions {
|
|
|
2403
2437
|
const fetch = yield this.ix.raydium.raydiumFetch({
|
|
2404
2438
|
personalPosition: params.personalPosition,
|
|
2405
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
|
+
}
|
|
2406
2453
|
const withdrawIx = yield this.ix.iyfMain.withdrawMultipleLamportPdaToken({
|
|
2407
2454
|
userWallet: params.userWallet,
|
|
2408
2455
|
withdraw: [
|
|
@@ -2446,7 +2493,7 @@ class Transactions {
|
|
|
2446
2493
|
return (0, functions_1.createTransactionMeta)({
|
|
2447
2494
|
payer: params.userWallet,
|
|
2448
2495
|
description: `Raydium decrease liquidity`,
|
|
2449
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
2496
|
+
addressLookupTableAddresses: [...addresses_1.GLOBAL_ALT, ...addressLookupTableAddresses],
|
|
2450
2497
|
mainInstructions,
|
|
2451
2498
|
});
|
|
2452
2499
|
});
|