@hawksightco/hawk-sdk 1.3.182 → 1.3.184
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 +0 -2
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +1 -4
- package/dist/src/classes/SimpleIxGenerator.d.ts +0 -7
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimpleIxGenerator.js +0 -7
- package/dist/src/classes/SimplePdaGenerator.d.ts +2 -7
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimplePdaGenerator.js +2 -7
- package/dist/src/classes/Transactions.d.ts +14 -46
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +226 -227
- package/dist/src/classes/TxGenerator.d.ts +1 -24
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +0 -96
- package/dist/src/classes/TxGeneratorAutomations.d.ts +15 -29
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +57 -84
- package/dist/src/types.d.ts +17 -118
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts +0 -92
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/HatchIxGenerator.js +0 -304
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts +0 -41
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/HatchPdaGenerator.js +0 -90
|
@@ -984,6 +984,7 @@ class Transactions {
|
|
|
984
984
|
}
|
|
985
985
|
compoundAutomationIx(_a) {
|
|
986
986
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
987
|
+
var _b;
|
|
987
988
|
try {
|
|
988
989
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
989
990
|
const position = yield program.account.positionV2.fetch(params.position);
|
|
@@ -1023,7 +1024,7 @@ class Transactions {
|
|
|
1023
1024
|
strategy: {
|
|
1024
1025
|
maxBinId: position.upperBinId,
|
|
1025
1026
|
minBinId: position.lowerBinId,
|
|
1026
|
-
strategyType: types_3.StrategyTypeMap[
|
|
1027
|
+
strategyType: types_3.StrategyTypeMap[(_b = params.distribution) !== null && _b !== void 0 ? _b : 'SPOT-IMBALANCED'],
|
|
1027
1028
|
},
|
|
1028
1029
|
skipInputTokenCheck: true,
|
|
1029
1030
|
slippage: slippageAmount,
|
|
@@ -1358,6 +1359,230 @@ class Transactions {
|
|
|
1358
1359
|
}
|
|
1359
1360
|
});
|
|
1360
1361
|
}
|
|
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
|
+
// --- Simple mode: single layer, delegate to same logic as Ixs2 ---
|
|
1398
|
+
if (layers.length === 1) {
|
|
1399
|
+
const result = yield this.rebalanceAutomationIx2({
|
|
1400
|
+
connection,
|
|
1401
|
+
params: {
|
|
1402
|
+
userWallet: params.userWallet,
|
|
1403
|
+
currentPosition: params.currentPosition,
|
|
1404
|
+
newPosition: params.newPosition,
|
|
1405
|
+
relativeBinRange: params.relativeBinRange,
|
|
1406
|
+
checkRange: params.checkRange,
|
|
1407
|
+
distribution: layers[0].distribution,
|
|
1408
|
+
useAta: params.useAta,
|
|
1409
|
+
targetActiveBin: params.targetActiveBin,
|
|
1410
|
+
},
|
|
1411
|
+
fetch: undefined,
|
|
1412
|
+
});
|
|
1413
|
+
return [result];
|
|
1414
|
+
}
|
|
1415
|
+
// --- Hybrid mode: multiple layers ---
|
|
1416
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
1417
|
+
const positionOnChain = yield program.account.positionV2.fetch(params.currentPosition);
|
|
1418
|
+
const lbPair = positionOnChain.lbPair;
|
|
1419
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, lbPair, this.ix);
|
|
1420
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
1421
|
+
// Get position data for amount estimates and bin range
|
|
1422
|
+
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
1423
|
+
const userPosition = userPositions.find(p => p.publicKey.equals(params.currentPosition));
|
|
1424
|
+
if (!userPosition) {
|
|
1425
|
+
throw new Error(`Position: ${params.currentPosition} does not exist.`);
|
|
1426
|
+
}
|
|
1427
|
+
const currentLowerBinId = userPosition.positionData.lowerBinId;
|
|
1428
|
+
const currentUpperBinId = userPosition.positionData.upperBinId;
|
|
1429
|
+
const lbPairState = dlmmPool.dlmm.lbPair;
|
|
1430
|
+
const tokenXMint = lbPairState.tokenXMint;
|
|
1431
|
+
const tokenYMint = lbPairState.tokenYMint;
|
|
1432
|
+
const rewardInfos = lbPairState.rewardInfos;
|
|
1433
|
+
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [tokenXMint, tokenYMint]);
|
|
1434
|
+
const tokenXProgram = tokenProgramMap[tokenXMint.toString()];
|
|
1435
|
+
const tokenYProgram = tokenProgramMap[tokenYMint.toString()];
|
|
1436
|
+
const remainingAccountsInfo = yield (0, functions_1.fetchRemainingAccountsInfo)(connection, tokenXMint, tokenYMint, tokenXProgram, tokenYProgram);
|
|
1437
|
+
const pdaTokenTypeForClaimables = params.useAta ? types_1.TokenType.ATA : types_1.TokenType.STA;
|
|
1438
|
+
// Estimate total X/Y from position data (liquidity + fees)
|
|
1439
|
+
const estimatedTotalX = new bn_js_1.default(userPosition.positionData.totalXAmount).add(userPosition.positionData.feeX);
|
|
1440
|
+
const estimatedTotalY = new bn_js_1.default(userPosition.positionData.totalYAmount).add(userPosition.positionData.feeY);
|
|
1441
|
+
// ===== TX1: Remove liquidity + claim fees/rewards + close position =====
|
|
1442
|
+
const tx1Ixs = [];
|
|
1443
|
+
const removeLiquidityIx = yield this.ix.meteoraDlmm.removeLiquidityByRange2Automation({
|
|
1444
|
+
connection,
|
|
1445
|
+
userWallet: params.userWallet,
|
|
1446
|
+
lbPair,
|
|
1447
|
+
position: params.currentPosition,
|
|
1448
|
+
tokenXMint, tokenYMint, tokenXProgram, tokenYProgram,
|
|
1449
|
+
fromBinId: currentLowerBinId,
|
|
1450
|
+
toBinId: currentUpperBinId,
|
|
1451
|
+
bpsToRemove: 10000,
|
|
1452
|
+
pdaTokenType: types_1.TokenType.ATA,
|
|
1453
|
+
remainingAccountsInfo,
|
|
1454
|
+
});
|
|
1455
|
+
tx1Ixs.push(removeLiquidityIx);
|
|
1456
|
+
const claimFeeIx = yield this.ix.meteoraDlmm.claimFee2Automation(connection, {
|
|
1457
|
+
userWallet: params.userWallet,
|
|
1458
|
+
lbPair,
|
|
1459
|
+
position: params.currentPosition,
|
|
1460
|
+
tokenMintX: tokenXMint, tokenMintY: tokenYMint,
|
|
1461
|
+
tokenProgramX: tokenXProgram, tokenProgramY: tokenYProgram,
|
|
1462
|
+
lowerBinId: currentLowerBinId, upperBinId: currentUpperBinId,
|
|
1463
|
+
pdaTokenType: pdaTokenTypeForClaimables,
|
|
1464
|
+
remainingAccountsInfo,
|
|
1465
|
+
});
|
|
1466
|
+
tx1Ixs.push(claimFeeIx);
|
|
1467
|
+
for (let rewardIndex = 0; rewardIndex < 2; rewardIndex++) {
|
|
1468
|
+
const rewardInfo = rewardInfos[rewardIndex];
|
|
1469
|
+
if (!rewardInfo || rewardInfo.mint.equals(web3.PublicKey.default))
|
|
1470
|
+
continue;
|
|
1471
|
+
const rewardTokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [rewardInfo.mint]);
|
|
1472
|
+
const rewardTokenProgram = rewardTokenProgramMap[rewardInfo.mint.toString()];
|
|
1473
|
+
const rewardRemainingAccountsInfo = yield (0, functions_1.fetchRemainingAccountsInfoForReward)(connection, rewardInfo.mint, rewardTokenProgram);
|
|
1474
|
+
const claimRewardIx = yield this.ix.meteoraDlmm.claimReward2Automation(connection, {
|
|
1475
|
+
userWallet: params.userWallet,
|
|
1476
|
+
lbPair,
|
|
1477
|
+
position: params.currentPosition,
|
|
1478
|
+
rewardIndex,
|
|
1479
|
+
rewardMint: rewardInfo.mint,
|
|
1480
|
+
rewardVault: rewardInfo.vault,
|
|
1481
|
+
tokenProgram: rewardTokenProgram,
|
|
1482
|
+
lowerBinId: currentLowerBinId, upperBinId: currentUpperBinId,
|
|
1483
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
1484
|
+
remainingAccountsInfo: rewardRemainingAccountsInfo,
|
|
1485
|
+
});
|
|
1486
|
+
tx1Ixs.push(claimRewardIx);
|
|
1487
|
+
}
|
|
1488
|
+
const closePositionIx = yield this.ix.meteoraDlmm.closePosition2Automation({
|
|
1489
|
+
connection,
|
|
1490
|
+
userWallet: params.userWallet,
|
|
1491
|
+
position: params.currentPosition,
|
|
1492
|
+
lbPair,
|
|
1493
|
+
});
|
|
1494
|
+
tx1Ixs.push(closePositionIx);
|
|
1495
|
+
// ===== TX2: Init new position + deposit layers =====
|
|
1496
|
+
const tx2Ixs = [];
|
|
1497
|
+
const width = params.relativeBinRange.upperRange - params.relativeBinRange.lowerRange + 1;
|
|
1498
|
+
const initPositionIx = yield this.ix.meteoraDlmm.initializePositionRelativeAutomation(connection, {
|
|
1499
|
+
userWallet: params.userWallet,
|
|
1500
|
+
lbPair,
|
|
1501
|
+
position: params.newPosition,
|
|
1502
|
+
relativeLowerBinId: params.relativeBinRange.lowerRange,
|
|
1503
|
+
width: Math.min(70, width),
|
|
1504
|
+
});
|
|
1505
|
+
tx2Ixs.push(initPositionIx);
|
|
1506
|
+
// Find the last layer index that has non-zero percentage for X and Y
|
|
1507
|
+
let lastActiveXIndex = -1;
|
|
1508
|
+
let lastActiveYIndex = -1;
|
|
1509
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
1510
|
+
if (lastActiveXIndex === -1 && layers[i].percentageX > 0)
|
|
1511
|
+
lastActiveXIndex = i;
|
|
1512
|
+
if (lastActiveYIndex === -1 && layers[i].percentageY > 0)
|
|
1513
|
+
lastActiveYIndex = i;
|
|
1514
|
+
}
|
|
1515
|
+
// Build deposit instruction for each layer
|
|
1516
|
+
const { binId: activeId } = yield dlmmPool.dlmm.getActiveBin();
|
|
1517
|
+
for (let i = 0; i < layers.length; i++) {
|
|
1518
|
+
const layer = layers[i];
|
|
1519
|
+
// Compute optional amounts
|
|
1520
|
+
let optionalTokenXAmount;
|
|
1521
|
+
let optionalTokenYAmount;
|
|
1522
|
+
if (layer.percentageX === 0) {
|
|
1523
|
+
optionalTokenXAmount = new bn_js_1.default(0);
|
|
1524
|
+
}
|
|
1525
|
+
else if (i === lastActiveXIndex) {
|
|
1526
|
+
optionalTokenXAmount = undefined; // sweep remaining
|
|
1527
|
+
}
|
|
1528
|
+
else {
|
|
1529
|
+
optionalTokenXAmount = estimatedTotalX.mul(new bn_js_1.default(layer.percentageX)).div(new bn_js_1.default(100));
|
|
1530
|
+
}
|
|
1531
|
+
if (layer.percentageY === 0) {
|
|
1532
|
+
optionalTokenYAmount = new bn_js_1.default(0);
|
|
1533
|
+
}
|
|
1534
|
+
else if (i === lastActiveYIndex) {
|
|
1535
|
+
optionalTokenYAmount = undefined; // sweep remaining
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
optionalTokenYAmount = estimatedTotalY.mul(new bn_js_1.default(layer.percentageY)).div(new bn_js_1.default(100));
|
|
1539
|
+
}
|
|
1540
|
+
// Map distribution to IMBALANCED strategy type
|
|
1541
|
+
const strategyType = types_3.StrategyTypeMap[layer.distribution];
|
|
1542
|
+
const depositIx = yield this.ix.meteoraDlmm.meteoraDlmmDepositRelativeAutomation({
|
|
1543
|
+
connection,
|
|
1544
|
+
userWallet: params.userWallet,
|
|
1545
|
+
lbPair,
|
|
1546
|
+
position: params.newPosition,
|
|
1547
|
+
tokenXMint, tokenYMint, tokenXProgram, tokenYProgram,
|
|
1548
|
+
activeId: (_b = params.targetActiveBin) !== null && _b !== void 0 ? _b : activeId,
|
|
1549
|
+
relativeBinRange: params.relativeBinRange,
|
|
1550
|
+
strategyType,
|
|
1551
|
+
optionalTokenXAmount,
|
|
1552
|
+
optionalTokenYAmount,
|
|
1553
|
+
checkRange: params.checkRange,
|
|
1554
|
+
remainingAccountsInfo,
|
|
1555
|
+
pdaTokenType: types_1.TokenType.ATA,
|
|
1556
|
+
});
|
|
1557
|
+
tx2Ixs.push(depositIx);
|
|
1558
|
+
}
|
|
1559
|
+
// Build transaction metadata array
|
|
1560
|
+
const transactions = [];
|
|
1561
|
+
transactions.push(yield (0, functions_1.createTransactionMeta)({
|
|
1562
|
+
payer: params.userWallet,
|
|
1563
|
+
description: 'Automation IX: Meteora Hybrid Rebalance TX1 - Remove liquidity + claim + close',
|
|
1564
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
1565
|
+
mainInstructions: tx1Ixs,
|
|
1566
|
+
}));
|
|
1567
|
+
transactions.push(yield (0, functions_1.createTransactionMeta)({
|
|
1568
|
+
payer: params.userWallet,
|
|
1569
|
+
description: 'Automation IX: Meteora Hybrid Rebalance TX2 - Init position + deposit layers',
|
|
1570
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
1571
|
+
mainInstructions: tx2Ixs,
|
|
1572
|
+
}));
|
|
1573
|
+
return transactions;
|
|
1574
|
+
}
|
|
1575
|
+
catch (error) {
|
|
1576
|
+
console.error('=== REBALANCE AUTOMATION IX3 ERROR ===');
|
|
1577
|
+
console.error('Error type:', error instanceof Error ? error.constructor.name : typeof error);
|
|
1578
|
+
console.error('Error message:', error instanceof Error ? error.message : String(error));
|
|
1579
|
+
console.error('Error stack:', error instanceof Error ? error.stack : 'No stack trace');
|
|
1580
|
+
console.error('Full error object:', error);
|
|
1581
|
+
console.error('=== END ERROR LOG ===');
|
|
1582
|
+
throw error;
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1361
1586
|
/**
|
|
1362
1587
|
* Rebalance a Meteora DLMM position with support for larger positions.
|
|
1363
1588
|
*
|
|
@@ -3932,232 +4157,6 @@ class Transactions {
|
|
|
3932
4157
|
});
|
|
3933
4158
|
});
|
|
3934
4159
|
}
|
|
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
|
-
// Create ATA init instructions if needed
|
|
3994
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
3995
|
-
accounts: [
|
|
3996
|
-
{
|
|
3997
|
-
owner: params.authority,
|
|
3998
|
-
payer: params.authority,
|
|
3999
|
-
mint: params.tokenMintX,
|
|
4000
|
-
programId: tokenProgramX,
|
|
4001
|
-
},
|
|
4002
|
-
{
|
|
4003
|
-
owner: params.authority,
|
|
4004
|
-
payer: params.authority,
|
|
4005
|
-
mint: params.tokenMintY,
|
|
4006
|
-
programId: tokenProgramY,
|
|
4007
|
-
},
|
|
4008
|
-
],
|
|
4009
|
-
});
|
|
4010
|
-
// Build main instructions
|
|
4011
|
-
const mainInstructions = yield Promise.all([
|
|
4012
|
-
// Wrap SOL if needed
|
|
4013
|
-
...(0, functions_1.wrapSolIfMintIsWsol)(params.authority, params.authority, [
|
|
4014
|
-
{ mint: params.tokenMintX, amount: params.amountX },
|
|
4015
|
-
{ mint: params.tokenMintY, amount: params.amountY },
|
|
4016
|
-
]),
|
|
4017
|
-
// Create pool and locked position via Hatch
|
|
4018
|
-
this.ix.hatch.createPoolAndLockedPosition({
|
|
4019
|
-
connection,
|
|
4020
|
-
authority: params.authority,
|
|
4021
|
-
position: params.position,
|
|
4022
|
-
base: params.base,
|
|
4023
|
-
presetParameter: params.presetParameter,
|
|
4024
|
-
tokenMintX: params.tokenMintX,
|
|
4025
|
-
tokenMintY: params.tokenMintY,
|
|
4026
|
-
tokenProgramX,
|
|
4027
|
-
tokenProgramY,
|
|
4028
|
-
activeId: params.activeId,
|
|
4029
|
-
lowerBinId: params.lowerBinId,
|
|
4030
|
-
upperBinId: params.upperBinId,
|
|
4031
|
-
strategyType: params.strategyType,
|
|
4032
|
-
lockReleasePoint: params.lockReleasePoint,
|
|
4033
|
-
amountX: params.amountX,
|
|
4034
|
-
amountY: params.amountY,
|
|
4035
|
-
}),
|
|
4036
|
-
]);
|
|
4037
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4038
|
-
payer: params.authority,
|
|
4039
|
-
description: 'Create pool and locked position via Hatch',
|
|
4040
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4041
|
-
mainInstructions: [...initAtaIxs, ...mainInstructions],
|
|
4042
|
-
});
|
|
4043
|
-
});
|
|
4044
|
-
}
|
|
4045
|
-
/**
|
|
4046
|
-
* Claim trading fees from a Hatch position.
|
|
4047
|
-
*
|
|
4048
|
-
* Only the rebalance authority can call this (automation).
|
|
4049
|
-
* Fees go to LauncherPda-owned token accounts, with 8% to treasury.
|
|
4050
|
-
*
|
|
4051
|
-
* @param connection The Solana web3 connection object
|
|
4052
|
-
* @param params Parameters for claiming fees
|
|
4053
|
-
* @returns TransactionMetadataResponse
|
|
4054
|
-
*/
|
|
4055
|
-
hatchClaimFee(_a) {
|
|
4056
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4057
|
-
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4058
|
-
// Create ATA init instructions for LauncherPda-owned accounts
|
|
4059
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4060
|
-
accounts: [
|
|
4061
|
-
{
|
|
4062
|
-
owner: launcherPda,
|
|
4063
|
-
payer: params.rebalanceAuthority,
|
|
4064
|
-
mint: params.tokenMintX,
|
|
4065
|
-
programId: params.tokenProgramX,
|
|
4066
|
-
},
|
|
4067
|
-
{
|
|
4068
|
-
owner: launcherPda,
|
|
4069
|
-
payer: params.rebalanceAuthority,
|
|
4070
|
-
mint: params.tokenMintY,
|
|
4071
|
-
programId: params.tokenProgramY,
|
|
4072
|
-
},
|
|
4073
|
-
],
|
|
4074
|
-
});
|
|
4075
|
-
const claimFeeIx = yield this.ix.hatch.claimFee({
|
|
4076
|
-
connection,
|
|
4077
|
-
rebalanceAuthority: params.rebalanceAuthority,
|
|
4078
|
-
launcherAuthority: params.launcherAuthority,
|
|
4079
|
-
position: params.position,
|
|
4080
|
-
lbPair: params.lbPair,
|
|
4081
|
-
minBinId: params.minBinId,
|
|
4082
|
-
maxBinId: params.maxBinId,
|
|
4083
|
-
tokenMintX: params.tokenMintX,
|
|
4084
|
-
tokenMintY: params.tokenMintY,
|
|
4085
|
-
tokenProgramX: params.tokenProgramX,
|
|
4086
|
-
tokenProgramY: params.tokenProgramY,
|
|
4087
|
-
});
|
|
4088
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4089
|
-
payer: params.rebalanceAuthority,
|
|
4090
|
-
description: 'Claim fees from Hatch position',
|
|
4091
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4092
|
-
mainInstructions: [...initAtaIxs, claimFeeIx],
|
|
4093
|
-
});
|
|
4094
|
-
});
|
|
4095
|
-
}
|
|
4096
|
-
/**
|
|
4097
|
-
* Claim farming rewards from a Hatch position.
|
|
4098
|
-
*
|
|
4099
|
-
* Only the rebalance authority can call this (automation).
|
|
4100
|
-
* Rewards go to LauncherPda-owned token account, with 8% to treasury.
|
|
4101
|
-
*
|
|
4102
|
-
* @param connection The Solana web3 connection object
|
|
4103
|
-
* @param params Parameters for claiming rewards
|
|
4104
|
-
* @returns TransactionMetadataResponse
|
|
4105
|
-
*/
|
|
4106
|
-
hatchClaimReward(_a) {
|
|
4107
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4108
|
-
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4109
|
-
// Create ATA init instruction for LauncherPda-owned account
|
|
4110
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4111
|
-
accounts: [
|
|
4112
|
-
{
|
|
4113
|
-
owner: launcherPda,
|
|
4114
|
-
payer: params.rebalanceAuthority,
|
|
4115
|
-
mint: params.rewardMint,
|
|
4116
|
-
programId: params.tokenProgram,
|
|
4117
|
-
},
|
|
4118
|
-
],
|
|
4119
|
-
});
|
|
4120
|
-
const claimRewardIx = yield this.ix.hatch.claimReward({
|
|
4121
|
-
connection,
|
|
4122
|
-
rebalanceAuthority: params.rebalanceAuthority,
|
|
4123
|
-
launcherAuthority: params.launcherAuthority,
|
|
4124
|
-
position: params.position,
|
|
4125
|
-
lbPair: params.lbPair,
|
|
4126
|
-
rewardIndex: params.rewardIndex,
|
|
4127
|
-
minBinId: params.minBinId,
|
|
4128
|
-
maxBinId: params.maxBinId,
|
|
4129
|
-
rewardMint: params.rewardMint,
|
|
4130
|
-
rewardVault: params.rewardVault,
|
|
4131
|
-
tokenProgram: params.tokenProgram,
|
|
4132
|
-
});
|
|
4133
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4134
|
-
payer: params.rebalanceAuthority,
|
|
4135
|
-
description: 'Claim rewards from Hatch position',
|
|
4136
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4137
|
-
mainInstructions: [...initAtaIxs, claimRewardIx],
|
|
4138
|
-
});
|
|
4139
|
-
});
|
|
4140
|
-
}
|
|
4141
|
-
/**
|
|
4142
|
-
* Initialize the global HawkfiPda (one-time operation).
|
|
4143
|
-
*
|
|
4144
|
-
* @param connection The Solana web3 connection object
|
|
4145
|
-
* @param params Parameters for initialization
|
|
4146
|
-
* @returns TransactionMetadataResponse
|
|
4147
|
-
*/
|
|
4148
|
-
hatchInitializeHawkfiPda(_a) {
|
|
4149
|
-
return __awaiter(this, arguments, void 0, function* ({ params, }) {
|
|
4150
|
-
const initIx = this.ix.hatch.initializeHawkfiPda({
|
|
4151
|
-
payer: params.payer,
|
|
4152
|
-
});
|
|
4153
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4154
|
-
payer: params.payer,
|
|
4155
|
-
description: 'Initialize Hatch HawkfiPda',
|
|
4156
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4157
|
-
mainInstructions: [initIx],
|
|
4158
|
-
});
|
|
4159
|
-
});
|
|
4160
|
-
}
|
|
4161
4160
|
}
|
|
4162
4161
|
exports.Transactions = Transactions;
|
|
4163
4162
|
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
|
|
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";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
import BN from "bn.js";
|
|
@@ -345,29 +345,6 @@ 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>>;
|
|
371
348
|
}
|
|
372
349
|
export {};
|
|
373
350
|
//# 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,EAC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AAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAwC7C,oBAAoB,CACxB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAwC7C,+BAA+B,CACnC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAwC7C,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAwC7C,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAwCpD"}
|
|
@@ -1831,101 +1831,5 @@ 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
|
-
}
|
|
1930
1834
|
}
|
|
1931
1835
|
exports.TxGenerator = TxGenerator;
|