@hawksightco/hawk-sdk 1.3.185 → 1.3.186
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/src/addresses.d.ts +2 -0
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +4 -1
- package/dist/src/classes/SimpleIxGenerator.d.ts +7 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimpleIxGenerator.js +7 -0
- package/dist/src/classes/SimplePdaGenerator.d.ts +7 -2
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimplePdaGenerator.js +7 -2
- package/dist/src/classes/Transactions.d.ts +46 -14
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +235 -198
- package/dist/src/classes/TxGenerator.d.ts +24 -1
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +96 -0
- package/dist/src/classes/TxGeneratorAutomations.d.ts +29 -15
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +84 -52
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts +104 -0
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/HatchIxGenerator.js +326 -0
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts +41 -0
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/HatchPdaGenerator.js +90 -0
- package/dist/src/types.d.ts +118 -21
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -984,7 +984,6 @@ class Transactions {
|
|
|
984
984
|
}
|
|
985
985
|
compoundAutomationIx(_a) {
|
|
986
986
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
987
|
-
var _b;
|
|
988
987
|
try {
|
|
989
988
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
990
989
|
const position = yield program.account.positionV2.fetch(params.position);
|
|
@@ -1024,7 +1023,7 @@ class Transactions {
|
|
|
1024
1023
|
strategy: {
|
|
1025
1024
|
maxBinId: position.upperBinId,
|
|
1026
1025
|
minBinId: position.lowerBinId,
|
|
1027
|
-
strategyType: types_3.StrategyTypeMap[
|
|
1026
|
+
strategyType: types_3.StrategyTypeMap['SPOT-IMBALANCED'], // TODO: how to get the right distribution from chain??
|
|
1028
1027
|
},
|
|
1029
1028
|
skipInputTokenCheck: true,
|
|
1030
1029
|
slippage: slippageAmount,
|
|
@@ -1359,202 +1358,6 @@ class Transactions {
|
|
|
1359
1358
|
}
|
|
1360
1359
|
});
|
|
1361
1360
|
}
|
|
1362
|
-
/**
|
|
1363
|
-
* Rebalance a Meteora DLMM position with hybrid liquidity support.
|
|
1364
|
-
*
|
|
1365
|
-
* Supports two modes:
|
|
1366
|
-
* - Simple mode: Single distribution (same as rebalanceAutomationIx2)
|
|
1367
|
-
* - Hybrid mode: Multiple liquidity layers with per-side distribution control
|
|
1368
|
-
*
|
|
1369
|
-
* Simple mode (1 TX): Remove + close + init + deposit (same as Ixs2)
|
|
1370
|
-
* Hybrid mode (2 TXs):
|
|
1371
|
-
* TX1: Remove liquidity + claim fees/rewards + close position
|
|
1372
|
-
* TX2: Init new position + deposit layer 1 (static amounts) + deposit layer 2 (sweep remaining)
|
|
1373
|
-
*/
|
|
1374
|
-
rebalanceAutomationIx3(_a) {
|
|
1375
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
1376
|
-
var _b;
|
|
1377
|
-
try {
|
|
1378
|
-
// --- Validate and normalize layers ---
|
|
1379
|
-
let layers;
|
|
1380
|
-
if (params.distribution && !params.layers) {
|
|
1381
|
-
layers = [{ distribution: params.distribution, percentageX: 100, percentageY: 100 }];
|
|
1382
|
-
}
|
|
1383
|
-
else if (params.layers && !params.distribution) {
|
|
1384
|
-
layers = params.layers;
|
|
1385
|
-
}
|
|
1386
|
-
else {
|
|
1387
|
-
throw new Error('Provide either distribution or layers, not both');
|
|
1388
|
-
}
|
|
1389
|
-
if (layers.length === 0 || layers.length > 3) {
|
|
1390
|
-
throw new Error('layers must have 1-3 entries');
|
|
1391
|
-
}
|
|
1392
|
-
const sumX = layers.reduce((s, l) => s + l.percentageX, 0);
|
|
1393
|
-
const sumY = layers.reduce((s, l) => s + l.percentageY, 0);
|
|
1394
|
-
if (sumX !== 100 || sumY !== 100) {
|
|
1395
|
-
throw new Error(`Layer percentages must sum to 100 per side (got X=${sumX}, Y=${sumY})`);
|
|
1396
|
-
}
|
|
1397
|
-
// --- Build labeled instructions ---
|
|
1398
|
-
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
1399
|
-
const positionOnChain = yield program.account.positionV2.fetch(params.currentPosition);
|
|
1400
|
-
const lbPair = positionOnChain.lbPair;
|
|
1401
|
-
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, lbPair, this.ix);
|
|
1402
|
-
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
1403
|
-
// Get position data for amount estimates and bin range
|
|
1404
|
-
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
1405
|
-
const userPosition = userPositions.find(p => p.publicKey.equals(params.currentPosition));
|
|
1406
|
-
if (!userPosition) {
|
|
1407
|
-
throw new Error(`Position: ${params.currentPosition} does not exist.`);
|
|
1408
|
-
}
|
|
1409
|
-
const currentLowerBinId = userPosition.positionData.lowerBinId;
|
|
1410
|
-
const currentUpperBinId = userPosition.positionData.upperBinId;
|
|
1411
|
-
const lbPairState = dlmmPool.dlmm.lbPair;
|
|
1412
|
-
const tokenXMint = lbPairState.tokenXMint;
|
|
1413
|
-
const tokenYMint = lbPairState.tokenYMint;
|
|
1414
|
-
const rewardInfos = lbPairState.rewardInfos;
|
|
1415
|
-
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [tokenXMint, tokenYMint]);
|
|
1416
|
-
const tokenXProgram = tokenProgramMap[tokenXMint.toString()];
|
|
1417
|
-
const tokenYProgram = tokenProgramMap[tokenYMint.toString()];
|
|
1418
|
-
const remainingAccountsInfo = yield (0, functions_1.fetchRemainingAccountsInfo)(connection, tokenXMint, tokenYMint, tokenXProgram, tokenYProgram);
|
|
1419
|
-
const pdaTokenTypeForClaimables = params.useAta ? types_1.TokenType.ATA : types_1.TokenType.STA;
|
|
1420
|
-
// Estimate total X/Y from position data (liquidity + fees)
|
|
1421
|
-
const estimatedTotalX = new bn_js_1.default(userPosition.positionData.totalXAmount).add(userPosition.positionData.feeX);
|
|
1422
|
-
const estimatedTotalY = new bn_js_1.default(userPosition.positionData.totalYAmount).add(userPosition.positionData.feeY);
|
|
1423
|
-
const instructions = [];
|
|
1424
|
-
const labels = [];
|
|
1425
|
-
const removeLiquidityIx = yield this.ix.meteoraDlmm.removeLiquidityByRange2Automation({
|
|
1426
|
-
connection,
|
|
1427
|
-
userWallet: params.userWallet,
|
|
1428
|
-
lbPair,
|
|
1429
|
-
position: params.currentPosition,
|
|
1430
|
-
tokenXMint, tokenYMint, tokenXProgram, tokenYProgram,
|
|
1431
|
-
fromBinId: currentLowerBinId,
|
|
1432
|
-
toBinId: currentUpperBinId,
|
|
1433
|
-
bpsToRemove: 10000,
|
|
1434
|
-
pdaTokenType: types_1.TokenType.ATA,
|
|
1435
|
-
remainingAccountsInfo,
|
|
1436
|
-
});
|
|
1437
|
-
instructions.push(removeLiquidityIx);
|
|
1438
|
-
labels.push('remove');
|
|
1439
|
-
const claimFeeIx = yield this.ix.meteoraDlmm.claimFee2Automation(connection, {
|
|
1440
|
-
userWallet: params.userWallet,
|
|
1441
|
-
lbPair,
|
|
1442
|
-
position: params.currentPosition,
|
|
1443
|
-
tokenMintX: tokenXMint, tokenMintY: tokenYMint,
|
|
1444
|
-
tokenProgramX: tokenXProgram, tokenProgramY: tokenYProgram,
|
|
1445
|
-
lowerBinId: currentLowerBinId, upperBinId: currentUpperBinId,
|
|
1446
|
-
pdaTokenType: pdaTokenTypeForClaimables,
|
|
1447
|
-
remainingAccountsInfo,
|
|
1448
|
-
});
|
|
1449
|
-
instructions.push(claimFeeIx);
|
|
1450
|
-
labels.push('claim_fee');
|
|
1451
|
-
for (let rewardIndex = 0; rewardIndex < 2; rewardIndex++) {
|
|
1452
|
-
const rewardInfo = rewardInfos[rewardIndex];
|
|
1453
|
-
if (!rewardInfo || rewardInfo.mint.equals(web3.PublicKey.default))
|
|
1454
|
-
continue;
|
|
1455
|
-
const rewardTokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [rewardInfo.mint]);
|
|
1456
|
-
const rewardTokenProgram = rewardTokenProgramMap[rewardInfo.mint.toString()];
|
|
1457
|
-
const rewardRemainingAccountsInfo = yield (0, functions_1.fetchRemainingAccountsInfoForReward)(connection, rewardInfo.mint, rewardTokenProgram);
|
|
1458
|
-
const claimRewardIx = yield this.ix.meteoraDlmm.claimReward2Automation(connection, {
|
|
1459
|
-
userWallet: params.userWallet,
|
|
1460
|
-
lbPair,
|
|
1461
|
-
position: params.currentPosition,
|
|
1462
|
-
rewardIndex,
|
|
1463
|
-
rewardMint: rewardInfo.mint,
|
|
1464
|
-
rewardVault: rewardInfo.vault,
|
|
1465
|
-
tokenProgram: rewardTokenProgram,
|
|
1466
|
-
lowerBinId: currentLowerBinId, upperBinId: currentUpperBinId,
|
|
1467
|
-
pdaTokenType: types_1.TokenType.STA,
|
|
1468
|
-
remainingAccountsInfo: rewardRemainingAccountsInfo,
|
|
1469
|
-
});
|
|
1470
|
-
instructions.push(claimRewardIx);
|
|
1471
|
-
labels.push('claim_reward');
|
|
1472
|
-
}
|
|
1473
|
-
const closePositionIx = yield this.ix.meteoraDlmm.closePosition2Automation({
|
|
1474
|
-
connection,
|
|
1475
|
-
userWallet: params.userWallet,
|
|
1476
|
-
position: params.currentPosition,
|
|
1477
|
-
lbPair,
|
|
1478
|
-
});
|
|
1479
|
-
instructions.push(closePositionIx);
|
|
1480
|
-
labels.push('close');
|
|
1481
|
-
const width = params.relativeBinRange.upperRange - params.relativeBinRange.lowerRange + 1;
|
|
1482
|
-
const initPositionIx = yield this.ix.meteoraDlmm.initializePositionRelativeAutomation(connection, {
|
|
1483
|
-
userWallet: params.userWallet,
|
|
1484
|
-
lbPair,
|
|
1485
|
-
position: params.newPosition,
|
|
1486
|
-
relativeLowerBinId: params.relativeBinRange.lowerRange,
|
|
1487
|
-
width: Math.min(70, width),
|
|
1488
|
-
});
|
|
1489
|
-
instructions.push(initPositionIx);
|
|
1490
|
-
labels.push('init');
|
|
1491
|
-
// Find the last layer index that has non-zero percentage for X and Y
|
|
1492
|
-
let lastActiveXIndex = -1;
|
|
1493
|
-
let lastActiveYIndex = -1;
|
|
1494
|
-
for (let i = layers.length - 1; i >= 0; i--) {
|
|
1495
|
-
if (lastActiveXIndex === -1 && layers[i].percentageX > 0)
|
|
1496
|
-
lastActiveXIndex = i;
|
|
1497
|
-
if (lastActiveYIndex === -1 && layers[i].percentageY > 0)
|
|
1498
|
-
lastActiveYIndex = i;
|
|
1499
|
-
}
|
|
1500
|
-
// Build deposit instruction for each layer
|
|
1501
|
-
const { binId: activeId } = yield dlmmPool.dlmm.getActiveBin();
|
|
1502
|
-
for (let i = 0; i < layers.length; i++) {
|
|
1503
|
-
const layer = layers[i];
|
|
1504
|
-
// Compute optional amounts
|
|
1505
|
-
let optionalTokenXAmount;
|
|
1506
|
-
let optionalTokenYAmount;
|
|
1507
|
-
if (layer.percentageX === 0) {
|
|
1508
|
-
optionalTokenXAmount = new bn_js_1.default(0);
|
|
1509
|
-
}
|
|
1510
|
-
else if (i === lastActiveXIndex) {
|
|
1511
|
-
optionalTokenXAmount = undefined; // sweep remaining
|
|
1512
|
-
}
|
|
1513
|
-
else {
|
|
1514
|
-
optionalTokenXAmount = estimatedTotalX.mul(new bn_js_1.default(layer.percentageX)).div(new bn_js_1.default(100));
|
|
1515
|
-
}
|
|
1516
|
-
if (layer.percentageY === 0) {
|
|
1517
|
-
optionalTokenYAmount = new bn_js_1.default(0);
|
|
1518
|
-
}
|
|
1519
|
-
else if (i === lastActiveYIndex) {
|
|
1520
|
-
optionalTokenYAmount = undefined; // sweep remaining
|
|
1521
|
-
}
|
|
1522
|
-
else {
|
|
1523
|
-
optionalTokenYAmount = estimatedTotalY.mul(new bn_js_1.default(layer.percentageY)).div(new bn_js_1.default(100));
|
|
1524
|
-
}
|
|
1525
|
-
// Map distribution to IMBALANCED strategy type
|
|
1526
|
-
const strategyType = types_3.StrategyTypeMap[layer.distribution];
|
|
1527
|
-
const depositIx = yield this.ix.meteoraDlmm.meteoraDlmmDepositRelativeAutomation({
|
|
1528
|
-
connection,
|
|
1529
|
-
userWallet: params.userWallet,
|
|
1530
|
-
lbPair,
|
|
1531
|
-
position: params.newPosition,
|
|
1532
|
-
tokenXMint, tokenYMint, tokenXProgram, tokenYProgram,
|
|
1533
|
-
activeId: (_b = params.targetActiveBin) !== null && _b !== void 0 ? _b : activeId,
|
|
1534
|
-
relativeBinRange: params.relativeBinRange,
|
|
1535
|
-
strategyType,
|
|
1536
|
-
optionalTokenXAmount,
|
|
1537
|
-
optionalTokenYAmount,
|
|
1538
|
-
checkRange: params.checkRange,
|
|
1539
|
-
remainingAccountsInfo,
|
|
1540
|
-
pdaTokenType: types_1.TokenType.ATA,
|
|
1541
|
-
});
|
|
1542
|
-
instructions.push(depositIx);
|
|
1543
|
-
labels.push('deposit');
|
|
1544
|
-
}
|
|
1545
|
-
return { instructions, labels };
|
|
1546
|
-
}
|
|
1547
|
-
catch (error) {
|
|
1548
|
-
console.error('=== REBALANCE AUTOMATION IX3 ERROR ===');
|
|
1549
|
-
console.error('Error type:', error instanceof Error ? error.constructor.name : typeof error);
|
|
1550
|
-
console.error('Error message:', error instanceof Error ? error.message : String(error));
|
|
1551
|
-
console.error('Error stack:', error instanceof Error ? error.stack : 'No stack trace');
|
|
1552
|
-
console.error('Full error object:', error);
|
|
1553
|
-
console.error('=== END ERROR LOG ===');
|
|
1554
|
-
throw error;
|
|
1555
|
-
}
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
1361
|
/**
|
|
1559
1362
|
* Rebalance a Meteora DLMM position with support for larger positions.
|
|
1560
1363
|
*
|
|
@@ -4129,6 +3932,240 @@ class Transactions {
|
|
|
4129
3932
|
});
|
|
4130
3933
|
});
|
|
4131
3934
|
}
|
|
3935
|
+
// ============================================================================
|
|
3936
|
+
// HATCH PROGRAM TRANSACTIONS
|
|
3937
|
+
// ============================================================================
|
|
3938
|
+
/**
|
|
3939
|
+
* Creates a Meteora DLMM pool with a locked position via the Hatch program.
|
|
3940
|
+
*
|
|
3941
|
+
* The position will have:
|
|
3942
|
+
* - Owner: HawkfiPda (global)
|
|
3943
|
+
* - Operator: HawkfiPda (global)
|
|
3944
|
+
* - Fee Owner: LauncherPda (per-launcher, derived from authority)
|
|
3945
|
+
*
|
|
3946
|
+
* Similar to meteoraCreatePoolAndPosition but uses Hatch program for locked positions.
|
|
3947
|
+
*
|
|
3948
|
+
* @param connection The Solana web3 connection object
|
|
3949
|
+
* @param params Parameters for creating the pool and locked position
|
|
3950
|
+
* @returns TransactionMetadataResponse
|
|
3951
|
+
*/
|
|
3952
|
+
hatchCreatePoolAndLockedPosition(_a) {
|
|
3953
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
3954
|
+
var _b, _c;
|
|
3955
|
+
// Get token programs - use provided or fetch from chain
|
|
3956
|
+
const validOwners = [
|
|
3957
|
+
addresses_1.TOKEN_PROGRAM_ID.toString(),
|
|
3958
|
+
addresses_1.TOKEN_2022_PROGRAM_ID.toString(),
|
|
3959
|
+
];
|
|
3960
|
+
let tokenProgramX;
|
|
3961
|
+
let tokenProgramY;
|
|
3962
|
+
if (params.tokenProgramX && params.tokenProgramY) {
|
|
3963
|
+
tokenProgramX = params.tokenProgramX;
|
|
3964
|
+
tokenProgramY = params.tokenProgramY;
|
|
3965
|
+
}
|
|
3966
|
+
else if (!params.tokenProgramX && !params.tokenProgramY) {
|
|
3967
|
+
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [
|
|
3968
|
+
params.tokenMintX,
|
|
3969
|
+
params.tokenMintY,
|
|
3970
|
+
]);
|
|
3971
|
+
tokenProgramX = tokenProgramMap[params.tokenMintX.toString()];
|
|
3972
|
+
tokenProgramY = tokenProgramMap[params.tokenMintY.toString()];
|
|
3973
|
+
}
|
|
3974
|
+
else {
|
|
3975
|
+
const missingMints = [];
|
|
3976
|
+
if (!params.tokenProgramX)
|
|
3977
|
+
missingMints.push(params.tokenMintX);
|
|
3978
|
+
if (!params.tokenProgramY)
|
|
3979
|
+
missingMints.push(params.tokenMintY);
|
|
3980
|
+
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, missingMints);
|
|
3981
|
+
tokenProgramX =
|
|
3982
|
+
(_b = params.tokenProgramX) !== null && _b !== void 0 ? _b : tokenProgramMap[params.tokenMintX.toString()];
|
|
3983
|
+
tokenProgramY =
|
|
3984
|
+
(_c = params.tokenProgramY) !== null && _c !== void 0 ? _c : tokenProgramMap[params.tokenMintY.toString()];
|
|
3985
|
+
}
|
|
3986
|
+
// Validate token programs
|
|
3987
|
+
if (!validOwners.includes(tokenProgramX.toString())) {
|
|
3988
|
+
throw new errors_1.AppError(`tokenMintX: ${params.tokenMintX.toString()} is not a valid token mint. Program owner: ${tokenProgramX.toString()}`, 'hatchCreatePoolAndLockedPosition');
|
|
3989
|
+
}
|
|
3990
|
+
if (!validOwners.includes(tokenProgramY.toString())) {
|
|
3991
|
+
throw new errors_1.AppError(`tokenMintY: ${params.tokenMintY.toString()} is not a valid token mint. Program owner: ${tokenProgramY.toString()}`, 'hatchCreatePoolAndLockedPosition');
|
|
3992
|
+
}
|
|
3993
|
+
// Check if LauncherPda exists, if not prepend initialization instruction
|
|
3994
|
+
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.authority);
|
|
3995
|
+
const launcherPdaInfo = yield connection.getAccountInfo(launcherPda);
|
|
3996
|
+
const initLauncherPdaIxs = [];
|
|
3997
|
+
if (!launcherPdaInfo) {
|
|
3998
|
+
// LauncherPda doesn't exist, need to initialize it first
|
|
3999
|
+
initLauncherPdaIxs.push(this.ix.hatch.initializeLauncherPda({ authority: params.authority }));
|
|
4000
|
+
}
|
|
4001
|
+
// Create ATA init instructions if needed
|
|
4002
|
+
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4003
|
+
accounts: [
|
|
4004
|
+
{
|
|
4005
|
+
owner: params.authority,
|
|
4006
|
+
payer: params.authority,
|
|
4007
|
+
mint: params.tokenMintX,
|
|
4008
|
+
programId: tokenProgramX,
|
|
4009
|
+
},
|
|
4010
|
+
{
|
|
4011
|
+
owner: params.authority,
|
|
4012
|
+
payer: params.authority,
|
|
4013
|
+
mint: params.tokenMintY,
|
|
4014
|
+
programId: tokenProgramY,
|
|
4015
|
+
},
|
|
4016
|
+
],
|
|
4017
|
+
});
|
|
4018
|
+
// Build main instructions
|
|
4019
|
+
const mainInstructions = yield Promise.all([
|
|
4020
|
+
// Wrap SOL if needed
|
|
4021
|
+
...(0, functions_1.wrapSolIfMintIsWsol)(params.authority, params.authority, [
|
|
4022
|
+
{ mint: params.tokenMintX, amount: params.amountX },
|
|
4023
|
+
{ mint: params.tokenMintY, amount: params.amountY },
|
|
4024
|
+
]),
|
|
4025
|
+
// Create pool and locked position via Hatch
|
|
4026
|
+
this.ix.hatch.createPoolAndLockedPosition({
|
|
4027
|
+
connection,
|
|
4028
|
+
authority: params.authority,
|
|
4029
|
+
position: params.position,
|
|
4030
|
+
base: params.base,
|
|
4031
|
+
presetParameter: params.presetParameter,
|
|
4032
|
+
tokenMintX: params.tokenMintX,
|
|
4033
|
+
tokenMintY: params.tokenMintY,
|
|
4034
|
+
tokenProgramX,
|
|
4035
|
+
tokenProgramY,
|
|
4036
|
+
activeId: params.activeId,
|
|
4037
|
+
lowerBinId: params.lowerBinId,
|
|
4038
|
+
upperBinId: params.upperBinId,
|
|
4039
|
+
strategyType: params.strategyType,
|
|
4040
|
+
lockReleasePoint: params.lockReleasePoint,
|
|
4041
|
+
amountX: params.amountX,
|
|
4042
|
+
amountY: params.amountY,
|
|
4043
|
+
}),
|
|
4044
|
+
]);
|
|
4045
|
+
return (0, functions_1.createTransactionMeta)({
|
|
4046
|
+
payer: params.authority,
|
|
4047
|
+
description: 'Create pool and locked position via Hatch',
|
|
4048
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4049
|
+
mainInstructions: [...initLauncherPdaIxs, ...initAtaIxs, ...mainInstructions],
|
|
4050
|
+
});
|
|
4051
|
+
});
|
|
4052
|
+
}
|
|
4053
|
+
/**
|
|
4054
|
+
* Claim trading fees from a Hatch position.
|
|
4055
|
+
*
|
|
4056
|
+
* Only the rebalance authority can call this (automation).
|
|
4057
|
+
* Fees go to LauncherPda-owned token accounts, with 8% to treasury.
|
|
4058
|
+
*
|
|
4059
|
+
* @param connection The Solana web3 connection object
|
|
4060
|
+
* @param params Parameters for claiming fees
|
|
4061
|
+
* @returns TransactionMetadataResponse
|
|
4062
|
+
*/
|
|
4063
|
+
hatchClaimFee(_a) {
|
|
4064
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4065
|
+
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4066
|
+
// Create ATA init instructions for LauncherPda-owned accounts
|
|
4067
|
+
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4068
|
+
accounts: [
|
|
4069
|
+
{
|
|
4070
|
+
owner: launcherPda,
|
|
4071
|
+
payer: params.rebalanceAuthority,
|
|
4072
|
+
mint: params.tokenMintX,
|
|
4073
|
+
programId: params.tokenProgramX,
|
|
4074
|
+
},
|
|
4075
|
+
{
|
|
4076
|
+
owner: launcherPda,
|
|
4077
|
+
payer: params.rebalanceAuthority,
|
|
4078
|
+
mint: params.tokenMintY,
|
|
4079
|
+
programId: params.tokenProgramY,
|
|
4080
|
+
},
|
|
4081
|
+
],
|
|
4082
|
+
});
|
|
4083
|
+
const claimFeeIx = yield this.ix.hatch.claimFee({
|
|
4084
|
+
connection,
|
|
4085
|
+
rebalanceAuthority: params.rebalanceAuthority,
|
|
4086
|
+
launcherAuthority: params.launcherAuthority,
|
|
4087
|
+
position: params.position,
|
|
4088
|
+
lbPair: params.lbPair,
|
|
4089
|
+
minBinId: params.minBinId,
|
|
4090
|
+
maxBinId: params.maxBinId,
|
|
4091
|
+
tokenMintX: params.tokenMintX,
|
|
4092
|
+
tokenMintY: params.tokenMintY,
|
|
4093
|
+
tokenProgramX: params.tokenProgramX,
|
|
4094
|
+
tokenProgramY: params.tokenProgramY,
|
|
4095
|
+
});
|
|
4096
|
+
return (0, functions_1.createTransactionMeta)({
|
|
4097
|
+
payer: params.rebalanceAuthority,
|
|
4098
|
+
description: 'Claim fees from Hatch position',
|
|
4099
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4100
|
+
mainInstructions: [...initAtaIxs, claimFeeIx],
|
|
4101
|
+
});
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4104
|
+
/**
|
|
4105
|
+
* Claim farming rewards from a Hatch position.
|
|
4106
|
+
*
|
|
4107
|
+
* Only the rebalance authority can call this (automation).
|
|
4108
|
+
* Rewards go to LauncherPda-owned token account, with 8% to treasury.
|
|
4109
|
+
*
|
|
4110
|
+
* @param connection The Solana web3 connection object
|
|
4111
|
+
* @param params Parameters for claiming rewards
|
|
4112
|
+
* @returns TransactionMetadataResponse
|
|
4113
|
+
*/
|
|
4114
|
+
hatchClaimReward(_a) {
|
|
4115
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4116
|
+
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4117
|
+
// Create ATA init instruction for LauncherPda-owned account
|
|
4118
|
+
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4119
|
+
accounts: [
|
|
4120
|
+
{
|
|
4121
|
+
owner: launcherPda,
|
|
4122
|
+
payer: params.rebalanceAuthority,
|
|
4123
|
+
mint: params.rewardMint,
|
|
4124
|
+
programId: params.tokenProgram,
|
|
4125
|
+
},
|
|
4126
|
+
],
|
|
4127
|
+
});
|
|
4128
|
+
const claimRewardIx = yield this.ix.hatch.claimReward({
|
|
4129
|
+
connection,
|
|
4130
|
+
rebalanceAuthority: params.rebalanceAuthority,
|
|
4131
|
+
launcherAuthority: params.launcherAuthority,
|
|
4132
|
+
position: params.position,
|
|
4133
|
+
lbPair: params.lbPair,
|
|
4134
|
+
rewardIndex: params.rewardIndex,
|
|
4135
|
+
minBinId: params.minBinId,
|
|
4136
|
+
maxBinId: params.maxBinId,
|
|
4137
|
+
rewardMint: params.rewardMint,
|
|
4138
|
+
rewardVault: params.rewardVault,
|
|
4139
|
+
tokenProgram: params.tokenProgram,
|
|
4140
|
+
});
|
|
4141
|
+
return (0, functions_1.createTransactionMeta)({
|
|
4142
|
+
payer: params.rebalanceAuthority,
|
|
4143
|
+
description: 'Claim rewards from Hatch position',
|
|
4144
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4145
|
+
mainInstructions: [...initAtaIxs, claimRewardIx],
|
|
4146
|
+
});
|
|
4147
|
+
});
|
|
4148
|
+
}
|
|
4149
|
+
/**
|
|
4150
|
+
* Initialize the global HawkfiPda (one-time operation).
|
|
4151
|
+
*
|
|
4152
|
+
* @param connection The Solana web3 connection object
|
|
4153
|
+
* @param params Parameters for initialization
|
|
4154
|
+
* @returns TransactionMetadataResponse
|
|
4155
|
+
*/
|
|
4156
|
+
hatchInitializeHawkfiPda(_a) {
|
|
4157
|
+
return __awaiter(this, arguments, void 0, function* ({ params, }) {
|
|
4158
|
+
const initIx = this.ix.hatch.initializeHawkfiPda({
|
|
4159
|
+
payer: params.payer,
|
|
4160
|
+
});
|
|
4161
|
+
return (0, functions_1.createTransactionMeta)({
|
|
4162
|
+
payer: params.payer,
|
|
4163
|
+
description: 'Initialize Hatch HawkfiPda',
|
|
4164
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4165
|
+
mainInstructions: [initIx],
|
|
4166
|
+
});
|
|
4167
|
+
});
|
|
4168
|
+
}
|
|
4132
4169
|
}
|
|
4133
4170
|
exports.Transactions = Transactions;
|
|
4134
4171
|
exports.txgen = Transactions.getInstance();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { InitializeStorageTokenAccount, ClaimTokensFromSTA, MeteoraTxWithdraw, ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda, RaydiumOpenPosition, RaydiumClosePosition, RaydiumIncreaseLiquidity, RaydiumDecreaseLiquidity, OrcaSweepDust, CreateLimitTokenParams, CloseLimitTokenParams, TokenType, RaydiumWithdrawAndClosePosition, MeteoraCreatePoolAndPosition, MeteoraInitializeBinArrays, ClaimTokenFromPda, MeteoraInitializeLargePosition, MeteoraDepositToLargePosition, MeteoraDepositLargerPosition, MeteoraTxWithdrawLargerPosition } from "../types";
|
|
3
|
+
import { InitializeStorageTokenAccount, ClaimTokensFromSTA, MeteoraTxWithdraw, ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda, RaydiumOpenPosition, RaydiumClosePosition, RaydiumIncreaseLiquidity, RaydiumDecreaseLiquidity, OrcaSweepDust, CreateLimitTokenParams, CloseLimitTokenParams, TokenType, RaydiumWithdrawAndClosePosition, MeteoraCreatePoolAndPosition, MeteoraInitializeBinArrays, ClaimTokenFromPda, MeteoraInitializeLargePosition, MeteoraDepositToLargePosition, MeteoraDepositLargerPosition, MeteoraTxWithdrawLargerPosition, HatchCreatePoolAndLockedPosition, HatchInitializeHawkfiPda } from "../types";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
import BN from "bn.js";
|
|
@@ -345,6 +345,29 @@ export declare class TxGenerator {
|
|
|
345
345
|
raydiumWithdrawAndClosePosition(connection: web3.Connection, payer: string, params: RaydiumWithdrawAndClosePosition): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
346
346
|
raydiumIncreaseLiquidity(connection: web3.Connection, payer: string, params: RaydiumIncreaseLiquidity): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
347
347
|
raydiumDecreaseLiquidity(connection: web3.Connection, payer: string, params: RaydiumDecreaseLiquidity): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
348
|
+
/**
|
|
349
|
+
* Creates a Meteora DLMM pool with a locked position via the Hatch program.
|
|
350
|
+
*
|
|
351
|
+
* The position will have:
|
|
352
|
+
* - Owner: HawkfiPda (global)
|
|
353
|
+
* - Operator: HawkfiPda (global)
|
|
354
|
+
* - Fee Owner: LauncherPda (per-launcher)
|
|
355
|
+
*
|
|
356
|
+
* @param connection The Solana web3 connection object
|
|
357
|
+
* @param payer The public key of the payer for transaction fees
|
|
358
|
+
* @param params Parameters for creating the pool and locked position
|
|
359
|
+
* @returns A ResponseWithStatus containing TransactionMetadata
|
|
360
|
+
*/
|
|
361
|
+
hatchCreatePoolAndLockedPosition(connection: web3.Connection, payer: string, params: HatchCreatePoolAndLockedPosition): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
362
|
+
/**
|
|
363
|
+
* Initialize the global HawkfiPda (one-time operation).
|
|
364
|
+
*
|
|
365
|
+
* @param connection The Solana web3 connection object
|
|
366
|
+
* @param payer The public key of the payer for transaction fees
|
|
367
|
+
* @param params Parameters for initialization
|
|
368
|
+
* @returns A ResponseWithStatus containing TransactionMetadata
|
|
369
|
+
*/
|
|
370
|
+
hatchInitializeHawkfiPda(connection: web3.Connection, payer: string, params: HatchInitializeHawkfiPda): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
348
371
|
}
|
|
349
372
|
export {};
|
|
350
373
|
//# sourceMappingURL=TxGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EAInB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kCAAkC,EAClC,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,+BAA+B,EAE/B,4BAA4B,EAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,8BAA8B,EAC9B,6BAA6B,EAC7B,4BAA4B,EAE5B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;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AAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IA4CnD;;;;;;;;;;;;OAYG;IACG,gCAAgC,CACpC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAuCnD;;;;;;;OAOG;IACG,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAsCpD"}
|
|
@@ -1831,5 +1831,101 @@ class TxGenerator {
|
|
|
1831
1831
|
}
|
|
1832
1832
|
});
|
|
1833
1833
|
}
|
|
1834
|
+
// ============================================================================
|
|
1835
|
+
// HATCH PROGRAM TRANSACTIONS
|
|
1836
|
+
// ============================================================================
|
|
1837
|
+
/**
|
|
1838
|
+
* Creates a Meteora DLMM pool with a locked position via the Hatch program.
|
|
1839
|
+
*
|
|
1840
|
+
* The position will have:
|
|
1841
|
+
* - Owner: HawkfiPda (global)
|
|
1842
|
+
* - Operator: HawkfiPda (global)
|
|
1843
|
+
* - Fee Owner: LauncherPda (per-launcher)
|
|
1844
|
+
*
|
|
1845
|
+
* @param connection The Solana web3 connection object
|
|
1846
|
+
* @param payer The public key of the payer for transaction fees
|
|
1847
|
+
* @param params Parameters for creating the pool and locked position
|
|
1848
|
+
* @returns A ResponseWithStatus containing TransactionMetadata
|
|
1849
|
+
*/
|
|
1850
|
+
hatchCreatePoolAndLockedPosition(connection, payer, params) {
|
|
1851
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1852
|
+
anchor_1.Anchor.initialize(connection);
|
|
1853
|
+
try {
|
|
1854
|
+
const result = yield Transactions_1.txgen.hatchCreatePoolAndLockedPosition({
|
|
1855
|
+
connection,
|
|
1856
|
+
params,
|
|
1857
|
+
fetch: undefined,
|
|
1858
|
+
});
|
|
1859
|
+
return {
|
|
1860
|
+
status: 200,
|
|
1861
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
catch (e) {
|
|
1865
|
+
if (e instanceof Error) {
|
|
1866
|
+
return {
|
|
1867
|
+
status: 400,
|
|
1868
|
+
data: {
|
|
1869
|
+
code: "custom",
|
|
1870
|
+
message: e.message,
|
|
1871
|
+
path: [],
|
|
1872
|
+
},
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
return {
|
|
1876
|
+
status: 400,
|
|
1877
|
+
data: {
|
|
1878
|
+
code: "custom",
|
|
1879
|
+
message: e,
|
|
1880
|
+
path: [],
|
|
1881
|
+
},
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Initialize the global HawkfiPda (one-time operation).
|
|
1888
|
+
*
|
|
1889
|
+
* @param connection The Solana web3 connection object
|
|
1890
|
+
* @param payer The public key of the payer for transaction fees
|
|
1891
|
+
* @param params Parameters for initialization
|
|
1892
|
+
* @returns A ResponseWithStatus containing TransactionMetadata
|
|
1893
|
+
*/
|
|
1894
|
+
hatchInitializeHawkfiPda(connection, payer, params) {
|
|
1895
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1896
|
+
anchor_1.Anchor.initialize(connection);
|
|
1897
|
+
try {
|
|
1898
|
+
const result = yield Transactions_1.txgen.hatchInitializeHawkfiPda({
|
|
1899
|
+
connection,
|
|
1900
|
+
params,
|
|
1901
|
+
fetch: undefined,
|
|
1902
|
+
});
|
|
1903
|
+
return {
|
|
1904
|
+
status: 200,
|
|
1905
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
catch (e) {
|
|
1909
|
+
if (e instanceof Error) {
|
|
1910
|
+
return {
|
|
1911
|
+
status: 400,
|
|
1912
|
+
data: {
|
|
1913
|
+
code: 'custom',
|
|
1914
|
+
message: e.message,
|
|
1915
|
+
path: [],
|
|
1916
|
+
},
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
return {
|
|
1920
|
+
status: 400,
|
|
1921
|
+
data: {
|
|
1922
|
+
code: 'custom',
|
|
1923
|
+
message: e,
|
|
1924
|
+
path: [],
|
|
1925
|
+
},
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1834
1930
|
}
|
|
1835
1931
|
exports.TxGenerator = TxGenerator;
|