@steerprotocol/sdk 1.19.14 → 1.19.16

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 (119) hide show
  1. package/README.md +281 -11
  2. package/dist/cjs/base/VaultClient.js +95 -1
  3. package/dist/cjs/base/VaultClient.js.map +1 -1
  4. package/dist/cjs/base/vault/single-asset/calculateLimitPrice.js +231 -0
  5. package/dist/cjs/base/vault/single-asset/calculateLimitPrice.js.map +1 -0
  6. package/dist/cjs/base/vault/single-asset/calculateSwapAmount.js +68 -0
  7. package/dist/cjs/base/vault/single-asset/calculateSwapAmount.js.map +1 -0
  8. package/dist/cjs/base/vault/single-asset/estimateLpTokens.js +355 -0
  9. package/dist/cjs/base/vault/single-asset/estimateLpTokens.js.map +1 -0
  10. package/dist/cjs/base/vault/single-asset/index.js +109 -0
  11. package/dist/cjs/base/vault/single-asset/index.js.map +1 -0
  12. package/dist/cjs/base/vault/single-asset/simulateSwap.js +291 -0
  13. package/dist/cjs/base/vault/single-asset/simulateSwap.js.map +1 -0
  14. package/dist/cjs/base/vault/single-asset/singleAssetDeposit.js +324 -0
  15. package/dist/cjs/base/vault/single-asset/singleAssetDeposit.js.map +1 -0
  16. package/dist/cjs/base/vault/single-asset/types.js +15 -0
  17. package/dist/cjs/base/vault/single-asset/types.js.map +1 -0
  18. package/dist/cjs/base/vault/utils.js +229 -18
  19. package/dist/cjs/base/vault/utils.js.map +1 -1
  20. package/dist/cjs/const/abis/index.js +3 -0
  21. package/dist/cjs/const/abis/index.js.map +1 -1
  22. package/dist/cjs/const/abis/quoter.js +248 -0
  23. package/dist/cjs/const/abis/quoter.js.map +1 -0
  24. package/dist/cjs/const/abis/singleTokenDeposit.js +925 -0
  25. package/dist/cjs/const/abis/singleTokenDeposit.js.map +1 -0
  26. package/dist/cjs/const/amm/configs/protocols/quickswap-integral.js +3 -0
  27. package/dist/cjs/const/amm/configs/protocols/quickswap-integral.js.map +1 -1
  28. package/dist/cjs/const/amm/configs/protocols/uniswap.js +15 -0
  29. package/dist/cjs/const/amm/configs/protocols/uniswap.js.map +1 -1
  30. package/dist/cjs/const/deployments/abis.js +277 -0
  31. package/dist/cjs/const/deployments/abis.js.map +1 -1
  32. package/dist/cjs/const/deployments/polygon.js +8 -0
  33. package/dist/cjs/const/deployments/polygon.js.map +1 -1
  34. package/dist/cjs/const/index.js +6 -5
  35. package/dist/cjs/const/index.js.map +1 -1
  36. package/dist/cjs/const/network.js.map +1 -1
  37. package/dist/cjs/const/quoter.js +38 -0
  38. package/dist/cjs/const/quoter.js.map +1 -0
  39. package/dist/cjs/index.js +1 -0
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/esm/base/VaultClient.js +81 -1
  42. package/dist/esm/base/VaultClient.js.map +1 -1
  43. package/dist/esm/base/vault/single-asset/calculateLimitPrice.js +224 -0
  44. package/dist/esm/base/vault/single-asset/calculateLimitPrice.js.map +1 -0
  45. package/dist/esm/base/vault/single-asset/calculateSwapAmount.js +65 -0
  46. package/dist/esm/base/vault/single-asset/calculateSwapAmount.js.map +1 -0
  47. package/dist/esm/base/vault/single-asset/estimateLpTokens.js +350 -0
  48. package/dist/esm/base/vault/single-asset/estimateLpTokens.js.map +1 -0
  49. package/dist/esm/base/vault/single-asset/index.js +83 -0
  50. package/dist/esm/base/vault/single-asset/index.js.map +1 -0
  51. package/dist/esm/base/vault/single-asset/simulateSwap.js +285 -0
  52. package/dist/esm/base/vault/single-asset/simulateSwap.js.map +1 -0
  53. package/dist/esm/base/vault/single-asset/singleAssetDeposit.js +320 -0
  54. package/dist/esm/base/vault/single-asset/singleAssetDeposit.js.map +1 -0
  55. package/dist/esm/base/vault/single-asset/types.js +12 -0
  56. package/dist/esm/base/vault/single-asset/types.js.map +1 -0
  57. package/dist/esm/base/vault/utils.js +226 -18
  58. package/dist/esm/base/vault/utils.js.map +1 -1
  59. package/dist/esm/const/abis/index.js +3 -0
  60. package/dist/esm/const/abis/index.js.map +1 -1
  61. package/dist/esm/const/abis/quoter.js +245 -0
  62. package/dist/esm/const/abis/quoter.js.map +1 -0
  63. package/dist/esm/const/abis/singleTokenDeposit.js +922 -0
  64. package/dist/esm/const/abis/singleTokenDeposit.js.map +1 -0
  65. package/dist/esm/const/amm/configs/protocols/quickswap-integral.js +3 -0
  66. package/dist/esm/const/amm/configs/protocols/quickswap-integral.js.map +1 -1
  67. package/dist/esm/const/amm/configs/protocols/uniswap.js +15 -0
  68. package/dist/esm/const/amm/configs/protocols/uniswap.js.map +1 -1
  69. package/dist/esm/const/deployments/abis.js +277 -0
  70. package/dist/esm/const/deployments/abis.js.map +1 -1
  71. package/dist/esm/const/deployments/polygon.js +8 -0
  72. package/dist/esm/const/deployments/polygon.js.map +1 -1
  73. package/dist/esm/const/index.js +6 -5
  74. package/dist/esm/const/index.js.map +1 -1
  75. package/dist/esm/const/network.js.map +1 -1
  76. package/dist/esm/const/quoter.js +34 -0
  77. package/dist/esm/const/quoter.js.map +1 -0
  78. package/dist/esm/index.js +1 -0
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/types/base/VaultClient.d.ts +136 -4
  81. package/dist/types/base/VaultClient.d.ts.map +1 -1
  82. package/dist/types/base/vault/single-asset/calculateLimitPrice.d.ts +59 -0
  83. package/dist/types/base/vault/single-asset/calculateLimitPrice.d.ts.map +1 -0
  84. package/dist/types/base/vault/single-asset/calculateSwapAmount.d.ts +30 -0
  85. package/dist/types/base/vault/single-asset/calculateSwapAmount.d.ts.map +1 -0
  86. package/dist/types/base/vault/single-asset/estimateLpTokens.d.ts +61 -0
  87. package/dist/types/base/vault/single-asset/estimateLpTokens.d.ts.map +1 -0
  88. package/dist/types/base/vault/single-asset/index.d.ts +80 -0
  89. package/dist/types/base/vault/single-asset/index.d.ts.map +1 -0
  90. package/dist/types/base/vault/single-asset/simulateSwap.d.ts +119 -0
  91. package/dist/types/base/vault/single-asset/simulateSwap.d.ts.map +1 -0
  92. package/dist/types/base/vault/single-asset/singleAssetDeposit.d.ts +141 -0
  93. package/dist/types/base/vault/single-asset/singleAssetDeposit.d.ts.map +1 -0
  94. package/dist/types/base/vault/single-asset/types.d.ts +167 -0
  95. package/dist/types/base/vault/single-asset/types.d.ts.map +1 -0
  96. package/dist/types/base/vault/utils.d.ts +95 -0
  97. package/dist/types/base/vault/utils.d.ts.map +1 -1
  98. package/dist/types/const/abis/index.d.ts +3 -0
  99. package/dist/types/const/abis/index.d.ts.map +1 -1
  100. package/dist/types/const/abis/quoter.d.ts +206 -0
  101. package/dist/types/const/abis/quoter.d.ts.map +1 -0
  102. package/dist/types/const/abis/singleTokenDeposit.d.ts +47 -0
  103. package/dist/types/const/abis/singleTokenDeposit.d.ts.map +1 -0
  104. package/dist/types/const/amm/configs/protocols/quickswap-integral.d.ts.map +1 -1
  105. package/dist/types/const/amm/configs/protocols/uniswap.d.ts.map +1 -1
  106. package/dist/types/const/deployments/abis.d.ts +215 -0
  107. package/dist/types/const/deployments/abis.d.ts.map +1 -1
  108. package/dist/types/const/deployments/polygon.d.ts.map +1 -1
  109. package/dist/types/const/index.d.ts +6 -5
  110. package/dist/types/const/index.d.ts.map +1 -1
  111. package/dist/types/const/network.d.ts +2 -0
  112. package/dist/types/const/network.d.ts.map +1 -1
  113. package/dist/types/const/quoter.d.ts +17 -0
  114. package/dist/types/const/quoter.d.ts.map +1 -0
  115. package/dist/types/index.d.ts +1 -0
  116. package/dist/types/index.d.ts.map +1 -1
  117. package/dist/types/types.d.ts +3 -0
  118. package/dist/types/types.d.ts.map +1 -1
  119. package/package.json +1 -1
