@panoptic-eng/sdk 1.0.63 → 1.0.65
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/README.md +1 -1
- package/dist/StateView-q4yMpBY6.js +323 -0
- package/dist/cow/index.d.ts +1 -1
- package/dist/cow/index.js +1 -1
- package/dist/cow/index.js.map +1 -1
- package/dist/{cow-BsSaoahK.js → cow-BU9YOHkh.js} +1 -1
- package/dist/index.d.ts +34 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/{irm-BDlcUNgJ.js → irm-DGyKOQXz.js} +4 -326
- package/dist/panoptic/v2/index.d.ts +161 -137
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +61 -51
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +168 -144
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +64 -54
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{rates-BwZnK0tG.js → rates-Y0Pbv1_x.js} +4 -4
- package/dist/{router-pm9PDlyH.js → router-CheXbrfz.js} +2 -2
- package/dist/{router-Dejb6MWu.js → router-DxE-iwYF.js} +304 -6
- package/dist/{transactionFees-aXQlx-lq.js → transactionFees-BF033Mob.js} +1 -1
- package/dist/uniswap/index.d.ts +194 -4
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +1316 -789
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-ccGPXWvq.js → v2-QFSAShVj.js} +29 -316
- package/dist/{writes--fM_8ggw.js → writes-BA21eyGF.js} +38 -38
- package/dist/zodiac/index.d.ts +3 -3
- package/dist/zodiac/index.js +3 -3
- package/dist/zodiac/index.js.map +1 -1
- package/package.json +1 -1
- /package/dist/{chainDeployments-BhXMBZ4B.js → chainDeployments-Do4NaZA_.js} +0 -0
- /package/dist/{greeks-CNi1-cnp.js → greeks-CGtgLUyh.js} +0 -0
- /package/dist/{providers-1WdiaRbY.js → providers-DubVMHWU.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ORACLE_EPOCH_SECONDS, SCHEMA_VERSION, STORAGE_PREFIX, calculatePositionGreeks, tickToSqrtPriceX96 } from "./greeks-
|
|
1
|
+
import { ORACLE_EPOCH_SECONDS, SCHEMA_VERSION, STORAGE_PREFIX, calculatePositionGreeks, tickToSqrtPriceX96 } from "./greeks-CGtgLUyh.js";
|
|
2
2
|
import { BaseError, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, encodeFunctionData, getAddress, keccak256, parseAbi, toFunctionSelector, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/generated.ts
|
|
@@ -7945,7 +7945,7 @@ var NoLegsExercisableError = class extends PanopticError {
|
|
|
7945
7945
|
var NotALongLegError = class extends PanopticError {
|
|
7946
7946
|
name = "NotALongLegError";
|
|
7947
7947
|
constructor(cause) {
|
|
7948
|
-
super("Cannot settle
|
|
7948
|
+
super("Cannot settle streamia for non-long leg", cause);
|
|
7949
7949
|
}
|
|
7950
7950
|
};
|
|
7951
7951
|
/**
|
|
@@ -8414,7 +8414,7 @@ var UnsafePremiumSettlementError = class extends PanopticError {
|
|
|
8414
8414
|
name = "UnsafePremiumSettlementError";
|
|
8415
8415
|
constructor(remainingForfeit, failedBuyerCount, cause) {
|
|
8416
8416
|
const [token0, token1] = remainingForfeit;
|
|
8417
|
-
super(failedBuyerCount > 0 ? `
|
|
8417
|
+
super(failedBuyerCount > 0 ? `Streamia settlement blocked: ${failedBuyerCount} buyer settlement${failedBuyerCount === 1 ? "" : "s"} would fail` : `Streamia settlement blocked: uncollectable streamia remains (${token0}, ${token1})`, cause);
|
|
8418
8418
|
this.remainingForfeit = remainingForfeit;
|
|
8419
8419
|
this.failedBuyerCount = failedBuyerCount;
|
|
8420
8420
|
}
|
|
@@ -11964,4 +11964,4 @@ function formatPerSecondRateWadAsAprPct(ratePerSecondWad, precision) {
|
|
|
11964
11964
|
}
|
|
11965
11965
|
|
|
11966
11966
|
//#endregion
|
|
11967
|
-
export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePosition, decodePositionBalance$1 as decodePositionBalance, decodeTickSpacing
|
|
11967
|
+
export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePosition, decodePositionBalance$1 as decodePositionBalance, decodeTickSpacing, diagnoseOracleSafeMode, fetchPoolId, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getBlockMeta, getClosedPositionsKey, getOpenPositionIds, getOracleRiskParameters, getOracleState, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPosition, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getRiskParameters, getSchemaVersionKey, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, getUtilization, isPanopticErrorType, isPositionTracked, jsonSerializer, mintableAfterBuffer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parsePanopticError, parseTokenAmount, parseWad, recoverSnapshot, recoverSnapshotFromTx, riskEngineAbi, selectDispatchForAccount, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, submitWrite, uniswapV3PoolAbi, validateBuilderCode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PanopticError, getBlockMeta, getPool, submitWrite } from "./rates-
|
|
2
|
-
import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, QuoterUnavailableError, getUniswapV4Addresses, universalRouterAbi } from "./router-
|
|
1
|
+
import { PanopticError, getBlockMeta, getPool, submitWrite } from "./rates-Y0Pbv1_x.js";
|
|
2
|
+
import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, QuoterUnavailableError, getUniswapV4Addresses, universalRouterAbi } from "./router-DxE-iwYF.js";
|
|
3
3
|
import { BaseError, ContractFunctionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, erc20Abi, isAddressEqual, maxUint256, zeroAddress } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/uniswap/v4/router/encodeSwap.ts
|
|
@@ -1,9 +1,297 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { StateViewAbi } from "./StateView-q4yMpBY6.js";
|
|
2
|
+
import { PanopticError, getBlockMeta, getPoolMetadata, stateViewAbi, submitWrite, uniswapV3PoolAbi } from "./rates-Y0Pbv1_x.js";
|
|
3
|
+
import { tickToSqrtPriceX96 } from "./greeks-CGtgLUyh.js";
|
|
4
|
+
import { decodeAllLegs, decodeTokenId } from "./writes-BA21eyGF.js";
|
|
5
|
+
import { BaseError, ContractFunctionRevertedError, ExecutionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, isAddressEqual, toHex, zeroAddress } from "viem";
|
|
5
6
|
import Decimal from "decimal.js";
|
|
6
7
|
|
|
8
|
+
//#region src/panoptic/v2/reads/priceHistory.ts
|
|
9
|
+
/**
|
|
10
|
+
* Get historical price data (tick + sqrtPriceX96) for a pool across multiple blocks.
|
|
11
|
+
*
|
|
12
|
+
* @param params - The parameters
|
|
13
|
+
* @returns Price snapshots at each block
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const { snapshots } = await getPriceHistory({
|
|
18
|
+
* client,
|
|
19
|
+
* blockNumbers: [18000000n, 18000100n, 18000200n],
|
|
20
|
+
* poolConfig: { version: 'v3', poolAddress: '0x...' },
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* for (const snap of snapshots) {
|
|
24
|
+
* console.log(`Block ${snap.blockNumber}: tick=${snap.tick}`)
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
async function getPriceHistory(params) {
|
|
29
|
+
const { client, blockNumbers, poolConfig } = params;
|
|
30
|
+
if (blockNumbers.length === 0) {
|
|
31
|
+
const _meta$1 = params._meta ?? await getBlockMeta({ client });
|
|
32
|
+
return {
|
|
33
|
+
snapshots: [],
|
|
34
|
+
_meta: _meta$1
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const slot0Requests = blockNumbers.map((bn) => fetchSlot0(client, bn, poolConfig));
|
|
38
|
+
const [slot0Results, _meta] = await Promise.all([Promise.all(slot0Requests), params._meta ? Promise.resolve(params._meta) : getBlockMeta({ client })]);
|
|
39
|
+
const snapshots = slot0Results.map((result, i) => ({
|
|
40
|
+
blockNumber: blockNumbers[i],
|
|
41
|
+
tick: result.tick,
|
|
42
|
+
sqrtPriceX96: result.sqrtPriceX96
|
|
43
|
+
}));
|
|
44
|
+
return {
|
|
45
|
+
snapshots,
|
|
46
|
+
_meta
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async function fetchSlot0(client, blockNumber, poolConfig) {
|
|
50
|
+
if (poolConfig.version === "v3") {
|
|
51
|
+
const result = await client.readContract({
|
|
52
|
+
address: poolConfig.poolAddress,
|
|
53
|
+
abi: uniswapV3PoolAbi,
|
|
54
|
+
functionName: "slot0",
|
|
55
|
+
blockNumber
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
sqrtPriceX96: result[0],
|
|
59
|
+
tick: result[1]
|
|
60
|
+
};
|
|
61
|
+
} else {
|
|
62
|
+
const result = await client.readContract({
|
|
63
|
+
address: poolConfig.stateViewAddress,
|
|
64
|
+
abi: stateViewAbi,
|
|
65
|
+
functionName: "getSlot0",
|
|
66
|
+
args: [poolConfig.poolId],
|
|
67
|
+
blockNumber
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
sqrtPriceX96: result[0],
|
|
71
|
+
tick: result[1]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/panoptic/v2/reads/uniswapLpPosition.ts
|
|
78
|
+
const nfpmAbi = [{
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "positions",
|
|
81
|
+
inputs: [{
|
|
82
|
+
name: "tokenId",
|
|
83
|
+
type: "uint256"
|
|
84
|
+
}],
|
|
85
|
+
outputs: [
|
|
86
|
+
{
|
|
87
|
+
name: "nonce",
|
|
88
|
+
type: "uint96"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "operator",
|
|
92
|
+
type: "address"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "token0",
|
|
96
|
+
type: "address"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "token1",
|
|
100
|
+
type: "address"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "fee",
|
|
104
|
+
type: "uint24"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "tickLower",
|
|
108
|
+
type: "int24"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "tickUpper",
|
|
112
|
+
type: "int24"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "liquidity",
|
|
116
|
+
type: "uint128"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "feeGrowthInside0LastX128",
|
|
120
|
+
type: "uint256"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "feeGrowthInside1LastX128",
|
|
124
|
+
type: "uint256"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "tokensOwed0",
|
|
128
|
+
type: "uint128"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "tokensOwed1",
|
|
132
|
+
type: "uint128"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
stateMutability: "view"
|
|
136
|
+
}, {
|
|
137
|
+
type: "function",
|
|
138
|
+
name: "collect",
|
|
139
|
+
inputs: [{
|
|
140
|
+
name: "params",
|
|
141
|
+
type: "tuple",
|
|
142
|
+
components: [
|
|
143
|
+
{
|
|
144
|
+
name: "tokenId",
|
|
145
|
+
type: "uint256"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "recipient",
|
|
149
|
+
type: "address"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "amount0Max",
|
|
153
|
+
type: "uint128"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "amount1Max",
|
|
157
|
+
type: "uint128"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}],
|
|
161
|
+
outputs: [{
|
|
162
|
+
name: "amount0",
|
|
163
|
+
type: "uint256"
|
|
164
|
+
}, {
|
|
165
|
+
name: "amount1",
|
|
166
|
+
type: "uint256"
|
|
167
|
+
}],
|
|
168
|
+
stateMutability: "payable"
|
|
169
|
+
}];
|
|
170
|
+
const MAX_UINT128 = 2n ** 128n - 1n;
|
|
171
|
+
const MAX_UINT256 = 2n ** 256n - 1n;
|
|
172
|
+
const Q128 = 2n ** 128n;
|
|
173
|
+
/**
|
|
174
|
+
* Whether an error thrown by a viem contract call is an on-chain revert (as
|
|
175
|
+
* opposed to a transport/RPC failure such as a timeout or rate limit).
|
|
176
|
+
*/
|
|
177
|
+
function isContractRevert(error) {
|
|
178
|
+
return error instanceof BaseError && error.walk((err) => err instanceof ContractFunctionRevertedError || err instanceof ExecutionRevertedError) != null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Fetch a Uniswap V3 LP position's state and uncollected fees.
|
|
182
|
+
*
|
|
183
|
+
* Fees come from simulating `collect` with max amounts as the owner — one
|
|
184
|
+
* eth_call returning the exact claimable amounts (tokensOwed + fee growth
|
|
185
|
+
* since the last poke). The simulation is best-effort: if it reverts (e.g.
|
|
186
|
+
* an empty position), fees fall back to 0.
|
|
187
|
+
*/
|
|
188
|
+
async function getUniswapV3LpPositionState(params) {
|
|
189
|
+
const { client, nfpmAddress, tokenId, owner, blockNumber } = params;
|
|
190
|
+
const _meta = await getBlockMeta({
|
|
191
|
+
client,
|
|
192
|
+
blockNumber
|
|
193
|
+
});
|
|
194
|
+
const position = await client.readContract({
|
|
195
|
+
address: nfpmAddress,
|
|
196
|
+
abi: nfpmAbi,
|
|
197
|
+
functionName: "positions",
|
|
198
|
+
args: [tokenId],
|
|
199
|
+
blockNumber: _meta.blockNumber
|
|
200
|
+
});
|
|
201
|
+
const [, , token0, token1, fee, tickLower, tickUpper, liquidity] = position;
|
|
202
|
+
let fees0 = 0n;
|
|
203
|
+
let fees1 = 0n;
|
|
204
|
+
try {
|
|
205
|
+
const { result } = await client.simulateContract({
|
|
206
|
+
address: nfpmAddress,
|
|
207
|
+
abi: nfpmAbi,
|
|
208
|
+
functionName: "collect",
|
|
209
|
+
args: [{
|
|
210
|
+
tokenId,
|
|
211
|
+
recipient: owner,
|
|
212
|
+
amount0Max: MAX_UINT128,
|
|
213
|
+
amount1Max: MAX_UINT128
|
|
214
|
+
}],
|
|
215
|
+
account: owner,
|
|
216
|
+
blockNumber: _meta.blockNumber
|
|
217
|
+
});
|
|
218
|
+
[fees0, fees1] = result;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
if (!isContractRevert(error)) throw error;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
token0,
|
|
224
|
+
token1,
|
|
225
|
+
fee: Number(fee),
|
|
226
|
+
tickLower: Number(tickLower),
|
|
227
|
+
tickUpper: Number(tickUpper),
|
|
228
|
+
liquidity,
|
|
229
|
+
fees0,
|
|
230
|
+
fees1,
|
|
231
|
+
_meta
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Uncollected fees from a feeGrowthInside delta, mirroring v4-core's
|
|
236
|
+
* `Position.calculatePositionFeesAccrued`: the subtraction wraps around
|
|
237
|
+
* uint256 (feeGrowthInside can legitimately underflow in-protocol).
|
|
238
|
+
*/
|
|
239
|
+
function feesFromFeeGrowthDelta(feeGrowthInsideCurrentX128, feeGrowthInsideLastX128, liquidity) {
|
|
240
|
+
const delta = feeGrowthInsideCurrentX128 - feeGrowthInsideLastX128 & MAX_UINT256;
|
|
241
|
+
return delta * liquidity / Q128;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Fetch a Uniswap V4 LP position's state and uncollected fees via StateView.
|
|
245
|
+
*
|
|
246
|
+
* The position inside PoolManager is keyed by (positionManager, tickLower,
|
|
247
|
+
* tickUpper, salt) where posm uses `bytes32(tokenId)` as the salt. Fees on
|
|
248
|
+
* pools with fee-taking hooks may be approximate.
|
|
249
|
+
*/
|
|
250
|
+
async function getUniswapV4LpPositionState(params) {
|
|
251
|
+
const { client, stateViewAddress, positionManagerAddress, poolId, tokenId, tickLower, tickUpper, blockNumber } = params;
|
|
252
|
+
const salt = toHex(tokenId, { size: 32 });
|
|
253
|
+
const _meta = await getBlockMeta({
|
|
254
|
+
client,
|
|
255
|
+
blockNumber
|
|
256
|
+
});
|
|
257
|
+
const [positionInfo, feeGrowthInside] = await client.multicall({
|
|
258
|
+
allowFailure: false,
|
|
259
|
+
blockNumber: _meta.blockNumber,
|
|
260
|
+
contracts: [{
|
|
261
|
+
address: stateViewAddress,
|
|
262
|
+
abi: StateViewAbi,
|
|
263
|
+
functionName: "getPositionInfo",
|
|
264
|
+
args: [
|
|
265
|
+
poolId,
|
|
266
|
+
positionManagerAddress,
|
|
267
|
+
tickLower,
|
|
268
|
+
tickUpper,
|
|
269
|
+
salt
|
|
270
|
+
]
|
|
271
|
+
}, {
|
|
272
|
+
address: stateViewAddress,
|
|
273
|
+
abi: StateViewAbi,
|
|
274
|
+
functionName: "getFeeGrowthInside",
|
|
275
|
+
args: [
|
|
276
|
+
poolId,
|
|
277
|
+
tickLower,
|
|
278
|
+
tickUpper
|
|
279
|
+
]
|
|
280
|
+
}]
|
|
281
|
+
});
|
|
282
|
+
const [liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128] = positionInfo;
|
|
283
|
+
const [feeGrowthInside0X128, feeGrowthInside1X128] = feeGrowthInside;
|
|
284
|
+
return {
|
|
285
|
+
liquidity,
|
|
286
|
+
tickLower,
|
|
287
|
+
tickUpper,
|
|
288
|
+
fees0: feesFromFeeGrowthDelta(feeGrowthInside0X128, feeGrowthInside0LastX128, liquidity),
|
|
289
|
+
fees1: feesFromFeeGrowthDelta(feeGrowthInside1X128, feeGrowthInside1LastX128, liquidity),
|
|
290
|
+
_meta
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
//#endregion
|
|
7
295
|
//#region src/uniswap/lpDeposit.ts
|
|
8
296
|
const Q96$1 = 1n << 96n;
|
|
9
297
|
const ceilDiv = (n, d) => (n + d - 1n) / d;
|
|
@@ -129,7 +417,7 @@ function getMaxLpPositionSize(params) {
|
|
|
129
417
|
const Precision = Decimal.clone({ precision: 80 });
|
|
130
418
|
const Q96 = 1n << 96n;
|
|
131
419
|
const YEAR_SECONDS = new Precision(31536e3);
|
|
132
|
-
/** The
|
|
420
|
+
/** The streamia-free position curve, expressed in one quote token's human units. */
|
|
133
421
|
function preparePositionGamma({ tokenId, positionSize, quoteIsToken0, quoteDecimals }) {
|
|
134
422
|
if (positionSize <= 0n || positionSize >= 1n << 128n) throw new RangeError("Invalid position size");
|
|
135
423
|
if (!Number.isInteger(quoteDecimals) || quoteDecimals < 0 || quoteDecimals > 255) throw new RangeError("Invalid quote decimals");
|
|
@@ -152,6 +440,16 @@ function preparePositionGamma({ tokenId, positionSize, quoteIsToken0, quoteDecim
|
|
|
152
440
|
isLong: leg.isLong
|
|
153
441
|
}];
|
|
154
442
|
});
|
|
443
|
+
return prepareLiquidityGamma({
|
|
444
|
+
chunks,
|
|
445
|
+
quoteIsToken0,
|
|
446
|
+
quoteDecimals
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
/** Signed dollar-gamma for fixed liquidity ranges in one quote frame. */
|
|
450
|
+
function prepareLiquidityGamma({ chunks, quoteIsToken0, quoteDecimals }) {
|
|
451
|
+
if (!Number.isInteger(quoteDecimals) || quoteDecimals < 0 || quoteDecimals > 255) throw new RangeError("Invalid quote decimals");
|
|
452
|
+
for (const chunk of chunks) if (!Number.isInteger(chunk.lowerTick) || !Number.isInteger(chunk.upperTick) || chunk.lowerTick < -887272 || chunk.upperTick > 887272 || chunk.lowerTick >= chunk.upperTick || chunk.liquidity < 0n || chunk.liquidity >= 1n << 128n) throw new RangeError("Invalid liquidity range");
|
|
155
453
|
const scale = new Precision(10).pow(quoteDecimals);
|
|
156
454
|
const atTick = (tick) => {
|
|
157
455
|
const netLiquidity = chunks.reduce((sum, chunk) => tick >= BigInt(chunk.lowerTick) && tick < BigInt(chunk.upperTick) ? sum + (chunk.isLong ? -chunk.liquidity : chunk.liquidity) : sum, 0n);
|
|
@@ -970,4 +1268,4 @@ async function swapExactOutViaV3Router(params) {
|
|
|
970
1268
|
}
|
|
971
1269
|
|
|
972
1270
|
//#endregion
|
|
973
|
-
export { AmountExceedsUint128Error, InvalidSwapTokenError, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V3_SWAP_EXACT_IN, V3_SWAP_EXACT_OUT, buildV3ExactOutSwapExecuteArgs, buildV3ExactOutSwapExecuteCalldata, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, calculatePositionVolatilityMetrics, encodeV3Path, getLpDepositAmounts, getLpDepositBreakdown, getLpFundingDeposit, getLpPositionFunding, getMaxLpPositionSize, getUnhedgedLpRanges, getUniswapV3Addresses, getUniswapV4Addresses, preparePositionGamma, quoteSwapExactInViaV3Router, quoteSwapExactOutViaV3Router, quoteV3ExactIn, quoteV3ExactOut, resolveV3SwapRoute, swapExactInViaV3Router, swapExactOutViaV3Router, universalRouterAbi, valuePositionAccrual };
|
|
1271
|
+
export { AmountExceedsUint128Error, InvalidSwapTokenError, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V3_SWAP_EXACT_IN, V3_SWAP_EXACT_OUT, buildV3ExactOutSwapExecuteArgs, buildV3ExactOutSwapExecuteCalldata, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, calculatePositionVolatilityMetrics, encodeV3Path, feesFromFeeGrowthDelta, getLpDepositAmounts, getLpDepositBreakdown, getLpFundingDeposit, getLpPositionFunding, getMaxLpPositionSize, getPriceHistory, getUnhedgedLpRanges, getUniswapV3Addresses, getUniswapV3LpPositionState, getUniswapV4Addresses, getUniswapV4LpPositionState, prepareLiquidityGamma, preparePositionGamma, quoteSwapExactInViaV3Router, quoteSwapExactOutViaV3Router, quoteV3ExactIn, quoteV3ExactOut, resolveV3SwapRoute, swapExactInViaV3Router, swapExactOutViaV3Router, universalRouterAbi, valuePositionAccrual };
|
package/dist/uniswap/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import Decimal from "decimal.js";
|
|
2
3
|
import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
|
|
4
|
+
import { z } from "zod";
|
|
3
5
|
|
|
4
6
|
//#region src/uniswap/estimateLpFees.d.ts
|
|
5
7
|
interface LpFeeCandle {
|
|
@@ -48,6 +50,181 @@ declare function estimateLpFees({
|
|
|
48
50
|
skippedCandles: number;
|
|
49
51
|
inferredCandles: number;
|
|
50
52
|
}; //#endregion
|
|
53
|
+
//#region src/uniswap/lpHistory.d.ts
|
|
54
|
+
declare const changeSchema: z.ZodObject<{
|
|
55
|
+
eventType: z.ZodEnum<{
|
|
56
|
+
Mint: "Mint";
|
|
57
|
+
Burn: "Burn";
|
|
58
|
+
}>;
|
|
59
|
+
liquidity: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
60
|
+
amountSource: z.ZodNullable<z.ZodString>;
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
hash: z.ZodString;
|
|
63
|
+
blockNumber: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
64
|
+
logIndex: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
65
|
+
timestamp: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
66
|
+
amount0: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
67
|
+
amount1: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
declare const collectSchema: z.ZodObject<{
|
|
70
|
+
recipient: z.ZodString;
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
hash: z.ZodString;
|
|
73
|
+
blockNumber: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
74
|
+
logIndex: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
75
|
+
timestamp: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
76
|
+
amount0: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
77
|
+
amount1: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
type LpPositionHistoryEvent = z.infer<typeof changeSchema> | (z.infer<typeof collectSchema> & {
|
|
80
|
+
eventType: 'Collect';
|
|
81
|
+
amountSource: 'ExactEvent';
|
|
82
|
+
});
|
|
83
|
+
/** Complete NFT activity at one indexed block, sorted by block and log index. */
|
|
84
|
+
declare function getLpPositionHistory({
|
|
85
|
+
url,
|
|
86
|
+
positionId,
|
|
87
|
+
signal
|
|
88
|
+
}: {
|
|
89
|
+
url: string;
|
|
90
|
+
positionId: string;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
events: LpPositionHistoryEvent[];
|
|
94
|
+
positionId: string;
|
|
95
|
+
blockHash: string;
|
|
96
|
+
blockNumber: bigint;
|
|
97
|
+
version: 4 | 3;
|
|
98
|
+
}>;
|
|
99
|
+
/** Token flows; v3 collects may include principal already recorded in removals. */
|
|
100
|
+
declare function summarizeLpPositionHistory(events: readonly LpPositionHistoryEvent[]): {
|
|
101
|
+
added: {
|
|
102
|
+
amount0: null;
|
|
103
|
+
amount1: null;
|
|
104
|
+
estimated: boolean;
|
|
105
|
+
} | {
|
|
106
|
+
amount0: bigint;
|
|
107
|
+
amount1: bigint;
|
|
108
|
+
estimated: boolean;
|
|
109
|
+
};
|
|
110
|
+
removed: {
|
|
111
|
+
amount0: null;
|
|
112
|
+
amount1: null;
|
|
113
|
+
estimated: boolean;
|
|
114
|
+
} | {
|
|
115
|
+
amount0: bigint;
|
|
116
|
+
amount1: bigint;
|
|
117
|
+
estimated: boolean;
|
|
118
|
+
};
|
|
119
|
+
collected: {
|
|
120
|
+
amount0: null;
|
|
121
|
+
amount1: null;
|
|
122
|
+
estimated: boolean;
|
|
123
|
+
} | {
|
|
124
|
+
amount0: bigint;
|
|
125
|
+
amount1: bigint;
|
|
126
|
+
estimated: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/uniswap/lpAccounting.d.ts
|
|
132
|
+
/** V3 NFT cash-flow returns, including withdrawn principal still awaiting collection. */
|
|
133
|
+
declare function calculateV3LpAccounting({
|
|
134
|
+
events,
|
|
135
|
+
inventory,
|
|
136
|
+
claimable,
|
|
137
|
+
prices,
|
|
138
|
+
endBlock,
|
|
139
|
+
token0Decimals,
|
|
140
|
+
token1Decimals
|
|
141
|
+
}: {
|
|
142
|
+
events: readonly LpPositionHistoryEvent[];
|
|
143
|
+
inventory: {
|
|
144
|
+
amount0: bigint;
|
|
145
|
+
amount1: bigint;
|
|
146
|
+
};
|
|
147
|
+
claimable: {
|
|
148
|
+
amount0: bigint;
|
|
149
|
+
amount1: bigint;
|
|
150
|
+
};
|
|
151
|
+
prices: readonly {
|
|
152
|
+
blockNumber: bigint;
|
|
153
|
+
sqrtPriceX96: bigint;
|
|
154
|
+
}[];
|
|
155
|
+
endBlock: bigint;
|
|
156
|
+
token0Decimals: number;
|
|
157
|
+
token1Decimals: number;
|
|
158
|
+
}): {
|
|
159
|
+
fees0: bigint;
|
|
160
|
+
fees1: bigint;
|
|
161
|
+
claimable: {
|
|
162
|
+
amount0: bigint;
|
|
163
|
+
amount1: bigint;
|
|
164
|
+
};
|
|
165
|
+
quote0: {
|
|
166
|
+
pnl: string;
|
|
167
|
+
deposited: string;
|
|
168
|
+
pnlPercent: string | null;
|
|
169
|
+
};
|
|
170
|
+
quote1: {
|
|
171
|
+
pnl: string;
|
|
172
|
+
deposited: string;
|
|
173
|
+
pnlPercent: string | null;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
/** Reconcile v3 activity and historical prices at the subgraph's indexed block. */
|
|
177
|
+
declare function getV3LpHistoryAccounting({
|
|
178
|
+
client,
|
|
179
|
+
history,
|
|
180
|
+
nfpmAddress,
|
|
181
|
+
poolAddress,
|
|
182
|
+
tickLower,
|
|
183
|
+
tickUpper,
|
|
184
|
+
token0Decimals,
|
|
185
|
+
token1Decimals
|
|
186
|
+
}: {
|
|
187
|
+
client: PublicClient;
|
|
188
|
+
history: Awaited<ReturnType<typeof getLpPositionHistory>>;
|
|
189
|
+
nfpmAddress: Address;
|
|
190
|
+
poolAddress: Address;
|
|
191
|
+
tickLower: bigint;
|
|
192
|
+
tickUpper: bigint;
|
|
193
|
+
token0Decimals: number;
|
|
194
|
+
token1Decimals: number;
|
|
195
|
+
}): Promise<{
|
|
196
|
+
claimable: {
|
|
197
|
+
amount0: bigint;
|
|
198
|
+
amount1: bigint;
|
|
199
|
+
};
|
|
200
|
+
quote0: null;
|
|
201
|
+
quote1: null;
|
|
202
|
+
blockNumber: bigint;
|
|
203
|
+
timestamp: bigint;
|
|
204
|
+
fees0: bigint;
|
|
205
|
+
fees1: bigint;
|
|
206
|
+
} | {
|
|
207
|
+
blockNumber: bigint;
|
|
208
|
+
timestamp: bigint;
|
|
209
|
+
fees0: bigint;
|
|
210
|
+
fees1: bigint;
|
|
211
|
+
claimable: {
|
|
212
|
+
amount0: bigint;
|
|
213
|
+
amount1: bigint;
|
|
214
|
+
};
|
|
215
|
+
quote0: {
|
|
216
|
+
pnl: string;
|
|
217
|
+
deposited: string;
|
|
218
|
+
pnlPercent: string | null;
|
|
219
|
+
};
|
|
220
|
+
quote1: {
|
|
221
|
+
pnl: string;
|
|
222
|
+
deposited: string;
|
|
223
|
+
pnlPercent: string | null;
|
|
224
|
+
};
|
|
225
|
+
}>;
|
|
226
|
+
|
|
227
|
+
//#endregion
|
|
51
228
|
//#region src/uniswap/lpDeposit.d.ts
|
|
52
229
|
/** Uniswap mint principal in raw token units, rounded up per leg, plus 5% headroom. */
|
|
53
230
|
declare function getLpDepositAmounts(ranges: readonly LpFeeRange[], sqrtPriceX96: bigint): {
|
|
@@ -130,7 +307,9 @@ declare function getMaxLpPositionSize(params: Omit<LpPositionFundingParams, 'pos
|
|
|
130
307
|
referenceSize: bigint;
|
|
131
308
|
requiredInQuote: bigint;
|
|
132
309
|
};
|
|
133
|
-
}): bigint;
|
|
310
|
+
}): bigint;
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
134
313
|
//#region src/uniswap/lpFeeReturn.d.ts
|
|
135
314
|
/** Simple fee APR over the full selected viewport, without compounding. */
|
|
136
315
|
declare function annualizeLpFeeReturn(feeReturnPercent: Decimal, durationSeconds: bigint): Decimal;
|
|
@@ -230,6 +409,15 @@ declare function getLpGreeks(input: LpGreeksInput): LpGreeks;
|
|
|
230
409
|
|
|
231
410
|
//#endregion
|
|
232
411
|
//#region src/panoptic/v2/greeks/positionVolatility.d.ts
|
|
412
|
+
interface PositionVolatilityObservation {
|
|
413
|
+
timestamp: bigint;
|
|
414
|
+
/** Any consistent positive price scale; only log price ratios are used. */
|
|
415
|
+
price: Decimal.Value;
|
|
416
|
+
/** Signed dollar-gamma in human quote units at this observation. */
|
|
417
|
+
gamma: Decimal.Value;
|
|
418
|
+
/** Whole-position gamma at price regions visited since the previous observation. */
|
|
419
|
+
rangeGammas?: readonly Decimal.Value[];
|
|
420
|
+
}
|
|
233
421
|
type VolatilityComparisonReason = 'insufficient-exposure' | 'changing-sign' | 'premium-unavailable' | 'inconsistent-premium-direction';
|
|
234
422
|
|
|
235
423
|
//#endregion
|
|
@@ -331,7 +519,7 @@ interface OptionBurntEvent extends BaseEvent {
|
|
|
331
519
|
tokenId: bigint;
|
|
332
520
|
/** Position size that was burnt */
|
|
333
521
|
positionSize: bigint;
|
|
334
|
-
/**
|
|
522
|
+
/** Streamia settled for each leg (token0 right, token1 left per leg) */
|
|
335
523
|
premiaByLeg: readonly [bigint, bigint, bigint, bigint];
|
|
336
524
|
}
|
|
337
525
|
/**
|
|
@@ -694,7 +882,8 @@ declare function calculateLpPositionVolatility({
|
|
|
694
882
|
tickUpper,
|
|
695
883
|
quoteIsToken0,
|
|
696
884
|
quoteDecimals,
|
|
697
|
-
snapshots
|
|
885
|
+
snapshots,
|
|
886
|
+
observations: priceObservations
|
|
698
887
|
}: {
|
|
699
888
|
liquidity: bigint;
|
|
700
889
|
tickLower: bigint;
|
|
@@ -702,6 +891,7 @@ declare function calculateLpPositionVolatility({
|
|
|
702
891
|
quoteIsToken0: boolean;
|
|
703
892
|
quoteDecimals: number;
|
|
704
893
|
snapshots: readonly UniswapFeeSnapshot[];
|
|
894
|
+
observations?: readonly PositionVolatilityObservation[];
|
|
705
895
|
}): {
|
|
706
896
|
gammaSign: string;
|
|
707
897
|
exposure: string;
|
|
@@ -1591,5 +1781,5 @@ declare function swapExactOutViaRouter(params: SwapExactOutViaRouterParams): Pro
|
|
|
1591
1781
|
declare function swapExactOutViaRouterAndWait(params: SwapExactOutViaRouterParams): Promise<TxReceipt>;
|
|
1592
1782
|
|
|
1593
1783
|
//#endregion
|
|
1594
|
-
export { AmountExceedsUint128Error, ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, BuildV3ExactOutSwapCalldataArgs, BuildV3SwapCalldataArgs, BuildV4ExactOutSwapCalldataArgs, BuildV4SwapCalldataArgs, CheckRouterApprovalParams, ExpectedTimeInRangeInput, InvalidSwapTokenError, LP_RANGE_HORIZONS_DAYS, LP_RANGE_HORIZONS_YEARS, LpAmounts, LpFeeCandle, LpFeeRange, LpGreeks, LpGreeksInput, LpPositionFundingParams, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoteSwapExactInViaRouterParams, QuoteSwapExactInViaV3RouterParams, QuoteSwapExactOutViaRouterParams, QuoteSwapExactOutViaV3RouterParams, QuoteV3ExactInParams, QuoteV3ExactOutParams, QuoteV4ExactInByPoolKeyParams, QuoterUnavailableError, RangeProbabilityInput, RangeStats, RangeStatsInput, ResolveSwapRouteParams, ResolveV3SwapRouteParams, ResolvedSwapRoute, ResolvedV3SwapRoute, RouterApprovalStatus, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactInViaV3RouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, SwapExactOutViaV3RouterParams, TAKE_ALL, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UniswapV3Addresses, UniswapV4Addresses, UnsupportedChainError, V3ExactInQuote, V3ExactOutQuote, V3_SWAP_EXACT_IN, V3_SWAP_EXACT_OUT, V4ExactInQuote, V4_SWAP, annualizeLpFeeReturn, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV3ExactOutSwapExecuteArgs, buildV3ExactOutSwapExecuteCalldata, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, calculateLpPositionVolatility, checkRouterApproval, encodeV3Path, estimateLpFees, expectedTimeInRange, getAmountsForLiquidity, getLpDepositAmounts, getLpDepositBreakdown, getLpFeeReturnSeries, getLpFundingDeposit, getLpGreeks, getLpPositionFunding, getMaxLpPositionSize, getUnhedgedLpRanges, getUniswapV3Addresses, getUniswapV3PoolBalances, getUniswapV4Addresses, normalCdf, pInRangeAt, quoteSwapExactInViaRouter, quoteSwapExactInViaV3Router, quoteSwapExactOutViaRouter, quoteSwapExactOutViaV3Router, quoteTokenPrices, quoteV3ExactIn, quoteV3ExactOut, quoteV4ExactInByPoolKey, rangeStats, resolveSwapRoute, resolveV3SwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactInViaV3Router, swapExactOutViaRouter, swapExactOutViaRouterAndWait, swapExactOutViaV3Router };
|
|
1784
|
+
export { AmountExceedsUint128Error, ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, BuildV3ExactOutSwapCalldataArgs, BuildV3SwapCalldataArgs, BuildV4ExactOutSwapCalldataArgs, BuildV4SwapCalldataArgs, CheckRouterApprovalParams, ExpectedTimeInRangeInput, InvalidSwapTokenError, LP_RANGE_HORIZONS_DAYS, LP_RANGE_HORIZONS_YEARS, LpAmounts, LpFeeCandle, LpFeeRange, LpGreeks, LpGreeksInput, LpPositionFundingParams, LpPositionHistoryEvent, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoteSwapExactInViaRouterParams, QuoteSwapExactInViaV3RouterParams, QuoteSwapExactOutViaRouterParams, QuoteSwapExactOutViaV3RouterParams, QuoteV3ExactInParams, QuoteV3ExactOutParams, QuoteV4ExactInByPoolKeyParams, QuoterUnavailableError, RangeProbabilityInput, RangeStats, RangeStatsInput, ResolveSwapRouteParams, ResolveV3SwapRouteParams, ResolvedSwapRoute, ResolvedV3SwapRoute, RouterApprovalStatus, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactInViaV3RouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, SwapExactOutViaV3RouterParams, TAKE_ALL, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UniswapV3Addresses, UniswapV4Addresses, UnsupportedChainError, V3ExactInQuote, V3ExactOutQuote, V3_SWAP_EXACT_IN, V3_SWAP_EXACT_OUT, V4ExactInQuote, V4_SWAP, annualizeLpFeeReturn, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV3ExactOutSwapExecuteArgs, buildV3ExactOutSwapExecuteCalldata, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, calculateLpPositionVolatility, calculateV3LpAccounting, checkRouterApproval, encodeV3Path, estimateLpFees, expectedTimeInRange, getAmountsForLiquidity, getLpDepositAmounts, getLpDepositBreakdown, getLpFeeReturnSeries, getLpFundingDeposit, getLpGreeks, getLpPositionFunding, getLpPositionHistory, getMaxLpPositionSize, getUnhedgedLpRanges, getUniswapV3Addresses, getUniswapV3PoolBalances, getUniswapV4Addresses, getV3LpHistoryAccounting, normalCdf, pInRangeAt, quoteSwapExactInViaRouter, quoteSwapExactInViaV3Router, quoteSwapExactOutViaRouter, quoteSwapExactOutViaV3Router, quoteTokenPrices, quoteV3ExactIn, quoteV3ExactOut, quoteV4ExactInByPoolKey, rangeStats, resolveSwapRoute, resolveV3SwapRoute, summarizeLpPositionHistory, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactInViaV3Router, swapExactOutViaRouter, swapExactOutViaRouterAndWait, swapExactOutViaV3Router };
|
|
1595
1785
|
//# sourceMappingURL=index.d.ts.map
|