@hawksightco/hawk-sdk 1.3.265 → 1.3.266

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.
Files changed (181) hide show
  1. package/dist/addresses.d.ts +37 -0
  2. package/dist/addresses.d.ts.map +1 -0
  3. package/dist/addresses.js +84 -0
  4. package/dist/anchor.d.ts +22 -0
  5. package/dist/anchor.d.ts.map +1 -0
  6. package/dist/anchor.js +121 -0
  7. package/dist/classes/AltStorage.d.ts +29 -0
  8. package/dist/classes/AltStorage.d.ts.map +1 -0
  9. package/dist/classes/AltStorage.js +58 -0
  10. package/dist/classes/Atomicity.d.ts +34 -0
  11. package/dist/classes/Atomicity.d.ts.map +1 -0
  12. package/dist/classes/Atomicity.js +110 -0
  13. package/dist/classes/Client.d.ts +35 -0
  14. package/dist/classes/Client.d.ts.map +1 -0
  15. package/dist/classes/Client.js +66 -0
  16. package/dist/classes/CombineTransactions.d.ts +11 -0
  17. package/dist/classes/CombineTransactions.d.ts.map +1 -0
  18. package/dist/classes/CombineTransactions.js +58 -0
  19. package/dist/classes/CreateTxMetadata.d.ts +100 -0
  20. package/dist/classes/CreateTxMetadata.d.ts.map +1 -0
  21. package/dist/classes/CreateTxMetadata.js +415 -0
  22. package/dist/classes/General.d.ts +87 -0
  23. package/dist/classes/General.d.ts.map +1 -0
  24. package/dist/classes/General.js +176 -0
  25. package/dist/classes/GeneralUtility.d.ts +79 -0
  26. package/dist/classes/GeneralUtility.d.ts.map +1 -0
  27. package/dist/classes/GeneralUtility.js +121 -0
  28. package/dist/classes/HawkAPI.d.ts +122 -0
  29. package/dist/classes/HawkAPI.d.ts.map +1 -0
  30. package/dist/classes/HawkAPI.js +169 -0
  31. package/dist/classes/Health.d.ts +29 -0
  32. package/dist/classes/Health.d.ts.map +1 -0
  33. package/dist/classes/Health.js +48 -0
  34. package/dist/classes/JupiterAlts.d.ts +37 -0
  35. package/dist/classes/JupiterAlts.d.ts.map +1 -0
  36. package/dist/classes/JupiterAlts.js +114 -0
  37. package/dist/classes/JupiterSwap.d.ts +21 -0
  38. package/dist/classes/JupiterSwap.d.ts.map +1 -0
  39. package/dist/classes/JupiterSwap.js +40 -0
  40. package/dist/classes/Logging.d.ts +13 -0
  41. package/dist/classes/Logging.d.ts.map +1 -0
  42. package/dist/classes/Logging.js +50 -0
  43. package/dist/classes/MultiTransaction.d.ts +75 -0
  44. package/dist/classes/MultiTransaction.d.ts.map +1 -0
  45. package/dist/classes/MultiTransaction.js +296 -0
  46. package/dist/classes/RaydiumSDK.d.ts +67 -0
  47. package/dist/classes/RaydiumSDK.d.ts.map +1 -0
  48. package/dist/classes/RaydiumSDK.js +206 -0
  49. package/dist/classes/Search.d.ts +100 -0
  50. package/dist/classes/Search.d.ts.map +1 -0
  51. package/dist/classes/Search.js +216 -0
  52. package/dist/classes/SimpleIxGenerator.d.ts +57 -0
  53. package/dist/classes/SimpleIxGenerator.d.ts.map +1 -0
  54. package/dist/classes/SimpleIxGenerator.js +62 -0
  55. package/dist/classes/SimplePdaGenerator.d.ts +28 -0
  56. package/dist/classes/SimplePdaGenerator.d.ts.map +1 -0
  57. package/dist/classes/SimplePdaGenerator.js +33 -0
  58. package/dist/classes/Transaction.d.ts +229 -0
  59. package/dist/classes/Transaction.d.ts.map +1 -0
  60. package/dist/classes/Transaction.js +643 -0
  61. package/dist/classes/Transaction2.d.ts +107 -0
  62. package/dist/classes/Transaction2.d.ts.map +1 -0
  63. package/dist/classes/Transaction2.js +249 -0
  64. package/dist/classes/Transaction3.d.ts +165 -0
  65. package/dist/classes/Transaction3.d.ts.map +1 -0
  66. package/dist/classes/Transaction3.js +416 -0
  67. package/dist/classes/TransactionBatchExecute.d.ts +163 -0
  68. package/dist/classes/TransactionBatchExecute.d.ts.map +1 -0
  69. package/dist/classes/TransactionBatchExecute.js +466 -0
  70. package/dist/classes/TransactionBatchExecute2.d.ts +99 -0
  71. package/dist/classes/TransactionBatchExecute2.d.ts.map +1 -0
  72. package/dist/classes/TransactionBatchExecute2.js +357 -0
  73. package/dist/classes/Transactions.d.ts +586 -0
  74. package/dist/classes/Transactions.d.ts.map +1 -0
  75. package/dist/classes/Transactions.js +7667 -0
  76. package/dist/classes/TxGenerator.d.ts +350 -0
  77. package/dist/classes/TxGenerator.d.ts.map +1 -0
  78. package/dist/classes/TxGenerator.js +1957 -0
  79. package/dist/classes/TxGeneratorAutomations.d.ts +186 -0
  80. package/dist/classes/TxGeneratorAutomations.d.ts.map +1 -0
  81. package/dist/classes/TxGeneratorAutomations.js +897 -0
  82. package/dist/classes/Util.d.ts +87 -0
  83. package/dist/classes/Util.d.ts.map +1 -0
  84. package/dist/classes/Util.js +148 -0
  85. package/dist/classes/account-cache/AccountCache.d.ts +54 -0
  86. package/dist/classes/account-cache/AccountCache.d.ts.map +1 -0
  87. package/dist/classes/account-cache/AccountCache.js +143 -0
  88. package/dist/classes/account-cache/MintCache.d.ts +33 -0
  89. package/dist/classes/account-cache/MintCache.d.ts.map +1 -0
  90. package/dist/classes/account-cache/MintCache.js +47 -0
  91. package/dist/classes/account-cache/TokenCache.d.ts +33 -0
  92. package/dist/classes/account-cache/TokenCache.d.ts.map +1 -0
  93. package/dist/classes/account-cache/TokenCache.js +47 -0
  94. package/dist/errors.d.ts +13 -0
  95. package/dist/errors.d.ts.map +1 -0
  96. package/dist/errors.js +96 -0
  97. package/dist/functions.d.ts +514 -0
  98. package/dist/functions.d.ts.map +1 -0
  99. package/dist/functions.js +1636 -0
  100. package/dist/hawksight.d.ts +53 -0
  101. package/dist/hawksight.d.ts.map +1 -0
  102. package/dist/hawksight.js +328 -0
  103. package/dist/hsToMeteora.d.ts +31 -0
  104. package/dist/hsToMeteora.d.ts.map +1 -0
  105. package/dist/hsToMeteora.js +3175 -0
  106. package/dist/idl/iyf-extension-idl.d.ts +14583 -0
  107. package/dist/idl/iyf-extension-idl.d.ts.map +1 -0
  108. package/dist/idl/iyf-extension-idl.js +14578 -0
  109. package/dist/idl/iyf-extension-wrapper.d.ts +112 -0
  110. package/dist/idl/iyf-extension-wrapper.d.ts.map +1 -0
  111. package/dist/idl/iyf-extension-wrapper.js +2 -0
  112. package/dist/idl/iyf-main-idl.d.ts +12078 -0
  113. package/dist/idl/iyf-main-idl.d.ts.map +1 -0
  114. package/dist/idl/iyf-main-idl.js +12073 -0
  115. package/dist/idl/iyf-main-wrapper.d.ts +112 -0
  116. package/dist/idl/iyf-main-wrapper.d.ts.map +1 -0
  117. package/dist/idl/iyf-main-wrapper.js +2 -0
  118. package/dist/idl/jupiter-idl.d.ts +3063 -0
  119. package/dist/idl/jupiter-idl.d.ts.map +1 -0
  120. package/dist/idl/jupiter-idl.js +3061 -0
  121. package/dist/idl/meteora-idl.d.ts +7371 -0
  122. package/dist/idl/meteora-idl.d.ts.map +1 -0
  123. package/dist/idl/meteora-idl.js +7372 -0
  124. package/dist/idl/orca-idl.d.ts +3833 -0
  125. package/dist/idl/orca-idl.d.ts.map +1 -0
  126. package/dist/idl/orca-idl.js +3834 -0
  127. package/dist/idl/raydium-idl.d.ts +3054 -0
  128. package/dist/idl/raydium-idl.d.ts.map +1 -0
  129. package/dist/idl/raydium-idl.js +3055 -0
  130. package/dist/index.d.ts +9 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +31 -0
  133. package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts +126 -0
  134. package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
  135. package/dist/ixGenerator/IyfExtensionIxGenerator.js +467 -0
  136. package/dist/ixGenerator/IyfMainIxGenerator.d.ts +330 -0
  137. package/dist/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
  138. package/dist/ixGenerator/IyfMainIxGenerator.js +1239 -0
  139. package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts +685 -0
  140. package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
  141. package/dist/ixGenerator/MeteoraDlmmIxGenerator.js +3005 -0
  142. package/dist/ixGenerator/OrcaIxGenerator.d.ts +119 -0
  143. package/dist/ixGenerator/OrcaIxGenerator.d.ts.map +1 -0
  144. package/dist/ixGenerator/OrcaIxGenerator.js +438 -0
  145. package/dist/ixGenerator/RaydiumIxGenerator.d.ts +99 -0
  146. package/dist/ixGenerator/RaydiumIxGenerator.d.ts.map +1 -0
  147. package/dist/ixGenerator/RaydiumIxGenerator.js +558 -0
  148. package/dist/ixGenerator/UtilIxGenerator.d.ts +20 -0
  149. package/dist/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
  150. package/dist/ixGenerator/UtilIxGenerator.js +25 -0
  151. package/dist/meteora/index.d.ts +2 -0
  152. package/dist/meteora/index.d.ts.map +1 -0
  153. package/dist/meteora/index.js +17 -0
  154. package/dist/meteora/liquidityStrategy.d.ts +408 -0
  155. package/dist/meteora/liquidityStrategy.d.ts.map +1 -0
  156. package/dist/meteora/liquidityStrategy.js +1325 -0
  157. package/dist/meteora.d.ts +669 -0
  158. package/dist/meteora.d.ts.map +1 -0
  159. package/dist/meteora.js +1932 -0
  160. package/dist/orca.d.ts +57 -0
  161. package/dist/orca.d.ts.map +1 -0
  162. package/dist/orca.js +123 -0
  163. package/dist/pdaGenerator/HawksightPdaGenerator.d.ts +29 -0
  164. package/dist/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
  165. package/dist/pdaGenerator/HawksightPdaGenerator.js +75 -0
  166. package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts +76 -0
  167. package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
  168. package/dist/pdaGenerator/MeteoraPdaGenerator.js +166 -0
  169. package/dist/pdaGenerator/OrcaPdaGenerator.d.ts +23 -0
  170. package/dist/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
  171. package/dist/pdaGenerator/OrcaPdaGenerator.js +68 -0
  172. package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts +49 -0
  173. package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
  174. package/dist/pdaGenerator/RaydiumPdaGenerator.js +114 -0
  175. package/dist/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
  176. package/dist/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
  177. package/dist/pdaGenerator/UtilPdaGenerator.js +51 -0
  178. package/dist/types.d.ts +1104 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +95 -0
  181. package/package.json +6 -5