@@ -0,0 +1,141 @@
1
+ import type { Hash, PublicClient, WalletClient } from 'viem';
2
+ import { SteerResponse } from '../../../types';
3
+ import type { SingleAssetDepositParams, SingleAssetDepositPreview } from './types';
4
+ import { AMMType } from './types';
5
+ /**
6
+ * Main single-asset deposit client that orchestrates all the steps
7
+ */
8
+ export declare class SingleAssetDepositClient {
9
+ private readonly publicClient;
10
+ private readonly walletClient;
11
+ constructor(publicClient: PublicClient, walletClient: WalletClient);
12
+ /**
13
+ * Previews a single-asset deposit by running all simulation steps
14
+ * This allows users to see the expected outcome before executing the transaction
15
+ *
16
+ * @param params - Single-asset deposit parameters
17
+ * @param poolAddress - Address of the pool (must be provided separately)
18
+ * @returns Promise resolving to the complete deposit preview
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const preview = await client.previewDeposit({
23
+ * assets: parseEther('100'),
24
+ * receiver: userAddress,
25
+ * vault: vaultAddress,
26
+ * isToken0: true,
27
+ * depositSlippagePercent: 5n,
28
+ * swapSlippageBP: 500,
29
+ * ammType: AMMType.UniswapV3,
30
+ * singleAssetDepositContract: contractAddress
31
+ * }, poolAddress);
32
+ *
33
+ * if (preview.success) {
34
+ * console.log('Expected LP tokens:', preview.data.lpEstimation.lpTokens);
35
+ * console.log('Swap amount:', preview.data.swapAmount);
36
+ * }
37
+ * ```
38
+ */
39
+ previewDeposit(params: SingleAssetDepositParams, poolAddress: `0x${string}`): Promise<SteerResponse<SingleAssetDepositPreview>>;
40
+ /**
41
+ * Executes a single-asset deposit transaction
42
+ *
43
+ * @param params - Single-asset deposit parameters
44
+ * @returns Promise resolving to the transaction hash
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const result = await client.deposit({
49
+ * assets: parseEther('100'),
50
+ * receiver: userAddress,
51
+ * vault: vaultAddress,
52
+ * isToken0: true,
53
+ * depositSlippagePercent: 5n,
54
+ * swapSlippageBP: 500,
55
+ * ammType: AMMType.UniswapV3,
56
+ * singleAssetDepositContract: contractAddress
57
+ * });
58
+ *
59
+ * if (result.success) {
60
+ * console.log('Transaction hash:', result.data);
61
+ * }
62
+ * ```
63
+ */
64
+ deposit(params: SingleAssetDepositParams): Promise<SteerResponse<Hash>>;
65
+ /**
66
+ * Prepares a single-asset deposit transaction without executing it
67
+ * Useful for batching transactions or custom execution logic
68
+ *
69
+ * @param params - Single-asset deposit parameters
70
+ * @returns Promise resolving to the prepared transaction data
71
+ */
72
+ prepareDepositTx(params: SingleAssetDepositParams): Promise<{
73
+ data: {
74
+ address: `0x${string}` | undefined;
75
+ abi: ({
76
+ type: string;
77
+ inputs: never[];
78
+ stateMutability: string;
79
+ name?: undefined;
80
+ outputs?: undefined;
81
+ anonymous?: undefined;
82
+ } | {
83
+ type: string;
84
+ name: string;
85
+ inputs: {
86
+ name: string;
87
+ type: string;
88
+ internalType: string;
89
+ }[];
90
+ outputs: {
91
+ name: string;
92
+ type: string;
93
+ internalType: string;
94
+ }[];
95
+ stateMutability: string;
96
+ anonymous?: undefined;
97
+ } | {
98
+ type: string;
99
+ name: string;
100
+ inputs: {
101
+ name: string;
102
+ type: string;
103
+ indexed: boolean;
104
+ internalType: string;
105
+ }[];
106
+ anonymous: boolean;
107
+ stateMutability?: undefined;
108
+ outputs?: undefined;
109
+ } | {
110
+ type: string;
111
+ name: string;
112
+ inputs: {
113
+ name: string;
114
+ type: string;
115
+ internalType: string;
116
+ }[];
117
+ stateMutability?: undefined;
118
+ outputs?: undefined;
119
+ anonymous?: undefined;
120
+ })[];
121
+ functionName: "deposit";
122
+ args: readonly [bigint, `0x${string}`, `0x${string}`, boolean, bigint, number, AMMType];
123
+ };
124
+ status: number;
125
+ success: boolean;
126
+ error?: undefined;
127
+ } | {
128
+ data: null;
129
+ status: number;
130
+ success: boolean;
131
+ error: string;
132
+ }>;
133
+ /**
134
+ * Validates single-asset deposit parameters
135
+ *
136
+ * @param params - Parameters to validate
137
+ * @throws Error if parameters are invalid
138
+ */
139
+ validateDepositParams(params: SingleAssetDepositParams): void;
140
+ }
141
+ //# sourceMappingURL=singleAssetDeposit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleAssetDeposit.d.ts","sourceRoot":"","sources":["../../../../../src/base/vault/single-asset/singleAssetDeposit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAItE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,OAAO,KAAK,EAGV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY;IAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,cAAc,CACzB,MAAM,EAAE,wBAAwB,EAChC,WAAW,EAAE,KAAK,MAAM,EAAE,GACzB,OAAO,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAmJpD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAgDpF;;;;;;OAMG;IACU,gBAAgB,CAAC,MAAM,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0D9D;;;;;OAKG;IACI,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI;CA6BrE"}
@@ -0,0 +1,167 @@
1
+ import type { Address } from 'viem';
2
+ import { SwapWithSlippageResponse } from './simulateSwap';
3
+ /**
4
+ * AMM Types supported by single-asset deposits
5
+ */
6
+ export declare enum AMMType {
7
+ UniswapV3 = 0,
8
+ Algebra = 1,
9
+ AlgebraDirectional = 2,
10
+ AlgebraVE33 = 3,
11
+ AlgebraIntegral = 4
12
+ }
13
+ /**
14
+ * Parameters for single-asset deposit
15
+ */
16
+ export interface SingleAssetDepositParams {
17
+ /** Amount of input token provided by the user */
18
+ assets: bigint;
19
+ /** Address to receive LP tokens */
20
+ receiver: Address;
21
+ /** Address of the vault to deposit into */
22
+ vault: Address;
23
+ /** true if input token is token0, false if token1 */
24
+ isToken0: boolean;
25
+ /** Maximum allowed slippage during deposit (in %) */
26
+ depositSlippagePercent: bigint;
27
+ /** Slippage tolerance for internal swap (in basis points) */
28
+ swapSlippageBP: number;
29
+ /** Type of AMM */
30
+ ammType: AMMType;
31
+ /** Address of the single-asset deposit contract */
32
+ singleAssetDepositContract?: Address;
33
+ }
34
+ /**
35
+ * Parameters for calculating swap amount
36
+ */
37
+ export interface CalculateSwapAmountParams {
38
+ /** Amount of tokens being deposited */
39
+ depositAmount: bigint;
40
+ /** true if depositing token0, false if token1 */
41
+ isToken0: boolean;
42
+ /** Address of the vault */
43
+ vault: Address;
44
+ /** Address of the pool */
45
+ pool: Address;
46
+ /** Type of AMM */
47
+ ammType: AMMType;
48
+ /** Address of the single-asset deposit contract */
49
+ singleAssetDepositContract: Address;
50
+ }
51
+ /**
52
+ * Response from calculateSwapAmount
53
+ */
54
+ export interface SwapAmountResponse {
55
+ /** Amount to be swapped from the input token */
56
+ swapAmount: bigint;
57
+ /** Current sqrt price (used for internal calculation) */
58
+ sqrtPrice: bigint;
59
+ }
60
+ /**
61
+ * Parameters for calculating sqrt price limit
62
+ */
63
+ export interface CalculateLimitPriceParams {
64
+ /** Address of the pool */
65
+ pool: Address;
66
+ /** Slippage tolerance in basis points */
67
+ slippageBP: number;
68
+ /** true if swapping token0 for token1, false otherwise */
69
+ zeroForOne: boolean;
70
+ /** Type of AMM */
71
+ ammType: AMMType;
72
+ /** Address of token0 */
73
+ token0: Address;
74
+ /** Address of token1 */
75
+ token1: Address;
76
+ }
77
+ /**
78
+ * Parameters for simulating a swap
79
+ */
80
+ export interface SimulateSwapParams {
81
+ /** Address of the pool */
82
+ pool: Address;
83
+ /** Address that will receive the swap output (or address(this) for simulation) */
84
+ recipient: Address;
85
+ /** true if swapping token0 → token1, else false */
86
+ zeroForOne: boolean;
87
+ /** Value from calculateSwapAmount */
88
+ amountSpecified: bigint;
89
+ /** Slippage-adjusted limit price */
90
+ sqrtPriceLimitX96: bigint;
91
+ /** AMM type */
92
+ ammType: AMMType;
93
+ /** Input token address (required for Quoter) */
94
+ tokenIn: Address;
95
+ /** Output token address (required for Quoter) */
96
+ tokenOut: Address;
97
+ /** Pool fee (required for Quoter) */
98
+ fee: number;
99
+ /** Quoter contract address (optional - will use default if not provided) */
100
+ quoterAddress?: Address;
101
+ }
102
+ /**
103
+ * Response from swap simulation
104
+ */
105
+ export interface SwapSimulationResponse {
106
+ /** Final token0 amount after swap */
107
+ amount0: bigint;
108
+ /** Final token1 amount after swap */
109
+ amount1: bigint;
110
+ sqrtPriceX96After: bigint;
111
+ }
112
+ /**
113
+ * Parameters for estimating LP tokens
114
+ */
115
+ export interface EstimateLpTokensParams {
116
+ /** Address of the vault */
117
+ vault: Address;
118
+ /** Original deposit amount */
119
+ originalAssets: bigint;
120
+ /** Amount that was swapped internally */
121
+ swapAmount: bigint;
122
+ /** Tokens received from the swap (amount0 and amount1) */
123
+ swapResult: SwapSimulationResponse;
124
+ /** true if original deposit was token0, false if token1 */
125
+ isToken0: boolean;
126
+ }
127
+ /**
128
+ * Response from LP token estimation
129
+ */
130
+ export interface LpTokenEstimationResponse {
131
+ /** Estimated amount of LP tokens to be received */
132
+ lpTokens: bigint;
133
+ /** Final amount of token0 that will be deposited */
134
+ finalAmount0: bigint;
135
+ /** Final amount of token1 that will be deposited */
136
+ finalAmount1: bigint;
137
+ }
138
+ /**
139
+ * Comprehensive single-asset deposit preview
140
+ */
141
+ export interface SingleAssetDepositPreview {
142
+ /** Amount to be swapped internally */
143
+ swapAmount: bigint;
144
+ /** Current sqrt price */
145
+ currentSqrtPrice: bigint;
146
+ /** Slippage-adjusted limit price for swap */
147
+ sqrtPriceLimitX96: bigint;
148
+ /** Simulated swap result */
149
+ swapSimulation: SwapWithSlippageResponse;
150
+ /** LP token estimation */
151
+ lpEstimation: LpTokenEstimationResponse;
152
+ /** Whether the swap direction is token0 → token1 */
153
+ zeroForOne: boolean;
154
+ }
155
+ /**
156
+ * Pool slot0 data structure for UniswapV3
157
+ */
158
+ export interface PoolSlot0 {
159
+ sqrtPriceX96: bigint;
160
+ tick: number;
161
+ observationIndex: number;
162
+ observationCardinality: number;
163
+ observationCardinalityNext: number;
164
+ feeProtocol: number;
165
+ unlocked: boolean;
166
+ }
167
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/base/vault/single-asset/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;GAEG;AACH,oBAAY,OAAO;IACjB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,kBAAkB,IAAI;IACtB,WAAW,IAAI;IACf,eAAe,IAAI;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;IAClB,qDAAqD;IACrD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,0BAA0B;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,0BAA0B,EAAE,OAAO,CAA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MAAM,CAAC;IACvB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,EAAE,sBAAsB,CAAC;IACnC,2DAA2D;IAC3D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4BAA4B;IAC5B,cAAc,EAAE,wBAAwB,CAAC;IACzC,0BAA0B;IAC1B,YAAY,EAAE,yBAAyB,CAAC;IACxC,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -1,5 +1,20 @@
1
1
  import { Address, PublicClient } from 'viem';
