@hawksightco/hawk-sdk 0.0.4 → 0.0.6
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/index.js +358 -0
- package/package.json +3 -2
- package/test/index.spec.ts +105 -105
- package/tsconfig.json +6 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
36
|
+
const client = __importStar(require("@hawksightco/swagger-client"));
|
|
37
|
+
class Client {
|
|
38
|
+
constructor(url = "https://api2.hawksight.co") {
|
|
39
|
+
this.url = url;
|
|
40
|
+
this.config = new client.Configuration({
|
|
41
|
+
basePath: url
|
|
42
|
+
});
|
|
43
|
+
this.healthCheck = new client.HealthCheckApi(this.config);
|
|
44
|
+
this.generalEndpoints = new client.GeneralEndpointsApi(this.config);
|
|
45
|
+
this.meteoraDLMMUtilityFunctionsApi = new client.MeteoraDLMMUtilityFunctionsApi(this.config);
|
|
46
|
+
this.meteoraDLMMInstructionsApi = new client.MeteoraDLMMInstructionsApi(this.config);
|
|
47
|
+
this.meteoraDLMMAutomationInstructionsApi = new client.MeteoraDLMMAutomationInstructionsApi(this.config);
|
|
48
|
+
this.orcaUtilityFunctionsApi = new client.OrcaUtilityFunctionsApi(this.config);
|
|
49
|
+
this.orcaCLMMInstructionsApi = new client.OrcaCLMMInstructionsApi(this.config);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class Health {
|
|
53
|
+
constructor(client) {
|
|
54
|
+
this.client = client;
|
|
55
|
+
}
|
|
56
|
+
health() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const result = yield this.client.healthCheck.healthGet().catch(e => e.response);
|
|
59
|
+
return {
|
|
60
|
+
status: result.status,
|
|
61
|
+
data: result.data,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class General {
|
|
67
|
+
constructor(client) {
|
|
68
|
+
this.client = client;
|
|
69
|
+
}
|
|
70
|
+
portfolio(params) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const result = yield this.client.generalEndpoints.portfolioGet(params.wallet, params.pool).catch(e => e.response);
|
|
73
|
+
return {
|
|
74
|
+
status: result.status,
|
|
75
|
+
data: result.data,
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
pools() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const result = yield this.client.generalEndpoints.poolsGet().catch(e => e.response);
|
|
82
|
+
return {
|
|
83
|
+
status: result.status,
|
|
84
|
+
data: result.data,
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
tokens() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const result = yield this.client.generalEndpoints.tokensGet().catch(e => e.response);
|
|
91
|
+
return {
|
|
92
|
+
status: result.status,
|
|
93
|
+
data: result.data,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
register(connection, payer, params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const result = yield this.client.generalEndpoints.registerPost(params).catch(e => e.response);
|
|
100
|
+
return resultOrError({
|
|
101
|
+
status: result.status,
|
|
102
|
+
data: result.data,
|
|
103
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class Util {
|
|
108
|
+
constructor(client) {
|
|
109
|
+
this.client = client;
|
|
110
|
+
}
|
|
111
|
+
meteoraDlmmPools() {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilPoolsGet().catch(e => e.response);
|
|
114
|
+
return {
|
|
115
|
+
status: result.status,
|
|
116
|
+
data: result.data,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
meteoraDlmmPositions(params) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilPositionsGet(params.wallet, params.pool).catch(e => e.response);
|
|
123
|
+
return {
|
|
124
|
+
status: result.status,
|
|
125
|
+
data: result.data,
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
meteoraDlmmActiveBin(params) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilActiveBinPost(params).catch(e => e.response);
|
|
132
|
+
return {
|
|
133
|
+
status: result.status,
|
|
134
|
+
data: result.data,
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
orcaClmmPools() {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilPoolsGet().catch(e => e.response);
|
|
141
|
+
return {
|
|
142
|
+
status: result.status,
|
|
143
|
+
data: result.data,
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
orcaPositions(params) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilPositionsGet(params.wallet, params.pool).catch(e => e.response);
|
|
150
|
+
return {
|
|
151
|
+
status: result.status,
|
|
152
|
+
data: result.data,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
orcaGetPositionMint(params) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilGetPositionMintGet(params.position).catch(e => e.response);
|
|
159
|
+
return {
|
|
160
|
+
status: result.status,
|
|
161
|
+
data: result.data,
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
class TxGenerator {
|
|
167
|
+
constructor(client) {
|
|
168
|
+
this.client = client;
|
|
169
|
+
}
|
|
170
|
+
meteoraCreatePositionAndDeposit(connection, payer, params) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const result = yield this.client.meteoraDLMMInstructionsApi.meteoraDlmmTxCreatePositionAndDepositPost(params).catch(e => e.response);
|
|
173
|
+
return resultOrError({
|
|
174
|
+
status: result.status,
|
|
175
|
+
data: result.data,
|
|
176
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
meteoraDeposit(connection, payer, params) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const result = yield this.client.meteoraDLMMInstructionsApi.meteoraDlmmTxDepositPost(params).catch(e => e.response);
|
|
182
|
+
return resultOrError({
|
|
183
|
+
status: result.status,
|
|
184
|
+
data: result.data,
|
|
185
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
meteoraWithdraw(connection, payer, params) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
const result = yield this.client.meteoraDLMMInstructionsApi.meteoraDlmmTxWithdrawPost(params).catch(e => e.response);
|
|
191
|
+
return resultOrError({
|
|
192
|
+
status: result.status,
|
|
193
|
+
data: result.data,
|
|
194
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
meteoraClaim(connection, payer, params) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const result = yield this.client.meteoraDLMMInstructionsApi.meteoraDlmmTxClaimPost(params).catch(e => e.response);
|
|
200
|
+
return resultOrError({
|
|
201
|
+
status: result.status,
|
|
202
|
+
data: result.data,
|
|
203
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
meteoraClosePosition(connection, payer, params) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const result = yield this.client.meteoraDLMMInstructionsApi.meteoraDlmmTxClosePositionPost(params).catch(e => e.response);
|
|
209
|
+
return resultOrError({
|
|
210
|
+
status: result.status,
|
|
211
|
+
data: result.data,
|
|
212
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
orcaOpenPosition(connection, payer, params) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const result = yield this.client.orcaCLMMInstructionsApi.orcaTxOpenPositionPost(params).catch(e => e.response);
|
|
218
|
+
return resultOrError({
|
|
219
|
+
status: result.status,
|
|
220
|
+
data: result.data,
|
|
221
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
orcaClosePosition(connection, payer, params) {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const result = yield this.client.orcaCLMMInstructionsApi.orcaTxClosePositionPost(params).catch(e => e.response);
|
|
227
|
+
return resultOrError({
|
|
228
|
+
status: result.status,
|
|
229
|
+
data: result.data,
|
|
230
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
orcaDeposit(connection, payer, params) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
const result = yield this.client.orcaCLMMInstructionsApi.orcaTxDepositPost(params).catch(e => e.response);
|
|
236
|
+
return resultOrError({
|
|
237
|
+
status: result.status,
|
|
238
|
+
data: result.data,
|
|
239
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
orcaWithdraw(connection, payer, params) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
const result = yield this.client.orcaCLMMInstructionsApi.orcaTxWithdrawPost(params).catch(e => e.response);
|
|
245
|
+
return resultOrError({
|
|
246
|
+
status: result.status,
|
|
247
|
+
data: result.data,
|
|
248
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
orcaClaimRewards(connection, payer, params) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
const result = yield this.client.orcaCLMMInstructionsApi.orcaTxClaimRewardsPost(params).catch(e => e.response);
|
|
254
|
+
return resultOrError({
|
|
255
|
+
status: result.status,
|
|
256
|
+
data: result.data,
|
|
257
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
class TxGeneratorAutomations {
|
|
262
|
+
constructor(client) {
|
|
263
|
+
this.client = client;
|
|
264
|
+
}
|
|
265
|
+
meteoraClaimFeeAndRewards(connection, payer, params) {
|
|
266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationClaimFeeAndRewardsAutomationIxPost(params).catch(e => e.response);
|
|
268
|
+
return resultOrError({
|
|
269
|
+
status: result.status,
|
|
270
|
+
data: result.data,
|
|
271
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
meteoraFullWithdrawalAndClosePosition(connection, payer, params) {
|
|
275
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationFullWithdrawAndClosePositionAutomationIxPost(params).catch(e => e.response);
|
|
277
|
+
return resultOrError({
|
|
278
|
+
status: result.status,
|
|
279
|
+
data: result.data,
|
|
280
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
meteoraCreatePositionAndDeposit(connection, payer, params) {
|
|
284
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationCreatePositionAndDepositAutomationIxPost(params).catch(e => e.response);
|
|
286
|
+
return resultOrError({
|
|
287
|
+
status: result.status,
|
|
288
|
+
data: result.data,
|
|
289
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield createTxMetadata(connection, payer, data); }));
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
class HawkAPI {
|
|
294
|
+
constructor(url = "https://api2.hawksight.co") {
|
|
295
|
+
this.url = url;
|
|
296
|
+
const client = new Client(url);
|
|
297
|
+
this.health = new Health(client);
|
|
298
|
+
this.general = new General(client);
|
|
299
|
+
this.util = new Util(client);
|
|
300
|
+
this.txGenerator = new TxGenerator(client);
|
|
301
|
+
this.txGeneratorAutomation = new TxGeneratorAutomations(client);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
exports.default = HawkAPI;
|
|
305
|
+
function createTxMetadata(connection, payer, data) {
|
|
306
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
307
|
+
const alts = [];
|
|
308
|
+
for (const alt of data.addressLookupTableAddresses) {
|
|
309
|
+
alts.push((yield connection.getAddressLookupTable(new web3.PublicKey(alt))).value);
|
|
310
|
+
}
|
|
311
|
+
const computeIxs = data.computeBudgetInstructions.map(ix => {
|
|
312
|
+
return new web3.TransactionInstruction({
|
|
313
|
+
keys: ix.accounts.map(meta => {
|
|
314
|
+
return { pubkey: new web3.PublicKey(meta.pubkey), isSigner: meta.isSigner, isWritable: meta.isWritable };
|
|
315
|
+
}),
|
|
316
|
+
programId: new web3.PublicKey(ix.programId),
|
|
317
|
+
data: Buffer.from(ix.data, 'base64'),
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
const mainIxs = data.computeBudgetInstructions.map(ix => {
|
|
321
|
+
return new web3.TransactionInstruction({
|
|
322
|
+
keys: ix.accounts.map(meta => {
|
|
323
|
+
return { pubkey: new web3.PublicKey(meta.pubkey), isSigner: meta.isSigner, isWritable: meta.isWritable };
|
|
324
|
+
}),
|
|
325
|
+
programId: new web3.PublicKey(ix.programId),
|
|
326
|
+
data: Buffer.from(ix.data, 'base64'),
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
const { blockhash: recentBlockhash } = yield connection.getLatestBlockhash();
|
|
330
|
+
const txMessage = new web3.TransactionMessage({
|
|
331
|
+
payerKey: new web3.PublicKey(payer),
|
|
332
|
+
instructions: [...computeIxs, ...mainIxs],
|
|
333
|
+
recentBlockhash,
|
|
334
|
+
});
|
|
335
|
+
const tx = new web3.VersionedTransaction(txMessage.compileToV0Message(alts));
|
|
336
|
+
return {
|
|
337
|
+
description: data.description,
|
|
338
|
+
estimatedFeeInSOL: data.estimatedFeeInSOL,
|
|
339
|
+
transaction: tx.serialize(),
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function resultOrError(result, successFn) {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
+
if (result.status === 200) {
|
|
346
|
+
return {
|
|
347
|
+
status: result.status,
|
|
348
|
+
data: yield successFn(result.data),
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
return {
|
|
353
|
+
status: result.status,
|
|
354
|
+
data: result.data,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hawksightco/hawk-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Hawksight v2 SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://github.com/ghabxph/hawk-api-client.git",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"start": "npx ts-node src/index.ts",
|
|
35
|
-
"test": "npx jest"
|
|
35
|
+
"test": "npx jest",
|
|
36
|
+
"build": "tsc --outDir dist/"
|
|
36
37
|
}
|
|
37
38
|
}
|
package/test/index.spec.ts
CHANGED
|
@@ -50,17 +50,17 @@ describe('General Endpoints', () => {
|
|
|
50
50
|
}
|
|
51
51
|
}, TIMEOUT);
|
|
52
52
|
|
|
53
|
-
it ('GET /pools', async () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, TIMEOUT);
|
|
53
|
+
// it ('GET /pools', async () => {
|
|
54
|
+
// const result = await client.general.pools();
|
|
55
|
+
// expect(result.status).toBe(200);
|
|
56
|
+
// expect(result.data.length >= 0).toBe(true);
|
|
57
|
+
// }, TIMEOUT);
|
|
58
58
|
|
|
59
|
-
it ('POST /register', async () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, TIMEOUT);
|
|
59
|
+
// it ('POST /register', async () => {
|
|
60
|
+
// const result = await client.general.register(connection, hawkWallet, { userWallet: hawkWallet });
|
|
61
|
+
// logIfNot200(result);
|
|
62
|
+
// expect(result.status).toBe(200);
|
|
63
|
+
// }, TIMEOUT);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
describe('Meteora Endpoints', () => {
|
|
@@ -93,103 +93,103 @@ describe('Meteora Endpoints', () => {
|
|
|
93
93
|
logIfNot200(result);
|
|
94
94
|
expect(result.status).toBe(200);
|
|
95
95
|
}, TIMEOUT);
|
|
96
|
-
it ('POST /meteora/dlmm/tx/deposit', async () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, TIMEOUT);
|
|
111
|
-
it ('POST /meteora/dlmm/tx/claim', async () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, TIMEOUT);
|
|
123
|
-
it ('POST /meteora/dlmm/tx/withdraw', async () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}, TIMEOUT);
|
|
137
|
-
it ('POST /meteora/dlmm/tx/closePosition', async () => { // will not work because position is not empty.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, TIMEOUT);
|
|
96
|
+
// it ('POST /meteora/dlmm/tx/deposit', async () => {
|
|
97
|
+
// const result = await client.txGenerator.meteoraDeposit(
|
|
98
|
+
// connection,
|
|
99
|
+
// hawkWallet,
|
|
100
|
+
// {
|
|
101
|
+
// position: testPosition,
|
|
102
|
+
// userWallet: testWallet,
|
|
103
|
+
// totalXAmount: 10_000,
|
|
104
|
+
// totalYAmount: 10_000,
|
|
105
|
+
// distribution: 'CURVE',
|
|
106
|
+
// }
|
|
107
|
+
// );
|
|
108
|
+
// logIfNot200(result);
|
|
109
|
+
// expect(result.status).toBe(200);
|
|
110
|
+
// }, TIMEOUT);
|
|
111
|
+
// it ('POST /meteora/dlmm/tx/claim', async () => {
|
|
112
|
+
// const result = await client.txGenerator.meteoraClaim(
|
|
113
|
+
// connection,
|
|
114
|
+
// hawkWallet,
|
|
115
|
+
// {
|
|
116
|
+
// position: testPosition,
|
|
117
|
+
// userWallet: testWallet,
|
|
118
|
+
// }
|
|
119
|
+
// );
|
|
120
|
+
// logIfNot200(result);
|
|
121
|
+
// expect(result.status).toBe(200);
|
|
122
|
+
// }, TIMEOUT);
|
|
123
|
+
// it ('POST /meteora/dlmm/tx/withdraw', async () => {
|
|
124
|
+
// const result = await client.txGenerator.meteoraWithdraw(
|
|
125
|
+
// connection,
|
|
126
|
+
// hawkWallet,
|
|
127
|
+
// {
|
|
128
|
+
// position: testPosition,
|
|
129
|
+
// userWallet: testWallet,
|
|
130
|
+
// amountBps: 10_000,
|
|
131
|
+
// shouldClaimAndClose: true,
|
|
132
|
+
// }
|
|
133
|
+
// );
|
|
134
|
+
// logIfNot200(result);
|
|
135
|
+
// expect(result.status).toBe(200);
|
|
136
|
+
// }, TIMEOUT);
|
|
137
|
+
// it ('POST /meteora/dlmm/tx/closePosition', async () => { // will not work because position is not empty.
|
|
138
|
+
// const result = await client.txGenerator.meteoraClosePosition(
|
|
139
|
+
// connection,
|
|
140
|
+
// hawkWallet,
|
|
141
|
+
// {
|
|
142
|
+
// position: testPosition,
|
|
143
|
+
// userWallet: testWallet,
|
|
144
|
+
// }
|
|
145
|
+
// );
|
|
146
|
+
// logIfNot200(result);
|
|
147
|
+
// expect(result.status).toBe(200);
|
|
148
|
+
// }, TIMEOUT);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
describe('Meteora Automation Endpoints', () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
151
|
+
// describe('Meteora Automation Endpoints', () => {
|
|
152
|
+
// it ('POST /meteora/dlmm/automation/claimFeeAndRewardsAutomationIx', async () => {
|
|
153
|
+
// const result = await client.txGeneratorAutomation.meteoraClaimFeeAndRewards(
|
|
154
|
+
// connection,
|
|
155
|
+
// hawkWallet,
|
|
156
|
+
// {
|
|
157
|
+
// userWallet: testWallet,
|
|
158
|
+
// position: testPosition,
|
|
159
|
+
// }
|
|
160
|
+
// );
|
|
161
|
+
// logIfNot200(result);
|
|
162
|
+
// expect(result.status).toBe(200);
|
|
163
|
+
// }, TIMEOUT);
|
|
164
|
+
// it ('POST /meteora/dlmm/automation/fullWithdrawAndClosePositionAutomationIx', async () => {
|
|
165
|
+
// const result = await client.txGeneratorAutomation.meteoraFullWithdrawalAndClosePosition(
|
|
166
|
+
// connection,
|
|
167
|
+
// hawkWallet,
|
|
168
|
+
// {
|
|
169
|
+
// userWallet: testWallet,
|
|
170
|
+
// position: testPosition,
|
|
171
|
+
// }
|
|
172
|
+
// );
|
|
173
|
+
// logIfNot200(result);
|
|
174
|
+
// expect(result.status).toBe(200);
|
|
175
|
+
// }, TIMEOUT);
|
|
176
|
+
// it ('POST /meteora/dlmm/automation/createPositionAndDepositAutomationIx', async () => { // can't test...
|
|
177
|
+
// const result = await client.txGeneratorAutomation.meteoraCreatePositionAndDeposit(
|
|
178
|
+
// connection,
|
|
179
|
+
// hawkWallet,
|
|
180
|
+
// {
|
|
181
|
+
// position: web3.Keypair.generate().publicKey.toString(),
|
|
182
|
+
// pool: testPool,
|
|
183
|
+
// userWallet: testWallet,
|
|
184
|
+
// lowerBinRange: activeBin - 20,
|
|
185
|
+
// upperBinRange: activeBin + 20,
|
|
186
|
+
// distribution: 'CURVE',
|
|
187
|
+
// }
|
|
188
|
+
// );
|
|
189
|
+
// logIfNot200(result);
|
|
190
|
+
// expect(result.status).toBe(200);
|
|
191
|
+
// }, TIMEOUT);
|
|
192
|
+
// });
|
|
193
193
|
|
|
194
194
|
describe('Orca Endpoints', () => {});
|
|
195
195
|
|
package/tsconfig.json
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
50
|
|
|
51
51
|
/* Emit */
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
54
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
55
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
56
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
@@ -105,5 +105,8 @@
|
|
|
105
105
|
/* Completeness */
|
|
106
106
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
107
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"exclude": [
|
|
110
|
+
"test"
|
|
111
|
+
]
|
|
109
112
|
}
|