@hawksightco/hawk-sdk 1.3.6 → 1.3.8
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.map +1 -1
- package/dist/src/classes/Transactions.js +32 -25
- package/dist/src/classes/TxGenerator.d.ts +1 -1
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +4 -2
- package/dist/src/functions.d.ts +3 -1
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +21 -2
- package/dist/src/hsToMeteora.js +484 -95
- package/dist/src/idl/iyf-extension-idl.d.ts +196 -0
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +196 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +2 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +2 -2
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +0 -1
- package/dist/src/meteora.d.ts +6 -4
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +102 -15
- package/dist/src/types.d.ts +11 -7
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +32 -32
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,
|
|
1
|
+
{"version":3,"file":"Transactions.d.ts","sour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AoB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuB3E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2F/E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAmFhF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -56,6 +56,7 @@ const whirlpools_sdk_1 = require("@orca-so/whirlpools-sdk");
|
|
|
56
56
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
57
57
|
const RaydiumIxGenerator_1 = require("../ixGenerator/RaydiumIxGenerator");
|
|
58
58
|
const RaydiumSDK_1 = require("./RaydiumSDK");
|
|
59
|
+
const types_3 = require("../types");
|
|
59
60
|
class Transactions {
|
|
60
61
|
/**
|
|
61
62
|
* Prohibit creating instance other than getInstance
|
|
@@ -202,7 +203,7 @@ class Transactions {
|
|
|
202
203
|
strategy: {
|
|
203
204
|
maxBinId: params.binRange.upperRange,
|
|
204
205
|
minBinId: params.binRange.lowerRange,
|
|
205
|
-
strategyType:
|
|
206
|
+
strategyType: types_3.StrategyTypeMap[params.distribution],
|
|
206
207
|
},
|
|
207
208
|
slippage: params.slippage,
|
|
208
209
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
@@ -238,7 +239,7 @@ class Transactions {
|
|
|
238
239
|
strategy: {
|
|
239
240
|
maxBinId: params.binRange.upperRange,
|
|
240
241
|
minBinId: params.binRange.lowerRange,
|
|
241
|
-
strategyType:
|
|
242
|
+
strategyType: types_3.StrategyTypeMap[params.distribution],
|
|
242
243
|
},
|
|
243
244
|
slippage: params.slippage,
|
|
244
245
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
@@ -307,7 +308,7 @@ class Transactions {
|
|
|
307
308
|
strategy: {
|
|
308
309
|
maxBinId,
|
|
309
310
|
minBinId,
|
|
310
|
-
strategyType:
|
|
311
|
+
strategyType: types_3.StrategyTypeMap[params.distribution],
|
|
311
312
|
},
|
|
312
313
|
slippage: params.slippage,
|
|
313
314
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
@@ -333,7 +334,7 @@ class Transactions {
|
|
|
333
334
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
334
335
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
335
336
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
336
|
-
let lbPair,
|
|
337
|
+
let lbPair, lowerBinId, upperBinId;
|
|
337
338
|
if (params.fastGeneration !== undefined) {
|
|
338
339
|
lbPair = params.fastGeneration.pool;
|
|
339
340
|
}
|
|
@@ -348,10 +349,12 @@ class Transactions {
|
|
|
348
349
|
if (userPosition === undefined) {
|
|
349
350
|
throw new Error("Position does not exist."); // this error should not happen...
|
|
350
351
|
}
|
|
351
|
-
|
|
352
|
+
lowerBinId = userPosition.positionData.lowerBinId;
|
|
353
|
+
upperBinId = userPosition.positionData.upperBinId;
|
|
352
354
|
}
|
|
353
355
|
else {
|
|
354
|
-
|
|
356
|
+
lowerBinId = params.fastGeneration.lowerBinId;
|
|
357
|
+
upperBinId = params.fastGeneration.upperBinId;
|
|
355
358
|
}
|
|
356
359
|
const amountBps = params.shouldClaimAndClose
|
|
357
360
|
? new bn_js_1.default(10000)
|
|
@@ -359,7 +362,8 @@ class Transactions {
|
|
|
359
362
|
const mainInstructions = (yield dlmmPool.removeLiquidity(connection, params.userWallet, params.userWallet, {
|
|
360
363
|
user: userPda,
|
|
361
364
|
position: params.position,
|
|
362
|
-
|
|
365
|
+
fromBinId: lowerBinId,
|
|
366
|
+
toBinId: upperBinId,
|
|
363
367
|
bps: amountBps,
|
|
364
368
|
shouldClaimAndClose: params.shouldClaimAndClose,
|
|
365
369
|
pdaTokenType: params.pdaTokenType,
|
|
@@ -396,7 +400,7 @@ class Transactions {
|
|
|
396
400
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
397
401
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
398
402
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
399
|
-
let lbPair,
|
|
403
|
+
let lbPair, lowerBinId, upperBinId;
|
|
400
404
|
if (params.fastGeneration !== undefined) {
|
|
401
405
|
lbPair = params.fastGeneration.pool;
|
|
402
406
|
}
|
|
@@ -411,10 +415,12 @@ class Transactions {
|
|
|
411
415
|
if (userPosition === undefined) {
|
|
412
416
|
throw new Error("Position does not exist."); // this error should not happen...
|
|
413
417
|
}
|
|
414
|
-
|
|
418
|
+
lowerBinId = userPosition.positionData.lowerBinId;
|
|
419
|
+
upperBinId = userPosition.positionData.upperBinId;
|
|
415
420
|
}
|
|
416
421
|
else {
|
|
417
|
-
|
|
422
|
+
lowerBinId = params.fastGeneration.lowerBinId;
|
|
423
|
+
upperBinId = params.fastGeneration.upperBinId;
|
|
418
424
|
}
|
|
419
425
|
const amountBps = params.shouldClaimAndClose
|
|
420
426
|
? new bn_js_1.default(10000)
|
|
@@ -422,7 +428,8 @@ class Transactions {
|
|
|
422
428
|
const withdrawPdaBuilder = yield dlmmPool.removeLiquidityPda(params.userWallet, params.userWallet, {
|
|
423
429
|
user: userPda,
|
|
424
430
|
position: params.position,
|
|
425
|
-
|
|
431
|
+
fromBinId: lowerBinId,
|
|
432
|
+
toBinId: upperBinId,
|
|
426
433
|
bps: amountBps,
|
|
427
434
|
shouldClaimAndClose: params.shouldClaimAndClose,
|
|
428
435
|
pdaTokenType: params.pdaTokenType,
|
|
@@ -672,7 +679,7 @@ class Transactions {
|
|
|
672
679
|
strategy: {
|
|
673
680
|
maxBinId: position.upperBinId,
|
|
674
681
|
minBinId: position.lowerBinId,
|
|
675
|
-
strategyType:
|
|
682
|
+
strategyType: types_3.StrategyTypeMap["SPOT-IMBALANCED"], // TODO: how to get the right distribution from chain??
|
|
676
683
|
},
|
|
677
684
|
skipInputTokenCheck: true,
|
|
678
685
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
@@ -738,7 +745,8 @@ class Transactions {
|
|
|
738
745
|
const removeLiquidityBuilder = yield dlmmPool.removeLiquidity(connection, params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
739
746
|
user: userPda,
|
|
740
747
|
position: params.currentPosition,
|
|
741
|
-
|
|
748
|
+
fromBinId: position.lowerBinId,
|
|
749
|
+
toBinId: position.upperBinId,
|
|
742
750
|
bps: new bn_js_1.default(10000),
|
|
743
751
|
shouldClaimAndClose: true,
|
|
744
752
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
@@ -759,7 +767,7 @@ class Transactions {
|
|
|
759
767
|
strategy: {
|
|
760
768
|
maxBinId: params.binRange.upperRange,
|
|
761
769
|
minBinId: params.binRange.lowerRange,
|
|
762
|
-
strategyType:
|
|
770
|
+
strategyType: types_3.StrategyTypeMap[params.distribution],
|
|
763
771
|
},
|
|
764
772
|
skipInputTokenCheck: true, // Rebalance should be independent of user wallet TA
|
|
765
773
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
@@ -791,11 +799,11 @@ class Transactions {
|
|
|
791
799
|
if (userPosition === undefined) {
|
|
792
800
|
throw new Error(`Position: ${params.currentPosition} does not exist.`);
|
|
793
801
|
}
|
|
794
|
-
const binIdsToRemove = userPosition.positionData.positionBinData.map((bin) => bin.binId);
|
|
795
802
|
const removeLiquidityBuilder = yield dlmmPool.removeLiquidity(connection, params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
796
803
|
user: userPda,
|
|
797
804
|
position: params.currentPosition,
|
|
798
|
-
|
|
805
|
+
fromBinId: position.lowerBinId,
|
|
806
|
+
toBinId: position.upperBinId,
|
|
799
807
|
bps: new bn_js_1.default(10000),
|
|
800
808
|
shouldClaimAndClose: true,
|
|
801
809
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
@@ -817,7 +825,7 @@ class Transactions {
|
|
|
817
825
|
relativeUpperBinId: relativeBinRange.upperRange,
|
|
818
826
|
// Note: we use the raw strategy types since the type is passed directly as IX instead of converted via meteora SDK
|
|
819
827
|
//
|
|
820
|
-
strategyType:
|
|
828
|
+
strategyType: types_3.StrategyTypeMap[distribution],
|
|
821
829
|
checkRange: {
|
|
822
830
|
minBinId: checkRange.lowerRange,
|
|
823
831
|
maxBinId: checkRange.upperRange,
|
|
@@ -853,7 +861,7 @@ class Transactions {
|
|
|
853
861
|
strategy: {
|
|
854
862
|
maxBinId: params.binRange.upperRange,
|
|
855
863
|
minBinId: params.binRange.lowerRange,
|
|
856
|
-
strategyType:
|
|
864
|
+
strategyType: types_3.StrategyTypeMap[params.distribution],
|
|
857
865
|
},
|
|
858
866
|
skipInputTokenCheck: true, // Rebalance should be independent of user wallet TA
|
|
859
867
|
opt: {
|
|
@@ -948,7 +956,8 @@ class Transactions {
|
|
|
948
956
|
removeLiquidityBuilder = yield retryRpcCall(() => dlmmPool.removeLiquidity(connection, params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
949
957
|
user: userPda,
|
|
950
958
|
position: params.position,
|
|
951
|
-
|
|
959
|
+
fromBinId: position.lowerBinId,
|
|
960
|
+
toBinId: position.upperBinId,
|
|
952
961
|
bps: new bn_js_1.default(10000),
|
|
953
962
|
shouldClaimAndClose: true,
|
|
954
963
|
pdaTokenType: params.pdaTokenType,
|
|
@@ -1002,7 +1011,8 @@ class Transactions {
|
|
|
1002
1011
|
const txn = yield dlmmPool.dlmm.removeLiquidity({
|
|
1003
1012
|
user: userPda,
|
|
1004
1013
|
position: params.position,
|
|
1005
|
-
|
|
1014
|
+
fromBinId: position.lowerBinId,
|
|
1015
|
+
toBinId: position.upperBinId,
|
|
1006
1016
|
bps: new bn_js_1.default(10000),
|
|
1007
1017
|
shouldClaimAndClose: true,
|
|
1008
1018
|
});
|
|
@@ -1161,15 +1171,12 @@ class Transactions {
|
|
|
1161
1171
|
// const binIdsToRemove = userPositions[0].positionData.positionBinData.map(
|
|
1162
1172
|
// (bin) => bin.binId
|
|
1163
1173
|
// );
|
|
1164
|
-
const binIdsToRemove = [];
|
|
1165
|
-
for (let i = position.lowerBinId; i <= position.upperBinId; i++) {
|
|
1166
|
-
binIdsToRemove.push(i);
|
|
1167
|
-
}
|
|
1168
1174
|
// Claim fees and/or rewards, remove liquidity, and possibly close position from Meteora API (if set)
|
|
1169
1175
|
const txn = yield dlmmPool.dlmm.removeLiquidity({
|
|
1170
1176
|
user: userPda,
|
|
1171
1177
|
position: params.position,
|
|
1172
|
-
|
|
1178
|
+
fromBinId: position.lowerBinId,
|
|
1179
|
+
toBinId: position.upperBinId,
|
|
1173
1180
|
bps: new bn_js_1.default(10000),
|
|
1174
1181
|
shouldClaimAndClose: true,
|
|
1175
1182
|
});
|
|
@@ -132,7 +132,7 @@ export declare class TxGenerator {
|
|
|
132
132
|
* @param params Parameters required
|
|
133
133
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
134
134
|
*/
|
|
135
|
-
meteoraWithdraw(connection: web3.Connection, payer: string, params:
|
|
135
|
+
meteoraWithdraw(connection: web3.Connection, payer: string, params: MeteoraTxWithdraw): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
136
136
|
/**
|
|
137
137
|
* Creates meteora instruction withdraws from a position.
|
|
138
138
|
*
|
|
@@ -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,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EAInB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kCAAkC,EAClC,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,+BAA+B,
|
|
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,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EAInB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kCAAkC,EAClC,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,+BAA+B,EAEhC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;CACL,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B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,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IA8B7C,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA6BpD"}
|
|
@@ -449,7 +449,8 @@ class TxGenerator {
|
|
|
449
449
|
fastGeneration: params.fastGeneration
|
|
450
450
|
? {
|
|
451
451
|
pool: new web3.PublicKey(params.fastGeneration.pool),
|
|
452
|
-
|
|
452
|
+
lowerBinId: params.fastGeneration.lowerBinId,
|
|
453
|
+
upperBinId: params.fastGeneration.upperBinId,
|
|
453
454
|
}
|
|
454
455
|
: undefined,
|
|
455
456
|
pdaTokenType: (_a = params.pdaTokenType) !== null && _a !== void 0 ? _a : types_1.TokenType.ATA,
|
|
@@ -496,7 +497,8 @@ class TxGenerator {
|
|
|
496
497
|
fastGeneration: params.fastGeneration
|
|
497
498
|
? {
|
|
498
499
|
pool: new web3.PublicKey(params.fastGeneration.pool),
|
|
499
|
-
|
|
500
|
+
lowerBinId: params.fastGeneration.lowerBinId,
|
|
501
|
+
upperBinId: params.fastGeneration.upperBinId,
|
|
500
502
|
}
|
|
501
503
|
: undefined,
|
|
502
504
|
useAta: params.useAta,
|
package/dist/src/functions.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as client from "@hawksightco/swagger-client";
|
|
3
3
|
import * as web3 from "@solana/web3.js";
|
|
4
|
-
import { MeteoraPoolInfo, ResponseWithStatus, TransactionMetadata, TransactionMetadataResponse, TokenAccountData, CreateAtaIdempotentParams, GetMintsFromInstructionParams, Instruction, PriorityFeeEstimate, TokenType } from "./types";
|
|
4
|
+
import { MeteoraPoolInfo, ResponseWithStatus, TransactionMetadata, TransactionMetadataResponse, TokenAccountData, CreateAtaIdempotentParams, GetMintsFromInstructionParams, Instruction, PriorityFeeEstimate, TokenType, StrategyType } from "./types";
|
|
5
5
|
import { GeneralUtility } from './classes/GeneralUtility';
|
|
6
6
|
import BN from "bn.js";
|
|
7
|
+
import { StrategyType as MeteoraStrategyType } from "@meteora-ag/dlmm";
|
|
7
8
|
export declare const METEORA_API_URL = "https://dlmm-api.meteora.ag";
|
|
8
9
|
/**
|
|
9
10
|
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
@@ -396,5 +397,6 @@ export declare function pubkeysInAlt(pubkeys: string[], alt: web3.AddressLookupT
|
|
|
396
397
|
export declare function getBatchedMultipleAccountsInfo(connection: web3.Connection, pubkeys: web3.PublicKey[], commitment?: web3.Commitment): Promise<(web3.AccountInfo<Buffer> | null)[]>;
|
|
397
398
|
export declare function getTokenProgramForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<web3.PublicKey>;
|
|
398
399
|
export declare function getTokenProgramMapForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<Record<string, web3.PublicKey>>;
|
|
400
|
+
export declare function getMeteoraStrategyType(strategyType: StrategyType, totalXAmount: BN, totalYAmount: BN): [MeteoraStrategyType, (boolean | undefined)];
|
|
399
401
|
export {};
|
|
400
402
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,EACnB,SAAS,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/funct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AAC,CAenJ"}
|
package/dist/src/functions.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.simulateTransaction = exports.extractPrimitives = exports.resolveDefined = exports.resolveArray = exports.resolveVec = exports.resolveOption = exports.resolveEnum = exports.resolveStruct = exports.extractValue = exports.deserializeParametersFromIDL = exports.tokenizer = exports.benchmark = exports.findNonceOwnedBy = exports.generateNonceAddressesOwnedBy = exports.generateNonceAddressFromIndex = exports.mid = exports.getPriorityFeeEstimate2 = exports.getPriorityFeeEstimate = exports.stringToAlt = exports.ixStrToWeb3Ix = exports.toVersionedTransaction = exports.getJupiterRouteIxParams = exports.inputTokenExists = exports.unwrapWsolToSol = exports.unwrapSolIfMintIsWsol = exports.wrapSolToWsol = exports.wrapSolIfMintIsWsol = exports.getMintsFromInstruction = exports.createAtaIdempotentIxs = exports.parseTokenAccountData = exports.tokenAccountExists = exports.sighash = exports.sighashMatch = exports.getIxs = exports.generateUserPdaStorageAccount = exports.generateOrcaPositionPDA = exports.generateAta2022 = exports.generateFuelAccount = exports.generateLimitToken = exports.generateAta = exports.generateUserPdaLamport = exports.generateUserPda = exports.legacyTxMetadata = exports.createTransactionMeta = exports.getMeteoraPool = exports.getFeeEstimate = exports.resultOrError = exports.createTxMetadata2 = exports.createTxMetadata = exports.METEORA_API_URL = void 0;
|
|
39
|
-
exports.getTokenProgramMapForMints = exports.getTokenProgramForMints = exports.getBatchedMultipleAccountsInfo = exports.pubkeysInAlt = exports.findUserAlts = exports.i32ToBeBuffer = exports.raydiumStartTickIndex = exports.createAssociatedTokenAccountIdempotentInstruction = void 0;
|
|
39
|
+
exports.getMeteoraStrategyType = exports.getTokenProgramMapForMints = exports.getTokenProgramForMints = exports.getBatchedMultipleAccountsInfo = exports.pubkeysInAlt = exports.findUserAlts = exports.i32ToBeBuffer = exports.raydiumStartTickIndex = exports.createAssociatedTokenAccountIdempotentInstruction = void 0;
|
|
40
40
|
const client = __importStar(require("@hawksightco/swagger-client"));
|
|
41
41
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
42
42
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -472,7 +472,9 @@ function getMintsFromInstruction({ instructions, find, }) {
|
|
|
472
472
|
for (const id in find) {
|
|
473
473
|
// Check if the instruction data matches the sighash and the program ID matches
|
|
474
474
|
try {
|
|
475
|
-
|
|
475
|
+
const _sighash = sighash(id, undefined, find[id].manualSnakeCase);
|
|
476
|
+
console.log(`id: ${id}, ix.data: ${ix.data.subarray(0, 8).join(',')}, sighash(id): ${_sighash.join(',')}, ix.programId: ${ix.programId}, match: ${sighashMatch(ix.data, _sighash)}`);
|
|
477
|
+
if (sighashMatch(ix.data, _sighash) &&
|
|
476
478
|
ix.programId.toBase58() == find[id].programId) {
|
|
477
479
|
// Iterate through each mint index specified in the find record
|
|
478
480
|
for (const index of find[id].mintIndices) {
|
|
@@ -1200,3 +1202,20 @@ function getTokenProgramMapForMints(connection, mints) {
|
|
|
1200
1202
|
});
|
|
1201
1203
|
}
|
|
1202
1204
|
exports.getTokenProgramMapForMints = getTokenProgramMapForMints;
|
|
1205
|
+
function getMeteoraStrategyType(strategyType, totalXAmount, totalYAmount) {
|
|
1206
|
+
let singleSidedX;
|
|
1207
|
+
const [_strategyType, oneSide] = types_1.StrategyTypeMap2[strategyType];
|
|
1208
|
+
if (oneSide) {
|
|
1209
|
+
if (totalXAmount.gt(new bn_js_1.default(0)) && totalYAmount.eq(new bn_js_1.default(0))) {
|
|
1210
|
+
singleSidedX = true;
|
|
1211
|
+
}
|
|
1212
|
+
else if (totalXAmount.eq(new bn_js_1.default(0)) && totalYAmount.gt(new bn_js_1.default(0))) {
|
|
1213
|
+
singleSidedX = false;
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
throw new errors_1.AppError("Total X or Y amount must be greater than 0 when adding liquidity one-sided");
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return [_strategyType, singleSidedX];
|
|
1220
|
+
}
|
|
1221
|
+
exports.getMeteoraStrategyType = getMeteoraStrategyType;
|