2
2
  import { PoolSharkGlobalState, Slot0, SteerResponse } from '../../types';
3
+ /**
4
+ * Parameters for getting pool state across different AMM types
5
+ */
6
+ export interface PoolStateParams {
7
+ /** The pool address */
8
+ poolAddress: Address;
9
+ /** Whether the pool is an Algebra pool */
10
+ isAlgebraPool?: boolean;
11
+ /** Whether the pool is an Algebra directional pool */
12
+ isAlgebraDirectionPool?: boolean;
13
+ /** Whether the pool is a PoolShark pool */
14
+ isPoolSharkPool?: boolean;
15
+ /** Whether the pool is an Algebra Integral pool */
16
+ isAlgebraIntegralPool?: boolean;
17
+ }
3
18
  /**
4
19
  * Gets slot0 data from a standard Uniswap V3 pool
5
20
  * @param poolAddress The pool address
@@ -22,4 +37,84 @@ export declare function getGlobalStatePoolShark(publicClient: PublicClient, pool
22
37
  * @param isDirectional Whether the pool is directional
23
38
  */
24
39
  export declare function getGlobalStateAlgebraIntegral(publicClient: PublicClient, poolAddress: Address, isDirectional?: boolean): Promise<SteerResponse<Slot0>>;
40
+ /**
41
+ * Unified method to get pool state across different AMM types
42
+ * Automatically calls the correct function based on pool type parameters
43
+ *
44
+ * @param publicClient - The public client for blockchain reads
45
+ * @param params - Parameters specifying the pool and its type
46
+ * @returns Promise resolving to standardized pool state data
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * // For Uniswap V3 pool
51
+ * const uniV3State = await getPoolState(publicClient, {
52
+ * poolAddress: '0x...',
53
+ * });
54
+ *
55
+ * // For Algebra pool
56
+ * const algebraState = await getPoolState(publicClient, {
57
+ * poolAddress: '0x...',
58
+ * isAlgebraPool: true,
59
+ * isAlgebraDirectionPool: false
60
+ * });
61
+ *
62
+ * // For PoolShark pool
63
+ * const poolSharkState = await getPoolState(publicClient, {
64
+ * poolAddress: '0x...',
65
+ * isPoolSharkPool: true
66
+ * });
67
+ * ```
68
+ */
69
+ export declare function getPoolState(publicClient: PublicClient, params: PoolStateParams): Promise<SteerResponse<Slot0>>;
70
+ /**
71
+ * Extracts the appropriate price value from pool state based on AMM type
72
+ * Different AMM protocols store price information in different fields
73
+ *
74
+ * @param poolStateData - The pool state data returned from getPoolState
75
+ * @param params - Pool type parameters to determine which price field to use
76
+ * @returns The price as bigint, or null if price cannot be extracted
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const stateResponse = await getPoolState(publicClient, {
81
+ * poolAddress: '0x...',
82
+ * isAlgebraPool: true
83
+ * });
84
+ *
85
+ * if (stateResponse.success && stateResponse.data) {
86
+ * const price = getPoolPrice(stateResponse.data, {
87
+ * isAlgebraPool: true,
88
+ * isAlgebraDirectionPool: false
89
+ * });
90
+ * console.log('Pool price:', price);
91
+ * }
92
+ * ```
93
+ */
94
+ export declare function getPoolPrice(poolStateData: Slot0, params: Pick<PoolStateParams, 'isAlgebraPool' | 'isAlgebraIntegralPool' | 'isPoolSharkPool'>): bigint | null;
95
+ /**
96
+ * Combined method to get both pool state and extract price in one call
97
+ * Convenience method that combines getPoolState and getPoolPrice
98
+ *
99
+ * @param publicClient - The public client for blockchain reads
100
+ * @param params - Parameters specifying the pool and its type
101
+ * @returns Promise resolving to object containing both state and price
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const result = await getPoolStateWithPrice(publicClient, {
106
+ * poolAddress: '0x...',
107
+ * isAlgebraPool: true
108
+ * });
109
+ *
110
+ * if (result.success && result.data) {
111
+ * console.log('Pool state:', result.data.state);
112
+ * console.log('Pool price:', result.data.price);
113
+ * }
114
+ * ```
115
+ */
116
+ export declare function getPoolStateWithPrice(publicClient: PublicClient, params: PoolStateParams): Promise<SteerResponse<{
117
+ state: Slot0;
118
+ price: bigint | null;
119
+ }>>;
25
120
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/base/vault/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4HzE;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CA6B/B;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,OAAO,EACpB,aAAa,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Y,EAAE,YAAY,EAC1B,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAwD9C;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,OAAO,EACpB,aAAa,UAAQ,GACpB,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CA6B/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,YAAY,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAoE/B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,KAAK,EACpB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,uBAAuB,GAAG,iBAAiB,CAAC,GAC3F,MAAM,GAAG,IAAI,CAwBf;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAAC,CA+BhE"}
@@ -1,4 +1,7 @@
1
1
  export * from './erc20';
