@hawksightco/hawk-sdk 1.3.192 → 1.3.194
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 -40
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +214 -254
- package/dist/src/classes/TxGenerator.d.ts +1 -15
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +0 -52
- 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 +52 -84
- package/dist/src/idl/iyf-extension-idl.d.ts +12 -0
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +12 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +6 -4
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +3 -3
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +0 -13
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -1
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +0 -26
- package/dist/src/types.d.ts +21 -110
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts +0 -108
- package/dist/src/ixGenerator/HatchIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/HatchIxGenerator.js +0 -308
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts +0 -39
- package/dist/src/pdaGenerator/HatchPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/HatchPdaGenerator.js +0 -85
|
@@ -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,218 @@ 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, _c;
|
|
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
|
+
// Find the last layer index that has non-zero percentage for X and Y
|
|
1482
|
+
let lastActiveXIndex = -1;
|
|
1483
|
+
let lastActiveYIndex = -1;
|
|
1484
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
1485
|
+
if (lastActiveXIndex === -1 && layers[i].percentageX > 0)
|
|
1486
|
+
lastActiveXIndex = i;
|
|
1487
|
+
if (lastActiveYIndex === -1 && layers[i].percentageY > 0)
|
|
1488
|
+
lastActiveYIndex = i;
|
|
1489
|
+
}
|
|
1490
|
+
// Helper to compute optional amounts for a layer
|
|
1491
|
+
const computeAmounts = (layer, i) => {
|
|
1492
|
+
let optionalTokenXAmount;
|
|
1493
|
+
let optionalTokenYAmount;
|
|
1494
|
+
if (layer.percentageX === 0) {
|
|
1495
|
+
optionalTokenXAmount = new bn_js_1.default(0);
|
|
1496
|
+
}
|
|
1497
|
+
else if (i === lastActiveXIndex) {
|
|
1498
|
+
optionalTokenXAmount = undefined; // sweep remaining
|
|
1499
|
+
}
|
|
1500
|
+
else {
|
|
1501
|
+
optionalTokenXAmount = estimatedTotalX.mul(new bn_js_1.default(layer.percentageX)).div(new bn_js_1.default(100));
|
|
1502
|
+
}
|
|
1503
|
+
if (layer.percentageY === 0) {
|
|
1504
|
+
optionalTokenYAmount = new bn_js_1.default(0);
|
|
1505
|
+
}
|
|
1506
|
+
else if (i === lastActiveYIndex) {
|
|
1507
|
+
optionalTokenYAmount = undefined; // sweep remaining
|
|
1508
|
+
}
|
|
1509
|
+
else {
|
|
1510
|
+
optionalTokenYAmount = estimatedTotalY.mul(new bn_js_1.default(layer.percentageY)).div(new bn_js_1.default(100));
|
|
1511
|
+
}
|
|
1512
|
+
return { optionalTokenXAmount, optionalTokenYAmount };
|
|
1513
|
+
};
|
|
1514
|
+
// Layer 0: init position + first deposit via relativeOpenAutomation
|
|
1515
|
+
const firstLayer = layers[0];
|
|
1516
|
+
const firstAmounts = computeAmounts(firstLayer, 0);
|
|
1517
|
+
const firstStrategyType = types_3.StrategyTypeMap[firstLayer.distribution];
|
|
1518
|
+
const initAndDepositIx = yield this.ix.meteoraDlmm.relativeOpenAutomation(connection, {
|
|
1519
|
+
userWallet: params.userWallet,
|
|
1520
|
+
lbPair,
|
|
1521
|
+
position: params.newPosition,
|
|
1522
|
+
relativeLowerBinId: params.relativeBinRange.lowerRange,
|
|
1523
|
+
relativeUpperBinId: params.relativeBinRange.upperRange,
|
|
1524
|
+
strategyType: firstStrategyType,
|
|
1525
|
+
checkRange: { minBinId: params.checkRange.lowerRange, maxBinId: params.checkRange.upperRange },
|
|
1526
|
+
targetActiveBin: (_b = params.targetActiveBin) !== null && _b !== void 0 ? _b : undefined,
|
|
1527
|
+
userTokenXAmount: firstAmounts.optionalTokenXAmount,
|
|
1528
|
+
userTokenYAmount: firstAmounts.optionalTokenYAmount,
|
|
1529
|
+
pdaTokenType: types_1.TokenType.ATA,
|
|
1530
|
+
});
|
|
1531
|
+
instructions.push(initAndDepositIx);
|
|
1532
|
+
labels.push('init');
|
|
1533
|
+
// Layers 1+ : deposit-only via addLiquidityByStrategy2Automation
|
|
1534
|
+
const { binId: activeId } = yield dlmmPool.dlmm.getActiveBin();
|
|
1535
|
+
const effectiveActiveId = (_c = params.targetActiveBin) !== null && _c !== void 0 ? _c : activeId;
|
|
1536
|
+
const absLower = effectiveActiveId + params.relativeBinRange.lowerRange;
|
|
1537
|
+
const absUpper = effectiveActiveId + params.relativeBinRange.upperRange;
|
|
1538
|
+
for (let i = 1; i < layers.length; i++) {
|
|
1539
|
+
const layer = layers[i];
|
|
1540
|
+
const { optionalTokenXAmount, optionalTokenYAmount } = computeAmounts(layer, i);
|
|
1541
|
+
const strategyType = types_3.StrategyTypeMap[layer.distribution];
|
|
1542
|
+
const depositIx = yield this.ix.meteoraDlmm.addLiquidityByStrategy2Automation(connection, {
|
|
1543
|
+
userWallet: params.userWallet,
|
|
1544
|
+
lbPair,
|
|
1545
|
+
position: params.newPosition,
|
|
1546
|
+
tokenXMint, tokenYMint, tokenXProgram, tokenYProgram,
|
|
1547
|
+
activeId: effectiveActiveId,
|
|
1548
|
+
maxActiveBinSlippage: 0,
|
|
1549
|
+
strategyParametersMinBinId: absLower,
|
|
1550
|
+
strategyParametersMaxBinId: absUpper,
|
|
1551
|
+
strategyParametersStrategyType: strategyType,
|
|
1552
|
+
strategyParametersParameters: new Array(64).fill(0),
|
|
1553
|
+
userTokenXAmount: optionalTokenXAmount,
|
|
1554
|
+
userTokenYAmount: optionalTokenYAmount,
|
|
1555
|
+
remainingAccountsInfo,
|
|
1556
|
+
pdaTokenType: types_1.TokenType.ATA,
|
|
1557
|
+
});
|
|
1558
|
+
instructions.push(depositIx);
|
|
1559
|
+
labels.push('deposit');
|
|
1560
|
+
}
|
|
1561
|
+
return { instructions, labels };
|
|
1562
|
+
}
|
|
1563
|
+
catch (error) {
|
|
1564
|
+
console.error('=== REBALANCE AUTOMATION IX3 ERROR ===');
|
|
1565
|
+
console.error('Error type:', error instanceof Error ? error.constructor.name : typeof error);
|
|
1566
|
+
console.error('Error message:', error instanceof Error ? error.message : String(error));
|
|
1567
|
+
console.error('Error stack:', error instanceof Error ? error.stack : 'No stack trace');
|
|
1568
|
+
console.error('Full error object:', error);
|
|
1569
|
+
console.error('=== END ERROR LOG ===');
|
|
1570
|
+
throw error;
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1361
1574
|
/**
|
|
1362
1575
|
* Rebalance a Meteora DLMM position with support for larger positions.
|
|
1363
1576
|
*
|
|
@@ -3932,259 +4145,6 @@ class Transactions {
|
|
|
3932
4145
|
});
|
|
3933
4146
|
});
|
|
3934
4147
|
}
|
|
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: LauncherPda (per-launcher, derived from authority)
|
|
3943
|
-
* - Operator: LauncherPda (same as owner)
|
|
3944
|
-
*
|
|
3945
|
-
* The position is "locked" because only the Hatch program can sign for LauncherPda via CPI.
|
|
3946
|
-
* Tokens are transferred from authority's ATAs to LauncherPda's ATAs before deposit.
|
|
3947
|
-
*
|
|
3948
|
-
* Similar to meteoraCreatePoolAndPosition but uses Hatch program for locked positions.
|
|
3949
|
-
*
|
|
3950
|
-
* @param connection The Solana web3 connection object
|
|
3951
|
-
* @param params Parameters for creating the pool and locked position
|
|
3952
|
-
* @returns TransactionMetadataResponse
|
|
3953
|
-
*/
|
|
3954
|
-
hatchCreatePoolAndLockedPosition(_a) {
|
|
3955
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
3956
|
-
var _b, _c;
|
|
3957
|
-
// Get token programs - use provided or fetch from chain
|
|
3958
|
-
const validOwners = [
|
|
3959
|
-
addresses_1.TOKEN_PROGRAM_ID.toString(),
|
|
3960
|
-
addresses_1.TOKEN_2022_PROGRAM_ID.toString(),
|
|
3961
|
-
];
|
|
3962
|
-
let tokenProgramX;
|
|
3963
|
-
let tokenProgramY;
|
|
3964
|
-
if (params.tokenProgramX && params.tokenProgramY) {
|
|
3965
|
-
tokenProgramX = params.tokenProgramX;
|
|
3966
|
-
tokenProgramY = params.tokenProgramY;
|
|
3967
|
-
}
|
|
3968
|
-
else if (!params.tokenProgramX && !params.tokenProgramY) {
|
|
3969
|
-
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, [
|
|
3970
|
-
params.tokenMintX,
|
|
3971
|
-
params.tokenMintY,
|
|
3972
|
-
]);
|
|
3973
|
-
tokenProgramX = tokenProgramMap[params.tokenMintX.toString()];
|
|
3974
|
-
tokenProgramY = tokenProgramMap[params.tokenMintY.toString()];
|
|
3975
|
-
}
|
|
3976
|
-
else {
|
|
3977
|
-
const missingMints = [];
|
|
3978
|
-
if (!params.tokenProgramX)
|
|
3979
|
-
missingMints.push(params.tokenMintX);
|
|
3980
|
-
if (!params.tokenProgramY)
|
|
3981
|
-
missingMints.push(params.tokenMintY);
|
|
3982
|
-
const tokenProgramMap = yield (0, functions_1.getTokenProgramMapForMints)(connection, missingMints);
|
|
3983
|
-
tokenProgramX =
|
|
3984
|
-
(_b = params.tokenProgramX) !== null && _b !== void 0 ? _b : tokenProgramMap[params.tokenMintX.toString()];
|
|
3985
|
-
tokenProgramY =
|
|
3986
|
-
(_c = params.tokenProgramY) !== null && _c !== void 0 ? _c : tokenProgramMap[params.tokenMintY.toString()];
|
|
3987
|
-
}
|
|
3988
|
-
// Validate token programs
|
|
3989
|
-
if (!validOwners.includes(tokenProgramX.toString())) {
|
|
3990
|
-
throw new errors_1.AppError(`tokenMintX: ${params.tokenMintX.toString()} is not a valid token mint. Program owner: ${tokenProgramX.toString()}`, 'hatchCreatePoolAndLockedPosition');
|
|
3991
|
-
}
|
|
3992
|
-
if (!validOwners.includes(tokenProgramY.toString())) {
|
|
3993
|
-
throw new errors_1.AppError(`tokenMintY: ${params.tokenMintY.toString()} is not a valid token mint. Program owner: ${tokenProgramY.toString()}`, 'hatchCreatePoolAndLockedPosition');
|
|
3994
|
-
}
|
|
3995
|
-
// Check if LauncherPda exists, if not prepend initialization instruction
|
|
3996
|
-
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.authority);
|
|
3997
|
-
const launcherPdaInfo = yield connection.getAccountInfo(launcherPda);
|
|
3998
|
-
const initLauncherPdaIxs = [];
|
|
3999
|
-
if (!launcherPdaInfo) {
|
|
4000
|
-
// LauncherPda doesn't exist, need to initialize it first
|
|
4001
|
-
initLauncherPdaIxs.push(this.ix.hatch.initializeLauncherPda({ authority: params.authority }));
|
|
4002
|
-
}
|
|
4003
|
-
// Derive ATAs for authority and LauncherPda
|
|
4004
|
-
const authorityTokenX = (0, functions_1.generateAta)(params.authority, params.tokenMintX, tokenProgramX);
|
|
4005
|
-
const authorityTokenY = (0, functions_1.generateAta)(params.authority, params.tokenMintY, tokenProgramY);
|
|
4006
|
-
const launcherPdaTokenX = (0, functions_1.generateAta)(launcherPda, params.tokenMintX, tokenProgramX);
|
|
4007
|
-
const launcherPdaTokenY = (0, functions_1.generateAta)(launcherPda, params.tokenMintY, tokenProgramY);
|
|
4008
|
-
// Create ATA init instructions if needed (for authority and LauncherPda)
|
|
4009
|
-
// LauncherPda's ATAs are required because position owner must own the token accounts
|
|
4010
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4011
|
-
accounts: [
|
|
4012
|
-
// Authority's ATAs (source of tokens)
|
|
4013
|
-
{
|
|
4014
|
-
owner: params.authority,
|
|
4015
|
-
payer: params.authority,
|
|
4016
|
-
mint: params.tokenMintX,
|
|
4017
|
-
programId: tokenProgramX,
|
|
4018
|
-
},
|
|
4019
|
-
{
|
|
4020
|
-
owner: params.authority,
|
|
4021
|
-
payer: params.authority,
|
|
4022
|
-
mint: params.tokenMintY,
|
|
4023
|
-
programId: tokenProgramY,
|
|
4024
|
-
},
|
|
4025
|
-
// LauncherPda's ATAs (position owner must own token accounts for deposit)
|
|
4026
|
-
{
|
|
4027
|
-
owner: launcherPda,
|
|
4028
|
-
payer: params.authority,
|
|
4029
|
-
mint: params.tokenMintX,
|
|
4030
|
-
programId: tokenProgramX,
|
|
4031
|
-
},
|
|
4032
|
-
{
|
|
4033
|
-
owner: launcherPda,
|
|
4034
|
-
payer: params.authority,
|
|
4035
|
-
mint: params.tokenMintY,
|
|
4036
|
-
programId: tokenProgramY,
|
|
4037
|
-
},
|
|
4038
|
-
],
|
|
4039
|
-
});
|
|
4040
|
-
// Build token transfer instructions (authority -> LauncherPda)
|
|
4041
|
-
// These must happen BEFORE the Hatch instruction which deposits from LauncherPda's ATAs
|
|
4042
|
-
const transferIxs = [];
|
|
4043
|
-
if (!params.amountX.isZero()) {
|
|
4044
|
-
transferIxs.push((0, spl_token_1.createTransferInstruction)(authorityTokenX, launcherPdaTokenX, params.authority, BigInt(params.amountX.toString()), [], tokenProgramX));
|
|
4045
|
-
}
|
|
4046
|
-
if (!params.amountY.isZero()) {
|
|
4047
|
-
transferIxs.push((0, spl_token_1.createTransferInstruction)(authorityTokenY, launcherPdaTokenY, params.authority, BigInt(params.amountY.toString()), [], tokenProgramY));
|
|
4048
|
-
}
|
|
4049
|
-
// Wrap SOL if needed (for authority's ATAs)
|
|
4050
|
-
const wrapSolIxs = (0, functions_1.wrapSolIfMintIsWsol)(params.authority, params.authority, [
|
|
4051
|
-
{ mint: params.tokenMintX, amount: params.amountX },
|
|
4052
|
-
{ mint: params.tokenMintY, amount: params.amountY },
|
|
4053
|
-
]);
|
|
4054
|
-
// Create pool and locked position via Hatch
|
|
4055
|
-
// Note: position is now a keypair (signer), not a derived PDA
|
|
4056
|
-
const createPoolIx = yield this.ix.hatch.createPoolAndLockedPosition({
|
|
4057
|
-
connection,
|
|
4058
|
-
authority: params.authority,
|
|
4059
|
-
position: params.position,
|
|
4060
|
-
presetParameter: params.presetParameter,
|
|
4061
|
-
tokenMintX: params.tokenMintX,
|
|
4062
|
-
tokenMintY: params.tokenMintY,
|
|
4063
|
-
tokenProgramX,
|
|
4064
|
-
tokenProgramY,
|
|
4065
|
-
activeId: params.activeId,
|
|
4066
|
-
lowerBinId: params.lowerBinId,
|
|
4067
|
-
upperBinId: params.upperBinId,
|
|
4068
|
-
strategyType: params.strategyType,
|
|
4069
|
-
amountX: params.amountX,
|
|
4070
|
-
amountY: params.amountY,
|
|
4071
|
-
});
|
|
4072
|
-
// Instruction order:
|
|
4073
|
-
// 1. Initialize LauncherPda (if needed)
|
|
4074
|
-
// 2. Initialize ATAs (authority + LauncherPda)
|
|
4075
|
-
// 3. Wrap SOL (if needed)
|
|
4076
|
-
// 4. Transfer tokens from authority to LauncherPda
|
|
4077
|
-
// 5. Create pool and locked position (deposits from LauncherPda's ATAs)
|
|
4078
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4079
|
-
payer: params.authority,
|
|
4080
|
-
description: 'Create pool and locked position via Hatch',
|
|
4081
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4082
|
-
mainInstructions: [
|
|
4083
|
-
...initLauncherPdaIxs,
|
|
4084
|
-
...initAtaIxs,
|
|
4085
|
-
...wrapSolIxs,
|
|
4086
|
-
...transferIxs,
|
|
4087
|
-
createPoolIx,
|
|
4088
|
-
],
|
|
4089
|
-
});
|
|
4090
|
-
});
|
|
4091
|
-
}
|
|
4092
|
-
/**
|
|
4093
|
-
* Claim trading fees from a Hatch position.
|
|
4094
|
-
*
|
|
4095
|
-
* Only the rebalance authority can call this (automation).
|
|
4096
|
-
* Fees go to LauncherPda-owned token accounts, with 8% to treasury.
|
|
4097
|
-
*
|
|
4098
|
-
* @param connection The Solana web3 connection object
|
|
4099
|
-
* @param params Parameters for claiming fees
|
|
4100
|
-
* @returns TransactionMetadataResponse
|
|
4101
|
-
*/
|
|
4102
|
-
hatchClaimFee(_a) {
|
|
4103
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4104
|
-
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4105
|
-
// Create ATA init instructions for LauncherPda-owned accounts
|
|
4106
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4107
|
-
accounts: [
|
|
4108
|
-
{
|
|
4109
|
-
owner: launcherPda,
|
|
4110
|
-
payer: params.rebalanceAuthority,
|
|
4111
|
-
mint: params.tokenMintX,
|
|
4112
|
-
programId: params.tokenProgramX,
|
|
4113
|
-
},
|
|
4114
|
-
{
|
|
4115
|
-
owner: launcherPda,
|
|
4116
|
-
payer: params.rebalanceAuthority,
|
|
4117
|
-
mint: params.tokenMintY,
|
|
4118
|
-
programId: params.tokenProgramY,
|
|
4119
|
-
},
|
|
4120
|
-
],
|
|
4121
|
-
});
|
|
4122
|
-
const claimFeeIx = yield this.ix.hatch.claimFee({
|
|
4123
|
-
connection,
|
|
4124
|
-
rebalanceAuthority: params.rebalanceAuthority,
|
|
4125
|
-
launcherAuthority: params.launcherAuthority,
|
|
4126
|
-
position: params.position,
|
|
4127
|
-
lbPair: params.lbPair,
|
|
4128
|
-
minBinId: params.minBinId,
|
|
4129
|
-
maxBinId: params.maxBinId,
|
|
4130
|
-
tokenMintX: params.tokenMintX,
|
|
4131
|
-
tokenMintY: params.tokenMintY,
|
|
4132
|
-
tokenProgramX: params.tokenProgramX,
|
|
4133
|
-
tokenProgramY: params.tokenProgramY,
|
|
4134
|
-
});
|
|
4135
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4136
|
-
payer: params.rebalanceAuthority,
|
|
4137
|
-
description: 'Claim fees from Hatch position',
|
|
4138
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4139
|
-
mainInstructions: [...initAtaIxs, claimFeeIx],
|
|
4140
|
-
});
|
|
4141
|
-
});
|
|
4142
|
-
}
|
|
4143
|
-
/**
|
|
4144
|
-
* Claim farming rewards from a Hatch position.
|
|
4145
|
-
*
|
|
4146
|
-
* Only the rebalance authority can call this (automation).
|
|
4147
|
-
* Rewards go to LauncherPda-owned token account, with 8% to treasury.
|
|
4148
|
-
*
|
|
4149
|
-
* @param connection The Solana web3 connection object
|
|
4150
|
-
* @param params Parameters for claiming rewards
|
|
4151
|
-
* @returns TransactionMetadataResponse
|
|
4152
|
-
*/
|
|
4153
|
-
hatchClaimReward(_a) {
|
|
4154
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
4155
|
-
const launcherPda = this.ix.pda.hatch.deriveLauncherPda(params.launcherAuthority);
|
|
4156
|
-
// Create ATA init instruction for LauncherPda-owned account
|
|
4157
|
-
const initAtaIxs = (0, functions_1.createAtaIdempotentIxs)({
|
|
4158
|
-
accounts: [
|
|
4159
|
-
{
|
|
4160
|
-
owner: launcherPda,
|
|
4161
|
-
payer: params.rebalanceAuthority,
|
|
4162
|
-
mint: params.rewardMint,
|
|
4163
|
-
programId: params.tokenProgram,
|
|
4164
|
-
},
|
|
4165
|
-
],
|
|
4166
|
-
});
|
|
4167
|
-
const claimRewardIx = yield this.ix.hatch.claimReward({
|
|
4168
|
-
connection,
|
|
4169
|
-
rebalanceAuthority: params.rebalanceAuthority,
|
|
4170
|
-
launcherAuthority: params.launcherAuthority,
|
|
4171
|
-
position: params.position,
|
|
4172
|
-
lbPair: params.lbPair,
|
|
4173
|
-
rewardIndex: params.rewardIndex,
|
|
4174
|
-
minBinId: params.minBinId,
|
|
4175
|
-
maxBinId: params.maxBinId,
|
|
4176
|
-
rewardMint: params.rewardMint,
|
|
4177
|
-
rewardVault: params.rewardVault,
|
|
4178
|
-
tokenProgram: params.tokenProgram,
|
|
4179
|
-
});
|
|
4180
|
-
return (0, functions_1.createTransactionMeta)({
|
|
4181
|
-
payer: params.rebalanceAuthority,
|
|
4182
|
-
description: 'Claim rewards from Hatch position',
|
|
4183
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
4184
|
-
mainInstructions: [...initAtaIxs, claimRewardIx],
|
|
4185
|
-
});
|
|
4186
|
-
});
|
|
4187
|
-
}
|
|
4188
4148
|
}
|
|
4189
4149
|
exports.Transactions = Transactions;
|
|
4190
4150
|
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,20 +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
348
|
}
|
|
363
349
|
export {};
|
|
364
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,EACT,+BAA+B,EAE/B,4BAA4B,EAC5B,0B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C,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,57 +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
1834
|
}
|
|
1887
1835
|
exports.TxGenerator = TxGenerator;
|