@hawksightco/hawk-sdk 1.2.9 → 1.2.11
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/SimpleIxGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimpleIxGenerator.js +1 -1
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +17 -17
- package/dist/src/classes/TxGenerator.d.ts +2 -2
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +8 -1
- package/dist/src/hawksight.d.ts +17 -2
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +120 -6
- package/dist/src/hsToMeteora.d.ts +3 -3
- package/dist/src/hsToMeteora.d.ts.map +1 -1
- package/dist/src/hsToMeteora.js +223 -44
- package/dist/src/idl/iyf-main-idl.d.ts +129 -0
- package/dist/src/idl/iyf-main-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-main-idl.js +129 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +54 -4
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +70 -4
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +3 -3
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +5 -5
- package/dist/src/meteora.d.ts +9 -1
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +21 -8
- package/dist/src/types.d.ts +8 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/SimpleIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;A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9D;;;;OAIG;IACI,YAAY,EAAE,uBAAuB,CAAuD;IAEnG;;;;OAIG;IACI,WAAW,EAAE,sBAAsB,CAAoC;IAE9E;;;;OAIG;IACI,IAAI,EAAE,eAAe,CAAqC;IAEjE;;;;;;;OAOG;IACI,OAAO,EAAE,kBAAkB,CAAqE;CACxG"}
|
|
@@ -41,7 +41,7 @@ class SimpleIxGenerator {
|
|
|
41
41
|
* Handles concentrated liquidity pool interactions and transactions.
|
|
42
42
|
* @param iyfMain - Reference to the main IYF instruction generator for dependency injection
|
|
43
43
|
*/
|
|
44
|
-
this.meteoraDlmm = new MeteoraDlmmIxGenerator_1.MeteoraDlmmIxGenerator(this
|
|
44
|
+
this.meteoraDlmm = new MeteoraDlmmIxGenerator_1.MeteoraDlmmIxGenerator(this);
|
|
45
45
|
/**
|
|
46
46
|
* Instruction generator for Orca DEX operations.
|
|
47
47
|
* Handles Orca-specific pool interactions and transactions.
|
|
@@ -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,EAGR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,
|
|
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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,MAAM,GACP,EAAE,WAAW,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA0LpE;;;;;;;OAOG;IACG,YAAY,CAAC,EACjB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA0GnE;;;;;;;OAOG;IACG,eAAe,CAAC,EACpB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAmOnE;;;;;;;OAOG;IACG,gBAAgB,CAAC,EACrB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA8IvE;;;;;;OAMG;IACG,mBAAmB,CAAC,EACxB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAyB1E;;;;;;OAMG;IACG,oBAAoB,CAAC,EACzB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAiB3E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA6B/E;;;;;;OAMG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAiChF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -166,18 +166,10 @@ class Transactions {
|
|
|
166
166
|
for (let i = 0; i < accountsData.length; i++) {
|
|
167
167
|
if (!accountsData[i]) {
|
|
168
168
|
(0, Logging_1.Log)(`initializing STA: ${filteredMints[i].toBase58()}`);
|
|
169
|
-
mainInstructions.push(yield
|
|
170
|
-
.
|
|
171
|
-
.accounts({
|
|
172
|
-
userPda: userPda,
|
|
173
|
-
payer: params.userWallet,
|
|
169
|
+
mainInstructions.push(yield this.ix.iyfMain.initializeStorageTokenAccount(connection, {
|
|
170
|
+
userWallet: params.userWallet,
|
|
174
171
|
mint: filteredMints[i],
|
|
175
|
-
|
|
176
|
-
rent: web3.SYSVAR_RENT_PUBKEY,
|
|
177
|
-
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
178
|
-
systemProgram: web3.SystemProgram.programId,
|
|
179
|
-
})
|
|
180
|
-
.instruction());
|
|
172
|
+
}));
|
|
181
173
|
}
|
|
182
174
|
}
|
|
183
175
|
return (0, functions_1.createTransactionMeta)({
|
|
@@ -212,6 +204,7 @@ class Transactions {
|
|
|
212
204
|
},
|
|
213
205
|
slippage: params.slippage,
|
|
214
206
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
207
|
+
pdaTokenType: params.pdaTokenType,
|
|
215
208
|
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
216
209
|
return (0, functions_1.createTransactionMeta)({
|
|
217
210
|
payer: params.userWallet,
|
|
@@ -245,6 +238,7 @@ class Transactions {
|
|
|
245
238
|
},
|
|
246
239
|
slippage: params.slippage,
|
|
247
240
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
241
|
+
pdaTokenType: params.pdaTokenType,
|
|
248
242
|
}, hsToMeteora_1.meteoraToHawksightPdaIxs)).default();
|
|
249
243
|
return (0, functions_1.createTransactionMeta)({
|
|
250
244
|
payer: params.userWallet,
|
|
@@ -313,6 +307,7 @@ class Transactions {
|
|
|
313
307
|
},
|
|
314
308
|
slippage: params.slippage,
|
|
315
309
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
310
|
+
pdaTokenType: params.pdaTokenType,
|
|
316
311
|
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
317
312
|
return (0, functions_1.createTransactionMeta)({
|
|
318
313
|
payer: params.userWallet,
|
|
@@ -363,6 +358,7 @@ class Transactions {
|
|
|
363
358
|
binIds: binIdsToRemove,
|
|
364
359
|
bps: amountBps,
|
|
365
360
|
shouldClaimAndClose: params.shouldClaimAndClose,
|
|
361
|
+
pdaTokenType: params.pdaTokenType,
|
|
366
362
|
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
367
363
|
let description;
|
|
368
364
|
if (params.shouldClaimAndClose) {
|
|
@@ -472,11 +468,12 @@ class Transactions {
|
|
|
472
468
|
lbPair = position.lbPair;
|
|
473
469
|
}
|
|
474
470
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
475
|
-
const fn = new meteora_1.MeteoraFunctions();
|
|
471
|
+
const fn = new meteora_1.MeteoraFunctions(this.ix);
|
|
476
472
|
const mainInstructions = (yield fn.claimAllRewardsByPosition(connection, params.userWallet, params.userWallet, {
|
|
477
473
|
owner: userPda,
|
|
478
474
|
position: params.position,
|
|
479
475
|
lbPair,
|
|
476
|
+
pdaTokenType: params.pdaTokenType,
|
|
480
477
|
}, hsToMeteora_1.meteoraToHawksight)).default();
|
|
481
478
|
const txMeta = (0, functions_1.createTransactionMeta)({
|
|
482
479
|
payer: params.userWallet,
|
|
@@ -498,7 +495,7 @@ class Transactions {
|
|
|
498
495
|
meteoraClaimAll(_a, payer_1, generalUtility_1) {
|
|
499
496
|
return __awaiter(this, arguments, void 0, function* ({ connection, params }, payer, generalUtility) {
|
|
500
497
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
501
|
-
const fn = new meteora_1.MeteoraFunctions();
|
|
498
|
+
const fn = new meteora_1.MeteoraFunctions(this.ix);
|
|
502
499
|
// Step 1: Get all user position
|
|
503
500
|
// This function also downloads pools needed to generate claim all transaction.
|
|
504
501
|
const positions = yield fn.getAllUserPosition(connection, userPda);
|
|
@@ -649,11 +646,12 @@ class Transactions {
|
|
|
649
646
|
throw new Error(`Position: ${params.position} does not exist.`);
|
|
650
647
|
}
|
|
651
648
|
// Claim fee and claim reward ixs
|
|
652
|
-
const fn = new meteora_1.MeteoraFunctions();
|
|
649
|
+
const fn = new meteora_1.MeteoraFunctions(this.ix);
|
|
653
650
|
const claimBuilder = yield fn.claimAllRewardsByPosition(connection, params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
654
651
|
owner: userPda,
|
|
655
652
|
position: params.position,
|
|
656
653
|
lbPair: position.lbPair,
|
|
654
|
+
pdaTokenType: types_1.TokenType.ATA,
|
|
657
655
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
658
656
|
// Re-deposit fees (TODO: How to re-deposit reward tokens that is not X or Y token?)
|
|
659
657
|
const addLiquidityBuilder = yield dlmmPool.addLiquidityByStrategy(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
@@ -696,15 +694,17 @@ class Transactions {
|
|
|
696
694
|
throw new Error(`Position: ${params.position} does not exist.`);
|
|
697
695
|
}
|
|
698
696
|
// Claim fee and claim reward ixs
|
|
699
|
-
const fn = new meteora_1.MeteoraFunctions();
|
|
697
|
+
const fn = new meteora_1.MeteoraFunctions(this.ix);
|
|
700
698
|
const claimBuilder = yield fn.claimAllRewardsByPosition(connection, params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
701
699
|
owner: userPda,
|
|
702
700
|
position: params.position,
|
|
703
701
|
lbPair: position.lbPair,
|
|
702
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
704
703
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
705
704
|
// Change to STA because we want the tokens to be in the HawkFi wallet
|
|
706
|
-
|
|
707
|
-
claimBuilder.
|
|
705
|
+
// NOTE: No longer needed with pdaTokenType
|
|
706
|
+
// claimBuilder.replaceClaimFeeTokenToSTA();
|
|
707
|
+
// claimBuilder.replaceClaimRewardToSTA();
|
|
708
708
|
const mainInstructions = [
|
|
709
709
|
// Step 1: Initialize ATA
|
|
710
710
|
...claimBuilder.createAtaIxs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { InitializeStorageTokenAccount, ClaimTokensFromSTA, ClaimTokenFromSTA, MeteoraTxWithdraw, ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda, RaydiumOpenPosition, RaydiumClosePosition, RaydiumIncreaseLiquidity, RaydiumDecreaseLiquidity, OrcaSweepDust, CreateLimitTokenParams, CloseLimitTokenParams } from "../types";
|
|
3
|
+
import { InitializeStorageTokenAccount, ClaimTokensFromSTA, ClaimTokenFromSTA, MeteoraTxWithdraw, ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda, RaydiumOpenPosition, RaydiumClosePosition, RaydiumIncreaseLiquidity, RaydiumDecreaseLiquidity, OrcaSweepDust, CreateLimitTokenParams, CloseLimitTokenParams, TokenType } from "../types";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
import { MultiTransaction } from "./MultiTransaction";
|
|
@@ -103,7 +103,7 @@ export declare class TxGenerator {
|
|
|
103
103
|
* @param params Parameters required
|
|
104
104
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
105
105
|
*/
|
|
106
|
-
meteoraWithdrawPda(connection: web3.Connection, payer: string, params: MeteoraTxWithdraw): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
106
|
+
meteoraWithdrawPda(connection: web3.Connection, payer: string, params: MeteoraTxWithdraw, pdaTokenType: TokenType): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
107
107
|
/**
|
|
108
108
|
* Creates meteora instruction that claims fees and rewards.
|
|
109
109
|
*
|
|
@@ -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,
|
|
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,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;GAIG;AACH,qBAAa,WAA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CAAC;IAkCnD;;;;;;;OAOG;IACG,aAAa,CACjB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IA8BnD;;;;;;;OAOG;IACG,gBAAgB,CACpB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiC7C,mBAAmB,CACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB;;;;IA+BvB,oBAAoB,CACxB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,oBAAoB;;;;IA+BxB,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB;;;;IA+B5B,wBAAwB,CAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB;;;;CA8BnC"}
|
|
@@ -34,6 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.TxGenerator = void 0;
|
|
36
36
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
37
|
+
const types_1 = require("../types");
|
|
37
38
|
const functions_1 = require("../functions");
|
|
38
39
|
const anchor_1 = require("../anchor");
|
|
39
40
|
const Transactions_1 = require("./Transactions");
|
|
@@ -317,6 +318,7 @@ class TxGenerator {
|
|
|
317
318
|
*/
|
|
318
319
|
meteoraDeposit(connection, payer, params) {
|
|
319
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
+
var _a;
|
|
320
322
|
// Initialize anchor
|
|
321
323
|
anchor_1.Anchor.initialize(connection);
|
|
322
324
|
try {
|
|
@@ -332,6 +334,7 @@ class TxGenerator {
|
|
|
332
334
|
skipInputTokenCheck: params.skipInputTokenCheck,
|
|
333
335
|
fastGeneration: params.fastGeneration
|
|
334
336
|
? Object.assign(Object.assign({}, params.fastGeneration), { pool: new web3.PublicKey(params.fastGeneration.pool) }) : undefined,
|
|
337
|
+
pdaTokenType: (_a = params.pdaTokenType) !== null && _a !== void 0 ? _a : types_1.TokenType.ATA,
|
|
335
338
|
},
|
|
336
339
|
fetch: undefined,
|
|
337
340
|
});
|
|
@@ -362,6 +365,7 @@ class TxGenerator {
|
|
|
362
365
|
*/
|
|
363
366
|
meteoraWithdraw(connection, payer, params) {
|
|
364
367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
var _a;
|
|
365
369
|
// Initialize anchor
|
|
366
370
|
anchor_1.Anchor.initialize(connection);
|
|
367
371
|
try {
|
|
@@ -378,6 +382,7 @@ class TxGenerator {
|
|
|
378
382
|
binIdsToRemove: params.fastGeneration.binIdsToRemove,
|
|
379
383
|
}
|
|
380
384
|
: undefined,
|
|
385
|
+
pdaTokenType: (_a = params.pdaTokenType) !== null && _a !== void 0 ? _a : types_1.TokenType.ATA,
|
|
381
386
|
},
|
|
382
387
|
fetch: undefined,
|
|
383
388
|
});
|
|
@@ -406,7 +411,7 @@ class TxGenerator {
|
|
|
406
411
|
* @param params Parameters required
|
|
407
412
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
408
413
|
*/
|
|
409
|
-
meteoraWithdrawPda(connection, payer, params) {
|
|
414
|
+
meteoraWithdrawPda(connection, payer, params, pdaTokenType) {
|
|
410
415
|
return __awaiter(this, void 0, void 0, function* () {
|
|
411
416
|
// Initialize anchor
|
|
412
417
|
anchor_1.Anchor.initialize(connection);
|
|
@@ -425,6 +430,7 @@ class TxGenerator {
|
|
|
425
430
|
}
|
|
426
431
|
: undefined,
|
|
427
432
|
useAta: params.useAta,
|
|
433
|
+
pdaTokenType: pdaTokenType !== null && pdaTokenType !== void 0 ? pdaTokenType : types_1.TokenType.ATA,
|
|
428
434
|
},
|
|
429
435
|
fetch: undefined,
|
|
430
436
|
});
|
|
@@ -470,6 +476,7 @@ class TxGenerator {
|
|
|
470
476
|
pool: new web3.PublicKey(params.fastGeneration.pool),
|
|
471
477
|
}
|
|
472
478
|
: undefined,
|
|
479
|
+
pdaTokenType: params.pdaTokenType,
|
|
473
480
|
},
|
|
474
481
|
fetch: undefined,
|
|
475
482
|
});
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import BN from "bn.js";
|
|
3
|
+
import { TokenType } from "./types";
|
|
3
4
|
export declare function depositMultipleToken(params: {
|
|
4
5
|
payer: web3.PublicKey;
|
|
5
6
|
deposit: {
|
|
6
7
|
mint: web3.PublicKey;
|
|
7
8
|
amount: BN;
|
|
8
9
|
}[];
|
|
9
|
-
|
|
10
|
+
}): Promise<web3.TransactionInstruction>;
|
|
11
|
+
export declare function depositMultipleTokenV2(params: {
|
|
12
|
+
payer: web3.PublicKey;
|
|
13
|
+
deposit: {
|
|
14
|
+
mint: web3.PublicKey;
|
|
15
|
+
amount: BN;
|
|
16
|
+
}[];
|
|
17
|
+
pdaTokenType?: TokenType;
|
|
10
18
|
}): Promise<web3.TransactionInstruction>;
|
|
11
19
|
export declare function withdrawMultipleToken(params: {
|
|
12
20
|
payer: web3.PublicKey;
|
|
@@ -14,7 +22,14 @@ export declare function withdrawMultipleToken(params: {
|
|
|
14
22
|
mint: web3.PublicKey;
|
|
15
23
|
}[];
|
|
16
24
|
useSta?: boolean;
|
|
17
|
-
|
|
25
|
+
}): Promise<web3.TransactionInstruction>;
|
|
26
|
+
export declare function withdrawMultipleTokenV2(params: {
|
|
27
|
+
payer: web3.PublicKey;
|
|
28
|
+
withdraw: {
|
|
29
|
+
mint: web3.PublicKey;
|
|
30
|
+
}[];
|
|
31
|
+
useSta?: boolean;
|
|
32
|
+
pdaTokenType?: TokenType;
|
|
18
33
|
}): Promise<web3.TransactionInstruction>;
|
|
19
34
|
export type AtomicityContextParams = {
|
|
20
35
|
userWallet: web3.PublicKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;AASvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;CACL,wCAyCA;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,wCAmDA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,wCAyCA;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,wCAmDA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUrH;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,qBAAqB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUxH;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAsB,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAkBtG"}
|
package/dist/src/hawksight.js
CHANGED
|
@@ -32,14 +32,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleToken = exports.depositMultipleToken = void 0;
|
|
35
|
+
exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleTokenV2 = exports.withdrawMultipleToken = exports.depositMultipleTokenV2 = exports.depositMultipleToken = void 0;
|
|
36
36
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
37
37
|
const anchor_1 = require("./anchor");
|
|
38
38
|
const addresses_1 = require("./addresses");
|
|
39
39
|
const util = __importStar(require("./functions"));
|
|
40
|
+
const types_1 = require("./types");
|
|
40
41
|
function depositMultipleToken(params) {
|
|
41
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
var _a;
|
|
43
43
|
const farm = addresses_1.USDC_FARM;
|
|
44
44
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
45
45
|
const amounts = params.deposit.map((d) => d.amount);
|
|
@@ -47,8 +47,8 @@ function depositMultipleToken(params) {
|
|
|
47
47
|
params.deposit.map((d) => {
|
|
48
48
|
const mint = d.mint;
|
|
49
49
|
const userToken = util.generateAta(params.payer, d.mint);
|
|
50
|
-
const userPdaToken = util.generateAta(userPda, d.mint);
|
|
51
50
|
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
51
|
+
const userPdaToken = util.generateAta(userPda, d.mint);
|
|
52
52
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
53
53
|
remainingAccounts.push({
|
|
54
54
|
pubkey: userToken,
|
|
@@ -67,7 +67,7 @@ function depositMultipleToken(params) {
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
70
|
-
.depositMultipleToken(amounts
|
|
70
|
+
.depositMultipleToken(amounts)
|
|
71
71
|
.accounts({
|
|
72
72
|
farm,
|
|
73
73
|
userPda,
|
|
@@ -83,12 +83,69 @@ function depositMultipleToken(params) {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
exports.depositMultipleToken = depositMultipleToken;
|
|
86
|
+
function depositMultipleTokenV2(params) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const farm = addresses_1.USDC_FARM;
|
|
89
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
90
|
+
const amounts = params.deposit.map((d) => d.amount);
|
|
91
|
+
const remainingAccounts = [];
|
|
92
|
+
let skipIdempotent = false;
|
|
93
|
+
params.deposit.map((d) => {
|
|
94
|
+
const mint = d.mint;
|
|
95
|
+
const userToken = util.generateAta(params.payer, d.mint);
|
|
96
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
97
|
+
let userPdaToken;
|
|
98
|
+
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
99
|
+
skipIdempotent = true;
|
|
100
|
+
userPdaToken = util.generateLimitToken(userPda, d.mint);
|
|
101
|
+
}
|
|
102
|
+
else if (params.pdaTokenType === types_1.TokenType.STA) {
|
|
103
|
+
skipIdempotent = true;
|
|
104
|
+
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
userPdaToken = util.generateAta(userPda, d.mint);
|
|
108
|
+
}
|
|
109
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
110
|
+
remainingAccounts.push({
|
|
111
|
+
pubkey: userToken,
|
|
112
|
+
isSigner: false,
|
|
113
|
+
isWritable: true,
|
|
114
|
+
});
|
|
115
|
+
remainingAccounts.push({
|
|
116
|
+
pubkey: userPdaToken,
|
|
117
|
+
isSigner: false,
|
|
118
|
+
isWritable: true,
|
|
119
|
+
});
|
|
120
|
+
remainingAccounts.push({
|
|
121
|
+
pubkey: ownerFeeToken,
|
|
122
|
+
isSigner: false,
|
|
123
|
+
isWritable: true,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
127
|
+
.depositMultipleTokenV2(amounts, skipIdempotent)
|
|
128
|
+
.accounts({
|
|
129
|
+
farm,
|
|
130
|
+
userPda,
|
|
131
|
+
payer: params.payer,
|
|
132
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
133
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
134
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
135
|
+
systemProgram: web3.SystemProgram.programId,
|
|
136
|
+
})
|
|
137
|
+
.remainingAccounts(remainingAccounts)
|
|
138
|
+
.instruction();
|
|
139
|
+
return ix;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
exports.depositMultipleTokenV2 = depositMultipleTokenV2;
|
|
86
143
|
function withdrawMultipleToken(params) {
|
|
87
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
var _a;
|
|
89
145
|
const farm = addresses_1.USDC_FARM;
|
|
90
146
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
91
147
|
const remainingAccounts = [];
|
|
148
|
+
let skipIdempotent = false;
|
|
92
149
|
params.withdraw.map((d) => {
|
|
93
150
|
const mint = d.mint;
|
|
94
151
|
const userToken = util.generateAta(params.payer, d.mint);
|
|
@@ -112,7 +169,7 @@ function withdrawMultipleToken(params) {
|
|
|
112
169
|
});
|
|
113
170
|
});
|
|
114
171
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
115
|
-
.withdrawMultipleToken(
|
|
172
|
+
.withdrawMultipleToken()
|
|
116
173
|
.accounts({
|
|
117
174
|
farm,
|
|
118
175
|
userPda,
|
|
@@ -128,6 +185,63 @@ function withdrawMultipleToken(params) {
|
|
|
128
185
|
});
|
|
129
186
|
}
|
|
130
187
|
exports.withdrawMultipleToken = withdrawMultipleToken;
|
|
188
|
+
function withdrawMultipleTokenV2(params) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
const farm = addresses_1.USDC_FARM;
|
|
191
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
192
|
+
const remainingAccounts = [];
|
|
193
|
+
let skipIdempotent = false;
|
|
194
|
+
params.withdraw.map((d) => {
|
|
195
|
+
const mint = d.mint;
|
|
196
|
+
const userToken = util.generateAta(params.payer, d.mint);
|
|
197
|
+
// const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint);
|
|
198
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
199
|
+
let userPdaToken;
|
|
200
|
+
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
201
|
+
skipIdempotent = true;
|
|
202
|
+
userPdaToken = util.generateLimitToken(userPda, d.mint);
|
|
203
|
+
}
|
|
204
|
+
else if (params.pdaTokenType === types_1.TokenType.STA || params.useSta) {
|
|
205
|
+
skipIdempotent = true;
|
|
206
|
+
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
userPdaToken = util.generateAta(userPda, d.mint);
|
|
210
|
+
}
|
|
211
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
212
|
+
remainingAccounts.push({
|
|
213
|
+
pubkey: userToken,
|
|
214
|
+
isSigner: false,
|
|
215
|
+
isWritable: true,
|
|
216
|
+
});
|
|
217
|
+
remainingAccounts.push({
|
|
218
|
+
pubkey: userPdaToken,
|
|
219
|
+
isSigner: false,
|
|
220
|
+
isWritable: true,
|
|
221
|
+
});
|
|
222
|
+
remainingAccounts.push({
|
|
223
|
+
pubkey: ownerFeeToken,
|
|
224
|
+
isSigner: false,
|
|
225
|
+
isWritable: true,
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
229
|
+
.withdrawMultipleTokenV2(skipIdempotent)
|
|
230
|
+
.accounts({
|
|
231
|
+
farm,
|
|
232
|
+
userPda,
|
|
233
|
+
payer: params.payer,
|
|
234
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
235
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
236
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
237
|
+
systemProgram: web3.SystemProgram.programId,
|
|
238
|
+
})
|
|
239
|
+
.remainingAccounts(remainingAccounts)
|
|
240
|
+
.instruction();
|
|
241
|
+
return ix;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
exports.withdrawMultipleTokenV2 = withdrawMultipleTokenV2;
|
|
131
245
|
function setTransactionSlot(_a) {
|
|
132
246
|
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
133
247
|
const ix = yield anchor_1.Anchor
|
|
@@ -6,19 +6,19 @@ import { MeteoraToHawksightParams } from "./types";
|
|
|
6
6
|
* @param params
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function meteoraToHawksight({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
9
|
+
export declare function meteoraToHawksight({ ixs, userPda, authority, pdaTokenType }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
10
10
|
/**
|
|
11
11
|
* Convert listed meteora instruction to hawksight meteora automation cpi
|
|
12
12
|
*
|
|
13
13
|
* @param params
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export declare function meteoraToHawksightAutomationIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
16
|
+
export declare function meteoraToHawksightAutomationIxs({ ixs, userPda, authority, pdaTokenType }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
17
17
|
/**
|
|
18
18
|
* Convert listed meteora instruction to hawksight meteora automation cpi
|
|
19
19
|
*
|
|
20
20
|
* @param params
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
|
-
export declare function meteoraToHawksightPdaIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
23
|
+
export declare function meteoraToHawksightPdaIxs({ ixs, userPda, authority, pdaTokenType }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
24
24
|
//# sourceMappingURL=hsToMeteora.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAa,MAAM,SAAS,CAAC;AAe9D;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUlJ;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAU/J;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUxJ"}
|