@hawksightco/hawk-sdk 1.2.11 → 1.2.12
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/classes/Transactions.d.ts +2 -0
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +65 -0
- package/dist/src/classes/TxGeneratorAutomations.d.ts +23 -1
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +74 -0
- package/package.json +1 -1
|
@@ -149,6 +149,8 @@ export declare class Transactions {
|
|
|
149
149
|
claimAutomationIx({ connection, params, }: TxgenParams<MeteoraCompound>): Promise<TransactionMetadataResponse>;
|
|
150
150
|
rebalanceAutomationIx({ connection, params, }: TxgenParams<MeteoraRebalance>): Promise<TransactionMetadataResponse>;
|
|
151
151
|
rebalanceAutomationIx2({ connection, params, }: TxgenParams<MeteoraRebalance2>): Promise<TransactionMetadataResponse>;
|
|
152
|
+
openAutomationIx({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDeposit>): Promise<TransactionMetadataResponse>;
|
|
153
|
+
closeAutomationIx({ connection, params, }: TxgenParams<MeteoraClose>): Promise<TransactionMetadataResponse>;
|
|
152
154
|
limitCloseAutomationIx({ connection, params, }: TxgenParams<MeteoraLimitCloseAutomation>): Promise<TransactionMetadataResponse>;
|
|
153
155
|
private removeLiquidityByRangeInfo;
|
|
154
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,6BA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AAE,WAAW,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA0LpE;;;;;;;OAOG;IACG,YAAY,CAAC,EACjB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA0GnE;;;;;;;OAOG;IACG,eAAe,CAAC,EACpB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAmOnE;;;;;;;OAOG;IACG,gBAAgB,CAAC,EACrB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA8IvE;;;;;;OAMG;IACG,mBAAmB,CAAC,EACxB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAyB1E;;;;;;OAMG;IACG,oBAAoB,CAAC,EACzB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAiB3E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA6B/E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAiChF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -836,6 +836,71 @@ class Transactions {
|
|
|
836
836
|
});
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
|
+
openAutomationIx(_a) {
|
|
840
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
841
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, params.pool);
|
|
842
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
843
|
+
// Open new position
|
|
844
|
+
const initPositionAndAddLiquidityBuilder = yield dlmmPool.initializePositionAndAddLiquidityByStrategy(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
845
|
+
positionPubKey: params.position,
|
|
846
|
+
user: userPda,
|
|
847
|
+
totalXAmount: new bn_js_1.default(100000), // This is overriden on-chain, so value here do not matter
|
|
848
|
+
totalYAmount: new bn_js_1.default(100000), // This is overriden on-chain, so value here do not matter
|
|
849
|
+
strategy: {
|
|
850
|
+
maxBinId: params.binRange.upperRange,
|
|
851
|
+
minBinId: params.binRange.lowerRange,
|
|
852
|
+
strategyType: types_1.StrategyTypeMap[params.distribution],
|
|
853
|
+
},
|
|
854
|
+
skipInputTokenCheck: true, // Rebalance should be independent of user wallet TA
|
|
855
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
856
|
+
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
857
|
+
const mainInstructions = [
|
|
858
|
+
...initPositionAndAddLiquidityBuilder.mainIxs,
|
|
859
|
+
];
|
|
860
|
+
return (0, functions_1.createTransactionMeta)({
|
|
861
|
+
payer: params.userWallet,
|
|
862
|
+
description: "Automation IX: Meteora Open instruction (Open position)",
|
|
863
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
864
|
+
mainInstructions,
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
closeAutomationIx(_a) {
|
|
869
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
870
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
871
|
+
const position = yield program.account.positionV2.fetch(params.position);
|
|
872
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, position.lbPair);
|
|
873
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
874
|
+
// Claim all fees/rewards, remove all liquidity and close current position
|
|
875
|
+
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
876
|
+
const userPosition = userPositions.find((userPosition) => userPosition.publicKey.equals(params.position));
|
|
877
|
+
if (userPosition === undefined) {
|
|
878
|
+
throw new Error(`Position: ${params.position} does not exist.`);
|
|
879
|
+
}
|
|
880
|
+
const binIdsToRemove = userPosition.positionData.positionBinData.map((bin) => bin.binId);
|
|
881
|
+
const removeLiquidityBuilder = yield dlmmPool.removeLiquidity(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
882
|
+
user: userPda,
|
|
883
|
+
position: params.position,
|
|
884
|
+
binIds: binIdsToRemove,
|
|
885
|
+
bps: new bn_js_1.default(10000),
|
|
886
|
+
shouldClaimAndClose: true,
|
|
887
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
888
|
+
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
889
|
+
// Plain Close automation defaults to STA for claim fees and rewards
|
|
890
|
+
removeLiquidityBuilder.replaceClaimFeeTokenToSTA();
|
|
891
|
+
removeLiquidityBuilder.replaceClaimRewardToSTA();
|
|
892
|
+
const mainInstructions = [
|
|
893
|
+
// Remove liquidity
|
|
894
|
+
...removeLiquidityBuilder.mainIxs,
|
|
895
|
+
];
|
|
896
|
+
return (0, functions_1.createTransactionMeta)({
|
|
897
|
+
payer: params.userWallet,
|
|
898
|
+
description: "Automation IX: Meteora Close instruction (Close position)",
|
|
899
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
900
|
+
mainInstructions,
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
}
|
|
839
904
|
limitCloseAutomationIx(_a) {
|
|
840
905
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
841
906
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { MeteoraCompound, MeteoraLimitCloseAutomation, MeteoraRebalance, MeteoraRebalance2, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
3
|
+
import { MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraLimitCloseAutomation, MeteoraRebalance, MeteoraRebalance2, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
/**
|
|
@@ -82,5 +82,27 @@ export declare class TxGeneratorAutomations {
|
|
|
82
82
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
83
83
|
*/
|
|
84
84
|
meteoraLimitCloseIxs(connection: web3.Connection, payer: string, params: MeteoraLimitCloseAutomation): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates meteora close instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
87
|
+
*
|
|
88
|
+
* NOTE: For hawksight devs only.
|
|
89
|
+
*
|
|
90
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
91
|
+
* @param payer The public key of the payer for transaction fees.
|
|
92
|
+
* @param params Parameters required
|
|
93
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
94
|
+
*/
|
|
95
|
+
meteoraCloseIxs(connection: web3.Connection, payer: string, params: MeteoraClose): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
96
|
+
/**
|
|
97
|
+
* Creates meteora open instruction (open position)
|
|
98
|
+
*
|
|
99
|
+
* NOTE: For hawksight devs only.
|
|
100
|
+
*
|
|
101
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
102
|
+
* @param payer The public key of the payer for transaction fees.
|
|
103
|
+
* @param params Parameters required
|
|
104
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
105
|
+
*/
|
|
106
|
+
meteoraOpenIxs(connection: web3.Connection, payer: string, params: MeteoraCreatePositionAndDeposit): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
85
107
|
}
|
|
86
108
|
//# sourceMappingURL=TxGeneratorAutomations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;AACvP,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD;;;;;;GAMG;AACH,qBAAa,sBAAsB;IAkB/B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAjBjC;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC;IAE/C;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IAEjC;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc;IAMjD;;;;;;;;;OASG;IACG,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ratorAutomations {
|
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Creates meteora close instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
246
|
+
*
|
|
247
|
+
* NOTE: For hawksight devs only.
|
|
248
|
+
*
|
|
249
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
250
|
+
* @param payer The public key of the payer for transaction fees.
|
|
251
|
+
* @param params Parameters required
|
|
252
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
253
|
+
*/
|
|
254
|
+
meteoraCloseIxs(connection, payer, params) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
// Initialize anchor
|
|
257
|
+
anchor_1.Anchor.initialize(connection);
|
|
258
|
+
try {
|
|
259
|
+
const result = yield Transactions_1.txgen.closeAutomationIx({
|
|
260
|
+
connection,
|
|
261
|
+
params,
|
|
262
|
+
fetch: undefined,
|
|
263
|
+
});
|
|
264
|
+
return {
|
|
265
|
+
status: 200,
|
|
266
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
return {
|
|
271
|
+
status: 400,
|
|
272
|
+
data: {
|
|
273
|
+
code: "custom",
|
|
274
|
+
message: e,
|
|
275
|
+
path: [],
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Creates meteora open instruction (open position)
|
|
283
|
+
*
|
|
284
|
+
* NOTE: For hawksight devs only.
|
|
285
|
+
*
|
|
286
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
287
|
+
* @param payer The public key of the payer for transaction fees.
|
|
288
|
+
* @param params Parameters required
|
|
289
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
290
|
+
*/
|
|
291
|
+
meteoraOpenIxs(connection, payer, params) {
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
// Initialize anchor
|
|
294
|
+
anchor_1.Anchor.initialize(connection);
|
|
295
|
+
try {
|
|
296
|
+
const result = yield Transactions_1.txgen.openAutomationIx({
|
|
297
|
+
connection,
|
|
298
|
+
params,
|
|
299
|
+
fetch: undefined,
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
status: 200,
|
|
303
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
catch (e) {
|
|
307
|
+
return {
|
|
308
|
+
status: 400,
|
|
309
|
+
data: {
|
|
310
|
+
code: "custom",
|
|
311
|
+
message: e,
|
|
312
|
+
path: [],
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
244
318
|
}
|
|
245
319
|
exports.TxGeneratorAutomations = TxGeneratorAutomations;
|