@hawksightco/hawk-sdk 1.3.236 → 1.3.238
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 +8 -63
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +356 -726
- package/dist/src/classes/TxGeneratorAutomations.d.ts +7 -64
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +32 -203
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +46 -17
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +550 -186
- package/dist/src/types.d.ts +0 -39
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as web3 from
|
|
2
|
-
import * as _client from
|
|
3
|
-
import { MeteoraClose, MeteoraCompound, MeteoraRedeposit, MeteoraRedeposit2, MeteoraLimitCloseAutomation, MeteoraLimitCloseAutomation2,
|
|
4
|
-
import { Client } from
|
|
5
|
-
import { GeneralUtility } from
|
|
1
|
+
import * as web3 from '@solana/web3.js';
|
|
2
|
+
import * as _client from '@hawksightco/swagger-client';
|
|
3
|
+
import { MeteoraClose, MeteoraCompound, MeteoraRedeposit, MeteoraRedeposit2, MeteoraLimitCloseAutomation, MeteoraLimitCloseAutomation2, MeteoraRebalance2, OpenAutomationIx, RelativeOpenAutomationIx, ResponseWithStatus, TransactionMetadata, TransactionMetadataWithActions, MeteoraRebalanceForLargerPosition, MeteoraRebalanceHybridLiquidity, MeteoraRedepositHybridLiquidity } from '../types';
|
|
4
|
+
import { Client } from './Client';
|
|
5
|
+
import { GeneralUtility } from './GeneralUtility';
|
|
6
6
|
/**
|
|
7
7
|
* The `TxGeneratorAutomations` class encapsulates methods to generate transactions with various trading operations
|
|
8
8
|
* on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
|
|
@@ -91,19 +91,6 @@ export declare class TxGeneratorAutomations {
|
|
|
91
91
|
* @returns A ResponseWithStatus containing an array of TransactionMetadata.
|
|
92
92
|
*/
|
|
93
93
|
meteoraClaimFromLargePositionIxs(connection: web3.Connection, payer: string, params: MeteoraCompound): Promise<ResponseWithStatus<TransactionMetadata[]>>;
|
|
94
|
-
/**
|
|
95
|
-
* Creates meteora auto-rebalance instruction
|
|
96
|
-
*
|
|
97
|
-
* @deprecated Use meteoraRebalanceLargePositionAutomation instead
|
|
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
|
-
meteoraRebalanceIxs(connection: web3.Connection, payer: string, params: MeteoraRebalance): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
107
94
|
/**
|
|
108
95
|
* Creates meteora auto-rebalance instruction (uses new re-deposit instruction)
|
|
109
96
|
*
|
|
@@ -118,38 +105,6 @@ export declare class TxGeneratorAutomations {
|
|
|
118
105
|
*/
|
|
119
106
|
meteoraRebalanceIxs2(connection: web3.Connection, payer: string, params: MeteoraRebalance2): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
120
107
|
meteoraRedepositForLargePositionIxs(connection: web3.Connection, payer: string, params: MeteoraRedeposit): Promise<ResponseWithStatus<TransactionMetadata[]>>;
|
|
121
|
-
/**
|
|
122
|
-
* Creates meteora hybrid rebalance instructions with per-side distribution control.
|
|
123
|
-
*
|
|
124
|
-
* Supports simple mode (single distribution, same as Ixs2) and hybrid mode
|
|
125
|
-
* (multiple layers with different distributions per side).
|
|
126
|
-
*
|
|
127
|
-
* NOTE: For hawksight devs only.
|
|
128
|
-
*
|
|
129
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
130
|
-
* @param payer The public key of the payer for transaction fees.
|
|
131
|
-
* @param params Parameters required (MeteoraRebalance3)
|
|
132
|
-
* @returns A ResponseWithStatus containing an array of TransactionMetadata (1-2 transactions).
|
|
133
|
-
*/
|
|
134
|
-
meteoraRebalanceIxs3(connection: web3.Connection, payer: string, params: MeteoraRebalance3): Promise<ResponseWithStatus<LabeledInstructions>>;
|
|
135
|
-
/**
|
|
136
|
-
* Generates a single rebalanceLiquidityAutomation instruction for reshaping a Meteora DLMM position.
|
|
137
|
-
*
|
|
138
|
-
* This is a low-level building block that creates ONE instruction to:
|
|
139
|
-
* - Remove liquidity from specified bins (removeLiquidityParams)
|
|
140
|
-
* - Add liquidity to new bins (addLiquidityParams)
|
|
141
|
-
*
|
|
142
|
-
* Unlike meteoraRebalanceLargePositionAutomation2 which handles full position reshaping
|
|
143
|
-
* with chunking and multiple TXs, this function returns a single instruction that can
|
|
144
|
-
* be composed into custom transaction flows.
|
|
145
|
-
*
|
|
146
|
-
* NOTE: For hawksight devs only.
|
|
147
|
-
*
|
|
148
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
149
|
-
* @param params Reshape parameters including position, bin ranges, and liquidity params
|
|
150
|
-
* @returns A ResponseWithStatus containing LabeledInstructions with single 'rebalance_liquidity' instruction
|
|
151
|
-
*/
|
|
152
|
-
meteoraReshapePositionAutomation(connection: web3.Connection, params: MeteoraReshapePositionAutomationParams): Promise<ResponseWithStatus<LabeledInstructions>>;
|
|
153
108
|
/**
|
|
154
109
|
* Rebalances a large Meteora DLMM position (up to 1400 bins) using automation instructions.
|
|
155
110
|
*
|
|
@@ -219,19 +174,7 @@ export declare class TxGeneratorAutomations {
|
|
|
219
174
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
220
175
|
*/
|
|
221
176
|
meteoraRelativeOpenIxs(connection: web3.Connection, payer: string, params: RelativeOpenAutomationIx): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
* independent X/Y distributions per layer.
|
|
225
|
-
*
|
|
226
|
-
* NOTE: For hawksight devs only.
|
|
227
|
-
*/
|
|
228
|
-
meteoraRebalanceHybridLiquidityIxs(connection: web3.Connection, payer: string, params: MeteoraRebalanceHybridLiquidity): Promise<ResponseWithStatus<TransactionMetadataWithActions[]>>;
|
|
229
|
-
/**
|
|
230
|
-
* Hybrid liquidity redeposit: withdraw from position and re-deposit with
|
|
231
|
-
* independent X/Y distributions per layer, staying on the same position.
|
|
232
|
-
*
|
|
233
|
-
* NOTE: For hawksight devs only.
|
|
234
|
-
*/
|
|
235
|
-
meteoraRedepositHybridLiquidityIxs(connection: web3.Connection, payer: string, params: MeteoraRedepositHybridLiquidity): Promise<ResponseWithStatus<TransactionMetadataWithActions[]>>;
|
|
177
|
+
meteoraRebalanceHybridLiquidityIxsV2(connection: web3.Connection, payer: string, params: MeteoraRebalanceHybridLiquidity): Promise<ResponseWithStatus<TransactionMetadataWithActions[]>>;
|
|
178
|
+
meteoraRedepositHybridLiquidityIxsV2(connection: web3.Connection, payer: string, params: MeteoraRedepositHybridLiquidity): Promise<ResponseWithStatus<TransactionMetadataWithActions[]>>;
|
|
236
179
|
}
|
|
237
180
|
//# 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,
|
|
1
|
+
{"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,O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OASG;IACG,qBAAqB,CACzB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAyCnD;;;;;;;;;OASG;IACG,eAAe,CACnB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCnD;;;;;;;;;OASG;IACG,cAAc,CAClB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAyCnD;;;;;;;;;OASG;IACG,sBAAsB,CAC1B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAyC7C,oCAAoC,CACxC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,kBAAkB,CAAC,8BAA8B,EAAE,CAAC,CAAC;IA6C1D,oCAAoC,CACxC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,kBAAkB,CAAC,8BAA8B,EAAE,CAAC,CAAC;CA4CjE"}
|
|
@@ -98,7 +98,7 @@ class TxGeneratorAutomations {
|
|
|
98
98
|
return {
|
|
99
99
|
status: 400,
|
|
100
100
|
data: {
|
|
101
|
-
code:
|
|
101
|
+
code: 'custom',
|
|
102
102
|
message: errorMessage,
|
|
103
103
|
path: [],
|
|
104
104
|
},
|
|
@@ -145,7 +145,7 @@ class TxGeneratorAutomations {
|
|
|
145
145
|
return {
|
|
146
146
|
status: 400,
|
|
147
147
|
data: {
|
|
148
|
-
code:
|
|
148
|
+
code: 'custom',
|
|
149
149
|
message: e.message,
|
|
150
150
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
151
151
|
path: [],
|
|
@@ -155,7 +155,7 @@ class TxGeneratorAutomations {
|
|
|
155
155
|
return {
|
|
156
156
|
status: 400,
|
|
157
157
|
data: {
|
|
158
|
-
code:
|
|
158
|
+
code: 'custom',
|
|
159
159
|
message: e,
|
|
160
160
|
path: [],
|
|
161
161
|
},
|
|
@@ -195,7 +195,7 @@ class TxGeneratorAutomations {
|
|
|
195
195
|
return {
|
|
196
196
|
status: 400,
|
|
197
197
|
data: {
|
|
198
|
-
code:
|
|
198
|
+
code: 'custom',
|
|
199
199
|
message: errorMessage,
|
|
200
200
|
path: [],
|
|
201
201
|
},
|
|
@@ -223,7 +223,7 @@ class TxGeneratorAutomations {
|
|
|
223
223
|
return {
|
|
224
224
|
status: 400,
|
|
225
225
|
data: {
|
|
226
|
-
code:
|
|
226
|
+
code: 'custom',
|
|
227
227
|
message: errorMessage,
|
|
228
228
|
path: [],
|
|
229
229
|
},
|
|
@@ -264,7 +264,7 @@ class TxGeneratorAutomations {
|
|
|
264
264
|
return {
|
|
265
265
|
status: 400,
|
|
266
266
|
data: {
|
|
267
|
-
code:
|
|
267
|
+
code: 'custom',
|
|
268
268
|
message: e.message,
|
|
269
269
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
270
270
|
path: [],
|
|
@@ -274,7 +274,7 @@ class TxGeneratorAutomations {
|
|
|
274
274
|
return {
|
|
275
275
|
status: 400,
|
|
276
276
|
data: {
|
|
277
|
-
code:
|
|
277
|
+
code: 'custom',
|
|
278
278
|
message: e,
|
|
279
279
|
path: [],
|
|
280
280
|
},
|
|
@@ -321,7 +321,7 @@ class TxGeneratorAutomations {
|
|
|
321
321
|
return {
|
|
322
322
|
status: 400,
|
|
323
323
|
data: {
|
|
324
|
-
code:
|
|
324
|
+
code: 'custom',
|
|
325
325
|
message: e.message,
|
|
326
326
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
327
327
|
path: [],
|
|
@@ -331,58 +331,7 @@ class TxGeneratorAutomations {
|
|
|
331
331
|
return {
|
|
332
332
|
status: 400,
|
|
333
333
|
data: {
|
|
334
|
-
code:
|
|
335
|
-
message: e,
|
|
336
|
-
path: [],
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Creates meteora auto-rebalance instruction
|
|
344
|
-
*
|
|
345
|
-
* @deprecated Use meteoraRebalanceLargePositionAutomation instead
|
|
346
|
-
*
|
|
347
|
-
* NOTE: For hawksight devs only.
|
|
348
|
-
*
|
|
349
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
350
|
-
* @param payer The public key of the payer for transaction fees.
|
|
351
|
-
* @param params Parameters required
|
|
352
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
353
|
-
*/
|
|
354
|
-
meteoraRebalanceIxs(connection, payer, params) {
|
|
355
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
356
|
-
var _a;
|
|
357
|
-
// Initialize anchor
|
|
358
|
-
anchor_1.Anchor.initialize(connection);
|
|
359
|
-
try {
|
|
360
|
-
const result = yield Transactions_1.txgen.rebalanceAutomationIx({
|
|
361
|
-
connection,
|
|
362
|
-
params,
|
|
363
|
-
fetch: undefined,
|
|
364
|
-
});
|
|
365
|
-
return {
|
|
366
|
-
status: 200,
|
|
367
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
catch (e) {
|
|
371
|
-
if (e instanceof Error) {
|
|
372
|
-
return {
|
|
373
|
-
status: 400,
|
|
374
|
-
data: {
|
|
375
|
-
code: "custom",
|
|
376
|
-
message: e.message,
|
|
377
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
378
|
-
path: [],
|
|
379
|
-
},
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
status: 400,
|
|
384
|
-
data: {
|
|
385
|
-
code: "custom",
|
|
334
|
+
code: 'custom',
|
|
386
335
|
message: e,
|
|
387
336
|
path: [],
|
|
388
337
|
},
|
|
@@ -423,7 +372,7 @@ class TxGeneratorAutomations {
|
|
|
423
372
|
return {
|
|
424
373
|
status: 400,
|
|
425
374
|
data: {
|
|
426
|
-
code:
|
|
375
|
+
code: 'custom',
|
|
427
376
|
message: e.message,
|
|
428
377
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
429
378
|
path: [],
|
|
@@ -433,7 +382,7 @@ class TxGeneratorAutomations {
|
|
|
433
382
|
return {
|
|
434
383
|
status: 400,
|
|
435
384
|
data: {
|
|
436
|
-
code:
|
|
385
|
+
code: 'custom',
|
|
437
386
|
message: e,
|
|
438
387
|
path: [],
|
|
439
388
|
},
|
|
@@ -466,59 +415,7 @@ class TxGeneratorAutomations {
|
|
|
466
415
|
return {
|
|
467
416
|
status: 400,
|
|
468
417
|
data: {
|
|
469
|
-
code:
|
|
470
|
-
message: e.message,
|
|
471
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
472
|
-
path: [],
|
|
473
|
-
},
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
return {
|
|
477
|
-
status: 400,
|
|
478
|
-
data: {
|
|
479
|
-
code: "custom",
|
|
480
|
-
message: e,
|
|
481
|
-
path: [],
|
|
482
|
-
},
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Creates meteora hybrid rebalance instructions with per-side distribution control.
|
|
489
|
-
*
|
|
490
|
-
* Supports simple mode (single distribution, same as Ixs2) and hybrid mode
|
|
491
|
-
* (multiple layers with different distributions per side).
|
|
492
|
-
*
|
|
493
|
-
* NOTE: For hawksight devs only.
|
|
494
|
-
*
|
|
495
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
496
|
-
* @param payer The public key of the payer for transaction fees.
|
|
497
|
-
* @param params Parameters required (MeteoraRebalance3)
|
|
498
|
-
* @returns A ResponseWithStatus containing an array of TransactionMetadata (1-2 transactions).
|
|
499
|
-
*/
|
|
500
|
-
meteoraRebalanceIxs3(connection, payer, params) {
|
|
501
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
502
|
-
var _a;
|
|
503
|
-
// Initialize anchor
|
|
504
|
-
anchor_1.Anchor.initialize(connection);
|
|
505
|
-
try {
|
|
506
|
-
const result = yield Transactions_1.txgen.rebalanceAutomationIx3({
|
|
507
|
-
connection,
|
|
508
|
-
params,
|
|
509
|
-
fetch: undefined,
|
|
510
|
-
});
|
|
511
|
-
return {
|
|
512
|
-
status: 200,
|
|
513
|
-
data: result,
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
catch (e) {
|
|
517
|
-
if (e instanceof Error) {
|
|
518
|
-
return {
|
|
519
|
-
status: 400,
|
|
520
|
-
data: {
|
|
521
|
-
code: "custom",
|
|
418
|
+
code: 'custom',
|
|
522
419
|
message: e.message,
|
|
523
420
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
524
421
|
path: [],
|
|
@@ -528,63 +425,7 @@ class TxGeneratorAutomations {
|
|
|
528
425
|
return {
|
|
529
426
|
status: 400,
|
|
530
427
|
data: {
|
|
531
|
-
code:
|
|
532
|
-
message: e,
|
|
533
|
-
path: [],
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Generates a single rebalanceLiquidityAutomation instruction for reshaping a Meteora DLMM position.
|
|
541
|
-
*
|
|
542
|
-
* This is a low-level building block that creates ONE instruction to:
|
|
543
|
-
* - Remove liquidity from specified bins (removeLiquidityParams)
|
|
544
|
-
* - Add liquidity to new bins (addLiquidityParams)
|
|
545
|
-
*
|
|
546
|
-
* Unlike meteoraRebalanceLargePositionAutomation2 which handles full position reshaping
|
|
547
|
-
* with chunking and multiple TXs, this function returns a single instruction that can
|
|
548
|
-
* be composed into custom transaction flows.
|
|
549
|
-
*
|
|
550
|
-
* NOTE: For hawksight devs only.
|
|
551
|
-
*
|
|
552
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
553
|
-
* @param params Reshape parameters including position, bin ranges, and liquidity params
|
|
554
|
-
* @returns A ResponseWithStatus containing LabeledInstructions with single 'rebalance_liquidity' instruction
|
|
555
|
-
*/
|
|
556
|
-
meteoraReshapePositionAutomation(connection, params) {
|
|
557
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
-
var _a;
|
|
559
|
-
// Initialize anchor
|
|
560
|
-
anchor_1.Anchor.initialize(connection);
|
|
561
|
-
try {
|
|
562
|
-
const result = yield Transactions_1.txgen.meteoraReshapePositionAutomation({
|
|
563
|
-
connection,
|
|
564
|
-
params,
|
|
565
|
-
fetch: undefined,
|
|
566
|
-
});
|
|
567
|
-
return {
|
|
568
|
-
status: 200,
|
|
569
|
-
data: result,
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
catch (e) {
|
|
573
|
-
if (e instanceof Error) {
|
|
574
|
-
return {
|
|
575
|
-
status: 400,
|
|
576
|
-
data: {
|
|
577
|
-
code: "custom",
|
|
578
|
-
message: e.message,
|
|
579
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
580
|
-
path: [],
|
|
581
|
-
},
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return {
|
|
585
|
-
status: 400,
|
|
586
|
-
data: {
|
|
587
|
-
code: "custom",
|
|
428
|
+
code: 'custom',
|
|
588
429
|
message: e,
|
|
589
430
|
path: [],
|
|
590
431
|
},
|
|
@@ -631,7 +472,7 @@ class TxGeneratorAutomations {
|
|
|
631
472
|
return {
|
|
632
473
|
status: 400,
|
|
633
474
|
data: {
|
|
634
|
-
code:
|
|
475
|
+
code: 'custom',
|
|
635
476
|
message: e.message,
|
|
636
477
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
637
478
|
path: [],
|
|
@@ -641,7 +482,7 @@ class TxGeneratorAutomations {
|
|
|
641
482
|
return {
|
|
642
483
|
status: 400,
|
|
643
484
|
data: {
|
|
644
|
-
code:
|
|
485
|
+
code: 'custom',
|
|
645
486
|
message: e,
|
|
646
487
|
path: [],
|
|
647
488
|
},
|
|
@@ -680,7 +521,7 @@ class TxGeneratorAutomations {
|
|
|
680
521
|
return {
|
|
681
522
|
status: 400,
|
|
682
523
|
data: {
|
|
683
|
-
code:
|
|
524
|
+
code: 'custom',
|
|
684
525
|
message: e.message,
|
|
685
526
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
686
527
|
path: [],
|
|
@@ -690,7 +531,7 @@ class TxGeneratorAutomations {
|
|
|
690
531
|
return {
|
|
691
532
|
status: 400,
|
|
692
533
|
data: {
|
|
693
|
-
code:
|
|
534
|
+
code: 'custom',
|
|
694
535
|
message: e,
|
|
695
536
|
path: [],
|
|
696
537
|
},
|
|
@@ -729,7 +570,7 @@ class TxGeneratorAutomations {
|
|
|
729
570
|
return {
|
|
730
571
|
status: 400,
|
|
731
572
|
data: {
|
|
732
|
-
code:
|
|
573
|
+
code: 'custom',
|
|
733
574
|
message: e.message,
|
|
734
575
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
735
576
|
path: [],
|
|
@@ -739,7 +580,7 @@ class TxGeneratorAutomations {
|
|
|
739
580
|
return {
|
|
740
581
|
status: 400,
|
|
741
582
|
data: {
|
|
742
|
-
code:
|
|
583
|
+
code: 'custom',
|
|
743
584
|
message: e,
|
|
744
585
|
path: [],
|
|
745
586
|
},
|
|
@@ -779,7 +620,7 @@ class TxGeneratorAutomations {
|
|
|
779
620
|
return {
|
|
780
621
|
status: 400,
|
|
781
622
|
data: {
|
|
782
|
-
code:
|
|
623
|
+
code: 'custom',
|
|
783
624
|
message: errorMessage,
|
|
784
625
|
path: [],
|
|
785
626
|
},
|
|
@@ -818,7 +659,7 @@ class TxGeneratorAutomations {
|
|
|
818
659
|
return {
|
|
819
660
|
status: 400,
|
|
820
661
|
data: {
|
|
821
|
-
code:
|
|
662
|
+
code: 'custom',
|
|
822
663
|
message: e.message,
|
|
823
664
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
824
665
|
path: [],
|
|
@@ -828,7 +669,7 @@ class TxGeneratorAutomations {
|
|
|
828
669
|
return {
|
|
829
670
|
status: 400,
|
|
830
671
|
data: {
|
|
831
|
-
code:
|
|
672
|
+
code: 'custom',
|
|
832
673
|
message: e,
|
|
833
674
|
path: [],
|
|
834
675
|
},
|
|
@@ -867,7 +708,7 @@ class TxGeneratorAutomations {
|
|
|
867
708
|
return {
|
|
868
709
|
status: 400,
|
|
869
710
|
data: {
|
|
870
|
-
code:
|
|
711
|
+
code: 'custom',
|
|
871
712
|
message: e.message,
|
|
872
713
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
873
714
|
path: [],
|
|
@@ -877,7 +718,7 @@ class TxGeneratorAutomations {
|
|
|
877
718
|
return {
|
|
878
719
|
status: 400,
|
|
879
720
|
data: {
|
|
880
|
-
code:
|
|
721
|
+
code: 'custom',
|
|
881
722
|
message: e,
|
|
882
723
|
path: [],
|
|
883
724
|
},
|
|
@@ -885,18 +726,12 @@ class TxGeneratorAutomations {
|
|
|
885
726
|
}
|
|
886
727
|
});
|
|
887
728
|
}
|
|
888
|
-
|
|
889
|
-
* Hybrid liquidity rebalance: teardown old position and rebuild with
|
|
890
|
-
* independent X/Y distributions per layer.
|
|
891
|
-
*
|
|
892
|
-
* NOTE: For hawksight devs only.
|
|
893
|
-
*/
|
|
894
|
-
meteoraRebalanceHybridLiquidityIxs(connection, payer, params) {
|
|
729
|
+
meteoraRebalanceHybridLiquidityIxsV2(connection, payer, params) {
|
|
895
730
|
return __awaiter(this, void 0, void 0, function* () {
|
|
896
731
|
var _a;
|
|
897
732
|
anchor_1.Anchor.initialize(connection);
|
|
898
733
|
try {
|
|
899
|
-
const results = yield Transactions_1.txgen.
|
|
734
|
+
const results = yield Transactions_1.txgen.meteoraRebalanceHybridLiquidityV2Automation({
|
|
900
735
|
connection,
|
|
901
736
|
params,
|
|
902
737
|
fetch: undefined,
|
|
@@ -916,7 +751,7 @@ class TxGeneratorAutomations {
|
|
|
916
751
|
return {
|
|
917
752
|
status: 400,
|
|
918
753
|
data: {
|
|
919
|
-
code:
|
|
754
|
+
code: 'custom',
|
|
920
755
|
message: e.message,
|
|
921
756
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
922
757
|
path: [],
|
|
@@ -926,7 +761,7 @@ class TxGeneratorAutomations {
|
|
|
926
761
|
return {
|
|
927
762
|
status: 400,
|
|
928
763
|
data: {
|
|
929
|
-
code:
|
|
764
|
+
code: 'custom',
|
|
930
765
|
message: e,
|
|
931
766
|
path: [],
|
|
932
767
|
},
|
|
@@ -934,18 +769,12 @@ class TxGeneratorAutomations {
|
|
|
934
769
|
}
|
|
935
770
|
});
|
|
936
771
|
}
|
|
937
|
-
|
|
938
|
-
* Hybrid liquidity redeposit: withdraw from position and re-deposit with
|
|
939
|
-
* independent X/Y distributions per layer, staying on the same position.
|
|
940
|
-
*
|
|
941
|
-
* NOTE: For hawksight devs only.
|
|
942
|
-
*/
|
|
943
|
-
meteoraRedepositHybridLiquidityIxs(connection, payer, params) {
|
|
772
|
+
meteoraRedepositHybridLiquidityIxsV2(connection, payer, params) {
|
|
944
773
|
return __awaiter(this, void 0, void 0, function* () {
|
|
945
774
|
var _a;
|
|
946
775
|
anchor_1.Anchor.initialize(connection);
|
|
947
776
|
try {
|
|
948
|
-
const results = yield Transactions_1.txgen.
|
|
777
|
+
const results = yield Transactions_1.txgen.meteoraRedepositHybridLiquidityV2Automation({
|
|
949
778
|
connection,
|
|
950
779
|
params,
|
|
951
780
|
fetch: undefined,
|
|
@@ -965,7 +794,7 @@ class TxGeneratorAutomations {
|
|
|
965
794
|
return {
|
|
966
795
|
status: 400,
|
|
967
796
|
data: {
|
|
968
|
-
code:
|
|
797
|
+
code: 'custom',
|
|
969
798
|
message: e.message,
|
|
970
799
|
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
971
800
|
path: [],
|
|
@@ -975,7 +804,7 @@ class TxGeneratorAutomations {
|
|
|
975
804
|
return {
|
|
976
805
|
status: 400,
|
|
977
806
|
data: {
|
|
978
|
-
code:
|
|
807
|
+
code: 'custom',
|
|
979
808
|
message: e,
|
|
980
809
|
path: [],
|
|
981
810
|
},
|