@panoptic-eng/sdk 1.0.36 → 1.0.38
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/cow/index.d.ts +4 -5
- package/dist/cow/index.js +3 -3
- package/dist/cow/types.d.ts +3 -2
- package/dist/{cow-aX6of9TS.js → cow-DB8siv6M.js} +2 -2
- package/dist/{cow-aX6of9TS.js.map → cow-DB8siv6M.js.map} +1 -1
- package/dist/deployments.d.ts +3 -2
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +4 -0
- package/dist/deployments.js.map +1 -1
- package/dist/{position-C8rkkKhi.js → getTrackedPositionIds-zYPIs5dt.js} +1086 -34
- package/dist/getTrackedPositionIds-zYPIs5dt.js.map +1 -0
- package/dist/hypoVault/vaultDisplayNames.d.ts +2 -0
- package/dist/hypoVault/vaultDisplayNames.js +4 -0
- package/dist/{index-CURXeKNy.d.ts → index-BhEBx83X.d.ts} +405 -351
- package/dist/index-BhEBx83X.d.ts.map +1 -0
- package/dist/index-Bo9tHtD7.d.ts +1901 -0
- package/dist/index-Bo9tHtD7.d.ts.map +1 -0
- package/dist/{index-Cp-nCeV2.d.ts → index-CttjEZ-S.d.ts} +3 -4
- package/dist/index-CttjEZ-S.d.ts.map +1 -0
- package/dist/{index-Zvu-rJpV.d.ts → index-DktZq9Kb.d.ts} +2 -2
- package/dist/{index-Zvu-rJpV.d.ts.map → index-DktZq9Kb.d.ts.map} +1 -1
- package/dist/index.d.ts +159 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +323 -70
- package/dist/index.js.map +1 -1
- package/dist/{irm-DnM96-X4.js → irm-ChkvYphK.js} +3 -318
- package/dist/irm-ChkvYphK.js.map +1 -0
- package/dist/{irm-CmgC1Mqi.d.ts → irm-D2WTHtuo.d.ts} +3 -30
- package/dist/{irm-CmgC1Mqi.d.ts.map → irm-D2WTHtuo.d.ts.map} +1 -1
- package/dist/irm-D5plRhpB.d.ts +32 -0
- package/dist/irm-D5plRhpB.d.ts.map +1 -0
- package/dist/panoptic/v2/greeks/index.d.ts +3 -2
- package/dist/panoptic/v2/index.d.ts +7 -8
- package/dist/panoptic/v2/index.js +7 -6
- package/dist/panoptic/v2/react-public.d.ts +29 -13
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +48 -8
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/panoptic/v2/types/index.d.ts +3 -0
- package/dist/panoptic/v2/types/index.js +0 -0
- package/dist/quote-DeHNUR0Z.d.ts +52 -0
- package/dist/quote-DeHNUR0Z.d.ts.map +1 -0
- package/dist/{router-CS86ptMu.js → router-BCUJkY8j.js} +3 -3
- package/dist/{router-CS86ptMu.js.map → router-BCUJkY8j.js.map} +1 -1
- package/dist/{router-DcoU2KmV.js → router-tCRa0ekE.js} +2 -2
- package/dist/{router-DcoU2KmV.js.map → router-tCRa0ekE.js.map} +1 -1
- package/dist/src-CRAtPwWk.js +321 -0
- package/dist/src-CRAtPwWk.js.map +1 -0
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/transactionFees-CVi2TrJh.js +175 -0
- package/dist/transactionFees-CVi2TrJh.js.map +1 -0
- package/dist/transactionFees-DzDyt50k.d.ts +63 -0
- package/dist/transactionFees-DzDyt50k.d.ts.map +1 -0
- package/dist/{types-D_jcYss-.d.ts → types-Cad5m4Td.d.ts} +3 -5
- package/dist/types-Cad5m4Td.d.ts.map +1 -0
- package/dist/{types-BHdnurYr.d.ts → types-DM0nxlZr.d.ts} +2 -2
- package/dist/{types-BHdnurYr.d.ts.map → types-DM0nxlZr.d.ts.map} +1 -1
- package/dist/uniswap/index.d.ts +4 -5
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +4 -4
- package/dist/{v2-D0dEatKb.js → v2-BxtzpUnV.js} +3267 -2675
- package/dist/v2-BxtzpUnV.js.map +1 -0
- package/dist/vault-transaction-fees.d.ts +2 -0
- package/dist/vault-transaction-fees.js +3 -0
- package/dist/vaultDisplayNames-CKpz51Hu.js +0 -0
- package/dist/vaultDisplayNames-Q6htUcch.d.ts +2 -0
- package/dist/{writes-AupZCK4M.js → writes-D3bj1wth.js} +326 -1292
- package/dist/writes-D3bj1wth.js.map +1 -0
- package/package.json +5 -1
- package/dist/index-CURXeKNy.d.ts.map +0 -1
- package/dist/index-Cp-nCeV2.d.ts.map +0 -1
- package/dist/irm-DnM96-X4.js.map +0 -1
- package/dist/position-BqIgubs5.d.ts +0 -199
- package/dist/position-BqIgubs5.d.ts.map +0 -1
- package/dist/position-C8rkkKhi.js.map +0 -1
- package/dist/quote-BxQkPBRg.d.ts +0 -718
- package/dist/quote-BxQkPBRg.d.ts.map +0 -1
- package/dist/simulation-zM6-YUaw.d.ts +0 -258
- package/dist/simulation-zM6-YUaw.d.ts.map +0 -1
- package/dist/tx-CbDQ58Io.d.ts +0 -367
- package/dist/tx-CbDQ58Io.d.ts.map +0 -1
- package/dist/types-D_jcYss-.d.ts.map +0 -1
- package/dist/v2-D0dEatKb.js.map +0 -1
- package/dist/writes-AupZCK4M.js.map +0 -1
package/dist/quote-BxQkPBRg.d.ts
DELETED
|
@@ -1,718 +0,0 @@
|
|
|
1
|
-
import { BlockMeta } from "./position-BqIgubs5.js";
|
|
2
|
-
import { Address, PublicClient } from "viem";
|
|
3
|
-
|
|
4
|
-
//#region src/panoptic/v2/formatters/tick.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Tick and price formatters for Uniswap V3/V4 pools.
|
|
7
|
-
*
|
|
8
|
-
* Ticks represent logarithmic prices where: price = 1.0001^tick
|
|
9
|
-
*
|
|
10
|
-
* @module v2/formatters/tick
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Tick and price formatters for Uniswap V3/V4 pools.
|
|
14
|
-
*
|
|
15
|
-
* Ticks represent logarithmic prices where: price = 1.0001^tick
|
|
16
|
-
*
|
|
17
|
-
* @module v2/formatters/tick
|
|
18
|
-
*/
|
|
19
|
-
declare function tickToSqrtPriceX96(tick: bigint): bigint;
|
|
20
|
-
/**
|
|
21
|
-
* Convert a tick to a raw price string (no decimal adjustment).
|
|
22
|
-
* Uses the formula: price = 1.0001^tick
|
|
23
|
-
*
|
|
24
|
-
* This returns the raw price ratio, not adjusted for token decimals.
|
|
25
|
-
* A fixed internal precision is used and trailing zeros are trimmed.
|
|
26
|
-
*
|
|
27
|
-
* @param tick - The tick value
|
|
28
|
-
* @returns Price string
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* tickToPrice(0n) // "1"
|
|
33
|
-
* tickToPrice(1000n) // "1.105..." (approximately)
|
|
34
|
-
* tickToPrice(-1000n) // "0.904..." (approximately)
|
|
35
|
-
* tickToPrice(200000n) // Very large number
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
declare function tickToPrice(tick: bigint): string;
|
|
39
|
-
/**
|
|
40
|
-
* Convert a tick to a human-readable price with decimal scaling.
|
|
41
|
-
* Uses the formula: price = 1.0001^tick * 10^(decimals0-decimals1)
|
|
42
|
-
*
|
|
43
|
-
* This adjusts for the different decimals of the two tokens in the pair.
|
|
44
|
-
*
|
|
45
|
-
* @param tick - The tick value
|
|
46
|
-
* @param decimals0 - Decimals of token0
|
|
47
|
-
* @param decimals1 - Decimals of token1
|
|
48
|
-
* @param precision - Number of decimal places to display
|
|
49
|
-
* @returns Formatted price string
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* // WETH/USDC pool (18 decimals / 6 decimals)
|
|
54
|
-
* // At tick ~200000, price is roughly $2000 per ETH
|
|
55
|
-
* tickToPriceDecimalScaled(200000n, 18n, 6n, 2n) // "2000.00" (approximately)
|
|
56
|
-
*
|
|
57
|
-
* // For token1/token0 price, swap the decimals
|
|
58
|
-
* tickToPriceDecimalScaled(200000n, 6n, 18n, 6n) // "0.000500" (approximately)
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare function tickToPriceDecimalScaled(tick: bigint, decimals0: bigint, decimals1: bigint, precision: bigint): string;
|
|
62
|
-
/**
|
|
63
|
-
* Convert a sqrtPriceX96 to a human-readable price with decimal scaling.
|
|
64
|
-
*
|
|
65
|
-
* Uses the formula: price = (sqrtPriceX96^2 / 2^192) * 10^(decimals0-decimals1)
|
|
66
|
-
*
|
|
67
|
-
* @param sqrtPriceX96 - The sqrt price in Q64.96 format
|
|
68
|
-
* @param decimals0 - Decimals of token0
|
|
69
|
-
* @param decimals1 - Decimals of token1
|
|
70
|
-
* @param precision - Number of decimal places to display
|
|
71
|
-
* @returns Formatted price string
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* sqrtPriceX96ToPriceDecimalScaled(2n ** 96n, 18n, 18n, 2n) // "1.00"
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
declare function sqrtPriceX96ToPriceDecimalScaled(sqrtPriceX96: bigint, decimals0: bigint, decimals1: bigint, precision: bigint): string;
|
|
79
|
-
/**
|
|
80
|
-
* Convert a price to a tick value.
|
|
81
|
-
*
|
|
82
|
-
* @param price - The price string
|
|
83
|
-
* @param decimals0 - Decimals of token0
|
|
84
|
-
* @param decimals1 - Decimals of token1
|
|
85
|
-
* @returns The tick value (rounded to nearest integer)
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* // WETH/USDC: What tick for $2000 per ETH?
|
|
90
|
-
* priceToTick("2000", 18n, 6n) // ~200000n
|
|
91
|
-
*
|
|
92
|
-
* // Inverse: What tick for 0.0005 ETH per USDC?
|
|
93
|
-
* priceToTick("0.0005", 6n, 18n) // ~200000n
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function priceToTick(price: string, decimals0: bigint, decimals1: bigint): bigint;
|
|
97
|
-
/**
|
|
98
|
-
* Convert a sqrtPriceX96 value to the nearest tick.
|
|
99
|
-
*
|
|
100
|
-
* @param sqrtPriceX96 - The sqrt price in Q64.96 format
|
|
101
|
-
* @returns The tick value (rounded to nearest integer)
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const tick = sqrtPriceX96ToTick(2n ** 96n) // 0n
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
declare function sqrtPriceX96ToTick(sqrtPriceX96: bigint): bigint;
|
|
109
|
-
/**
|
|
110
|
-
* Format a tick value for display.
|
|
111
|
-
*
|
|
112
|
-
* @param tick - The tick value
|
|
113
|
-
* @returns Formatted tick string
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* formatTick(200000n) // "200000"
|
|
118
|
-
* formatTick(-50000n) // "-50000"
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
declare function formatTick(tick: bigint): string;
|
|
122
|
-
/**
|
|
123
|
-
* Get the price at a specific tick, returning both token0/token1 and token1/token0 prices.
|
|
124
|
-
*
|
|
125
|
-
* @param tick - The tick value
|
|
126
|
-
* @param decimals0 - Decimals of token0
|
|
127
|
-
* @param decimals1 - Decimals of token1
|
|
128
|
-
* @param precision - Number of decimal places to display
|
|
129
|
-
* @returns Object with both price directions
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* const prices = getPricesAtTick(200000n, 18n, 6n, 2n)
|
|
134
|
-
* // prices.token0PerToken1 = "0.00" (very small)
|
|
135
|
-
* // prices.token1PerToken0 = "2000.00" (USDC per ETH)
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
declare function getPricesAtTick(tick: bigint, decimals0: bigint, decimals1: bigint, precision: bigint): {
|
|
139
|
-
token0PerToken1: string;
|
|
140
|
-
token1PerToken0: string;
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Format a tick range for display.
|
|
144
|
-
*
|
|
145
|
-
* @param tickLower - Lower tick
|
|
146
|
-
* @param tickUpper - Upper tick
|
|
147
|
-
* @returns Formatted tick range string
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* formatTickRange(-50000n, 200000n) // "-50000 - 200000"
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
declare function formatTickRange(tickLower: bigint, tickUpper: bigint): string;
|
|
155
|
-
/**
|
|
156
|
-
* Format a price range for display.
|
|
157
|
-
*
|
|
158
|
-
* @param tickLower - Lower tick
|
|
159
|
-
* @param tickUpper - Upper tick
|
|
160
|
-
* @param decimals0 - Decimals of token0
|
|
161
|
-
* @param decimals1 - Decimals of token1
|
|
162
|
-
* @param precision - Number of decimal places to display
|
|
163
|
-
* @returns Formatted price range string
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* formatPriceRange(0n, 0n, 18n, 18n, 2n) // "1.00 - 1.00"
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
declare function formatPriceRange(tickLower: bigint, tickUpper: bigint, decimals0: bigint, decimals1: bigint, precision: bigint): string;
|
|
171
|
-
/**
|
|
172
|
-
* Calculate the tick spacing for a given fee tier.
|
|
173
|
-
*
|
|
174
|
-
* @param feeBps - Fee in basis points (e.g., 500n for 0.05%)
|
|
175
|
-
* @returns Tick spacing
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* ```typescript
|
|
179
|
-
* getTickSpacing(100n) // 1n (0.01% fee tier)
|
|
180
|
-
* getTickSpacing(500n) // 10n (0.05% fee tier)
|
|
181
|
-
* getTickSpacing(3000n) // 60n (0.30% fee tier)
|
|
182
|
-
* getTickSpacing(10000n) // 200n (1.00% fee tier)
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
declare function getTickSpacing(feeBps: bigint): bigint;
|
|
186
|
-
/**
|
|
187
|
-
* Round a tick to the nearest valid tick for a given tick spacing.
|
|
188
|
-
*
|
|
189
|
-
* @param tick - The tick to round
|
|
190
|
-
* @param tickSpacing - The tick spacing
|
|
191
|
-
* @returns Rounded tick
|
|
192
|
-
*
|
|
193
|
-
* @example
|
|
194
|
-
* ```typescript
|
|
195
|
-
* roundToTickSpacing(12345n, 10n) // 12340n
|
|
196
|
-
* roundToTickSpacing(12345n, 60n) // 12360n
|
|
197
|
-
* roundToTickSpacing(-12345n, 10n) // -12350n
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
declare function roundToTickSpacing(tick: bigint, tickSpacing: bigint): bigint;
|
|
201
|
-
/**
|
|
202
|
-
* Result of {@link tickLimits}.
|
|
203
|
-
*/
|
|
204
|
-
interface TickLimitsResult {
|
|
205
|
-
/** Lower tick limit (clamped to MIN_TICK). */
|
|
206
|
-
low: bigint;
|
|
207
|
-
/** Upper tick limit (clamped to MAX_TICK). */
|
|
208
|
-
high: bigint;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Compute slippage-bounded tick limits around the current tick.
|
|
212
|
-
*
|
|
213
|
-
* 1 tick ≈ 1 basis point (0.01 %) of price change, so a `toleranceBps`
|
|
214
|
-
* of 500 allows roughly 5 % price movement. The result is clamped to
|
|
215
|
-
* the protocol's `[MIN_TICK, MAX_TICK]` range.
|
|
216
|
-
*
|
|
217
|
-
* Useful for setting `tickLimitLow` / `tickLimitHigh` on `openPosition`
|
|
218
|
-
* and `closePosition` to protect against MEV sandwiches and volatile
|
|
219
|
-
* tick moves.
|
|
220
|
-
*
|
|
221
|
-
* @param currentTick - The current pool tick (must be within [MIN_TICK, MAX_TICK]).
|
|
222
|
-
* @param toleranceBps - Slippage tolerance in basis points (≈ ticks). Must be non-negative.
|
|
223
|
-
* @returns Clamped `{ low, high }` tick limits.
|
|
224
|
-
* @throws {RangeError} If `toleranceBps` is negative or `currentTick` is out of bounds.
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
|
-
* ```typescript
|
|
228
|
-
* const { low, high } = tickLimits(200_000n, 500n)
|
|
229
|
-
* // low = 199_500n
|
|
230
|
-
* // high = 200_500n
|
|
231
|
-
*
|
|
232
|
-
* await openPosition({ ..., tickLimitLow: low, tickLimitHigh: high })
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
declare function tickLimits(currentTick: bigint, toleranceBps: bigint): TickLimitsResult; //#endregion
|
|
236
|
-
//#region src/panoptic/v2/reads/pool.d.ts
|
|
237
|
-
/**
|
|
238
|
-
* Immutable pool metadata that can be cached.
|
|
239
|
-
* These values never change for a given pool, so they're exempt from
|
|
240
|
-
* same-block consistency requirements (per PLAN.md "Static Prefetches" exception).
|
|
241
|
-
*/
|
|
242
|
-
interface PoolMetadata {
|
|
243
|
-
/** Pool key bytes */
|
|
244
|
-
poolKeyBytes: `0x${string}`;
|
|
245
|
-
/** Pool ID */
|
|
246
|
-
poolId: bigint;
|
|
247
|
-
/** Collateral tracker 0 address */
|
|
248
|
-
collateralToken0Address: Address;
|
|
249
|
-
/** Collateral tracker 1 address */
|
|
250
|
-
collateralToken1Address: Address;
|
|
251
|
-
/** Risk engine address */
|
|
252
|
-
riskEngineAddress: Address;
|
|
253
|
-
/** Token 0 underlying asset address */
|
|
254
|
-
token0Asset: Address;
|
|
255
|
-
/** Token 1 underlying asset address */
|
|
256
|
-
token1Asset: Address;
|
|
257
|
-
/** Token 0 symbol */
|
|
258
|
-
token0Symbol: string;
|
|
259
|
-
/** Token 1 symbol */
|
|
260
|
-
token1Symbol: string;
|
|
261
|
-
/** Token 0 decimals */
|
|
262
|
-
token0Decimals: bigint;
|
|
263
|
-
/** Token 1 decimals */
|
|
264
|
-
token1Decimals: bigint;
|
|
265
|
-
/** Token 0 name */
|
|
266
|
-
token0Name: string;
|
|
267
|
-
/** Token 1 name */
|
|
268
|
-
token1Name: string;
|
|
269
|
-
/** Underlying pool ID (V3: pool address, V4: keccak256(poolKeyBytes)) */
|
|
270
|
-
underlyingPoolId: string;
|
|
271
|
-
/** Whether this is a V4 pool (poolManager is non-zero) */
|
|
272
|
-
isV4: boolean;
|
|
273
|
-
/** Tick spacing */
|
|
274
|
-
tickSpacing: bigint;
|
|
275
|
-
/** Fee tier (V4: from poolKey, V3: from Uniswap pool fee()) */
|
|
276
|
-
fee: bigint;
|
|
277
|
-
/** SemiFungiblePositionManager address */
|
|
278
|
-
sfpmAddress: Address;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Parameters for getPoolMetadata.
|
|
282
|
-
*/
|
|
283
|
-
interface GetPoolMetadataParams {
|
|
284
|
-
/** viem PublicClient */
|
|
285
|
-
client: PublicClient;
|
|
286
|
-
/** PanopticPool address */
|
|
287
|
-
poolAddress: Address;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Fetch immutable pool metadata (addresses, symbols, decimals).
|
|
291
|
-
* This data never changes for a given pool and can be cached indefinitely.
|
|
292
|
-
*
|
|
293
|
-
* This is the "static prefetch" per PLAN.md §6 - exempt from same-block consistency.
|
|
294
|
-
*
|
|
295
|
-
* @param params - The parameters
|
|
296
|
-
* @returns Immutable pool metadata
|
|
297
|
-
*/
|
|
298
|
-
declare function getPoolMetadata(params: GetPoolMetadataParams): Promise<PoolMetadata>;
|
|
299
|
-
/**
|
|
300
|
-
* Parameters for getPool.
|
|
301
|
-
*/
|
|
302
|
-
interface GetPoolParams {
|
|
303
|
-
/** viem PublicClient */
|
|
304
|
-
client: PublicClient;
|
|
305
|
-
/** PanopticPool address */
|
|
306
|
-
poolAddress: Address;
|
|
307
|
-
/** Chain ID */
|
|
308
|
-
chainId: bigint;
|
|
309
|
-
/** Optional block number for historical queries */
|
|
310
|
-
blockNumber?: bigint;
|
|
311
|
-
/** Optional pre-fetched pool metadata (for caching/optimization) */
|
|
312
|
-
poolMetadata?: PoolMetadata;
|
|
313
|
-
/** Optional StateView address for V4 pools (needed to read Uniswap pool liquidity) */
|
|
314
|
-
stateViewAddress?: Address;
|
|
315
|
-
/** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */
|
|
316
|
-
_meta?: BlockMeta;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Get full pool data including both collateral trackers and oracle state.
|
|
320
|
-
*
|
|
321
|
-
* ## Same-Block Guarantee
|
|
322
|
-
* All dynamic data is fetched in ONE multicall at the target block.
|
|
323
|
-
* Static metadata (addresses, symbols, decimals) is either provided via
|
|
324
|
-
* poolMetadata or fetched separately (static prefetch exception).
|
|
325
|
-
*
|
|
326
|
-
* @param params - The parameters
|
|
327
|
-
* @returns Pool data with block metadata
|
|
328
|
-
*/
|
|
329
|
-
declare function getPool(params: GetPoolParams): Promise<Pool>;
|
|
330
|
-
/**
|
|
331
|
-
* Parameters for getUtilization.
|
|
332
|
-
*/
|
|
333
|
-
interface GetUtilizationParams {
|
|
334
|
-
/** viem PublicClient */
|
|
335
|
-
client: PublicClient;
|
|
336
|
-
/** PanopticPool address */
|
|
337
|
-
poolAddress: Address;
|
|
338
|
-
/** Optional block number for historical queries */
|
|
339
|
-
blockNumber?: bigint;
|
|
340
|
-
/** Optional pre-fetched collateral tracker addresses (for caching/optimization) */
|
|
341
|
-
collateralAddresses?: {
|
|
342
|
-
collateralToken0: Address;
|
|
343
|
-
collateralToken1: Address;
|
|
344
|
-
};
|
|
345
|
-
/** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */
|
|
346
|
-
_meta?: BlockMeta;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Get current pool utilization for both tokens.
|
|
350
|
-
*
|
|
351
|
-
* ## Same-Block Guarantee
|
|
352
|
-
* All dynamic data is fetched in ONE multicall at the target block.
|
|
353
|
-
* Collateral tracker addresses are either provided or fetched separately (static prefetch).
|
|
354
|
-
*
|
|
355
|
-
* @param params - The parameters
|
|
356
|
-
* @returns Utilization data with block metadata
|
|
357
|
-
*/
|
|
358
|
-
declare function getUtilization(params: GetUtilizationParams): Promise<Utilization>;
|
|
359
|
-
/**
|
|
360
|
-
* Parameters for getOracleState.
|
|
361
|
-
*/
|
|
362
|
-
interface GetOracleStateParams {
|
|
363
|
-
/** viem PublicClient */
|
|
364
|
-
client: PublicClient;
|
|
365
|
-
/** PanopticPool address */
|
|
366
|
-
poolAddress: Address;
|
|
367
|
-
/** Optional block number for historical queries */
|
|
368
|
-
blockNumber?: bigint;
|
|
369
|
-
/** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */
|
|
370
|
-
_meta?: BlockMeta;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Get current oracle state from the pool.
|
|
374
|
-
*
|
|
375
|
-
* ## Same-Block Guarantee
|
|
376
|
-
* Single contract call + block meta fetch at the same block.
|
|
377
|
-
*
|
|
378
|
-
* @param params - The parameters
|
|
379
|
-
* @returns Oracle state with block metadata
|
|
380
|
-
*/
|
|
381
|
-
declare function getOracleState(params: GetOracleStateParams): Promise<OracleState>;
|
|
382
|
-
/**
|
|
383
|
-
* Parameters for getRiskParameters.
|
|
384
|
-
*/
|
|
385
|
-
interface GetRiskParametersParams {
|
|
386
|
-
/** viem PublicClient */
|
|
387
|
-
client: PublicClient;
|
|
388
|
-
/** PanopticPool address */
|
|
389
|
-
poolAddress: Address;
|
|
390
|
-
/** Builder code (default: 0) */
|
|
391
|
-
builderCode?: bigint;
|
|
392
|
-
/** Optional block number for historical queries */
|
|
393
|
-
blockNumber?: bigint;
|
|
394
|
-
/** Optional pre-fetched risk engine address (for caching/optimization) */
|
|
395
|
-
riskEngineAddress?: Address;
|
|
396
|
-
/** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */
|
|
397
|
-
_meta?: BlockMeta;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Get risk parameters from the pool.
|
|
401
|
-
*
|
|
402
|
-
* ## Same-Block Guarantee
|
|
403
|
-
* All dynamic data is fetched in ONE multicall at the target block.
|
|
404
|
-
* Risk engine address is either provided or fetched separately (static prefetch).
|
|
405
|
-
*
|
|
406
|
-
* @param params - The parameters
|
|
407
|
-
* @returns Risk parameters with block metadata
|
|
408
|
-
*/
|
|
409
|
-
declare function getRiskParameters(params: GetRiskParametersParams): Promise<RiskParameters>;
|
|
410
|
-
/**
|
|
411
|
-
* Validate whether a builder code maps to a deployed builder wallet.
|
|
412
|
-
*
|
|
413
|
-
* Calls `PanopticPool.getRiskParameters(builderCode)` — the contract reverts
|
|
414
|
-
* with `InvalidBuilderCode` when the computed CREATE2 address has no bytecode.
|
|
415
|
-
*
|
|
416
|
-
* @returns `true` when valid, `false` when the contract reverts.
|
|
417
|
-
*/
|
|
418
|
-
declare function validateBuilderCode(params: {
|
|
419
|
-
client: PublicClient;
|
|
420
|
-
poolAddress: Address;
|
|
421
|
-
builderCode: bigint;
|
|
422
|
-
}): Promise<boolean>;
|
|
423
|
-
/**
|
|
424
|
-
* Parameters for fetchPoolId.
|
|
425
|
-
*/
|
|
426
|
-
interface FetchPoolIdParams {
|
|
427
|
-
/** viem PublicClient */
|
|
428
|
-
client: PublicClient;
|
|
429
|
-
/** PanopticPool address */
|
|
430
|
-
poolAddress: Address;
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Result of fetchPoolId, including block metadata for same-block consistency.
|
|
434
|
-
*/
|
|
435
|
-
interface FetchPoolIdResult {
|
|
436
|
-
/** The encoded 64-bit pool ID */
|
|
437
|
-
poolId: bigint;
|
|
438
|
-
/** Block metadata from the pinned read */
|
|
439
|
-
_meta: BlockMeta;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Fetch the encoded 64-bit pool ID from a PanopticPool contract.
|
|
443
|
-
*
|
|
444
|
-
* Use this when you need the poolId without fetching the full pool state.
|
|
445
|
-
* The returned poolId can be passed directly to `createTokenIdBuilder()`.
|
|
446
|
-
* The read is pinned to the latest block at call time.
|
|
447
|
-
*
|
|
448
|
-
* @param params - The parameters
|
|
449
|
-
* @returns The pool ID and block metadata
|
|
450
|
-
*/
|
|
451
|
-
declare function fetchPoolId(params: FetchPoolIdParams): Promise<FetchPoolIdResult>;
|
|
452
|
-
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/panoptic/v2/types/pool.d.ts
|
|
455
|
-
/**
|
|
456
|
-
* Pool health status.
|
|
457
|
-
*/
|
|
458
|
-
type PoolHealthStatus = 'active' | 'low_liquidity' | 'paused';
|
|
459
|
-
/**
|
|
460
|
-
* Collateral tracker information.
|
|
461
|
-
*/
|
|
462
|
-
interface CollateralTracker {
|
|
463
|
-
/** Address of the collateral tracker contract */
|
|
464
|
-
address: Address;
|
|
465
|
-
/** Address of the underlying token */
|
|
466
|
-
token: Address;
|
|
467
|
-
/** Token symbol */
|
|
468
|
-
symbol: string;
|
|
469
|
-
/** Token decimals */
|
|
470
|
-
decimals: bigint;
|
|
471
|
-
/** Total assets accounted to the pool (deposited assets plus assets in the AMM) */
|
|
472
|
-
totalAssets: bigint;
|
|
473
|
-
/** Assets currently inside the AMM (deployed as liquidity) */
|
|
474
|
-
insideAMM: bigint;
|
|
475
|
-
/** Credited shares (shares owed to liquidity providers) */
|
|
476
|
-
creditedShares: bigint;
|
|
477
|
-
/** Total shares outstanding */
|
|
478
|
-
totalShares: bigint;
|
|
479
|
-
/** Current utilization (0-10000 bps) */
|
|
480
|
-
utilization: bigint;
|
|
481
|
-
/** Current borrow rate (annualized, WAD-scaled: 1e18 = 100%/year) */
|
|
482
|
-
borrowRate: bigint;
|
|
483
|
-
/** Current supply rate (annualized, WAD-scaled: 1e18 = 100%/year) */
|
|
484
|
-
supplyRate: bigint;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Risk engine information.
|
|
488
|
-
*/
|
|
489
|
-
interface RiskEngine {
|
|
490
|
-
/** Address of the risk engine contract */
|
|
491
|
-
address: Address;
|
|
492
|
-
/** Collateral requirement factor (in bps) */
|
|
493
|
-
collateralRequirement: bigint;
|
|
494
|
-
/** Maintenance margin factor (in bps) */
|
|
495
|
-
maintenanceMargin: bigint;
|
|
496
|
-
/** Commission rate (in bps), charged on notional at mint */
|
|
497
|
-
commissionRate: bigint;
|
|
498
|
-
/**
|
|
499
|
-
* Premium fee rate (in bps), charged on realized premium at burn. The burn
|
|
500
|
-
* commission is the lesser of this applied to the realized premium and
|
|
501
|
-
* 10x `commissionRate` applied to the notional — see CollateralTracker.settleBurn.
|
|
502
|
-
*/
|
|
503
|
-
premiumFeeRate: bigint;
|
|
504
|
-
/** VEGOID constant used in spread calculation */
|
|
505
|
-
vegoid: bigint;
|
|
506
|
-
/** Maximum spread parameter (in bps) */
|
|
507
|
-
maxSpread: bigint;
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Uniswap V4 pool key.
|
|
511
|
-
*/
|
|
512
|
-
interface PoolKey {
|
|
513
|
-
/** Token 0 address */
|
|
514
|
-
currency0: Address;
|
|
515
|
-
/** Token 1 address */
|
|
516
|
-
currency1: Address;
|
|
517
|
-
/** Fee tier */
|
|
518
|
-
fee: bigint;
|
|
519
|
-
/** Tick spacing */
|
|
520
|
-
tickSpacing: bigint;
|
|
521
|
-
/** Hook address (if any) */
|
|
522
|
-
hooks: Address;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Pool data returned by getPool().
|
|
526
|
-
*/
|
|
527
|
-
interface Pool {
|
|
528
|
-
/** Address of the PanopticPool contract */
|
|
529
|
-
address: Address;
|
|
530
|
-
/** Chain ID */
|
|
531
|
-
chainId: bigint;
|
|
532
|
-
/** Encoded pool ID (64-bit) */
|
|
533
|
-
poolId: bigint;
|
|
534
|
-
/** Uniswap pool key (V4: full struct, V3: zeroed fields) */
|
|
535
|
-
poolKey: PoolKey;
|
|
536
|
-
/** Tick spacing (extracted from encoded poolId) */
|
|
537
|
-
tickSpacing: bigint;
|
|
538
|
-
/** Token 0 collateral tracker */
|
|
539
|
-
collateralTracker0: CollateralTracker;
|
|
540
|
-
/** Token 1 collateral tracker */
|
|
541
|
-
collateralTracker1: CollateralTracker;
|
|
542
|
-
/** Risk engine */
|
|
543
|
-
riskEngine: RiskEngine;
|
|
544
|
-
/** Current tick */
|
|
545
|
-
currentTick: bigint;
|
|
546
|
-
/** Current sqrt price (Q64.96) */
|
|
547
|
-
sqrtPriceX96: bigint;
|
|
548
|
-
/** Uniswap pool in-range liquidity (from V3 pool.liquidity() or V4 StateView.getLiquidity()) */
|
|
549
|
-
uniswapPoolLiquidity: bigint;
|
|
550
|
-
/** Pool health status */
|
|
551
|
-
healthStatus: PoolHealthStatus;
|
|
552
|
-
/** Immutable pool metadata (addresses, symbols, decimals, names, underlyingPoolId) */
|
|
553
|
-
metadata: PoolMetadata;
|
|
554
|
-
/** Block metadata */
|
|
555
|
-
_meta: BlockMeta;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Utilization data for both tokens.
|
|
559
|
-
*/
|
|
560
|
-
interface Utilization {
|
|
561
|
-
/** Token 0 utilization (0-10000 bps) */
|
|
562
|
-
utilization0: bigint;
|
|
563
|
-
/** Token 1 utilization (0-10000 bps) */
|
|
564
|
-
utilization1: bigint;
|
|
565
|
-
/**
|
|
566
|
-
* Assets of token 0 currently available to borrow, in token units.
|
|
567
|
-
*
|
|
568
|
-
* Mirrors the contract's `maxWithdraw` cap:
|
|
569
|
-
* `depositedAssets - 1 - convertToAssets(creditedShares)`, floored at 0.
|
|
570
|
-
* Slightly conservative — like the rest of the SDK's pool reads it omits
|
|
571
|
-
* `unrealizedInterest` from `totalAssets`.
|
|
572
|
-
*
|
|
573
|
-
* Informational only: credit-based swaps are not gated by this.
|
|
574
|
-
*/
|
|
575
|
-
availableToBorrow0: bigint;
|
|
576
|
-
/** See {@link Utilization.availableToBorrow0}. */
|
|
577
|
-
availableToBorrow1: bigint;
|
|
578
|
-
/** Block metadata */
|
|
579
|
-
_meta: BlockMeta;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
//#endregion
|
|
583
|
-
//#region src/panoptic/v2/types/oracle.d.ts
|
|
584
|
-
/**
|
|
585
|
-
* Safe mode level from the RiskEngine.
|
|
586
|
-
*/
|
|
587
|
-
type SafeMode = 'normal' | 'restricted' | 'emergency';
|
|
588
|
-
/**
|
|
589
|
-
* Oracle state from the PanopticPool.
|
|
590
|
-
*/
|
|
591
|
-
interface OracleState {
|
|
592
|
-
/** Last update epoch (64-second intervals) */
|
|
593
|
-
epoch: bigint;
|
|
594
|
-
/** Last update timestamp */
|
|
595
|
-
lastUpdateTimestamp: bigint;
|
|
596
|
-
/** Reference tick */
|
|
597
|
-
referenceTick: bigint;
|
|
598
|
-
/** Spot EMA tick */
|
|
599
|
-
spotEMA: bigint;
|
|
600
|
-
/** Fast EMA tick */
|
|
601
|
-
fastEMA: bigint;
|
|
602
|
-
/** Slow EMA tick */
|
|
603
|
-
slowEMA: bigint;
|
|
604
|
-
/** Eons EMA tick */
|
|
605
|
-
eonsEMA: bigint;
|
|
606
|
-
/** Lock mode (0 = unlocked, 1 = spot locked, 2 = full locked) */
|
|
607
|
-
lockMode: bigint;
|
|
608
|
-
/** Median tick from sorted observations */
|
|
609
|
-
medianTick: bigint;
|
|
610
|
-
/** Block metadata */
|
|
611
|
-
_meta: BlockMeta;
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Safe mode state from the RiskEngine.
|
|
615
|
-
*/
|
|
616
|
-
interface SafeModeState {
|
|
617
|
-
/** Current safe mode level */
|
|
618
|
-
mode: SafeMode;
|
|
619
|
-
/** Whether minting new positions is allowed */
|
|
620
|
-
canMint: boolean;
|
|
621
|
-
/** Whether burning positions is allowed */
|
|
622
|
-
canBurn: boolean;
|
|
623
|
-
/** Whether force exercise is allowed */
|
|
624
|
-
canForceExercise: boolean;
|
|
625
|
-
/** Whether liquidations are allowed */
|
|
626
|
-
canLiquidate: boolean;
|
|
627
|
-
/** Whether swapAtMint is allowed (false for NO_SWAP level 2+) */
|
|
628
|
-
canSwapAtMint: boolean;
|
|
629
|
-
/** Reason for current safe mode (if not normal) */
|
|
630
|
-
reason?: string;
|
|
631
|
-
/** Block metadata */
|
|
632
|
-
_meta: BlockMeta;
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Risk parameters from the RiskEngine.
|
|
636
|
-
*/
|
|
637
|
-
interface RiskParameters {
|
|
638
|
-
/** Collateral requirement multiplier (in bps, e.g., 10000 = 100%) */
|
|
639
|
-
collateralRequirement: bigint;
|
|
640
|
-
/** Maintenance margin requirement (in bps) */
|
|
641
|
-
maintenanceMargin: bigint;
|
|
642
|
-
/** Commission rate (in bps) */
|
|
643
|
-
commissionRate: bigint;
|
|
644
|
-
/** Target pool utilization (in bps) */
|
|
645
|
-
targetUtilization: bigint;
|
|
646
|
-
/** Saturated pool utilization threshold (in bps) */
|
|
647
|
-
saturatedUtilization: bigint;
|
|
648
|
-
/** ITM spread multiplier */
|
|
649
|
-
itmSpreadMultiplier: bigint;
|
|
650
|
-
/** Block metadata */
|
|
651
|
-
_meta: BlockMeta;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Current interest rates from the CollateralTrackers.
|
|
655
|
-
*/
|
|
656
|
-
interface CurrentRates {
|
|
657
|
-
/** Token 0 borrow rate (per-second, WAD-scaled) */
|
|
658
|
-
borrowRate0: bigint;
|
|
659
|
-
/** Token 0 supply rate (per-second, WAD-scaled) */
|
|
660
|
-
supplyRate0: bigint;
|
|
661
|
-
/** Token 1 borrow rate (per-second, WAD-scaled) */
|
|
662
|
-
borrowRate1: bigint;
|
|
663
|
-
/** Token 1 supply rate (per-second, WAD-scaled) */
|
|
664
|
-
supplyRate1: bigint;
|
|
665
|
-
/** Block metadata */
|
|
666
|
-
_meta: BlockMeta;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
//#endregion
|
|
670
|
-
//#region src/uniswap/v3/addresses.d.ts
|
|
671
|
-
interface UniswapV3Addresses {
|
|
672
|
-
/** Uniswap v3 QuoterV2 — `quoteExactInputSingle` (revert/staticcall-based). */
|
|
673
|
-
quoterV2: Address;
|
|
674
|
-
/** Uniswap v3 NonfungiblePositionManager — ERC721 LP position NFTs. */
|
|
675
|
-
nonfungiblePositionManager: Address;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only
|
|
679
|
-
* after verifying against the canonical Uniswap v3 deployment listing.
|
|
680
|
-
*/
|
|
681
|
-
declare const UNISWAP_V3_ADDRESSES: Record<number, UniswapV3Addresses>;
|
|
682
|
-
/**
|
|
683
|
-
* Resolve Uniswap v3 addresses for a chain, applying optional overrides.
|
|
684
|
-
*
|
|
685
|
-
* @throws {UnsupportedChainError} when the chain is not listed and overrides do
|
|
686
|
-
* not supply every required address.
|
|
687
|
-
*/
|
|
688
|
-
declare function getUniswapV3Addresses(chainId: number | bigint, overrides?: Partial<UniswapV3Addresses>): UniswapV3Addresses;
|
|
689
|
-
|
|
690
|
-
//#endregion
|
|
691
|
-
//#region src/uniswap/v3/router/quote.d.ts
|
|
692
|
-
interface QuoteV3ExactInParams {
|
|
693
|
-
client: PublicClient;
|
|
694
|
-
chainId: bigint;
|
|
695
|
-
tokenIn: Address;
|
|
696
|
-
tokenOut: Address;
|
|
697
|
-
fee: bigint;
|
|
698
|
-
amountIn: bigint;
|
|
699
|
-
/** Slippage tolerance in bps, used to compute `amountOutMinimum`. */
|
|
700
|
-
slippageBps: bigint;
|
|
701
|
-
blockNumber?: bigint;
|
|
702
|
-
addresses?: Partial<UniswapV3Addresses>;
|
|
703
|
-
}
|
|
704
|
-
interface V3ExactInQuote {
|
|
705
|
-
amountOut: bigint;
|
|
706
|
-
amountOutMinimum: bigint;
|
|
707
|
-
gasEstimate: bigint;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the
|
|
711
|
-
* pool does not exist / has no liquidity) so callers can skip that pool when
|
|
712
|
-
* ranking venues, rather than aborting the whole cycle.
|
|
713
|
-
*/
|
|
714
|
-
declare function quoteV3ExactIn(params: QuoteV3ExactInParams): Promise<V3ExactInQuote | null>;
|
|
715
|
-
|
|
716
|
-
//#endregion
|
|
717
|
-
export { CollateralTracker, CurrentRates, FetchPoolIdParams, FetchPoolIdResult, GetOracleStateParams, GetPoolMetadataParams, GetPoolParams, GetRiskParametersParams, GetUtilizationParams, OracleState, Pool, PoolHealthStatus, PoolKey, PoolMetadata, QuoteV3ExactInParams, RiskEngine, RiskParameters, SafeMode, SafeModeState, TickLimitsResult, UNISWAP_V3_ADDRESSES as UNISWAP_V3_ADDRESSES$1, UniswapV3Addresses, Utilization, V3ExactInQuote, fetchPoolId as fetchPoolId$1, formatPriceRange as formatPriceRange$1, formatTick as formatTick$1, formatTickRange as formatTickRange$1, getOracleState as getOracleState$1, getPool as getPool$1, getPoolMetadata as getPoolMetadata$1, getPricesAtTick as getPricesAtTick$1, getRiskParameters as getRiskParameters$1, getTickSpacing as getTickSpacing$1, getUniswapV3Addresses as getUniswapV3Addresses$1, getUtilization as getUtilization$1, priceToTick as priceToTick$1, quoteV3ExactIn as quoteV3ExactIn$1, roundToTickSpacing as roundToTickSpacing$1, sqrtPriceX96ToPriceDecimalScaled as sqrtPriceX96ToPriceDecimalScaled$1, sqrtPriceX96ToTick as sqrtPriceX96ToTick$1, tickLimits as tickLimits$1, tickToPrice as tickToPrice$1, tickToPriceDecimalScaled as tickToPriceDecimalScaled$1, tickToSqrtPriceX96 as tickToSqrtPriceX96$1, validateBuilderCode as validateBuilderCode$1 };
|
|
718
|
-
//# sourceMappingURL=quote-BxQkPBRg.d.ts.map
|