@hawksightco/hawk-sdk 1.3.263 → 1.3.265
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/package.json +1 -1
- package/dist/src/addresses.d.ts +0 -37
- package/dist/src/addresses.d.ts.map +0 -1
- package/dist/src/addresses.js +0 -84
- package/dist/src/anchor.d.ts +0 -22
- package/dist/src/anchor.d.ts.map +0 -1
- package/dist/src/anchor.js +0 -121
- package/dist/src/classes/AltStorage.d.ts +0 -29
- package/dist/src/classes/AltStorage.d.ts.map +0 -1
- package/dist/src/classes/AltStorage.js +0 -58
- package/dist/src/classes/Atomicity.d.ts +0 -34
- package/dist/src/classes/Atomicity.d.ts.map +0 -1
- package/dist/src/classes/Atomicity.js +0 -110
- package/dist/src/classes/Client.d.ts +0 -35
- package/dist/src/classes/Client.d.ts.map +0 -1
- package/dist/src/classes/Client.js +0 -66
- package/dist/src/classes/CombineTransactions.d.ts +0 -11
- package/dist/src/classes/CombineTransactions.d.ts.map +0 -1
- package/dist/src/classes/CombineTransactions.js +0 -58
- package/dist/src/classes/CreateTxMetadata.d.ts +0 -100
- package/dist/src/classes/CreateTxMetadata.d.ts.map +0 -1
- package/dist/src/classes/CreateTxMetadata.js +0 -415
- package/dist/src/classes/General.d.ts +0 -87
- package/dist/src/classes/General.d.ts.map +0 -1
- package/dist/src/classes/General.js +0 -176
- package/dist/src/classes/GeneralUtility.d.ts +0 -79
- package/dist/src/classes/GeneralUtility.d.ts.map +0 -1
- package/dist/src/classes/GeneralUtility.js +0 -121
- package/dist/src/classes/HawkAPI.d.ts +0 -122
- package/dist/src/classes/HawkAPI.d.ts.map +0 -1
- package/dist/src/classes/HawkAPI.js +0 -169
- package/dist/src/classes/Health.d.ts +0 -29
- package/dist/src/classes/Health.d.ts.map +0 -1
- package/dist/src/classes/Health.js +0 -48
- package/dist/src/classes/JupiterAlts.d.ts +0 -37
- package/dist/src/classes/JupiterAlts.d.ts.map +0 -1
- package/dist/src/classes/JupiterAlts.js +0 -114
- package/dist/src/classes/JupiterSwap.d.ts +0 -21
- package/dist/src/classes/JupiterSwap.d.ts.map +0 -1
- package/dist/src/classes/JupiterSwap.js +0 -40
- package/dist/src/classes/Logging.d.ts +0 -13
- package/dist/src/classes/Logging.d.ts.map +0 -1
- package/dist/src/classes/Logging.js +0 -50
- package/dist/src/classes/MultiTransaction.d.ts +0 -75
- package/dist/src/classes/MultiTransaction.d.ts.map +0 -1
- package/dist/src/classes/MultiTransaction.js +0 -296
- package/dist/src/classes/RaydiumSDK.d.ts +0 -67
- package/dist/src/classes/RaydiumSDK.d.ts.map +0 -1
- package/dist/src/classes/RaydiumSDK.js +0 -206
- package/dist/src/classes/Search.d.ts +0 -100
- package/dist/src/classes/Search.d.ts.map +0 -1
- package/dist/src/classes/Search.js +0 -216
- package/dist/src/classes/SimpleIxGenerator.d.ts +0 -57
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +0 -1
- package/dist/src/classes/SimpleIxGenerator.js +0 -62
- package/dist/src/classes/SimplePdaGenerator.d.ts +0 -28
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +0 -1
- package/dist/src/classes/SimplePdaGenerator.js +0 -33
- package/dist/src/classes/Transaction.d.ts +0 -229
- package/dist/src/classes/Transaction.d.ts.map +0 -1
- package/dist/src/classes/Transaction.js +0 -643
- package/dist/src/classes/Transaction2.d.ts +0 -107
- package/dist/src/classes/Transaction2.d.ts.map +0 -1
- package/dist/src/classes/Transaction2.js +0 -249
- package/dist/src/classes/Transaction3.d.ts +0 -165
- package/dist/src/classes/Transaction3.d.ts.map +0 -1
- package/dist/src/classes/Transaction3.js +0 -416
- package/dist/src/classes/TransactionBatchExecute.d.ts +0 -163
- package/dist/src/classes/TransactionBatchExecute.d.ts.map +0 -1
- package/dist/src/classes/TransactionBatchExecute.js +0 -466
- package/dist/src/classes/TransactionBatchExecute2.d.ts +0 -99
- package/dist/src/classes/TransactionBatchExecute2.d.ts.map +0 -1
- package/dist/src/classes/TransactionBatchExecute2.js +0 -357
- package/dist/src/classes/Transactions.d.ts +0 -586
- package/dist/src/classes/Transactions.d.ts.map +0 -1
- package/dist/src/classes/Transactions.js +0 -7656
- package/dist/src/classes/TxGenerator.d.ts +0 -350
- package/dist/src/classes/TxGenerator.d.ts.map +0 -1
- package/dist/src/classes/TxGenerator.js +0 -1957
- package/dist/src/classes/TxGeneratorAutomations.d.ts +0 -186
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +0 -1
- package/dist/src/classes/TxGeneratorAutomations.js +0 -897
- package/dist/src/classes/Util.d.ts +0 -87
- package/dist/src/classes/Util.d.ts.map +0 -1
- package/dist/src/classes/Util.js +0 -148
- package/dist/src/classes/account-cache/AccountCache.d.ts +0 -54
- package/dist/src/classes/account-cache/AccountCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/AccountCache.js +0 -143
- package/dist/src/classes/account-cache/MintCache.d.ts +0 -33
- package/dist/src/classes/account-cache/MintCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/MintCache.js +0 -47
- package/dist/src/classes/account-cache/TokenCache.d.ts +0 -33
- package/dist/src/classes/account-cache/TokenCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/TokenCache.js +0 -47
- package/dist/src/errors.d.ts +0 -13
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -96
- package/dist/src/functions.d.ts +0 -514
- package/dist/src/functions.d.ts.map +0 -1
- package/dist/src/functions.js +0 -1636
- package/dist/src/hawksight.d.ts +0 -53
- package/dist/src/hawksight.d.ts.map +0 -1
- package/dist/src/hawksight.js +0 -328
- package/dist/src/hsToMeteora.d.ts +0 -31
- package/dist/src/hsToMeteora.d.ts.map +0 -1
- package/dist/src/hsToMeteora.js +0 -3175
- package/dist/src/idl/iyf-extension-idl.d.ts +0 -14583
- package/dist/src/idl/iyf-extension-idl.d.ts.map +0 -1
- package/dist/src/idl/iyf-extension-idl.js +0 -14578
- package/dist/src/idl/iyf-extension-wrapper.d.ts +0 -112
- package/dist/src/idl/iyf-extension-wrapper.d.ts.map +0 -1
- package/dist/src/idl/iyf-extension-wrapper.js +0 -2
- package/dist/src/idl/iyf-main-idl.d.ts +0 -11329
- package/dist/src/idl/iyf-main-idl.d.ts.map +0 -1
- package/dist/src/idl/iyf-main-idl.js +0 -11324
- package/dist/src/idl/iyf-main-wrapper.d.ts +0 -112
- package/dist/src/idl/iyf-main-wrapper.d.ts.map +0 -1
- package/dist/src/idl/iyf-main-wrapper.js +0 -2
- package/dist/src/idl/jupiter-idl.d.ts +0 -3063
- package/dist/src/idl/jupiter-idl.d.ts.map +0 -1
- package/dist/src/idl/jupiter-idl.js +0 -3061
- package/dist/src/idl/meteora-idl.d.ts +0 -7371
- package/dist/src/idl/meteora-idl.d.ts.map +0 -1
- package/dist/src/idl/meteora-idl.js +0 -7372
- package/dist/src/idl/orca-idl.d.ts +0 -3833
- package/dist/src/idl/orca-idl.d.ts.map +0 -1
- package/dist/src/idl/orca-idl.js +0 -3834
- package/dist/src/idl/raydium-idl.d.ts +0 -3054
- package/dist/src/idl/raydium-idl.d.ts.map +0 -1
- package/dist/src/idl/raydium-idl.js +0 -3055
- package/dist/src/index.d.ts +0 -9
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -31
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts +0 -126
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.js +0 -467
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +0 -330
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +0 -1239
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +0 -685
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +0 -3005
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts +0 -119
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/OrcaIxGenerator.js +0 -438
- package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts +0 -99
- package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/RaydiumIxGenerator.js +0 -558
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts +0 -20
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/UtilIxGenerator.js +0 -25
- package/dist/src/meteora/index.d.ts +0 -2
- package/dist/src/meteora/index.d.ts.map +0 -1
- package/dist/src/meteora/index.js +0 -17
- package/dist/src/meteora/liquidityStrategy.d.ts +0 -408
- package/dist/src/meteora/liquidityStrategy.d.ts.map +0 -1
- package/dist/src/meteora/liquidityStrategy.js +0 -1325
- package/dist/src/meteora.d.ts +0 -669
- package/dist/src/meteora.d.ts.map +0 -1
- package/dist/src/meteora.js +0 -1932
- package/dist/src/orca.d.ts +0 -57
- package/dist/src/orca.d.ts.map +0 -1
- package/dist/src/orca.js +0 -123
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts +0 -29
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/HawksightPdaGenerator.js +0 -75
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +0 -76
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +0 -166
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +0 -23
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/OrcaPdaGenerator.js +0 -68
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts +0 -49
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.js +0 -114
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts +0 -8
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/UtilPdaGenerator.js +0 -51
- package/dist/src/types.d.ts +0 -1100
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -95
|
@@ -1,897 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.TxGeneratorAutomations = void 0;
|
|
46
|
-
const _client = __importStar(require("@hawksightco/swagger-client"));
|
|
47
|
-
const functions_1 = require("../functions");
|
|
48
|
-
const anchor_1 = require("../anchor");
|
|
49
|
-
const Transactions_1 = require("./Transactions");
|
|
50
|
-
/**
|
|
51
|
-
* The `TxGeneratorAutomations` class encapsulates methods to generate transactions with various trading operations
|
|
52
|
-
* on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
|
|
53
|
-
* setting custom transaction priority and fees to manage transaction processing speed and cost.
|
|
54
|
-
*
|
|
55
|
-
* NOTE: For hawksight devs only.
|
|
56
|
-
*/
|
|
57
|
-
class TxGeneratorAutomations {
|
|
58
|
-
/**
|
|
59
|
-
* Initializes a new instance of the TxGenerator class with a specified client.
|
|
60
|
-
*
|
|
61
|
-
* @param client An instance of Client used to interact with various APIs for transaction generation.
|
|
62
|
-
*/
|
|
63
|
-
constructor(client, generalUtility) {
|
|
64
|
-
this.client = client;
|
|
65
|
-
this.generalUtility = generalUtility;
|
|
66
|
-
this.priorityLevel = _client.PriorityLevel.Default;
|
|
67
|
-
this.maxPriorityFee = 500000; // Default max priority fee in lamports
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Creates meteora auto-compound instruction (claim fee, reward, and deposit to position)
|
|
71
|
-
*
|
|
72
|
-
* NOTE: For hawksight devs only.
|
|
73
|
-
*
|
|
74
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
75
|
-
* @param payer The public key of the payer for transaction fees.
|
|
76
|
-
* @param params Parameters required
|
|
77
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
78
|
-
*/
|
|
79
|
-
meteoraCompoundIxs(connection, payer, params) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
// Initialize anchor
|
|
82
|
-
anchor_1.Anchor.initialize(connection);
|
|
83
|
-
try {
|
|
84
|
-
const result = yield Transactions_1.txgen.compoundAutomationIx({
|
|
85
|
-
connection,
|
|
86
|
-
params,
|
|
87
|
-
fetch: undefined,
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
status: 200,
|
|
91
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
catch (e) {
|
|
95
|
-
// Extract error message properly
|
|
96
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
97
|
-
console.error('meteoraCompoundIxs error:', errorMessage, e);
|
|
98
|
-
return {
|
|
99
|
-
status: 400,
|
|
100
|
-
data: {
|
|
101
|
-
code: 'custom',
|
|
102
|
-
message: errorMessage,
|
|
103
|
-
path: [],
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Compound (claim + re-deposit) fees and rewards from a large Meteora DLMM position (up to 1400 bins).
|
|
111
|
-
*
|
|
112
|
-
* For ≤149 bins, delegates to single-TX compoundAutomationIx.
|
|
113
|
-
* For ≥150 bins, chunks claim and re-deposit into multiple TXs.
|
|
114
|
-
*
|
|
115
|
-
* NOTE: For hawksight devs only.
|
|
116
|
-
*
|
|
117
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
118
|
-
* @param payer The public key of the payer for transaction fees.
|
|
119
|
-
* @param params Parameters required
|
|
120
|
-
* @returns A ResponseWithStatus containing an array of TransactionMetadataWithActions.
|
|
121
|
-
*/
|
|
122
|
-
meteoraCompoundFromLargePositionIxs(connection, payer, params) {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
var _a;
|
|
125
|
-
// Initialize anchor
|
|
126
|
-
anchor_1.Anchor.initialize(connection);
|
|
127
|
-
try {
|
|
128
|
-
const results = yield Transactions_1.txgen.compoundFromLargePositionAutomationIx({
|
|
129
|
-
connection,
|
|
130
|
-
params,
|
|
131
|
-
fetch: undefined,
|
|
132
|
-
});
|
|
133
|
-
const txMetadatas = [];
|
|
134
|
-
for (const result of results) {
|
|
135
|
-
const txMeta = yield (0, functions_1.createTxMetadataWithActions)(this.generalUtility, connection, payer, result);
|
|
136
|
-
txMetadatas.push(txMeta);
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
status: 200,
|
|
140
|
-
data: txMetadatas,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
catch (e) {
|
|
144
|
-
if (e instanceof Error) {
|
|
145
|
-
return {
|
|
146
|
-
status: 400,
|
|
147
|
-
data: {
|
|
148
|
-
code: 'custom',
|
|
149
|
-
message: e.message,
|
|
150
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
151
|
-
path: [],
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
status: 400,
|
|
157
|
-
data: {
|
|
158
|
-
code: 'custom',
|
|
159
|
-
message: e,
|
|
160
|
-
path: [],
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Creates meteora redeposit instruction (withdraw liquidity, claim fees, and deposit back to same position)
|
|
168
|
-
*
|
|
169
|
-
* NOTE: For hawksight devs only.
|
|
170
|
-
*
|
|
171
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
172
|
-
* @param payer The public key of the payer for transaction fees.
|
|
173
|
-
* @param params Parameters required (position, distribution, useAta for fee destination)
|
|
174
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
175
|
-
*/
|
|
176
|
-
meteoraRedepositIxs(connection, payer, params) {
|
|
177
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
// Initialize anchor
|
|
179
|
-
anchor_1.Anchor.initialize(connection);
|
|
180
|
-
try {
|
|
181
|
-
const result = yield Transactions_1.txgen.redepositAutomationIx({
|
|
182
|
-
connection,
|
|
183
|
-
params,
|
|
184
|
-
fetch: undefined,
|
|
185
|
-
});
|
|
186
|
-
return {
|
|
187
|
-
status: 200,
|
|
188
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
catch (e) {
|
|
192
|
-
// Extract error message properly
|
|
193
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
194
|
-
console.error('meteoraRedepositIxs error:', errorMessage, e);
|
|
195
|
-
return {
|
|
196
|
-
status: 400,
|
|
197
|
-
data: {
|
|
198
|
-
code: 'custom',
|
|
199
|
-
message: errorMessage,
|
|
200
|
-
path: [],
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
meteoraRedepositIxs2(connection, payer, params) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
anchor_1.Anchor.initialize(connection);
|
|
209
|
-
try {
|
|
210
|
-
const result = yield Transactions_1.txgen.redepositAutomationIx2({
|
|
211
|
-
connection,
|
|
212
|
-
params,
|
|
213
|
-
fetch: undefined,
|
|
214
|
-
});
|
|
215
|
-
return {
|
|
216
|
-
status: 200,
|
|
217
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
catch (e) {
|
|
221
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
222
|
-
console.error('meteoraRedepositIxs2 error:', errorMessage, e);
|
|
223
|
-
return {
|
|
224
|
-
status: 400,
|
|
225
|
-
data: {
|
|
226
|
-
code: 'custom',
|
|
227
|
-
message: errorMessage,
|
|
228
|
-
path: [],
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Creates meteora auto-claim instruction (claim fee, reward)
|
|
236
|
-
*
|
|
237
|
-
* @deprecated Use meteoraClaimFromLargePositionIxs instead
|
|
238
|
-
*
|
|
239
|
-
* NOTE: For hawksight devs only.
|
|
240
|
-
*
|
|
241
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
242
|
-
* @param payer The public key of the payer for transaction fees.
|
|
243
|
-
* @param params Parameters required
|
|
244
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
245
|
-
*/
|
|
246
|
-
meteoraClaimIxs(connection, payer, params) {
|
|
247
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
-
var _a;
|
|
249
|
-
// Initialize anchor
|
|
250
|
-
anchor_1.Anchor.initialize(connection);
|
|
251
|
-
try {
|
|
252
|
-
const result = yield Transactions_1.txgen.claimAutomationIx({
|
|
253
|
-
connection,
|
|
254
|
-
params,
|
|
255
|
-
fetch: undefined,
|
|
256
|
-
});
|
|
257
|
-
return {
|
|
258
|
-
status: 200,
|
|
259
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
catch (e) {
|
|
263
|
-
if (e instanceof Error) {
|
|
264
|
-
return {
|
|
265
|
-
status: 400,
|
|
266
|
-
data: {
|
|
267
|
-
code: 'custom',
|
|
268
|
-
message: e.message,
|
|
269
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
270
|
-
path: [],
|
|
271
|
-
},
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
return {
|
|
275
|
-
status: 400,
|
|
276
|
-
data: {
|
|
277
|
-
code: 'custom',
|
|
278
|
-
message: e,
|
|
279
|
-
path: [],
|
|
280
|
-
},
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Claims fees and rewards from a large Meteora DLMM position (up to 1400 bins).
|
|
287
|
-
*
|
|
288
|
-
* For ≤149 bins, delegates to single-TX claimAutomationIx.
|
|
289
|
-
* For ≥150 bins, chunks the bin range into ≤149-bin pieces, returning multiple TXs.
|
|
290
|
-
*
|
|
291
|
-
* NOTE: For hawksight devs only.
|
|
292
|
-
*
|
|
293
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
294
|
-
* @param payer The public key of the payer for transaction fees.
|
|
295
|
-
* @param params Parameters required
|
|
296
|
-
* @returns A ResponseWithStatus containing an array of TransactionMetadata.
|
|
297
|
-
*/
|
|
298
|
-
meteoraClaimFromLargePositionIxs(connection, payer, params) {
|
|
299
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
var _a;
|
|
301
|
-
// Initialize anchor
|
|
302
|
-
anchor_1.Anchor.initialize(connection);
|
|
303
|
-
try {
|
|
304
|
-
const results = yield Transactions_1.txgen.claimFromLargePositionAutomationIx({
|
|
305
|
-
connection,
|
|
306
|
-
params,
|
|
307
|
-
fetch: undefined,
|
|
308
|
-
});
|
|
309
|
-
const txMetadatas = [];
|
|
310
|
-
for (const result of results) {
|
|
311
|
-
const txMeta = yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result);
|
|
312
|
-
txMetadatas.push(txMeta);
|
|
313
|
-
}
|
|
314
|
-
return {
|
|
315
|
-
status: 200,
|
|
316
|
-
data: txMetadatas,
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
catch (e) {
|
|
320
|
-
if (e instanceof Error) {
|
|
321
|
-
return {
|
|
322
|
-
status: 400,
|
|
323
|
-
data: {
|
|
324
|
-
code: 'custom',
|
|
325
|
-
message: e.message,
|
|
326
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
327
|
-
path: [],
|
|
328
|
-
},
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
return {
|
|
332
|
-
status: 400,
|
|
333
|
-
data: {
|
|
334
|
-
code: 'custom',
|
|
335
|
-
message: e,
|
|
336
|
-
path: [],
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Creates meteora auto-rebalance instruction (uses new re-deposit 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
|
-
meteoraRebalanceIxs2(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.rebalanceAutomationIx2({
|
|
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',
|
|
386
|
-
message: e,
|
|
387
|
-
path: [],
|
|
388
|
-
},
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
meteoraRedepositForLargePositionIxs(connection, payer, params) {
|
|
394
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
-
var _a;
|
|
396
|
-
anchor_1.Anchor.initialize(connection);
|
|
397
|
-
try {
|
|
398
|
-
const results = yield Transactions_1.txgen.redepositForLargePositionAutomationIx({
|
|
399
|
-
connection,
|
|
400
|
-
params,
|
|
401
|
-
fetch: undefined,
|
|
402
|
-
});
|
|
403
|
-
const txMetadatas = [];
|
|
404
|
-
for (const result of results) {
|
|
405
|
-
const txMeta = yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result);
|
|
406
|
-
txMetadatas.push(txMeta);
|
|
407
|
-
}
|
|
408
|
-
return {
|
|
409
|
-
status: 200,
|
|
410
|
-
data: txMetadatas,
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
catch (e) {
|
|
414
|
-
if (e instanceof Error) {
|
|
415
|
-
return {
|
|
416
|
-
status: 400,
|
|
417
|
-
data: {
|
|
418
|
-
code: 'custom',
|
|
419
|
-
message: e.message,
|
|
420
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
421
|
-
path: [],
|
|
422
|
-
},
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
return {
|
|
426
|
-
status: 400,
|
|
427
|
-
data: {
|
|
428
|
-
code: 'custom',
|
|
429
|
-
message: e,
|
|
430
|
-
path: [],
|
|
431
|
-
},
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Rebalances a large Meteora DLMM position (up to 1400 bins) using automation instructions.
|
|
438
|
-
*
|
|
439
|
-
* For ≤70 bins, delegates to meteoraRebalanceSmallerPositionAutomation.
|
|
440
|
-
* For ≥150 bins, uses a chunked multi-TX approach (withdraw, init, deposit).
|
|
441
|
-
*
|
|
442
|
-
* NOTE: For hawksight devs only.
|
|
443
|
-
*
|
|
444
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
445
|
-
* @param payer The public key of the payer for transaction fees.
|
|
446
|
-
* @param params Parameters required
|
|
447
|
-
* @returns A ResponseWithStatus containing an array of TransactionMetadata.
|
|
448
|
-
*/
|
|
449
|
-
meteoraRebalanceLargePositionAutomation(connection, payer, params) {
|
|
450
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
451
|
-
var _a;
|
|
452
|
-
// Initialize anchor
|
|
453
|
-
anchor_1.Anchor.initialize(connection);
|
|
454
|
-
try {
|
|
455
|
-
const results = yield Transactions_1.txgen.rebalanceLargePositionAutomation({
|
|
456
|
-
connection,
|
|
457
|
-
params,
|
|
458
|
-
fetch: undefined,
|
|
459
|
-
});
|
|
460
|
-
const txMetadatas = [];
|
|
461
|
-
for (const result of results) {
|
|
462
|
-
const txMeta = yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result);
|
|
463
|
-
txMetadatas.push(txMeta);
|
|
464
|
-
}
|
|
465
|
-
return {
|
|
466
|
-
status: 200,
|
|
467
|
-
data: txMetadatas,
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
catch (e) {
|
|
471
|
-
if (e instanceof Error) {
|
|
472
|
-
return {
|
|
473
|
-
status: 400,
|
|
474
|
-
data: {
|
|
475
|
-
code: 'custom',
|
|
476
|
-
message: e.message,
|
|
477
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
478
|
-
path: [],
|
|
479
|
-
},
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
return {
|
|
483
|
-
status: 400,
|
|
484
|
-
data: {
|
|
485
|
-
code: 'custom',
|
|
486
|
-
message: e,
|
|
487
|
-
path: [],
|
|
488
|
-
},
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Creates meteora close limit instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
495
|
-
*
|
|
496
|
-
* NOTE: For hawksight devs only.
|
|
497
|
-
*
|
|
498
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
499
|
-
* @param payer The public key of the payer for transaction fees.
|
|
500
|
-
* @param params Parameters required
|
|
501
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
502
|
-
*/
|
|
503
|
-
meteoraLimitCloseIxs(connection, payer, params) {
|
|
504
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
-
var _a;
|
|
506
|
-
// Initialize anchor
|
|
507
|
-
anchor_1.Anchor.initialize(connection);
|
|
508
|
-
try {
|
|
509
|
-
const result = yield Transactions_1.txgen.limitCloseAutomationIx({
|
|
510
|
-
connection,
|
|
511
|
-
params,
|
|
512
|
-
fetch: undefined,
|
|
513
|
-
});
|
|
514
|
-
return {
|
|
515
|
-
status: 200,
|
|
516
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
catch (e) {
|
|
520
|
-
if (e instanceof Error) {
|
|
521
|
-
return {
|
|
522
|
-
status: 400,
|
|
523
|
-
data: {
|
|
524
|
-
code: 'custom',
|
|
525
|
-
message: e.message,
|
|
526
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
527
|
-
path: [],
|
|
528
|
-
},
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
return {
|
|
532
|
-
status: 400,
|
|
533
|
-
data: {
|
|
534
|
-
code: 'custom',
|
|
535
|
-
message: e,
|
|
536
|
-
path: [],
|
|
537
|
-
},
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Creates meteora close limit instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
544
|
-
*
|
|
545
|
-
* NOTE: For hawksight devs only.
|
|
546
|
-
*
|
|
547
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
548
|
-
* @param payer The public key of the payer for transaction fees.
|
|
549
|
-
* @param params Parameters required
|
|
550
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
551
|
-
*/
|
|
552
|
-
meteoraLimitCloseIxs2(connection, payer, params) {
|
|
553
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
554
|
-
var _a;
|
|
555
|
-
// Initialize anchor
|
|
556
|
-
anchor_1.Anchor.initialize(connection);
|
|
557
|
-
try {
|
|
558
|
-
const result = yield Transactions_1.txgen.limitCloseAutomationIx2({
|
|
559
|
-
connection,
|
|
560
|
-
params,
|
|
561
|
-
fetch: undefined,
|
|
562
|
-
});
|
|
563
|
-
return {
|
|
564
|
-
status: 200,
|
|
565
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
catch (e) {
|
|
569
|
-
if (e instanceof Error) {
|
|
570
|
-
return {
|
|
571
|
-
status: 400,
|
|
572
|
-
data: {
|
|
573
|
-
code: 'custom',
|
|
574
|
-
message: e.message,
|
|
575
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
576
|
-
path: [],
|
|
577
|
-
},
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
return {
|
|
581
|
-
status: 400,
|
|
582
|
-
data: {
|
|
583
|
-
code: 'custom',
|
|
584
|
-
message: e,
|
|
585
|
-
path: [],
|
|
586
|
-
},
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
meteoraLimitCloseIxsV2(connection, payer, params) {
|
|
592
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
593
|
-
var _a;
|
|
594
|
-
anchor_1.Anchor.initialize(connection);
|
|
595
|
-
try {
|
|
596
|
-
const results = yield Transactions_1.txgen.limitCloseV2AutomationIxs({
|
|
597
|
-
connection,
|
|
598
|
-
params,
|
|
599
|
-
fetch: undefined,
|
|
600
|
-
});
|
|
601
|
-
const txMetadatas = [];
|
|
602
|
-
for (const result of results) {
|
|
603
|
-
const txMeta = yield (0, functions_1.createTxMetadataWithActions)(this.generalUtility, connection, payer, result);
|
|
604
|
-
txMetadatas.push(txMeta);
|
|
605
|
-
}
|
|
606
|
-
return {
|
|
607
|
-
status: 200,
|
|
608
|
-
data: txMetadatas,
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
catch (e) {
|
|
612
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
613
|
-
return {
|
|
614
|
-
status: 400,
|
|
615
|
-
data: {
|
|
616
|
-
code: 'custom',
|
|
617
|
-
message: errorMessage,
|
|
618
|
-
stack: e instanceof Error ? (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n') : undefined,
|
|
619
|
-
path: [],
|
|
620
|
-
},
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Creates meteora close instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
627
|
-
*
|
|
628
|
-
* NOTE: For hawksight devs only.
|
|
629
|
-
*
|
|
630
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
631
|
-
* @param payer The public key of the payer for transaction fees.
|
|
632
|
-
* @param params Parameters required
|
|
633
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
634
|
-
*/
|
|
635
|
-
meteoraCloseIxs(connection, payer, params) {
|
|
636
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
637
|
-
// Initialize anchor
|
|
638
|
-
anchor_1.Anchor.initialize(connection);
|
|
639
|
-
try {
|
|
640
|
-
const result = yield Transactions_1.txgen.closeAutomationIx({
|
|
641
|
-
connection,
|
|
642
|
-
params,
|
|
643
|
-
fetch: undefined,
|
|
644
|
-
});
|
|
645
|
-
return {
|
|
646
|
-
status: 200,
|
|
647
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
catch (e) {
|
|
651
|
-
// Extract error message properly
|
|
652
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
653
|
-
console.error('meteoraCloseIxs error:', errorMessage, e);
|
|
654
|
-
return {
|
|
655
|
-
status: 400,
|
|
656
|
-
data: {
|
|
657
|
-
code: 'custom',
|
|
658
|
-
message: errorMessage,
|
|
659
|
-
path: [],
|
|
660
|
-
},
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Creates meteora open instruction (open position)
|
|
667
|
-
*
|
|
668
|
-
* NOTE: For hawksight devs only.
|
|
669
|
-
*
|
|
670
|
-
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
671
|
-
* @param payer The public key of the payer for transaction fees.
|
|
672
|
-
* @param params Parameters required
|
|
673
|
-
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
674
|
-
*/
|
|
675
|
-
meteoraOpenIxs(connection, payer, params) {
|
|
676
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
677
|
-
var _a;
|
|
678
|
-
// Initialize anchor
|
|
679
|
-
anchor_1.Anchor.initialize(connection);
|
|
680
|
-
try {
|
|
681
|
-
const result = yield Transactions_1.txgen.openAutomationIx({
|
|
682
|
-
connection,
|
|
683
|
-
params,
|
|
684
|
-
fetch: undefined,
|
|
685
|
-
});
|
|
686
|
-
return {
|
|
687
|
-
status: 200,
|
|
688
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
catch (e) {
|
|
692
|
-
if (e instanceof Error) {
|
|
693
|
-
return {
|
|
694
|
-
status: 400,
|
|
695
|
-
data: {
|
|
696
|
-
code: 'custom',
|
|
697
|
-
message: e.message,
|
|
698
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
699
|
-
path: [],
|
|
700
|
-
},
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
return {
|
|
704
|
-
status: 400,
|
|
705
|
-
data: {
|
|
706
|
-
code: 'custom',
|
|
707
|
-
message: e,
|
|
708
|
-
path: [],
|
|
709
|
-
},
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* Creates transaction metadata for a large Meteora relative-position open.
|
|
716
|
-
*
|
|
717
|
-
* This route splits the open into one or more init/extend transactions followed
|
|
718
|
-
* by a deposit transaction so callers can execute positions wider than the
|
|
719
|
-
* init-only relative-open limit.
|
|
720
|
-
*
|
|
721
|
-
* NOTE: For hawksight devs only.
|
|
722
|
-
*
|
|
723
|
-
* @param connection The Solana web3 connection used to fetch pool and token state and build instructions.
|
|
724
|
-
* @param payer The public key string that pays transaction fees for the generated metadata.
|
|
725
|
-
* @param params Relative open automation parameters, including position, pool, relative bin range, check range, distribution, and optional token amounts.
|
|
726
|
-
* @returns A ResponseWithStatus whose successful data is an ordered TransactionMetadataWithActions array for init/extend and add-liquidity transactions; failures return status 400 with a custom error payload.
|
|
727
|
-
*/
|
|
728
|
-
meteoraRelativeOpenLargePositionIxs(connection, payer, params) {
|
|
729
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
730
|
-
var _a;
|
|
731
|
-
anchor_1.Anchor.initialize(connection);
|
|
732
|
-
try {
|
|
733
|
-
const results = yield Transactions_1.txgen.relativeOpenLargePositionAutomationIxs({
|
|
734
|
-
connection,
|
|
735
|
-
params,
|
|
736
|
-
fetch: undefined,
|
|
737
|
-
});
|
|
738
|
-
const txMetadatas = [];
|
|
739
|
-
for (const result of results) {
|
|
740
|
-
const txMeta = yield (0, functions_1.createTxMetadataWithActions)(this.generalUtility, connection, payer, result);
|
|
741
|
-
txMetadatas.push(txMeta);
|
|
742
|
-
}
|
|
743
|
-
return {
|
|
744
|
-
status: 200,
|
|
745
|
-
data: txMetadatas,
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
catch (e) {
|
|
749
|
-
if (e instanceof Error) {
|
|
750
|
-
return {
|
|
751
|
-
status: 400,
|
|
752
|
-
data: {
|
|
753
|
-
code: 'custom',
|
|
754
|
-
message: e.message,
|
|
755
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
756
|
-
path: [],
|
|
757
|
-
},
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
return {
|
|
761
|
-
status: 400,
|
|
762
|
-
data: {
|
|
763
|
-
code: 'custom',
|
|
764
|
-
message: e,
|
|
765
|
-
path: [],
|
|
766
|
-
},
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
meteoraRelativeOpenIxs(connection, payer, params) {
|
|
772
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
773
|
-
var _a;
|
|
774
|
-
// Initialize anchor
|
|
775
|
-
anchor_1.Anchor.initialize(connection);
|
|
776
|
-
try {
|
|
777
|
-
const result = yield Transactions_1.txgen.relativeOpenAutomationIx({
|
|
778
|
-
connection,
|
|
779
|
-
params,
|
|
780
|
-
fetch: undefined,
|
|
781
|
-
});
|
|
782
|
-
return {
|
|
783
|
-
status: 200,
|
|
784
|
-
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
785
|
-
};
|
|
786
|
-
}
|
|
787
|
-
catch (e) {
|
|
788
|
-
if (e instanceof Error) {
|
|
789
|
-
return {
|
|
790
|
-
status: 400,
|
|
791
|
-
data: {
|
|
792
|
-
code: 'custom',
|
|
793
|
-
message: e.message,
|
|
794
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
795
|
-
path: [],
|
|
796
|
-
},
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
return {
|
|
800
|
-
status: 400,
|
|
801
|
-
data: {
|
|
802
|
-
code: 'custom',
|
|
803
|
-
message: e,
|
|
804
|
-
path: [],
|
|
805
|
-
},
|
|
806
|
-
};
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
meteoraRebalanceHybridLiquidityIxsV2(connection, payer, params) {
|
|
811
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
812
|
-
var _a;
|
|
813
|
-
anchor_1.Anchor.initialize(connection);
|
|
814
|
-
try {
|
|
815
|
-
const results = yield Transactions_1.txgen.meteoraRebalanceHybridLiquidityV2Automation({
|
|
816
|
-
connection,
|
|
817
|
-
params,
|
|
818
|
-
fetch: undefined,
|
|
819
|
-
});
|
|
820
|
-
const txMetadatas = [];
|
|
821
|
-
for (const result of results) {
|
|
822
|
-
const txMeta = yield (0, functions_1.createTxMetadataWithActions)(this.generalUtility, connection, payer, result);
|
|
823
|
-
txMetadatas.push(txMeta);
|
|
824
|
-
}
|
|
825
|
-
return {
|
|
826
|
-
status: 200,
|
|
827
|
-
data: txMetadatas,
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
catch (e) {
|
|
831
|
-
if (e instanceof Error) {
|
|
832
|
-
return {
|
|
833
|
-
status: 400,
|
|
834
|
-
data: {
|
|
835
|
-
code: 'custom',
|
|
836
|
-
message: e.message,
|
|
837
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
838
|
-
path: [],
|
|
839
|
-
},
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
return {
|
|
843
|
-
status: 400,
|
|
844
|
-
data: {
|
|
845
|
-
code: 'custom',
|
|
846
|
-
message: e,
|
|
847
|
-
path: [],
|
|
848
|
-
},
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
meteoraRedepositHybridLiquidityIxsV2(connection, payer, params) {
|
|
854
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
855
|
-
var _a;
|
|
856
|
-
anchor_1.Anchor.initialize(connection);
|
|
857
|
-
try {
|
|
858
|
-
const results = yield Transactions_1.txgen.meteoraRedepositHybridLiquidityV2Automation({
|
|
859
|
-
connection,
|
|
860
|
-
params,
|
|
861
|
-
fetch: undefined,
|
|
862
|
-
});
|
|
863
|
-
const txMetadatas = [];
|
|
864
|
-
for (const result of results) {
|
|
865
|
-
const txMeta = yield (0, functions_1.createTxMetadataWithActions)(this.generalUtility, connection, payer, result);
|
|
866
|
-
txMetadatas.push(txMeta);
|
|
867
|
-
}
|
|
868
|
-
return {
|
|
869
|
-
status: 200,
|
|
870
|
-
data: txMetadatas,
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
catch (e) {
|
|
874
|
-
if (e instanceof Error) {
|
|
875
|
-
return {
|
|
876
|
-
status: 400,
|
|
877
|
-
data: {
|
|
878
|
-
code: 'custom',
|
|
879
|
-
message: e.message,
|
|
880
|
-
stack: (_a = e.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
881
|
-
path: [],
|
|
882
|
-
},
|
|
883
|
-
};
|
|
884
|
-
}
|
|
885
|
-
return {
|
|
886
|
-
status: 400,
|
|
887
|
-
data: {
|
|
888
|
-
code: 'custom',
|
|
889
|
-
message: e,
|
|
890
|
-
path: [],
|
|
891
|
-
},
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
exports.TxGeneratorAutomations = TxGeneratorAutomations;
|