@@ -0,0 +1,9 @@
1
+ export * from "./types";
2
+ export * from "./functions";
3
+ export { HawkAPI } from "./classes/HawkAPI";
4
+ export { TxGenerator } from "./classes/TxGenerator";
5
+ export { Client } from "./classes/Client";
6
+ export { CreateTxMetadata } from "./classes/CreateTxMetadata";
7
+ export { TransactionBatchExecute2 } from "./classes/TransactionBatchExecute2";
8
+ export { AltStorage } from './classes/AltStorage';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.AltStorage = exports.TransactionBatchExecute2 = exports.CreateTxMetadata = exports.Client = exports.TxGenerator = exports.HawkAPI = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ __exportStar(require("./functions"), exports);
20
+ var HawkAPI_1 = require("./classes/HawkAPI");
21
+ Object.defineProperty(exports, "HawkAPI", { enumerable: true, get: function () { return HawkAPI_1.HawkAPI; } });
22
+ var TxGenerator_1 = require("./classes/TxGenerator");
23
+ Object.defineProperty(exports, "TxGenerator", { enumerable: true, get: function () { return TxGenerator_1.TxGenerator; } });
24
+ var Client_1 = require("./classes/Client");
25
+ Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
26
+ var CreateTxMetadata_1 = require("./classes/CreateTxMetadata");
27
+ Object.defineProperty(exports, "CreateTxMetadata", { enumerable: true, get: function () { return CreateTxMetadata_1.CreateTxMetadata; } });
28
+ var TransactionBatchExecute2_1 = require("./classes/TransactionBatchExecute2");
29
+ Object.defineProperty(exports, "TransactionBatchExecute2", { enumerable: true, get: function () { return TransactionBatchExecute2_1.TransactionBatchExecute2; } });
30
+ var AltStorage_1 = require("./classes/AltStorage");
31
+ Object.defineProperty(exports, "AltStorage", { enumerable: true, get: function () { return AltStorage_1.AltStorage; } });
@@ -0,0 +1,126 @@
1
+ import * as web3 from "@solana/web3.js";
2
+ import BN from "bn.js";
3
+ import { IyfMainIxGenerator } from "./IyfMainIxGenerator";
4
+ import { SimplePdaGenerator } from "../classes/SimplePdaGenerator";
5
+ import { RaydiumClosePositionAutomation } from "../types";
6
+ type MoveTokenIx = {
7
+ connection: web3.Connection;
8
+ userWallet: web3.PublicKey;
9
+ mint: web3.PublicKey;
10
+ useSourceAmount: boolean;
11
+ amount?: BN;
12
+ };
13
+ type RaydiumOpenPositionAutomation = {
14
+ connection: web3.Connection;
15
+ userWallet: web3.PublicKey;
16
+ nftMint: web3.PublicKey;
17
+ poolState: web3.PublicKey;
18
+ tokenVault0: web3.PublicKey;
19
+ tokenVault1: web3.PublicKey;
20
+ vault0Mint: web3.PublicKey;
21
+ vault1Mint: web3.PublicKey;
22
+ tickSpacing: number;
23
+ tickLowerIndex: number;
24
+ tickUpperIndex: number;
25
+ liquidity: BN | null;
26
+ amount0Max: BN | null;
27
+ amount1Max: BN | null;
28
+ };
29
+ type RaydiumDecreaseLiquidity = {
30
+ connection: web3.Connection;
31
+ userWallet: web3.PublicKey;
32
+ nftMint: web3.PublicKey;
33
+ poolState: web3.PublicKey;
34
+ personalPosition: web3.PublicKey;
35
+ tokenVault0: web3.PublicKey;
36
+ tokenVault1: web3.PublicKey;
37
+ vault0Mint: web3.PublicKey;
38
+ vault1Mint: web3.PublicKey;
39
+ tickSpacing: number;
40
+ tickLowerIndex: number;
41
+ tickUpperIndex: number;
42
+ liquidity: BN;
43
+ amount0Min: BN;
44
+ amount1Min: BN;
45
+ rewardInfos: {
46
+ tokenMint: web3.PublicKey;
47
+ tokenVault: web3.PublicKey;
48
+ }[];
49
+ };
50
+ type RaydiumDecreaseLiquidityAutomation = {
51
+ connection: web3.Connection;
52
+ userWallet: web3.PublicKey;
53
+ nftMint: web3.PublicKey;
54
+ poolState: web3.PublicKey;
55
+ personalPosition: web3.PublicKey;
56
+ tokenVault0: web3.PublicKey;
57
+ tokenVault1: web3.PublicKey;
58
+ vault0Mint: web3.PublicKey;
59
+ vault1Mint: web3.PublicKey;
60
+ tickSpacing: number;
61
+ tickLowerIndex: number;
62
+ tickUpperIndex: number;
63
+ liquidity: BN | null;
64
+ amount0Min: BN | null;
65
+ amount1Min: BN | null;
66
+ slippage: number | null;
67
+ rewardInfos: {
68
+ tokenMint: web3.PublicKey;
69
+ tokenVault: web3.PublicKey;
70
+ }[];
71
+ };
72
+ type RaydiumIncreaseLiquidityAutomation = {
73
+ connection: web3.Connection;
74
+ userWallet: web3.PublicKey;
75
+ nftMint: web3.PublicKey;
76
+ poolState: web3.PublicKey;
77
+ tokenVault0: web3.PublicKey;
78
+ tokenVault1: web3.PublicKey;
79
+ vault0Mint: web3.PublicKey;
80
+ vault1Mint: web3.PublicKey;
81
+ tickSpacing: number;
82
+ tickLowerIndex: number;
83
+ tickUpperIndex: number;
84
+ liquidity: BN | null;
85
+ amount0Max: BN | null;
86
+ amount1Max: BN | null;
87
+ };
88
+ type RaydiumSweepDust = {
89
+ connection: web3.Connection;
90
+ userWallet: web3.PublicKey;
91
+ nftMint: web3.PublicKey;
92
+ poolState: web3.PublicKey;
93
+ tokenVault0: web3.PublicKey;
94
+ tokenVault1: web3.PublicKey;
95
+ vault0Mint: web3.PublicKey;
96
+ vault1Mint: web3.PublicKey;
97
+ ammConfig: web3.PublicKey;
98
+ observationKey: web3.PublicKey;
99
+ tickCurrent: number;
100
+ tickSpacing: number;
101
+ tickLowerIndex: number;
102
+ tickUpperIndex: number;
103
+ };
104
+ /**
105
+ * Iyf Extension IX Generator
106
+ */
107
+ export declare class IyfExtensionIxGenerator {
108
+ private pda;
109
+ private iyfMain;
110
+ constructor(pda: SimplePdaGenerator, iyfMain: IyfMainIxGenerator);
111
+ /**
112
+ * Move token from ATA to STA
113
+ *
114
+ * @param param0
115
+ * @returns
116
+ */
117
+ moveTokenIx({ connection, userWallet, mint, useSourceAmount, amount, }: MoveTokenIx): Promise<web3.TransactionInstruction>;
118
+ raydiumOpenPositionAutomation({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Max, amount1Max, }: RaydiumOpenPositionAutomation): Promise<web3.TransactionInstruction>;
119
+ raydiumClosePositionAutomation({ connection, userWallet, positionNftMint, }: RaydiumClosePositionAutomation): Promise<web3.TransactionInstruction>;
120
+ raydiumDecreaseLiquidity({ connection, userWallet, nftMint, poolState, personalPosition, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Min, amount1Min, rewardInfos, }: RaydiumDecreaseLiquidity): Promise<web3.TransactionInstruction>;
121
+ raydiumDecreaseLiquidityAutomation({ connection, userWallet, nftMint, poolState, personalPosition, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Min, amount1Min, rewardInfos, slippage, }: RaydiumDecreaseLiquidityAutomation): Promise<web3.TransactionInstruction>;
122
+ raydiumIncreaseLiquidityAutomation({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Max, amount1Max, }: RaydiumIncreaseLiquidityAutomation): Promise<web3.TransactionInstruction>;
123
+ raydiumSweepDust({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, ammConfig, observationKey, tickCurrent, tickSpacing, tickLowerIndex, tickUpperIndex, }: RaydiumSweepDust): Promise<web3.TransactionInstruction>;
124
+ }
125
+ export {};
126
+ //# sourceMappingURL=IyfExtensionIxGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IyfExtensionIxGenerator.d.ts","sourceRoot":"","sources":["../../src/ixGenerator/IyfExtensionIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAE1D,KAAK,WAAW,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,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IA+CtE,gBAAgB,CAAC,EACrB,UAAU,EACV,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,GACf,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;CA6D3D"}
@@ -0,0 +1,467 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.IyfExtensionIxGenerator = void 0;
49
+ const web3 = __importStar(require("@solana/web3.js"));
50
+ const anchor_1 = require("../anchor");
51
+ const functions_1 = require("../functions");
52
+ const addresses_1 = require("../addresses");
53
+ const bn_js_1 = __importDefault(require("bn.js"));
54
+ /**
55
+ * Iyf Extension IX Generator
56
+ */
57
+ class IyfExtensionIxGenerator {
58
+ constructor(pda, iyfMain) {
59
+ this.pda = pda;
60
+ this.iyfMain = iyfMain;
61
+ }
62
+ /**
63
+ * Move token from ATA to STA
64
+ *
65
+ * @param param0
66
+ * @returns
67
+ */
68
+ moveTokenIx(_a) {
69
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, mint, useSourceAmount, amount, }) {
70
+ // Initialize anchor
71
+ anchor_1.Anchor.initialize(connection);
72
+ // Generate user pda
73
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
74
+ const sourceToken = (0, functions_1.generateAta)(userPda, mint);
75
+ const destinationToken = (0, functions_1.generateUserPdaStorageAccount)(userPda, mint);
76
+ if (!useSourceAmount && amount === undefined) {
77
+ throw new Error('Source amount cannot be undefined if `useSourceAmount` is false');
78
+ }
79
+ if (amount === undefined) {
80
+ amount = new bn_js_1.default(0);
81
+ }
82
+ // Generate move_token instruction
83
+ // @ts-ignore
84
+ const iyfExtensionIx = yield anchor_1.Anchor.instance().iyfExtension
85
+ .methods
86
+ .moveToken(useSourceAmount, amount)
87
+ .accounts({
88
+ farm: addresses_1.USDC_FARM,
89
+ userPda,
90
+ authority: userWallet,
91
+ iyfProgram: addresses_1.IYF_MAIN,
92
+ hawksightAuthority: addresses_1.HS_AUTHORITY,
93
+ sourceToken,
94
+ destinationToken,
95
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
96
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
97
+ })
98
+ .instruction();
99
+ // Wrap instruction in iyf extension (iyf-main)
100
+ return yield this.iyfMain.iyfExtensionExecute(connection, {
101
+ userWallet,
102
+ iyfExtensionIx,
103
+ });
104
+ });
105
+ }
106
+ raydiumOpenPositionAutomation(_a) {
107
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Max, amount1Max, }) {
108
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
109
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
110
+ const tickArrayLowerStartIndex = (0, functions_1.raydiumStartTickIndex)(tickLowerIndex, tickSpacing);
111
+ const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(tickUpperIndex, tickSpacing);
112
+ const nftAccount = (0, functions_1.generateAta2022)(nftOwner, nftMint);
113
+ const protocolPosition = this.pda.raydium.generateRaydiumProtocolPosition(poolState, tickLowerIndex, tickUpperIndex);
114
+ const personalPosition = this.pda.raydium.generateRaydiumPersonalPosition(nftMint);
115
+ const tokenAccount0 = (0, functions_1.generateAta)(nftOwner, vault0Mint);
116
+ const tokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
117
+ const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
118
+ const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
119
+ //@ts-ignore
120
+ const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
121
+ .raydiumOpenPositionAutomation(tickLowerIndex, tickUpperIndex, tickArrayLowerStartIndex, tickArrayUpperStartIndex, liquidity, amount0Max, amount1Max, false, null)
122
+ .accounts({
123
+ raydiumProgram: addresses_1.RAYDIUM_PROGRAM,
124
+ userPda,
125
+ hawksightAuthority: addresses_1.HS_AUTHORITY,
126
+ nftOwner,
127
+ nftMint,
128
+ nftAccount,
129
+ poolState,
130
+ protocolPosition,
131
+ tickArrayLower,
132
+ tickArrayUpper,
133
+ personalPosition,
134
+ tokenAccount0,
135
+ tokenAccount1,
136
+ tokenVault0,
137
+ tokenVault1,
138
+ rent: web3.SYSVAR_RENT_PUBKEY,
139
+ systemProgram: web3.SystemProgram.programId,
140
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
141
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
142
+ tokenProgram2022: addresses_1.TOKEN_2022,
143
+ vault0Mint,
144
+ vault1Mint,
145
+ })
146
+ .instruction();
147
+ ix.keys[3].isSigner = false;
148
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
149
+ userPda,
150
+ authority: addresses_1.HS_AUTHORITY,
151
+ ix
152
+ });
153
+ });
154
+ }
155
+ raydiumClosePositionAutomation(_a) {
156
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, positionNftMint, }) {
157
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
158
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
159
+ const positionNftAccount = (0, functions_1.generateAta2022)(nftOwner, positionNftMint);
160
+ const personalPosition = this.pda.raydium.generateRaydiumPersonalPosition(positionNftMint);
161
+ // @ts-ignore
162
+ const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
163
+ .raydiumClosePositionAutomation()
164
+ .accounts({
165
+ raydiumProgram: addresses_1.RAYDIUM_PROGRAM,
166
+ userPda,
167
+ hawksightAuthority: addresses_1.HS_AUTHORITY,
168
+ nftOwner,
169
+ positionNftMint,
170
+ positionNftAccount,
171
+ personalPosition,
172
+ systemProgram: web3.SystemProgram.programId,
173
+ tokenProgram: addresses_1.TOKEN_2022,
174
+ })
175
+ .instruction();
176
+ ix.keys[3].isSigner = false;
177
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
178
+ userPda,
179
+ authority: addresses_1.HS_AUTHORITY,
180
+ ix
181
+ });
182
+ });
183
+ }
184
+ raydiumDecreaseLiquidity(_a) {
185
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, nftMint, poolState, personalPosition, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Min, amount1Min, rewardInfos, }) {
186
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
187
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
188
+ const tickArrayLowerStartIndex = (0, functions_1.raydiumStartTickIndex)(tickLowerIndex, tickSpacing);
189
+ const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(tickUpperIndex, tickSpacing);
190
+ const nftAccount = (0, functions_1.generateAta2022)(nftOwner, nftMint);
191
+ const protocolPosition = this.pda.raydium.generateRaydiumProtocolPosition(poolState, tickLowerIndex, tickUpperIndex);
192
+ const recipientTokenAccount0 = (0, functions_1.generateAta)(nftOwner, vault0Mint);
193
+ const recipientTokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
194
+ const ownerFee0 = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, vault0Mint);
195
+ const ownerFee1 = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, vault1Mint);
196
+ const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
197
+ const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
198
+ // @ts-ignore
199
+ const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
200
+ .raydiumDecreaseLiquidity(liquidity, amount0Min, amount1Min)
201
+ .accounts({
202
+ raydiumProgram: addresses_1.RAYDIUM_PROGRAM,
203
+ userPda,
204
+ authority: userWallet,
205
+ nftOwner,
206
+ nftAccount,
207
+ personalPosition,
208
+ poolState,
209
+ protocolPosition,
210
+ tokenVault0,
211
+ tokenVault1,
212
+ tickArrayLower,
213
+ tickArrayUpper,
214
+ recipientTokenAccount0,
215
+ recipientTokenAccount1,
216
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
217
+ tokenProgram2022: addresses_1.TOKEN_2022,
218
+ memoProgram: addresses_1.MEMO_PROGRAM,
219
+ vault0Mint,
220
+ vault1Mint,
221
+ ownerFee0,
222
+ ownerFee1,
223
+ })
224
+ .remainingAccounts([
225
+ ...rewardInfos.map((v) => {
226
+ if (v.tokenVault.equals(web3.PublicKey.default)) {
227
+ return [];
228
+ }
229
+ const rewardFee = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, v.tokenMint);
230
+ return [
231
+ {
232
+ pubkey: rewardFee,
233
+ isSigner: false,
234
+ isWritable: true,
235
+ },
236
+ ];
237
+ }).flat(),
238
+ ...rewardInfos.map((v) => {
239
+ if (v.tokenVault.equals(web3.PublicKey.default)) {
240
+ return [];
241
+ }
242
+ const rewardVault = v.tokenVault;
243
+ const rewardMint = v.tokenMint;
244
+ const rewardAccount = (0, functions_1.generateAta)(nftOwner, rewardMint); // TODO: allow sta / lta
245
+ return [
246
+ {
247
+ pubkey: rewardVault,
248
+ isSigner: false,
249
+ isWritable: true,
250
+ },
251
+ {
252
+ pubkey: rewardAccount,
253
+ isSigner: false,
254
+ isWritable: true,
255
+ },
256
+ {
257
+ pubkey: rewardMint,
258
+ isSigner: false,
259
+ isWritable: true,
260
+ },
261
+ ];
262
+ }).flat()
263
+ ])
264
+ .instruction();
265
+ ix.keys[3].isSigner = false;
266
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
267
+ userPda,
268
+ authority: userWallet,
269
+ ix
270
+ });
271
+ });
272
+ }
273
+ raydiumDecreaseLiquidityAutomation(_a) {
274
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, nftMint, poolState, personalPosition, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Min, amount1Min, rewardInfos, slippage, }) {
275
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
276
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
277
+ const tickArrayLowerStartIndex = (0, functions_1.raydiumStartTickIndex)(tickLowerIndex, tickSpacing);
278
+ const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(tickUpperIndex, tickSpacing);
279
+ const nftAccount = (0, functions_1.generateAta2022)(nftOwner, nftMint);
280
+ const protocolPosition = this.pda.raydium.generateRaydiumProtocolPosition(poolState, tickLowerIndex, tickUpperIndex);
281
+ const recipientTokenAccount0 = (0, functions_1.generateAta)(nftOwner, vault0Mint);
282
+ const recipientTokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
283
+ const ownerFee0 = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, vault0Mint);
284
+ const ownerFee1 = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, vault1Mint);
285
+ const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
286
+ const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
287
+ // @ts-ignore
288
+ const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
289
+ .raydiumDecreaseLiquidityAutomation(slippage, liquidity, amount0Min, amount1Min)
290
+ .accounts({
291
+ userPda,
292
+ hawksightAuthority: addresses_1.HS_AUTHORITY,
293
+ raydiumProgram: addresses_1.RAYDIUM_PROGRAM,
294
+ nftOwner,
295
+ nftAccount,
296
+ personalPosition,
297
+ poolState,
298
+ protocolPosition,
299
+ tokenVault0,
300
+ tokenVault1,
301
+ tickArrayLower,
302
+ tickArrayUpper,
303
+ recipientTokenAccount0,
304
+ recipientTokenAccount1,
305
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
306
+ tokenProgram2022: addresses_1.TOKEN_2022,
307
+ memoProgram: addresses_1.MEMO_PROGRAM,
308
+ vault0Mint,
309
+ vault1Mint,
310
+ ownerFee0,
311
+ ownerFee1,
312
+ })
313
+ .remainingAccounts([
314
+ ...rewardInfos.map((v) => {
315
+ if (v.tokenVault.equals(web3.PublicKey.default)) {
316
+ return [];
317
+ }
318
+ const rewardFee = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, v.tokenMint);
319
+ return [
320
+ {
321
+ pubkey: rewardFee,
322
+ isSigner: false,
323
+ isWritable: true,
324
+ },
325
+ ];
326
+ }).flat(),
327
+ ...rewardInfos.map((v) => {
328
+ if (v.tokenVault.equals(web3.PublicKey.default)) {
329
+ return [];
330
+ }
331
+ const rewardVault = v.tokenVault;
332
+ const rewardMint = v.tokenMint;
333
+ const rewardAccount = (0, functions_1.generateAta)(nftOwner, rewardMint); // TODO: allow sta / lta
334
+ return [
335
+ {
336
+ pubkey: rewardVault,
337
+ isSigner: false,
338
+ isWritable: true,
339
+ },
340
+ {
341
+ pubkey: rewardAccount,
342
+ isSigner: false,
343
+ isWritable: true,
344
+ },
345
+ {
346
+ pubkey: rewardMint,
347
+ isSigner: false,
348
+ isWritable: true,
349
+ },
350
+ ];
351
+ }).flat()
352
+ ])
353
+ .instruction();
354
+ ix.keys[3].isSigner = false;
355
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
356
+ userPda,
357
+ authority: addresses_1.HS_AUTHORITY,
358
+ ix
359
+ });
360
+ });
361
+ }
362
+ raydiumIncreaseLiquidityAutomation(_a) {
363
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, tickSpacing, tickLowerIndex, tickUpperIndex, liquidity, amount0Max, amount1Max, }) {
364
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
365
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
366
+ const tickArrayLowerStartIndex = (0, functions_1.raydiumStartTickIndex)(tickLowerIndex, tickSpacing);
367
+ const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(tickUpperIndex, tickSpacing);
368
+ const nftAccount = (0, functions_1.generateAta2022)(nftOwner, nftMint);
369
+ const protocolPosition = this.pda.raydium.generateRaydiumProtocolPosition(poolState, tickLowerIndex, tickUpperIndex);
370
+ const personalPosition = this.pda.raydium.generateRaydiumPersonalPosition(nftMint);
371
+ const tokenAccount0 = (0, functions_1.generateAta)(nftOwner, vault0Mint);
372
+ const tokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
373
+ const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
374
+ const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
375
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
376
+ userPda,
377
+ authority: addresses_1.HS_AUTHORITY,
378
+ //@ts-ignore
379
+ ix: yield anchor_1.Anchor.instance().iyfExtension.methods
380
+ .raydiumIncreaseLiquidityAutomation(liquidity, amount0Max, amount1Max, false)
381
+ .accounts({
382
+ raydiumProgram: addresses_1.RAYDIUM_PROGRAM,
383
+ userPda,
384
+ hawksightAuthority: addresses_1.HS_AUTHORITY,
385
+ nftOwner,
386
+ nftAccount,
387
+ poolState,
388
+ protocolPosition,
389
+ personalPosition,
390
+ tickArrayLower,
391
+ tickArrayUpper,
392
+ tokenAccount0,
393
+ tokenAccount1,
394
+ tokenVault0,
395
+ tokenVault1,
396
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
397
+ tokenProgram2022: addresses_1.TOKEN_2022,
398
+ vault0Mint,
399
+ vault1Mint,
400
+ })
401
+ .instruction()
402
+ });
403
+ });
404
+ }
405
+ raydiumSweepDust(_a) {
406
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, nftMint, poolState, tokenVault0, tokenVault1, vault0Mint, vault1Mint, ammConfig, observationKey, tickCurrent, tickSpacing, tickLowerIndex, tickUpperIndex, }) {
407
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
408
+ const nftOwner = (0, functions_1.generateUserPdaLamport)(userWallet);
409
+ const tickArrayLowerStartIndex = (0, functions_1.raydiumStartTickIndex)(tickLowerIndex, tickSpacing);
410
+ const tickArrayUpperStartIndex = (0, functions_1.raydiumStartTickIndex)(tickUpperIndex, tickSpacing);
411
+ const nftAccount = (0, functions_1.generateAta2022)(nftOwner, nftMint);
412
+ const protocolPosition = this.pda.raydium.generateRaydiumProtocolPosition(poolState, tickLowerIndex, tickUpperIndex);
413
+ const personalPosition = this.pda.raydium.generateRaydiumPersonalPosition(nftMint);
414
+ const tokenAccount0 = (0, functions_1.generateAta)(nftOwner, vault0Mint);
415
+ const tokenAccount1 = (0, functions_1.generateAta)(nftOwner, vault1Mint);
416
+ const tickArrayLower = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayLowerStartIndex);
417
+ const tickArrayUpper = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArrayUpperStartIndex);
418
+ const tickArrayBitmapExtension = this.pda.raydium.generateRaydiumTickArrayBitmapExtension(poolState);
419
+ const TICK_ARRAY_SIZE = 60;
420
+ const tickArray_1_index = (0, functions_1.raydiumStartTickIndex)(tickCurrent, tickSpacing);
421
+ const tickArray_0_index = (0, functions_1.raydiumStartTickIndex)(tickArray_1_index - (tickSpacing * TICK_ARRAY_SIZE), tickSpacing);
422
+ const tickArray_2_index = (0, functions_1.raydiumStartTickIndex)(tickArray_1_index + (tickSpacing * TICK_ARRAY_SIZE), tickSpacing);
423
+ const tickArray_0 = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArray_0_index);
424
+ const tickArray_1 = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArray_1_index);
425
+ const tickArray_2 = this.pda.raydium.generateRaydiumTickArrayPda(poolState, tickArray_2_index);
426
+ return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
427
+ userPda,
428
+ authority: addresses_1.HS_AUTHORITY,
429
+ ix: new web3.TransactionInstruction({
430
+ programId: addresses_1.IYF_EXTENSION,
431
+ keys: [
432
+ { pubkey: userPda, isSigner: false, isWritable: false },
433
+ { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
434
+ { pubkey: addresses_1.RAYDIUM_PROGRAM, isSigner: false, isWritable: false },
435
+ { pubkey: nftOwner, isSigner: false, isWritable: true },
436
+ { pubkey: personalPosition, isSigner: false, isWritable: true },
437
+ { pubkey: protocolPosition, isSigner: false, isWritable: true },
438
+ { pubkey: poolState, isSigner: false, isWritable: true },
439
+ { pubkey: tickArrayLower, isSigner: false, isWritable: true },
440
+ { pubkey: tickArrayUpper, isSigner: false, isWritable: true },
441
+ { pubkey: nftAccount, isSigner: false, isWritable: false },
442
+ { pubkey: tokenVault0, isSigner: false, isWritable: true },
443
+ { pubkey: tokenVault1, isSigner: false, isWritable: true },
444
+ { pubkey: tokenAccount0, isSigner: false, isWritable: true },
445
+ { pubkey: tokenAccount1, isSigner: false, isWritable: true },
446
+ { pubkey: vault0Mint, isSigner: false, isWritable: true },
447
+ { pubkey: vault1Mint, isSigner: false, isWritable: true },
448
+ { pubkey: tickArray_0, isSigner: false, isWritable: true },
449
+ { pubkey: tickArray_1, isSigner: false, isWritable: true },
450
+ { pubkey: tickArray_2, isSigner: false, isWritable: true },
451
+ { pubkey: ammConfig, isSigner: false, isWritable: true },
452
+ { pubkey: observationKey, isSigner: false, isWritable: true },
453
+ { pubkey: tickArrayBitmapExtension, isSigner: false, isWritable: true },
454
+ { pubkey: addresses_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
455
+ { pubkey: addresses_1.ASSOCIATED_TOKEN_PROGRAM, isSigner: false, isWritable: false },
456
+ { pubkey: addresses_1.TOKEN_2022, isSigner: false, isWritable: false },
457
+ { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
458
+ ],
459
+ data: Buffer.concat([
460
+ new Uint8Array((0, functions_1.sighash)('raydium_sweep_dust')),
461
+ ]),
462
+ })
463
+ });
464
+ });
465
+ }
466
+ }
467
+ exports.IyfExtensionIxGenerator = IyfExtensionIxGenerator;