2
2
  export * from './erc721';
3
3
  export * from './erc1155';
4
+ export * from './singleTokenDeposit';
5
+ export * from './UniswapPool';
6
+ export * from './quoter';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,206 @@
1
+ export declare const UniswapV3QuoterABI: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_factory";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "address";
8
+ readonly name: "_WETH9";
9
+ readonly type: "address";
10
+ }];
11
+ readonly stateMutability: "nonpayable";
12
+ readonly type: "constructor";
13
+ }, {
14
+ readonly inputs: readonly [];
15
+ readonly name: "WETH9";
16
+ readonly outputs: readonly [{
17
+ readonly internalType: "address";
18
+ readonly name: "";
19
+ readonly type: "address";
20
+ }];
21
+ readonly stateMutability: "view";
22
+ readonly type: "function";
23
+ }, {
24
+ readonly inputs: readonly [];
25
+ readonly name: "factory";
26
+ readonly outputs: readonly [{
27
+ readonly internalType: "address";
28
+ readonly name: "";
29
+ readonly type: "address";
30
+ }];
31
+ readonly stateMutability: "view";
32
+ readonly type: "function";
33
+ }, {
34
+ readonly inputs: readonly [{
35
+ readonly internalType: "bytes";
36
+ readonly name: "path";
37
+ readonly type: "bytes";
38
+ }, {
39
+ readonly internalType: "uint256";
40
+ readonly name: "amountIn";
41
+ readonly type: "uint256";
42
+ }];
43
+ readonly name: "quoteExactInput";
44
+ readonly outputs: readonly [{
45
+ readonly internalType: "uint256";
46
+ readonly name: "amountOut";
47
+ readonly type: "uint256";
48
+ }, {
49
+ readonly internalType: "uint160[]";
50
+ readonly name: "sqrtPriceX96AfterList";
51
+ readonly type: "uint160[]";
52
+ }, {
53
+ readonly internalType: "uint32[]";
54
+ readonly name: "initializedTicksCrossedList";
55
+ readonly type: "uint32[]";
56
+ }, {
57
+ readonly internalType: "uint256";
58
+ readonly name: "gasEstimate";
59
+ readonly type: "uint256";
60
+ }];
61
+ readonly stateMutability: "nonpayable";
62
+ readonly type: "function";
63
+ }, {
64
+ readonly inputs: readonly [{
65
+ readonly components: readonly [{
66
+ readonly internalType: "address";
67
+ readonly name: "tokenIn";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly internalType: "address";
71
+ readonly name: "tokenOut";
72
+ readonly type: "address";
73
+ }, {
74
+ readonly internalType: "uint256";
75
+ readonly name: "amountIn";
76
+ readonly type: "uint256";
77
+ }, {
78
+ readonly internalType: "uint24";
79
+ readonly name: "fee";
80
+ readonly type: "uint24";
81
+ }, {
82
+ readonly internalType: "uint160";
83
+ readonly name: "sqrtPriceLimitX96";
84
+ readonly type: "uint160";
85
+ }];
86
+ readonly internalType: "struct IQuoterV2.QuoteExactInputSingleParams";
87
+ readonly name: "params";
88
+ readonly type: "tuple";
89
+ }];
90
+ readonly name: "quoteExactInputSingle";
91
+ readonly outputs: readonly [{
92
+ readonly internalType: "uint256";
93
+ readonly name: "amountOut";
94
+ readonly type: "uint256";
95
+ }, {
96
+ readonly internalType: "uint160";
97
+ readonly name: "sqrtPriceX96After";
98
+ readonly type: "uint160";
99
+ }, {
100
+ readonly internalType: "uint32";
101
+ readonly name: "initializedTicksCrossed";
102
+ readonly type: "uint32";
103
+ }, {
104
+ readonly internalType: "uint256";
105
+ readonly name: "gasEstimate";
106
+ readonly type: "uint256";
107
+ }];
108
+ readonly stateMutability: "nonpayable";
109
+ readonly type: "function";
110
+ }, {
111
+ readonly inputs: readonly [{
112
+ readonly internalType: "bytes";
113
+ readonly name: "path";
114
+ readonly type: "bytes";
115
+ }, {
116
+ readonly internalType: "uint256";
117
+ readonly name: "amountOut";
118
+ readonly type: "uint256";
119
+ }];
120
+ readonly name: "quoteExactOutput";
121
+ readonly outputs: readonly [{
122
+ readonly internalType: "uint256";
123
+ readonly name: "amountIn";
124
+ readonly type: "uint256";
125
+ }, {
126
+ readonly internalType: "uint160[]";
127
+ readonly name: "sqrtPriceX96AfterList";
128
+ readonly type: "uint160[]";
129
+ }, {
130
+ readonly internalType: "uint32[]";
131
+ readonly name: "initializedTicksCrossedList";
132
+ readonly type: "uint32[]";
133
+ }, {
134
+ readonly internalType: "uint256";
135
+ readonly name: "gasEstimate";
136
+ readonly type: "uint256";
137
+ }];
138
+ readonly stateMutability: "nonpayable";
139
+ readonly type: "function";
140
+ }, {
141
+ readonly inputs: readonly [{
142
+ readonly components: readonly [{
143
+ readonly internalType: "address";
144
+ readonly name: "tokenIn";
145
+ readonly type: "address";
146
+ }, {
147
+ readonly internalType: "address";
148
+ readonly name: "tokenOut";
149
+ readonly type: "address";
150
+ }, {
151
+ readonly internalType: "uint256";
152
+ readonly name: "amount";
153
+ readonly type: "uint256";
154
+ }, {
155
+ readonly internalType: "uint24";
156
+ readonly name: "fee";
157
+ readonly type: "uint24";
158
+ }, {
159
+ readonly internalType: "uint160";
160
+ readonly name: "sqrtPriceLimitX96";
161
+ readonly type: "uint160";
162
+ }];
163
+ readonly internalType: "struct IQuoterV2.QuoteExactOutputSingleParams";
164
+ readonly name: "params";
165
+ readonly type: "tuple";
166
+ }];
167
+ readonly name: "quoteExactOutputSingle";
168
+ readonly outputs: readonly [{
169
+ readonly internalType: "uint256";
170
+ readonly name: "amountIn";
171
+ readonly type: "uint256";
172
+ }, {
173
+ readonly internalType: "uint160";
174
+ readonly name: "sqrtPriceX96After";
175
+ readonly type: "uint160";
176
+ }, {
177
+ readonly internalType: "uint32";
178
+ readonly name: "initializedTicksCrossed";
179
+ readonly type: "uint32";
180
+ }, {
181
+ readonly internalType: "uint256";
182
+ readonly name: "gasEstimate";
183
+ readonly type: "uint256";
184
+ }];
185
+ readonly stateMutability: "nonpayable";
186
+ readonly type: "function";
187
+ }, {
188
+ readonly inputs: readonly [{
189
+ readonly internalType: "int256";
190
+ readonly name: "amount0Delta";
191
+ readonly type: "int256";
192
+ }, {
193
+ readonly internalType: "int256";
194
+ readonly name: "amount1Delta";
195
+ readonly type: "int256";
196
+ }, {
197
+ readonly internalType: "bytes";
198
+ readonly name: "path";
199
+ readonly type: "bytes";
200
+ }];
201
+ readonly name: "uniswapV3SwapCallback";
202
+ readonly outputs: readonly [];
203
+ readonly stateMutability: "view";
204
+ readonly type: "function";
205
+ }];
206
+ //# sourceMappingURL=quoter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoter.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/quoter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmPrB,CAAC"}