@panoptic-eng/sdk 1.0.38 → 1.0.39
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 +804 -5
- package/dist/cow/index.d.ts.map +1 -0
- package/dist/cow/index.js +5268 -5
- package/dist/cow/index.js.map +1 -0
- package/dist/{cow-DB8siv6M.js → cow-tRUtAUZy.js} +2 -3
- package/dist/{getTrackedPositionIds-zYPIs5dt.js → getTrackedPositionIds-ms3W9dYB.js} +1 -2
- package/dist/greeks-GysWXct-.js +1 -2
- package/dist/index.d.ts +5752 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11952 -2130
- package/dist/index.js.map +1 -1
- package/dist/{irm-ChkvYphK.js → irm-SPC2KxLA.js} +321 -3
- package/dist/panoptic/v2/greeks/index.d.ts +277 -4
- package/dist/panoptic/v2/greeks/index.d.ts.map +1 -0
- package/dist/panoptic/v2/greeks/index.js +620 -2
- package/dist/panoptic/v2/greeks/index.js.map +1 -0
- package/dist/panoptic/v2/index.d.ts +14633 -7
- package/dist/panoptic/v2/index.d.ts.map +1 -0
- package/dist/panoptic/v2/index.js +27875 -9
- package/dist/panoptic/v2/index.js.map +1 -0
- package/dist/panoptic/v2/react-public.d.ts +14779 -15
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +29463 -89
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{router-tCRa0ekE.js → router-BTfbaRfg.js} +2 -3
- package/dist/{router-BCUJkY8j.js → router-mLWy0MD9.js} +3 -4
- package/dist/test/index.d.ts +3 -3
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +2 -2
- package/dist/{transactionFees-CVi2TrJh.js → transactionFees-C_Qx07mx.js} +1 -2
- package/dist/uniswap/index.d.ts +813 -78
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +5884 -13
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-BxtzpUnV.js → v2-DG7qG6di.js} +4 -5
- package/dist/vault-transaction-fees.d.ts +63 -2
- package/dist/vault-transaction-fees.d.ts.map +1 -0
- package/dist/vault-transaction-fees.js +174 -2
- package/dist/vault-transaction-fees.js.map +1 -0
- package/dist/{writes-D3bj1wth.js → writes-Xp9Wa8GQ.js} +2 -3
- package/package.json +4 -3
- package/dist/cow/types.d.ts +0 -4
- package/dist/cow/types.js +0 -0
- package/dist/cow-DB8siv6M.js.map +0 -1
- package/dist/getTrackedPositionIds-zYPIs5dt.js.map +0 -1
- package/dist/greeks-GysWXct-.js.map +0 -1
- package/dist/hypoVault/vaultDisplayNames.d.ts +0 -2
- package/dist/hypoVault/vaultDisplayNames.js +0 -4
- package/dist/index-BhEBx83X.d.ts +0 -9760
- package/dist/index-BhEBx83X.d.ts.map +0 -1
- package/dist/index-Bo9tHtD7.d.ts +0 -1901
- package/dist/index-Bo9tHtD7.d.ts.map +0 -1
- package/dist/index-CttjEZ-S.d.ts +0 -275
- package/dist/index-CttjEZ-S.d.ts.map +0 -1
- package/dist/index-DktZq9Kb.d.ts +0 -261
- package/dist/index-DktZq9Kb.d.ts.map +0 -1
- package/dist/irm-ChkvYphK.js.map +0 -1
- package/dist/irm-D2WTHtuo.d.ts +0 -5667
- package/dist/irm-D2WTHtuo.d.ts.map +0 -1
- package/dist/irm-D5plRhpB.d.ts +0 -32
- package/dist/irm-D5plRhpB.d.ts.map +0 -1
- package/dist/panoptic/v2/types/index.d.ts +0 -3
- package/dist/panoptic/v2/types/index.js +0 -0
- package/dist/quote-DeHNUR0Z.d.ts +0 -52
- package/dist/quote-DeHNUR0Z.d.ts.map +0 -1
- package/dist/router-BCUJkY8j.js.map +0 -1
- package/dist/router-tCRa0ekE.js.map +0 -1
- package/dist/src-CRAtPwWk.js +0 -321
- package/dist/src-CRAtPwWk.js.map +0 -1
- package/dist/transactionFees-CVi2TrJh.js.map +0 -1
- package/dist/transactionFees-DzDyt50k.d.ts +0 -63
- package/dist/transactionFees-DzDyt50k.d.ts.map +0 -1
- package/dist/types-Cad5m4Td.d.ts +0 -246
- package/dist/types-Cad5m4Td.d.ts.map +0 -1
- package/dist/types-DM0nxlZr.d.ts +0 -128
- package/dist/types-DM0nxlZr.d.ts.map +0 -1
- package/dist/v2-BxtzpUnV.js.map +0 -1
- package/dist/vaultDisplayNames-CKpz51Hu.js +0 -0
- package/dist/vaultDisplayNames-Q6htUcch.d.ts +0 -2
- package/dist/writes-D3bj1wth.js.map +0 -1
package/dist/cow/index.d.ts
CHANGED
|
@@ -1,5 +1,804 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/cow/addresses.d.ts
|
|
4
|
+
/** GPv2Settlement — EIP-712 verifying contract for signed orders. */
|
|
5
|
+
|
|
6
|
+
/** GPv2Settlement — EIP-712 verifying contract for signed orders. */
|
|
7
|
+
declare const COW_SETTLEMENT: Address;
|
|
8
|
+
/** GPv2VaultRelayer — the ERC20 approval target (NOT the settlement contract). */
|
|
9
|
+
declare const COW_VAULT_RELAYER: Address;
|
|
10
|
+
/**
|
|
11
|
+
* Buy-token marker for native ETH. Orders buying this sentinel settle in
|
|
12
|
+
* native ETH (the settlement contract unwraps WETH). Only valid on the buy
|
|
13
|
+
* side — selling native ETH requires the eth-flow contract (unsupported here).
|
|
14
|
+
*/
|
|
15
|
+
declare const COW_NATIVE_ETH: Address;
|
|
16
|
+
/** Order-book API base URL per chain. */
|
|
17
|
+
declare const COW_API_URLS: Partial<Record<number, string>>;
|
|
18
|
+
/** Whether CoW Protocol has an order book for the chain. */
|
|
19
|
+
declare function isCowSupportedChain(chainId: bigint | number): boolean; //#endregion
|
|
20
|
+
//#region src/panoptic/v2/types/meta.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* Block metadata types for the Panoptic v2 SDK.
|
|
23
|
+
* @module v2/types/meta
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Block metadata attached to all RPC responses.
|
|
27
|
+
* Used for freshness checks and reorg detection.
|
|
28
|
+
*/
|
|
29
|
+
interface BlockMeta {
|
|
30
|
+
/** Block number when the data was fetched */
|
|
31
|
+
blockNumber: bigint;
|
|
32
|
+
/** Block timestamp in Unix seconds */
|
|
33
|
+
blockTimestamp: bigint;
|
|
34
|
+
/** Block hash for reorg detection */
|
|
35
|
+
blockHash: `0x${string}`;
|
|
36
|
+
/** Whether the data is considered stale */
|
|
37
|
+
isStale?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/panoptic/v2/types/events.d.ts
|
|
42
|
+
/**
|
|
43
|
+
* Supported Panoptic event types.
|
|
44
|
+
*/
|
|
45
|
+
type PanopticEventType = 'OptionMinted' | 'OptionBurnt' | 'AccountLiquidated' | 'ForcedExercised' | 'PremiumSettled' | 'Deposit' | 'Withdraw' | 'BorrowRateUpdated' | 'LiquidityChunkUpdated' | 'ProtocolLossRealized' | 'ModifyLiquidity' | 'Swap' | 'Donate';
|
|
46
|
+
/**
|
|
47
|
+
* Base event data common to all events.
|
|
48
|
+
*/
|
|
49
|
+
interface BaseEvent {
|
|
50
|
+
/** Event type */
|
|
51
|
+
type: PanopticEventType;
|
|
52
|
+
/** Transaction hash */
|
|
53
|
+
transactionHash: Hash;
|
|
54
|
+
/** Block number */
|
|
55
|
+
blockNumber: bigint;
|
|
56
|
+
/** Block hash */
|
|
57
|
+
blockHash: Hash;
|
|
58
|
+
/** Log index within the block */
|
|
59
|
+
logIndex: bigint;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* OptionMinted event data.
|
|
63
|
+
*/
|
|
64
|
+
interface OptionMintedEvent extends BaseEvent {
|
|
65
|
+
type: 'OptionMinted';
|
|
66
|
+
/** Recipient of the minted position */
|
|
67
|
+
recipient: Address;
|
|
68
|
+
/** TokenId of the minted position */
|
|
69
|
+
tokenId: bigint;
|
|
70
|
+
/** Position size */
|
|
71
|
+
positionSize: bigint;
|
|
72
|
+
/** Pool utilization for token 0 at mint */
|
|
73
|
+
poolUtilization0: bigint;
|
|
74
|
+
/** Pool utilization for token 1 at mint */
|
|
75
|
+
poolUtilization1: bigint;
|
|
76
|
+
/** Tick at mint */
|
|
77
|
+
tickAtMint: bigint;
|
|
78
|
+
/** Timestamp at mint (Unix seconds) */
|
|
79
|
+
timestampAtMint: bigint;
|
|
80
|
+
/** Block number at mint */
|
|
81
|
+
blockAtMint: bigint;
|
|
82
|
+
/** Whether a swap happened at mint */
|
|
83
|
+
swapAtMint: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* OptionBurnt event data.
|
|
87
|
+
*/
|
|
88
|
+
interface OptionBurntEvent extends BaseEvent {
|
|
89
|
+
type: 'OptionBurnt';
|
|
90
|
+
/** Recipient (owner) of the burnt position */
|
|
91
|
+
recipient: Address;
|
|
92
|
+
/** TokenId of the burnt position */
|
|
93
|
+
tokenId: bigint;
|
|
94
|
+
/** Position size that was burnt */
|
|
95
|
+
positionSize: bigint;
|
|
96
|
+
/** Premia settled for each leg (token0 right, token1 left per leg) */
|
|
97
|
+
premiaByLeg: readonly [bigint, bigint, bigint, bigint];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* AccountLiquidated event data.
|
|
101
|
+
*/
|
|
102
|
+
interface AccountLiquidatedEvent extends BaseEvent {
|
|
103
|
+
type: 'AccountLiquidated';
|
|
104
|
+
/** Address of the liquidator */
|
|
105
|
+
liquidator: Address;
|
|
106
|
+
/** Address of the liquidated account */
|
|
107
|
+
liquidatee: Address;
|
|
108
|
+
/** Bonus paid to liquidator for token 0 */
|
|
109
|
+
bonusAmount0: bigint;
|
|
110
|
+
/** Bonus paid to liquidator for token 1 */
|
|
111
|
+
bonusAmount1: bigint;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* ForcedExercised event data.
|
|
115
|
+
*/
|
|
116
|
+
interface ForcedExercisedEvent extends BaseEvent {
|
|
117
|
+
type: 'ForcedExercised';
|
|
118
|
+
/** Address of the exerciser */
|
|
119
|
+
exercisor: Address;
|
|
120
|
+
/** Address of the position owner */
|
|
121
|
+
user: Address;
|
|
122
|
+
/** TokenId of the exercised position */
|
|
123
|
+
tokenId: bigint;
|
|
124
|
+
/** Exercise fee for token 0 (negative = cost to exerciser) */
|
|
125
|
+
exerciseFee0: bigint;
|
|
126
|
+
/** Exercise fee for token 1 (negative = cost to exerciser) */
|
|
127
|
+
exerciseFee1: bigint;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* PremiumSettled event data.
|
|
131
|
+
*/
|
|
132
|
+
interface PremiumSettledEvent extends BaseEvent {
|
|
133
|
+
type: 'PremiumSettled';
|
|
134
|
+
/** Position owner */
|
|
135
|
+
user: Address;
|
|
136
|
+
/** TokenId */
|
|
137
|
+
tokenId: bigint;
|
|
138
|
+
/** Leg index that was settled */
|
|
139
|
+
legIndex: bigint;
|
|
140
|
+
/** Settled amount for token 0 */
|
|
141
|
+
settledAmount0: bigint;
|
|
142
|
+
/** Settled amount for token 1 */
|
|
143
|
+
settledAmount1: bigint;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Deposit event data (ERC4626).
|
|
147
|
+
*/
|
|
148
|
+
interface DepositEvent extends BaseEvent {
|
|
149
|
+
type: 'Deposit';
|
|
150
|
+
/** Sender address */
|
|
151
|
+
sender: Address;
|
|
152
|
+
/** Owner address */
|
|
153
|
+
owner: Address;
|
|
154
|
+
/** Assets deposited */
|
|
155
|
+
assets: bigint;
|
|
156
|
+
/** Shares minted */
|
|
157
|
+
shares: bigint;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Withdraw event data (ERC4626).
|
|
161
|
+
*/
|
|
162
|
+
interface WithdrawEvent extends BaseEvent {
|
|
163
|
+
type: 'Withdraw';
|
|
164
|
+
/** Sender address */
|
|
165
|
+
sender: Address;
|
|
166
|
+
/** Receiver address */
|
|
167
|
+
receiver: Address;
|
|
168
|
+
/** Owner address */
|
|
169
|
+
owner: Address;
|
|
170
|
+
/** Assets withdrawn */
|
|
171
|
+
assets: bigint;
|
|
172
|
+
/** Shares burned */
|
|
173
|
+
shares: bigint;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* BorrowRateUpdated event data (RiskEngine).
|
|
177
|
+
*/
|
|
178
|
+
interface BorrowRateUpdatedEvent extends BaseEvent {
|
|
179
|
+
type: 'BorrowRateUpdated';
|
|
180
|
+
/** Collateral token address */
|
|
181
|
+
collateralToken: Address;
|
|
182
|
+
/** Average borrow rate */
|
|
183
|
+
avgBorrowRate: bigint;
|
|
184
|
+
/** Rate at target utilization */
|
|
185
|
+
rateAtTarget: bigint;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* LiquidityChunkUpdated event data (SFPM).
|
|
189
|
+
*/
|
|
190
|
+
interface LiquidityChunkUpdatedEvent extends BaseEvent {
|
|
191
|
+
type: 'LiquidityChunkUpdated';
|
|
192
|
+
/** Pool ID (bytes32) */
|
|
193
|
+
poolId: Hash;
|
|
194
|
+
/** Owner address */
|
|
195
|
+
owner: Address;
|
|
196
|
+
/** Token type (0 or 1) */
|
|
197
|
+
tokenType: bigint;
|
|
198
|
+
/** Lower tick */
|
|
199
|
+
tickLower: number;
|
|
200
|
+
/** Upper tick */
|
|
201
|
+
tickUpper: number;
|
|
202
|
+
/** Liquidity delta (positive = added, negative = removed) */
|
|
203
|
+
liquidityDelta: bigint;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* ProtocolLossRealized event data (CollateralTracker).
|
|
207
|
+
*/
|
|
208
|
+
interface ProtocolLossRealizedEvent extends BaseEvent {
|
|
209
|
+
type: 'ProtocolLossRealized';
|
|
210
|
+
/** Liquidated account */
|
|
211
|
+
liquidatee: Address;
|
|
212
|
+
/** Liquidator address */
|
|
213
|
+
liquidator: Address;
|
|
214
|
+
/** Protocol loss in assets */
|
|
215
|
+
protocolLossAssets: bigint;
|
|
216
|
+
/** Protocol loss in shares */
|
|
217
|
+
protocolLossShares: bigint;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* ModifyLiquidity event data (v4 PoolManager).
|
|
221
|
+
*/
|
|
222
|
+
interface ModifyLiquidityEvent extends BaseEvent {
|
|
223
|
+
type: 'ModifyLiquidity';
|
|
224
|
+
/** Pool ID (bytes32) */
|
|
225
|
+
id: Hash;
|
|
226
|
+
/** Sender address */
|
|
227
|
+
sender: Address;
|
|
228
|
+
/** Lower tick */
|
|
229
|
+
tickLower: number;
|
|
230
|
+
/** Upper tick */
|
|
231
|
+
tickUpper: number;
|
|
232
|
+
/** Liquidity delta */
|
|
233
|
+
liquidityDelta: bigint;
|
|
234
|
+
/** Salt */
|
|
235
|
+
salt: Hash;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Swap event data (v4 PoolManager).
|
|
239
|
+
*/
|
|
240
|
+
interface SwapEvent extends BaseEvent {
|
|
241
|
+
type: 'Swap';
|
|
242
|
+
/** Pool ID (bytes32) */
|
|
243
|
+
id: Hash;
|
|
244
|
+
/** Sender address */
|
|
245
|
+
sender: Address;
|
|
246
|
+
/** Amount of token 0 */
|
|
247
|
+
amount0: bigint;
|
|
248
|
+
/** Amount of token 1 */
|
|
249
|
+
amount1: bigint;
|
|
250
|
+
/** Square root price X96 */
|
|
251
|
+
sqrtPriceX96: bigint;
|
|
252
|
+
/** Liquidity */
|
|
253
|
+
liquidity: bigint;
|
|
254
|
+
/** Tick */
|
|
255
|
+
tick: number;
|
|
256
|
+
/** Fee */
|
|
257
|
+
fee: number;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Donate event data (v4 PoolManager).
|
|
261
|
+
*/
|
|
262
|
+
interface DonateEvent extends BaseEvent {
|
|
263
|
+
type: 'Donate';
|
|
264
|
+
/** Pool ID (bytes32) */
|
|
265
|
+
id: Hash;
|
|
266
|
+
/** Sender address */
|
|
267
|
+
sender: Address;
|
|
268
|
+
/** Amount of token 0 */
|
|
269
|
+
amount0: bigint;
|
|
270
|
+
/** Amount of token 1 */
|
|
271
|
+
amount1: bigint;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Union of all Panoptic event types.
|
|
275
|
+
*/
|
|
276
|
+
type PanopticEvent = OptionMintedEvent | OptionBurntEvent | AccountLiquidatedEvent | ForcedExercisedEvent | PremiumSettledEvent | DepositEvent | WithdrawEvent | BorrowRateUpdatedEvent | LiquidityChunkUpdatedEvent | ProtocolLossRealizedEvent | ModifyLiquidityEvent | SwapEvent | DonateEvent; //#endregion
|
|
277
|
+
//#region src/panoptic/v2/types/tx.d.ts
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Leg update data from events.
|
|
281
|
+
*/
|
|
282
|
+
/**
|
|
283
|
+
* Transaction result returned by write functions.
|
|
284
|
+
* Provides immediate access to hash and a wait function for confirmation.
|
|
285
|
+
*/
|
|
286
|
+
interface TxResult {
|
|
287
|
+
/** Transaction hash, available immediately */
|
|
288
|
+
hash: Hash;
|
|
289
|
+
/** Wait for transaction confirmation */
|
|
290
|
+
wait: (confirmations?: bigint) => Promise<TxReceipt>;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Transaction result with receipt already awaited.
|
|
294
|
+
* Returned by *AndWait convenience functions.
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Transaction receipt after confirmation.
|
|
299
|
+
*/
|
|
300
|
+
interface TxReceipt {
|
|
301
|
+
/** Transaction hash */
|
|
302
|
+
hash: Hash;
|
|
303
|
+
/** Block number */
|
|
304
|
+
blockNumber: bigint;
|
|
305
|
+
/** Block hash */
|
|
306
|
+
blockHash: Hash;
|
|
307
|
+
/** Gas used */
|
|
308
|
+
gasUsed: bigint;
|
|
309
|
+
/** Transaction status */
|
|
310
|
+
status: 'success' | 'reverted';
|
|
311
|
+
/** Parsed Panoptic events from the transaction */
|
|
312
|
+
events: PanopticEvent[];
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Transaction broadcaster interface for private transaction support.
|
|
316
|
+
* Allows plugging in Flashbots or other MEV protection services.
|
|
317
|
+
*/
|
|
318
|
+
interface TxBroadcaster {
|
|
319
|
+
/**
|
|
320
|
+
* Broadcast a signed transaction.
|
|
321
|
+
* @param signedTx - The signed transaction bytes
|
|
322
|
+
* @returns The transaction hash
|
|
323
|
+
*/
|
|
324
|
+
broadcast: (signedTx: `0x${string}`) => Promise<Hash>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Gas and transaction overrides for write operations.
|
|
328
|
+
* Supports EIP-1559 gas parameters, explicit nonce, and custom broadcasters.
|
|
329
|
+
*/
|
|
330
|
+
interface TxOverrides {
|
|
331
|
+
/** EIP-1559 max fee per gas */
|
|
332
|
+
maxFeePerGas?: bigint;
|
|
333
|
+
/** EIP-1559 max priority fee per gas (tip) */
|
|
334
|
+
maxPriorityFeePerGas?: bigint;
|
|
335
|
+
/** Gas limit override */
|
|
336
|
+
gas?: bigint;
|
|
337
|
+
/** Explicit nonce (for concurrent tx submission) */
|
|
338
|
+
nonce?: bigint;
|
|
339
|
+
/** Custom broadcaster for MEV protection (Flashbots, private mempool) */
|
|
340
|
+
broadcaster?: TxBroadcaster;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/panoptic/v2/errors/base.d.ts
|
|
345
|
+
/**
|
|
346
|
+
* Nonce manager for concurrent transaction submission.
|
|
347
|
+
*/
|
|
348
|
+
/**
|
|
349
|
+
* Base error class for the Panoptic v2 SDK.
|
|
350
|
+
* @module v2/errors/base
|
|
351
|
+
*/
|
|
352
|
+
/**
|
|
353
|
+
* Base error class for all Panoptic SDK errors.
|
|
354
|
+
* All errors thrown by the SDK extend this class.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```typescript
|
|
358
|
+
* try {
|
|
359
|
+
* await openPosition(config, params)
|
|
360
|
+
* } catch (error) {
|
|
361
|
+
* if (error instanceof PanopticError) {
|
|
362
|
+
* console.log('Panoptic error:', error.name, error.message)
|
|
363
|
+
* console.log('Original cause:', error.cause)
|
|
364
|
+
* }
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
declare class PanopticError extends Error {
|
|
369
|
+
readonly cause?: Error | undefined;
|
|
370
|
+
readonly name: string;
|
|
371
|
+
/** The Solidity error name (e.g. 'PriceBoundFail', 'InputListFail'). Set by the parser. */
|
|
372
|
+
errorName?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Creates a new PanopticError.
|
|
375
|
+
*
|
|
376
|
+
* @param message - Human-readable error message
|
|
377
|
+
* @param cause - Optional underlying error that caused this error
|
|
378
|
+
*/
|
|
379
|
+
constructor(message: string, cause?: Error | undefined);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/panoptic/v2/types/simulation.d.ts
|
|
384
|
+
/**
|
|
385
|
+
* Token flow data from simulation.
|
|
386
|
+
* Measures collateral asset changes via getAssetsOf-dispatch-getAssetsOf pattern
|
|
387
|
+
* using PanopticPool.multicall.
|
|
388
|
+
*/
|
|
389
|
+
interface TokenFlow {
|
|
390
|
+
/** Token 0 collateral change (negative = user deposits, positive = user receives) */
|
|
391
|
+
delta0: bigint;
|
|
392
|
+
/** Token 1 collateral change (negative = user deposits, positive = user receives) */
|
|
393
|
+
delta1: bigint;
|
|
394
|
+
/** Collateral assets in token 0 before the call */
|
|
395
|
+
balanceBefore0: bigint;
|
|
396
|
+
/** Collateral assets in token 1 before the call */
|
|
397
|
+
balanceBefore1: bigint;
|
|
398
|
+
/** Collateral assets in token 0 after the call */
|
|
399
|
+
balanceAfter0: bigint;
|
|
400
|
+
/** Collateral assets in token 1 after the call */
|
|
401
|
+
balanceAfter1: bigint;
|
|
402
|
+
/** Pool tick before the operation */
|
|
403
|
+
tickBefore: bigint | null;
|
|
404
|
+
/** Pool tick after the operation */
|
|
405
|
+
tickAfter: bigint | null;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Simulation result discriminated union.
|
|
409
|
+
* Success case returns data, failure case returns error.
|
|
410
|
+
*
|
|
411
|
+
* Note: tokenFlow is optional because some simulations (deposit/withdraw)
|
|
412
|
+
* don't use the PanopticPool.multicall token flow measurement.
|
|
413
|
+
*/
|
|
414
|
+
type SimulationResult<T> = {
|
|
415
|
+
success: true;
|
|
416
|
+
data: T;
|
|
417
|
+
gasEstimate: bigint;
|
|
418
|
+
tokenFlow?: TokenFlow;
|
|
419
|
+
_meta: BlockMeta;
|
|
420
|
+
} | {
|
|
421
|
+
success: false;
|
|
422
|
+
error: PanopticError;
|
|
423
|
+
_meta: BlockMeta;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/cow/types.d.ts
|
|
428
|
+
/**
|
|
429
|
+
* Open position simulation result data.
|
|
430
|
+
*/
|
|
431
|
+
/** Order kind: 'sell' = exact-in, 'buy' = exact-out. */
|
|
432
|
+
type CowOrderKind = 'sell' | 'buy';
|
|
433
|
+
/** Order-book lifecycle states. */
|
|
434
|
+
type CowOrderStatus = 'presignaturePending' | 'open' | 'fulfilled' | 'cancelled' | 'expired';
|
|
435
|
+
/** Parameters for {@link quoteCowSwap}. */
|
|
436
|
+
interface QuoteCowSwapParams {
|
|
437
|
+
/** Chain ID (selects the order-book API). */
|
|
438
|
+
chainId: bigint;
|
|
439
|
+
/** ERC20 token to sell (native ETH not supported). */
|
|
440
|
+
sellToken: Address;
|
|
441
|
+
/** Token to buy. The zero address (native ETH) maps to the CoW buy sentinel. */
|
|
442
|
+
buyToken: Address;
|
|
443
|
+
/** 'sell' = exact-in (amount is sellAmountBeforeFee), 'buy' = exact-out (amount is buyAmountAfterFee). */
|
|
444
|
+
kind: CowOrderKind;
|
|
445
|
+
/** Exact amount being quoted (see `kind`). */
|
|
446
|
+
amount: bigint;
|
|
447
|
+
/** Order owner — the API validates balances/fees against this account. */
|
|
448
|
+
from: Address;
|
|
449
|
+
/** Slippage tolerance in bps applied to the signed limit amounts. */
|
|
450
|
+
slippageBps: bigint;
|
|
451
|
+
/** Order validity window in seconds (drives `validTo`). Defaults to 30 minutes. */
|
|
452
|
+
validForSeconds?: bigint;
|
|
453
|
+
/** Override the order-book API base URL (e.g. tests). */
|
|
454
|
+
apiUrl?: string;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Quote result data (carried inside a `SimulationResult`).
|
|
458
|
+
*
|
|
459
|
+
* `orderSellAmount`/`orderBuyAmount` are the limit amounts to sign: fee folded
|
|
460
|
+
* into the sell side (`feeAmount` is signed as 0 per the current fee model)
|
|
461
|
+
* and slippage applied to the non-exact side.
|
|
462
|
+
*/
|
|
463
|
+
interface CowQuote {
|
|
464
|
+
kind: CowOrderKind;
|
|
465
|
+
sellToken: Address;
|
|
466
|
+
buyToken: Address;
|
|
467
|
+
/** Quoted sell amount, excluding fee. */
|
|
468
|
+
sellAmount: bigint;
|
|
469
|
+
/** Quoted buy amount (net). */
|
|
470
|
+
buyAmount: bigint;
|
|
471
|
+
/** Quoted protocol fee, in the sell token. */
|
|
472
|
+
feeAmount: bigint;
|
|
473
|
+
/** Total sell-token outflow at the quoted price (sellAmount + feeAmount). */
|
|
474
|
+
sellAmountTotal: bigint;
|
|
475
|
+
/** Sell amount to sign (sell orders: gross; buy orders: slippage-padded max). */
|
|
476
|
+
orderSellAmount: bigint;
|
|
477
|
+
/** Buy amount to sign (sell orders: slippage-reduced min; buy orders: exact). */
|
|
478
|
+
orderBuyAmount: bigint;
|
|
479
|
+
/** Order expiry (unix seconds, uint32). */
|
|
480
|
+
validTo: bigint;
|
|
481
|
+
/** Order-book quote id, echoed on order submission for tracing. */
|
|
482
|
+
quoteId: number | null;
|
|
483
|
+
}
|
|
484
|
+
/** Parameters for {@link signAndSubmitCowOrder}. */
|
|
485
|
+
interface SignAndSubmitCowOrderParams {
|
|
486
|
+
walletClient: WalletClient;
|
|
487
|
+
/** Order owner (signer). */
|
|
488
|
+
account: Address;
|
|
489
|
+
chainId: bigint;
|
|
490
|
+
/** Quote to turn into a signed order. */
|
|
491
|
+
quote: CowQuote;
|
|
492
|
+
/** Recipient of the buy token. Defaults to `account`. */
|
|
493
|
+
receiver?: Address;
|
|
494
|
+
/** Override the order-book API base URL (e.g. tests). */
|
|
495
|
+
apiUrl?: string;
|
|
496
|
+
}
|
|
497
|
+
/** Result of posting an order: the order-book UID (not a tx hash). */
|
|
498
|
+
interface CowOrderResult {
|
|
499
|
+
orderUid: Hex;
|
|
500
|
+
}
|
|
501
|
+
/** Parameters for {@link cancelCowOrder}. */
|
|
502
|
+
interface CancelCowOrderParams {
|
|
503
|
+
walletClient: WalletClient;
|
|
504
|
+
account: Address;
|
|
505
|
+
chainId: bigint;
|
|
506
|
+
orderUid: Hex;
|
|
507
|
+
apiUrl?: string;
|
|
508
|
+
}
|
|
509
|
+
/** Parameters for {@link getCowOrderStatus}. */
|
|
510
|
+
interface GetCowOrderStatusParams {
|
|
511
|
+
chainId: bigint;
|
|
512
|
+
orderUid: Hex;
|
|
513
|
+
apiUrl?: string;
|
|
514
|
+
}
|
|
515
|
+
/** Result of {@link getCowOrderStatus}. */
|
|
516
|
+
interface CowOrderState {
|
|
517
|
+
status: CowOrderStatus;
|
|
518
|
+
/** Cumulative executed amounts (partial fills included). */
|
|
519
|
+
executedSellAmount: bigint;
|
|
520
|
+
executedBuyAmount: bigint;
|
|
521
|
+
/** Settlement tx hash, available once at least one trade has executed. */
|
|
522
|
+
settlementTxHash?: Hex;
|
|
523
|
+
}
|
|
524
|
+
/** Parameters for {@link checkCowApproval}. */
|
|
525
|
+
interface CheckCowApprovalParams {
|
|
526
|
+
client: PublicClient;
|
|
527
|
+
/** ERC20 token being sold. */
|
|
528
|
+
sellToken: Address;
|
|
529
|
+
/** Token owner. */
|
|
530
|
+
owner: Address;
|
|
531
|
+
/** Amount that must be spendable by the vault relayer. */
|
|
532
|
+
amount: bigint;
|
|
533
|
+
}
|
|
534
|
+
/** Result of {@link checkCowApproval}. */
|
|
535
|
+
interface CowApprovalStatus {
|
|
536
|
+
needsApproval: boolean;
|
|
537
|
+
/** Current ERC20 → VaultRelayer allowance. */
|
|
538
|
+
allowance: bigint;
|
|
539
|
+
}
|
|
540
|
+
/** Parameters for {@link approveErc20ForCow}. */
|
|
541
|
+
interface ApproveErc20ForCowParams {
|
|
542
|
+
client: PublicClient;
|
|
543
|
+
walletClient: WalletClient;
|
|
544
|
+
account: Address;
|
|
545
|
+
/** ERC20 token to approve to the vault relayer. */
|
|
546
|
+
sellToken: Address;
|
|
547
|
+
/** Amount to approve. Defaults to uint256 max. */
|
|
548
|
+
amount?: bigint;
|
|
549
|
+
txOverrides?: TxOverrides;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/cow/approval.d.ts
|
|
554
|
+
/** Check whether the vault relayer can pull `amount` of the sell token. */
|
|
555
|
+
declare function checkCowApproval(params: CheckCowApprovalParams): Promise<CowApprovalStatus>;
|
|
556
|
+
/** Approve the sell token to the vault relayer (defaults to unlimited). */
|
|
557
|
+
declare function approveErc20ForCow(params: ApproveErc20ForCowParams): Promise<TxResult>;
|
|
558
|
+
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/cow/compare.d.ts
|
|
561
|
+
/**
|
|
562
|
+
* Venue selection between the Uniswap v4 router and CoW Swap.
|
|
563
|
+
*
|
|
564
|
+
* Pure amount comparison so it stays testable and reusable outside React.
|
|
565
|
+
* Gas cost of the router tx is not factored in (CoW ERC20 sells are gasless);
|
|
566
|
+
* TODO: optionally discount the Uniswap side by gasEstimate × gas price.
|
|
567
|
+
*
|
|
568
|
+
* @module cow/compare
|
|
569
|
+
*/
|
|
570
|
+
/** Swap venues the UI can route through. */
|
|
571
|
+
type SwapVenue = 'uniswap' | 'cow';
|
|
572
|
+
/** Parameters for {@link pickBestVenue}. */
|
|
573
|
+
interface PickBestVenueParams {
|
|
574
|
+
/** 'sell' = exact-in (maximize output), 'buy' = exact-out (minimize input). */
|
|
575
|
+
kind: 'sell' | 'buy';
|
|
576
|
+
/** Uniswap quote amounts; omit when the quote failed or is unavailable. */
|
|
577
|
+
uniswap?: {
|
|
578
|
+
/** Quoted output (exact-in). */
|
|
579
|
+
amountOut?: bigint;
|
|
580
|
+
/** Quoted input (exact-out). */
|
|
581
|
+
amountIn?: bigint;
|
|
582
|
+
};
|
|
583
|
+
/** CoW quote amounts; omit when the quote failed or is unavailable. */
|
|
584
|
+
cow?: {
|
|
585
|
+
/** Quoted net output (exact-in). */
|
|
586
|
+
buyAmount?: bigint;
|
|
587
|
+
/** Quoted gross input including fee (exact-out). */
|
|
588
|
+
sellAmountTotal?: bigint;
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
/** Result of {@link pickBestVenue}. */
|
|
592
|
+
interface BestVenue {
|
|
593
|
+
winner: SwapVenue;
|
|
594
|
+
/** Price advantage of the winner over the loser in bps (only when both quoted). */
|
|
595
|
+
advantageBps?: bigint;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Pick the venue with the better effective price. Exact-in compares net
|
|
599
|
+
* output (higher wins); exact-out compares gross input (lower wins). With a
|
|
600
|
+
* single usable quote that venue wins; ties go to Uniswap (instant
|
|
601
|
+
* settlement); with no usable quotes Uniswap wins by default.
|
|
602
|
+
*/
|
|
603
|
+
declare function pickBestVenue(params: PickBestVenueParams): BestVenue;
|
|
604
|
+
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/cow/eip712.d.ts
|
|
607
|
+
/** GPv2 `Order` struct, in EIP-712 typed-data form. */
|
|
608
|
+
declare const COW_ORDER_TYPES: {
|
|
609
|
+
readonly Order: readonly [{
|
|
610
|
+
readonly name: "sellToken";
|
|
611
|
+
readonly type: "address";
|
|
612
|
+
}, {
|
|
613
|
+
readonly name: "buyToken";
|
|
614
|
+
readonly type: "address";
|
|
615
|
+
}, {
|
|
616
|
+
readonly name: "receiver";
|
|
617
|
+
readonly type: "address";
|
|
618
|
+
}, {
|
|
619
|
+
readonly name: "sellAmount";
|
|
620
|
+
readonly type: "uint256";
|
|
621
|
+
}, {
|
|
622
|
+
readonly name: "buyAmount";
|
|
623
|
+
readonly type: "uint256";
|
|
624
|
+
}, {
|
|
625
|
+
readonly name: "validTo";
|
|
626
|
+
readonly type: "uint32";
|
|
627
|
+
}, {
|
|
628
|
+
readonly name: "appData";
|
|
629
|
+
readonly type: "bytes32";
|
|
630
|
+
}, {
|
|
631
|
+
readonly name: "feeAmount";
|
|
632
|
+
readonly type: "uint256";
|
|
633
|
+
}, {
|
|
634
|
+
readonly name: "kind";
|
|
635
|
+
readonly type: "string";
|
|
636
|
+
}, {
|
|
637
|
+
readonly name: "partiallyFillable";
|
|
638
|
+
readonly type: "bool";
|
|
639
|
+
}, {
|
|
640
|
+
readonly name: "sellTokenBalance";
|
|
641
|
+
readonly type: "string";
|
|
642
|
+
}, {
|
|
643
|
+
readonly name: "buyTokenBalance";
|
|
644
|
+
readonly type: "string";
|
|
645
|
+
}];
|
|
646
|
+
};
|
|
647
|
+
/** GPv2 order-cancellation struct (batch of order UIDs). */
|
|
648
|
+
declare const COW_CANCELLATION_TYPES: {
|
|
649
|
+
readonly OrderCancellations: readonly [{
|
|
650
|
+
readonly name: "orderUids";
|
|
651
|
+
readonly type: "bytes[]";
|
|
652
|
+
}];
|
|
653
|
+
};
|
|
654
|
+
/** EIP-712 domain for GPv2Settlement on the given chain. */
|
|
655
|
+
declare function cowDomain(chainId: bigint | number): {
|
|
656
|
+
name: string;
|
|
657
|
+
version: string;
|
|
658
|
+
chainId: number;
|
|
659
|
+
verifyingContract: Address;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Full appData JSON document attached to orders. The order itself carries only
|
|
663
|
+
* its keccak256 hash; the API stores the document when it accompanies the
|
|
664
|
+
* order POST. Must stay byte-identical to {@link APP_DATA_HASH}.
|
|
665
|
+
*/
|
|
666
|
+
declare const APP_DATA_DOC = "{\"appCode\":\"panoptic\",\"metadata\":{},\"version\":\"1.3.0\"}";
|
|
667
|
+
/** keccak256 of {@link APP_DATA_DOC} — the `appData` field signed in the order. */
|
|
668
|
+
declare const APP_DATA_HASH: `0x${string}`;
|
|
669
|
+
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region src/cow/errors.d.ts
|
|
672
|
+
/** The chain has no CoW order book. */
|
|
673
|
+
declare class CowUnsupportedChainError extends PanopticError {
|
|
674
|
+
readonly chainId: bigint;
|
|
675
|
+
readonly name = "CowUnsupportedChainError";
|
|
676
|
+
constructor(chainId: bigint, cause?: Error);
|
|
677
|
+
}
|
|
678
|
+
/** The order-book API rejected a request (non-2xx response). */
|
|
679
|
+
declare class CowApiError extends PanopticError {
|
|
680
|
+
/** Machine-readable API error type, e.g. 'SellAmountDoesNotCoverFee'. */
|
|
681
|
+
readonly errorType: string;
|
|
682
|
+
readonly status: number;
|
|
683
|
+
readonly name: string;
|
|
684
|
+
constructor(/** Machine-readable API error type, e.g. 'SellAmountDoesNotCoverFee'. */
|
|
685
|
+
errorType: string, message: string, status: number, cause?: Error);
|
|
686
|
+
}
|
|
687
|
+
/** The sell amount is too small to cover the protocol fee (dust order). */
|
|
688
|
+
declare class CowOrderTooSmallError extends CowApiError {
|
|
689
|
+
readonly name = "CowOrderTooSmallError";
|
|
690
|
+
constructor(message: string, status: number, cause?: Error);
|
|
691
|
+
}
|
|
692
|
+
/** Selling native ETH requires the eth-flow contract (unsupported here); buying it is fine. */
|
|
693
|
+
declare class CowNativeTokenError extends PanopticError {
|
|
694
|
+
readonly name = "CowNativeTokenError";
|
|
695
|
+
constructor(cause?: Error);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/cow/order.d.ts
|
|
700
|
+
/**
|
|
701
|
+
* Build the final order from a quote, sign it (EIP-712) and POST it to the
|
|
702
|
+
* order book. The signed `feeAmount` is 0 — the fee is already folded into the
|
|
703
|
+
* quote's `orderSellAmount`.
|
|
704
|
+
*/
|
|
705
|
+
declare function signAndSubmitCowOrder(params: SignAndSubmitCowOrderParams): Promise<CowOrderResult>;
|
|
706
|
+
/**
|
|
707
|
+
* Cancel an open order off-chain (free, signed cancellation). Cancellation is
|
|
708
|
+
* best-effort: an order already committed to a solver batch can still settle.
|
|
709
|
+
*/
|
|
710
|
+
declare function cancelCowOrder(params: CancelCowOrderParams): Promise<void>;
|
|
711
|
+
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region src/cow/quote.d.ts
|
|
714
|
+
/** Default order validity window (30 minutes). */
|
|
715
|
+
declare const DEFAULT_VALID_FOR_SECONDS = 1800n;
|
|
716
|
+
/**
|
|
717
|
+
* Quote a swap via the CoW order book.
|
|
718
|
+
*
|
|
719
|
+
* For `kind: 'sell'` (exact-in) `amount` is the sell amount before fee; for
|
|
720
|
+
* `kind: 'buy'` (exact-out) it is the exact buy amount. The returned
|
|
721
|
+
* `orderSellAmount`/`orderBuyAmount` are ready to sign: the fee is folded into
|
|
722
|
+
* the sell side (orders are placed with `feeAmount: 0` under the current fee
|
|
723
|
+
* model) and `slippageBps` is applied to the non-exact side.
|
|
724
|
+
*/
|
|
725
|
+
declare function quoteCowSwap(params: QuoteCowSwapParams): Promise<SimulationResult<CowQuote>>;
|
|
726
|
+
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/cow/status.d.ts
|
|
729
|
+
/**
|
|
730
|
+
* Fetch an order's lifecycle state. Once any trade has executed, the
|
|
731
|
+
* settlement tx hash is included (fetched from the trades endpoint).
|
|
732
|
+
*/
|
|
733
|
+
declare function getCowOrderStatus(params: GetCowOrderStatusParams): Promise<CowOrderState>;
|
|
734
|
+
|
|
735
|
+
//#endregion
|
|
736
|
+
//#region src/cow/tokens.d.ts
|
|
737
|
+
/** Resolved token-list entry. */
|
|
738
|
+
interface CowTokenInfo {
|
|
739
|
+
chainId: number;
|
|
740
|
+
address: Address;
|
|
741
|
+
symbol: string;
|
|
742
|
+
name: string;
|
|
743
|
+
decimals: number;
|
|
744
|
+
logoURI?: string;
|
|
745
|
+
}
|
|
746
|
+
/** Parameters for {@link findCowToken}. */
|
|
747
|
+
interface FindCowTokenParams {
|
|
748
|
+
/** Chain to resolve on. */
|
|
749
|
+
chainId: bigint;
|
|
750
|
+
/** Token symbol, case-insensitive (e.g. 'nvdax'). */
|
|
751
|
+
symbol: string;
|
|
752
|
+
/** Override the token-list URLs (e.g. tests). */
|
|
753
|
+
listUrls?: string[];
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Find a token by symbol on the given chain across CoW's token lists. The
|
|
757
|
+
* first list containing a (case-insensitive) symbol match wins; within a
|
|
758
|
+
* list the first match wins, which favors canonical entries on collisions.
|
|
759
|
+
* Returns null when no list resolves the symbol (or all fetches fail).
|
|
760
|
+
*
|
|
761
|
+
* Resolution only proves the token is listed — whether solvers can actually
|
|
762
|
+
* fill a given pair/size is answered by `quoteCowSwap`.
|
|
763
|
+
*/
|
|
764
|
+
declare function findCowToken(params: FindCowTokenParams): Promise<CowTokenInfo | null>;
|
|
765
|
+
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/cow/xstockWrappers.generated.d.ts
|
|
768
|
+
declare const XSTOCK_WRAPPERS: XstockWrapperRegistry;
|
|
769
|
+
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region src/cow/xstockWrappers.d.ts
|
|
772
|
+
/** A single xStock → wrapper mapping entry. */
|
|
773
|
+
interface XstockWrapperInfo {
|
|
774
|
+
/** ERC4626 wrapper (the token Panoptic/Uniswap pools trade). */
|
|
775
|
+
wrapper: Address;
|
|
776
|
+
/** Underlying rebasing xStock (`asset()` of the wrapper; the CoW-traded token). */
|
|
777
|
+
underlying: Address;
|
|
778
|
+
/** Wrapper symbol, e.g. `wNVDAx`. */
|
|
779
|
+
symbol: string;
|
|
780
|
+
/** Wrapper name, e.g. `Wrapped NVIDIA xStock`. */
|
|
781
|
+
name: string;
|
|
782
|
+
/** Wrapper (and underlying) ERC20 decimals. */
|
|
783
|
+
decimals: number;
|
|
784
|
+
}
|
|
785
|
+
/** Generated registry keyed by chainId. */
|
|
786
|
+
type XstockWrapperRegistry = Partial<Record<number, XstockWrapperInfo[]>>;
|
|
787
|
+
/**
|
|
788
|
+
* Resolve the wrapper for an unwrapped xStock. Returns `undefined` when the
|
|
789
|
+
* address isn't a known xStock underlying on this chain.
|
|
790
|
+
*/
|
|
791
|
+
declare function getXstockWrapper(chainId: number, underlying: Address): XstockWrapperInfo | undefined;
|
|
792
|
+
/**
|
|
793
|
+
* Resolve the underlying xStock for a wrapper address. Returns `undefined` when
|
|
794
|
+
* the address isn't a known xStock wrapper on this chain.
|
|
795
|
+
*/
|
|
796
|
+
declare function getXstockUnderlying(chainId: number, wrapper: Address): XstockWrapperInfo | undefined;
|
|
797
|
+
/** True if `address` is a known unwrapped xStock on this chain. */
|
|
798
|
+
declare function isXstockUnderlying(chainId: number, address: Address): boolean;
|
|
799
|
+
/** True if `address` is a known xStock wrapper on this chain. */
|
|
800
|
+
declare function isXstockWrapper(chainId: number, address: Address): boolean;
|
|
801
|
+
|
|
802
|
+
//#endregion
|
|
803
|
+
export { APP_DATA_DOC, APP_DATA_HASH, ApproveErc20ForCowParams, BestVenue, COW_API_URLS, COW_CANCELLATION_TYPES, COW_NATIVE_ETH, COW_ORDER_TYPES, COW_SETTLEMENT, COW_VAULT_RELAYER, CancelCowOrderParams, CheckCowApprovalParams, CowApiError, CowApprovalStatus, CowNativeTokenError, CowOrderKind, CowOrderResult, CowOrderState, CowOrderStatus, CowOrderTooSmallError, CowQuote, CowTokenInfo, CowUnsupportedChainError, DEFAULT_VALID_FOR_SECONDS, FindCowTokenParams, GetCowOrderStatusParams, PickBestVenueParams, QuoteCowSwapParams, SignAndSubmitCowOrderParams, SwapVenue, XSTOCK_WRAPPERS, XstockWrapperInfo, XstockWrapperRegistry, approveErc20ForCow, cancelCowOrder, checkCowApproval, cowDomain, findCowToken, getCowOrderStatus, getXstockUnderlying, getXstockWrapper, isCowSupportedChain, isXstockUnderlying, isXstockWrapper, pickBestVenue, quoteCowSwap, signAndSubmitCowOrder };
|
|
804
|
+
//# sourceMappingURL=index.d.ts.map
|