@hawksightco/hawk-sdk 1.1.45 → 1.1.47-hotfix-1
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 +18 -0
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +95 -0
- package/dist/src/classes/TxGenerator.d.ts +18 -0
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +92 -0
- package/dist/src/idl/iyf-extension-idl.d.ts +0 -8
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +0 -8
- package/dist/src/meteora.d.ts +130 -0
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +260 -1
- package/package.json +1 -1
|
@@ -49,6 +49,15 @@ export declare class Transactions {
|
|
|
49
49
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
50
50
|
*/
|
|
51
51
|
meteoraCreatePositionAndDeposit({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDeposit>): Promise<TransactionMetadataResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates meteora instruction that creates new position and deposit.
|
|
54
|
+
*
|
|
55
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
56
|
+
* @param payer The public key of the payer for transaction fees.
|
|
57
|
+
* @param params Parameters required
|
|
58
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
59
|
+
*/
|
|
60
|
+
meteoraCreatePositionAndDepositPda({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDeposit>): Promise<TransactionMetadataResponse>;
|
|
52
61
|
/**
|
|
53
62
|
* Creates meteora instruction that initializes bin arrays.
|
|
54
63
|
*
|
|
@@ -76,6 +85,15 @@ export declare class Transactions {
|
|
|
76
85
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
77
86
|
*/
|
|
78
87
|
meteoraWithdraw({ connection, params, }: TxgenParams<MeteoraWithdraw>): Promise<TransactionMetadataResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates meteora instruction withdraws from a position.
|
|
90
|
+
*
|
|
91
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
92
|
+
* @param payer The public key of the payer for transaction fees.
|
|
93
|
+
* @param params Parameters required
|
|
94
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
95
|
+
*/
|
|
96
|
+
meteoraWithdrawPda({ connection, params, }: TxgenParams<MeteoraWithdraw>): Promise<TransactionMetadataResponse>;
|
|
79
97
|
/**
|
|
80
98
|
* Creates meteora instruction that claims fees and rewards.
|
|
81
99
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAiBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAER,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA8BlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,YAAY;IAEvB;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IAEtC;;OAEG;IACI,EAAE,EAAE,iBAAiB,CAAC;IAE7B;;;;OAIG;IACH,MAAM,CAAC,W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Transactions {
|
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Creates meteora instruction that creates new position and deposit.
|
|
173
|
+
*
|
|
174
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
175
|
+
* @param payer The public key of the payer for transaction fees.
|
|
176
|
+
* @param params Parameters required
|
|
177
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
178
|
+
*/
|
|
179
|
+
meteoraCreatePositionAndDepositPda(_a) {
|
|
180
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
181
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, new web3.PublicKey(params.pool));
|
|
182
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
183
|
+
const mainInstructions = (yield dlmmPool.initializePositionAndAddLiquidityByStrategyPda(params.userWallet, params.userWallet, {
|
|
184
|
+
positionPubKey: params.position,
|
|
185
|
+
user: userPda,
|
|
186
|
+
totalXAmount: params.totalXAmount,
|
|
187
|
+
totalYAmount: params.totalYAmount,
|
|
188
|
+
strategy: {
|
|
189
|
+
maxBinId: params.binRange.upperRange,
|
|
190
|
+
minBinId: params.binRange.lowerRange,
|
|
191
|
+
strategyType: types_1.StrategyTypeMap[params.distribution],
|
|
192
|
+
},
|
|
193
|
+
slippage: params.slippage,
|
|
194
|
+
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
195
|
+
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
196
|
+
return (0, functions_1.createTransactionMeta)({
|
|
197
|
+
payer: params.userWallet,
|
|
198
|
+
description: "Create position and deposit to Meteora DLMM",
|
|
199
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
200
|
+
mainInstructions,
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
171
204
|
/**
|
|
172
205
|
* Creates meteora instruction that initializes bin arrays.
|
|
173
206
|
*
|
|
@@ -298,6 +331,68 @@ class Transactions {
|
|
|
298
331
|
});
|
|
299
332
|
});
|
|
300
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Creates meteora instruction withdraws from a position.
|
|
336
|
+
*
|
|
337
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
338
|
+
* @param payer The public key of the payer for transaction fees.
|
|
339
|
+
* @param params Parameters required
|
|
340
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse.
|
|
341
|
+
*/
|
|
342
|
+
meteoraWithdrawPda(_a) {
|
|
343
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
344
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
345
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
346
|
+
let lbPair, binIdsToRemove;
|
|
347
|
+
if (params.fastGeneration !== undefined) {
|
|
348
|
+
lbPair = params.fastGeneration.pool;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
const position = yield program.account.positionV2.fetch(params.position);
|
|
352
|
+
lbPair = position.lbPair;
|
|
353
|
+
}
|
|
354
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, lbPair);
|
|
355
|
+
if (params.fastGeneration === undefined) {
|
|
356
|
+
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
357
|
+
const userPosition = userPositions.find((userPosition) => userPosition.publicKey.toString() === params.position.toString());
|
|
358
|
+
if (userPosition === undefined) {
|
|
359
|
+
throw new Error("Position does not exist."); // this error should not happen...
|
|
360
|
+
}
|
|
361
|
+
binIdsToRemove = userPosition.positionData.positionBinData.map((bin) => bin.binId);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
binIdsToRemove = params.fastGeneration.binIdsToRemove;
|
|
365
|
+
}
|
|
366
|
+
const amountBps = params.shouldClaimAndClose
|
|
367
|
+
? new bn_js_1.default(10000)
|
|
368
|
+
: params.amountBps;
|
|
369
|
+
const mainInstructions = (yield dlmmPool.removeLiquidityPda(params.userWallet, params.userWallet, {
|
|
370
|
+
user: userPda,
|
|
371
|
+
position: params.position,
|
|
372
|
+
binIds: binIdsToRemove,
|
|
373
|
+
bps: amountBps,
|
|
374
|
+
shouldClaimAndClose: params.shouldClaimAndClose,
|
|
375
|
+
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
376
|
+
let description;
|
|
377
|
+
if (params.shouldClaimAndClose) {
|
|
378
|
+
description =
|
|
379
|
+
"Full position withdrawal with claim and close instructisons from Meteora DLMM";
|
|
380
|
+
}
|
|
381
|
+
else if (amountBps.eq(new bn_js_1.default(10000))) {
|
|
382
|
+
description =
|
|
383
|
+
"Full position withdrawal without claim and close instructions from Meteora DLMM";
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
description = "Partial position withdrawal from Meteora DLMM";
|
|
387
|
+
}
|
|
388
|
+
return (0, functions_1.createTransactionMeta)({
|
|
389
|
+
payer: params.userWallet,
|
|
390
|
+
description,
|
|
391
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
392
|
+
mainInstructions,
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
301
396
|
/**
|
|
302
397
|
* Creates meteora instruction that claims fees and rewards.
|
|
303
398
|
*
|
|
@@ -28,6 +28,15 @@ export declare class TxGenerator {
|
|
|
28
28
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
29
29
|
*/
|
|
30
30
|
meteoraCreatePositionAndDeposit(connection: web3.Connection, payer: string, params: _client.TxCreatePositionAndDepositBody): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates meteora instruction that creates new position and deposit.
|
|
33
|
+
*
|
|
34
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
35
|
+
* @param payer The public key of the payer for transaction fees.
|
|
36
|
+
* @param params Parameters required
|
|
37
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
38
|
+
*/
|
|
39
|
+
meteoraCreatePositionAndDepositPda(connection: web3.Connection, payer: string, params: _client.TxCreatePositionAndDepositBody): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
31
40
|
/**
|
|
32
41
|
* Creates meteora instruction that deposits to position.
|
|
33
42
|
*
|
|
@@ -46,6 +55,15 @@ export declare class TxGenerator {
|
|
|
46
55
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
47
56
|
*/
|
|
48
57
|
meteoraWithdraw(connection: web3.Connection, payer: string, params: _client.TxWithdrawBody): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates meteora instruction withdraws from a position.
|
|
60
|
+
*
|
|
61
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
62
|
+
* @param payer The public key of the payer for transaction fees.
|
|
63
|
+
* @param params Parameters required
|
|
64
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
65
|
+
*/
|
|
66
|
+
meteoraWithdrawPda(connection: web3.Connection, payer: string, params: _client.TxWithdrawBody): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
49
67
|
/**
|
|
50
68
|
* Creates meteora instruction that claims fees and rewards.
|
|
51
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAkE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACtO,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM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,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAgChJ;;;;;;;OAOG;IACG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAmCpI;;;;;;;OAOG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCtI;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA+B/I"}
|
|
@@ -101,6 +101,53 @@ class TxGenerator {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Creates meteora instruction that creates new position and deposit.
|
|
106
|
+
*
|
|
107
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
108
|
+
* @param payer The public key of the payer for transaction fees.
|
|
109
|
+
* @param params Parameters required
|
|
110
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
111
|
+
*/
|
|
112
|
+
meteoraCreatePositionAndDepositPda(connection, payer, params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
// Initialize anchor
|
|
115
|
+
anchor_1.Anchor.initialize(connection);
|
|
116
|
+
try {
|
|
117
|
+
const result = yield Transactions_1.txgen.meteoraCreatePositionAndDepositPda({
|
|
118
|
+
connection,
|
|
119
|
+
params: {
|
|
120
|
+
position: new web3.PublicKey(params.position),
|
|
121
|
+
pool: new web3.PublicKey(params.pool),
|
|
122
|
+
userWallet: new web3.PublicKey(params.userWallet),
|
|
123
|
+
totalXAmount: new bn_js_1.BN(params.totalXAmount),
|
|
124
|
+
totalYAmount: new bn_js_1.BN(params.totalYAmount),
|
|
125
|
+
binRange: {
|
|
126
|
+
lowerRange: params.lowerBinRange,
|
|
127
|
+
upperRange: params.upperBinRange,
|
|
128
|
+
},
|
|
129
|
+
slippage: params.slippage,
|
|
130
|
+
distribution: params.distribution,
|
|
131
|
+
skipInputTokenCheck: true,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
status: 200,
|
|
136
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
return {
|
|
141
|
+
status: 400,
|
|
142
|
+
data: {
|
|
143
|
+
code: "custom",
|
|
144
|
+
message: e,
|
|
145
|
+
path: [],
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
104
151
|
/**
|
|
105
152
|
* Creates meteora instruction that deposits to position.
|
|
106
153
|
*
|
|
@@ -190,6 +237,51 @@ class TxGenerator {
|
|
|
190
237
|
}
|
|
191
238
|
});
|
|
192
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Creates meteora instruction withdraws from a position.
|
|
242
|
+
*
|
|
243
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
244
|
+
* @param payer The public key of the payer for transaction fees.
|
|
245
|
+
* @param params Parameters required
|
|
246
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
247
|
+
*/
|
|
248
|
+
meteoraWithdrawPda(connection, payer, params) {
|
|
249
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
// Initialize anchor
|
|
251
|
+
anchor_1.Anchor.initialize(connection);
|
|
252
|
+
try {
|
|
253
|
+
const result = yield Transactions_1.txgen.meteoraWithdrawPda({
|
|
254
|
+
connection,
|
|
255
|
+
params: {
|
|
256
|
+
position: new web3.PublicKey(params.position),
|
|
257
|
+
userWallet: new web3.PublicKey(params.userWallet),
|
|
258
|
+
amountBps: new bn_js_1.BN(params.amountBps),
|
|
259
|
+
shouldClaimAndClose: params.shouldClaimAndClose,
|
|
260
|
+
fastGeneration: params.fastGeneration
|
|
261
|
+
? {
|
|
262
|
+
pool: new web3.PublicKey(params.fastGeneration.pool),
|
|
263
|
+
binIdsToRemove: params.fastGeneration.binIdsToRemove,
|
|
264
|
+
}
|
|
265
|
+
: undefined,
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
status: 200,
|
|
270
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
return {
|
|
275
|
+
status: 400,
|
|
276
|
+
data: {
|
|
277
|
+
code: "custom",
|
|
278
|
+
message: e,
|
|
279
|
+
path: [],
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
193
285
|
/**
|
|
194
286
|
* Creates meteora instruction that claims fees and rewards.
|
|
195
287
|
*
|
|
@@ -3242,14 +3242,6 @@ export type IyfExtension = {
|
|
|
3242
3242
|
"Token Y Mint (to be validated by meteora lb_pair within their program)"
|
|
3243
3243
|
];
|
|
3244
3244
|
},
|
|
3245
|
-
{
|
|
3246
|
-
"name": "binArrayLower";
|
|
3247
|
-
"writable": true;
|
|
3248
|
-
},
|
|
3249
|
-
{
|
|
3250
|
-
"name": "binArrayUpper";
|
|
3251
|
-
"writable": true;
|
|
3252
|
-
},
|
|
3253
3245
|
{
|
|
3254
3246
|
"name": "systemProgram";
|
|
3255
3247
|
"docs": [
|