@1inch/swap-vm-sdk 0.1.2-rc.3 → 0.1.2-rc.5

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 CHANGED
@@ -523,18 +523,18 @@ The SDK includes pre-configured contract addresses of `AquaSwapVMRouter` for the
523
523
 
524
524
  | Network | Chain ID | Address |
525
525
  |---------|----------|---------|
526
- | Ethereum | 1 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://etherscan.io/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
527
- | BNB Chain | 56 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://bscscan.com/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
528
- | Polygon | 137 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://polygonscan.com/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
529
- | Arbitrum | 42161 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://arbiscan.io/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
530
- | Avalanche | 43114 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](http://snowscan.xyz/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
531
- | Gnosis | 100 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://gnosisscan.io/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
532
- | Coinbase Base | 8453 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://basescan.org/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
533
- | Optimism | 10 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://optimistic.etherscan.io/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
534
- | zkSync Era | 324 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://era.zksync.network/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
535
- | Linea | 59144 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://lineascan.build/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
536
- | Unichain | 1301 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://uniscan.xyz/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
537
- | Sonic | 146 | [0x8fdd04dbf6111437b44bbca99c28882434e0958f](https://sonicscan.org/address/0x8fdd04dbf6111437b44bbca99c28882434e0958f) |
526
+ | Ethereum | 1 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://etherscan.io/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
527
+ | BNB Chain | 56 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://bscscan.com/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
528
+ | Polygon | 137 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://polygonscan.com/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
529
+ | Arbitrum | 42161 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://arbiscan.io/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
530
+ | Avalanche | 43114 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](http://snowscan.xyz/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
531
+ | Gnosis | 100 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://gnosisscan.io/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
532
+ | Coinbase Base | 8453 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://basescan.org/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
533
+ | Optimism | 10 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://optimistic.etherscan.io/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
534
+ | zkSync Era | 324 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://era.zksync.network/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
535
+ | Linea | 59144 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://lineascan.build/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
536
+ | Unichain | 1301 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://uniscan.xyz/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
537
+ | Sonic | 146 | [0xdfd05fe230bfe7b212878414270c72c8345506fa](https://sonicscan.org/address/0xdfd05fe230bfe7b212878414270c72c8345506fa) |
538
538
 
539
539
  Access addresses using:
540
540
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './swap-vm-contract';
2
2
  export * from './swap-vm';
3
3
  export * as ABI from './abi';
4
- export { Address, HexString, NetworkEnum, CallInfo } from '@1inch/sdk-core';
4
+ export { Address, HexString, NetworkEnum } from '@1inch/sdk-core';
5
+ export type { CallInfo } from '@1inch/sdk-core';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './swap-vm-contract';
2
2
  export * from './swap-vm';
3
3
  export * as ABI from './abi';
4
- export { Address, HexString, NetworkEnum, CallInfo } from '@1inch/sdk-core';
4
+ export { Address, HexString, NetworkEnum } from '@1inch/sdk-core';
5
+ export type { CallInfo } from '@1inch/sdk-core';
package/dist/index.js CHANGED
@@ -725,18 +725,18 @@ var SwapVMContract = class SwapVMContract {
725
725
  * @see "../swap-vm/programs/aqua-program-builder"
726
726
  */
727
727
  const AQUA_SWAP_VM_CONTRACT_ADDRESSES = {
728
- [__1inch_sdk_core.NetworkEnum.ETHEREUM]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
729
- [__1inch_sdk_core.NetworkEnum.BINANCE]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
730
- [__1inch_sdk_core.NetworkEnum.POLYGON]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
731
- [__1inch_sdk_core.NetworkEnum.ARBITRUM]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
732
- [__1inch_sdk_core.NetworkEnum.AVALANCHE]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
733
- [__1inch_sdk_core.NetworkEnum.GNOSIS]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
734
- [__1inch_sdk_core.NetworkEnum.COINBASE]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
735
- [__1inch_sdk_core.NetworkEnum.OPTIMISM]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
736
- [__1inch_sdk_core.NetworkEnum.ZKSYNC]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
737
- [__1inch_sdk_core.NetworkEnum.LINEA]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
738
- [__1inch_sdk_core.NetworkEnum.UNICHAIN]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
739
- [__1inch_sdk_core.NetworkEnum.SONIC]: new __1inch_sdk_core.Address("0x8fdd04dbf6111437b44bbca99c28882434e0958f")
728
+ [__1inch_sdk_core.NetworkEnum.ETHEREUM]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
729
+ [__1inch_sdk_core.NetworkEnum.BINANCE]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
730
+ [__1inch_sdk_core.NetworkEnum.POLYGON]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
731
+ [__1inch_sdk_core.NetworkEnum.ARBITRUM]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
732
+ [__1inch_sdk_core.NetworkEnum.AVALANCHE]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
733
+ [__1inch_sdk_core.NetworkEnum.GNOSIS]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
734
+ [__1inch_sdk_core.NetworkEnum.COINBASE]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
735
+ [__1inch_sdk_core.NetworkEnum.OPTIMISM]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
736
+ [__1inch_sdk_core.NetworkEnum.ZKSYNC]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
737
+ [__1inch_sdk_core.NetworkEnum.LINEA]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
738
+ [__1inch_sdk_core.NetworkEnum.UNICHAIN]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
739
+ [__1inch_sdk_core.NetworkEnum.SONIC]: new __1inch_sdk_core.Address("0xdfd05fe230bfe7b212878414270c72c8345506fa")
740
740
  };
741
741
 
742
742
  //#endregion
@@ -1142,8 +1142,8 @@ var TakerTraits = class TakerTraits {
1142
1142
  let flags = new __1inch_byte_utils.BN(0n);
1143
1143
  flags = flags.setBit(TakerTraits.IS_EXACT_IN_BIT_FLAG, this.exactIn);
1144
1144
  flags = flags.setBit(TakerTraits.SHOULD_UNWRAP_BIT_FLAG, this.shouldUnwrap);
1145
- flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG, !this.preTransferInCallbackData.isEmpty());
1146
- flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG, !this.preTransferOutCallbackData.isEmpty());
1145
+ flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG, this.preTransferInCallbackEnabled || !this.preTransferInCallbackData.isEmpty());
1146
+ flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG, this.preTransferOutCallbackEnabled || !this.preTransferOutCallbackData.isEmpty());
1147
1147
  flags = flags.setBit(TakerTraits.IS_STRICT_THRESHOLD_BIT_FLAG, this.strictThreshold);
1148
1148
  flags = flags.setBit(TakerTraits.IS_FIRST_TRANSFER_FROM_TAKER_BIT_FLAG, this.firstTransferFromTaker);
1149
1149
  flags = flags.setBit(TakerTraits.USE_TRANSFER_FROM_AND_AQUA_PUSH_FLAG, this.useTransferFromAndAquaPush);
@@ -2024,11 +2024,159 @@ function mulDiv(a, b, c) {
2024
2024
  return a * b / c;
2025
2025
  }
2026
2026
 
2027
+ //#endregion
2028
+ //#region src/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/concentrate-liquidity-calculator.ts
2029
+ /**
2030
+ * Calculator for concentrated liquidity: given two tokens and a price range (min, spot, max),
2031
+ * computes sqrt prices and token reserves for "max allocation" (use all available balances)
2032
+ * or "fixed allocation" (fix one token amount and solve for the other).
2033
+ *
2034
+ * Token ordering follows the pool convention: token0 = lower address, token1 = higher address.
2035
+ * Prices are supplied as ScaledPrices with scale 10^(token0Decimals + token1Decimals); they are
2036
+ * converted internally to P = token1/token0 in 1e18 and then to sqrt(P * 1e18) for the math.
2037
+ */
2038
+ var ConcentrateLiquidityCalculator = class ConcentrateLiquidityCalculator {
2039
+ static ONE_E18 = 10n ** 18n;
2040
+ constructor(tokenA, tokenB) {
2041
+ this.tokenA = tokenA;
2042
+ this.tokenB = tokenB;
2043
+ }
2044
+ /**
2045
+ * Token with the smaller address (token0 in pool convention; "Lt" in the math).
2046
+ */
2047
+ get token0() {
2048
+ return this.tokenA.address.lt(this.tokenB.address) ? this.tokenA : this.tokenB;
2049
+ }
2050
+ /**
2051
+ * Token with the larger address (token1 in pool convention; "Gt" in the math).
2052
+ */
2053
+ get token1() {
2054
+ return this.tokenA.address.lt(this.tokenB.address) ? this.tokenB : this.tokenA;
2055
+ }
2056
+ static new(data) {
2057
+ return new ConcentrateLiquidityCalculator(data.tokenA, data.tokenB);
2058
+ }
2059
+ /**
2060
+ * Compute reserves when one token amount is fixed: the position uses exactly
2061
+ * `fixedReserve` of `fixedReserveForToken` and the other token amount is derived
2062
+ * to keep the same liquidity L. Returns sqrt prices and token0/token1
2063
+ * reserves (raw amounts).
2064
+ * Due to integer math (floor division, sqrt), the fixed asset amount in the result
2065
+ * may be less than requested by a few wei.
2066
+ */
2067
+ computeFixedAllocation(scaledPrices, fixedReserveForToken, fixedReserve) {
2068
+ const { minPriceRaw, spotPriceRaw, maxPriceRaw } = this.computeRawPrices(scaledPrices);
2069
+ const sqrtPriceMin = bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2070
+ const sqrtPriceSpot = bigintSqrt(spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2071
+ const sqrtPriceMax = bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2072
+ const isFixedLt = fixedReserveForToken.equal(this.token0.address);
2073
+ const availableLt = isFixedLt ? fixedReserve : __1inch_byte_utils.UINT_256_MAX;
2074
+ const availableGt = isFixedLt ? __1inch_byte_utils.UINT_256_MAX : fixedReserve;
2075
+ const { actualLt, actualGt } = computeLiquidityFromAmounts(availableLt, availableGt, sqrtPriceSpot, sqrtPriceMin, sqrtPriceMax);
2076
+ return {
2077
+ sqrtPriceMin,
2078
+ sqrtPriceSpot,
2079
+ sqrtPriceMax,
2080
+ token0Reserve: actualLt,
2081
+ token1Reserve: actualGt
2082
+ };
2083
+ }
2084
+ /**
2085
+ * Compute reserves when both token amounts are taken from token info: uses
2086
+ * token0.maxAvailableLiquidity and token1.maxAvailableLiquidity to maximize
2087
+ * L. Returns sqrt prices and the token0/token1 reserves that achieve
2088
+ * that maximum.
2089
+ */
2090
+ computeMaxAllocation(scaledPrices) {
2091
+ const { minPriceRaw, spotPriceRaw, maxPriceRaw } = this.computeRawPrices(scaledPrices);
2092
+ const sqrtPriceMin = bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2093
+ const sqrtPriceSpot = bigintSqrt(spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2094
+ const sqrtPriceMax = bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2095
+ const { actualLt, actualGt } = computeLiquidityFromAmounts(this.token0.maxAvailableLiquidity, this.token1.maxAvailableLiquidity, sqrtPriceSpot, sqrtPriceMin, sqrtPriceMax);
2096
+ return {
2097
+ sqrtPriceMin,
2098
+ sqrtPriceSpot,
2099
+ sqrtPriceMax,
2100
+ token0Reserve: actualLt,
2101
+ token1Reserve: actualGt
2102
+ };
2103
+ }
2104
+ /**
2105
+ * Implied spot sqrt price from token0/token1 balances and a scaled price range
2106
+ * (same convention as {@link computeMaxAllocation}). Inverse of the allocation math; wraps
2107
+ * {@link computeLiquidityAndPrice} from concentrate-liquidity-math.
2108
+ *
2109
+ * @returns sqrt(P_spot) in 1e18 fixed-point (same as {@link ConcentratedLiquidityInfo.sqrtPriceSpot}).
2110
+ */
2111
+ computeSpotPrice(token0Balance, token1Balance, scaledPriceBounds) {
2112
+ const { sqrtPriceMin, sqrtPriceMax } = this.computeSqrtPriceBounds(scaledPriceBounds);
2113
+ const { sqrtPriceSpot } = computeLiquidityAndPrice(token0Balance, token1Balance, sqrtPriceMin, sqrtPriceMax);
2114
+ return sqrtPriceSpot;
2115
+ }
2116
+ /**
2117
+ * Convert user-facing ScaledPrices (scale 10^(token0Decimals+token1Decimals)) into internal
2118
+ * raw prices P = token1/token0 (before sqrt), so that sqrt(P * 1e18) can be
2119
+ * passed to the liquidity math. Handles both quote = token0 and quote = token1.
2120
+ */
2121
+ computeRawPrices(scaledPrices) {
2122
+ const { minPriceRaw, maxPriceRaw } = this.computeRawPriceBounds(scaledPrices);
2123
+ const token0 = this.token0;
2124
+ const token1 = this.token1;
2125
+ if (scaledPrices.quoteToken.equal(token0.address)) {
2126
+ const numerator = 10n ** (token1.decimals + token1.decimals) * ConcentrateLiquidityCalculator.ONE_E18;
2127
+ return {
2128
+ minPriceRaw,
2129
+ spotPriceRaw: numerator / scaledPrices.spotPriceRaw,
2130
+ maxPriceRaw
2131
+ };
2132
+ }
2133
+ if (scaledPrices.quoteToken.equal(token1.address)) {
2134
+ const denominator = 10n ** (token0.decimals + token0.decimals);
2135
+ return {
2136
+ minPriceRaw,
2137
+ spotPriceRaw: scaledPrices.spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator,
2138
+ maxPriceRaw
2139
+ };
2140
+ }
2141
+ throw new Error("unknown quote token");
2142
+ }
2143
+ computeSqrtPriceBounds(scaledPriceBounds) {
2144
+ const { minPriceRaw, maxPriceRaw } = this.computeRawPriceBounds(scaledPriceBounds);
2145
+ return {
2146
+ sqrtPriceMin: bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18),
2147
+ sqrtPriceMax: bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18)
2148
+ };
2149
+ }
2150
+ /**
2151
+ * Internal P = token1/token0 (1e18) from scaled min/max only (same mapping as {@link computeRawPrices}).
2152
+ */
2153
+ computeRawPriceBounds(scaledPriceBounds) {
2154
+ const token0 = this.token0;
2155
+ const token1 = this.token1;
2156
+ if (scaledPriceBounds.quoteToken.equal(token0.address)) {
2157
+ const numerator = 10n ** (token1.decimals + token1.decimals) * ConcentrateLiquidityCalculator.ONE_E18;
2158
+ return {
2159
+ minPriceRaw: numerator / scaledPriceBounds.maxPriceRaw,
2160
+ maxPriceRaw: numerator / scaledPriceBounds.minPriceRaw
2161
+ };
2162
+ }
2163
+ if (scaledPriceBounds.quoteToken.equal(token1.address)) {
2164
+ const denominator = 10n ** (token0.decimals + token0.decimals);
2165
+ return {
2166
+ minPriceRaw: scaledPriceBounds.minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator,
2167
+ maxPriceRaw: scaledPriceBounds.maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator
2168
+ };
2169
+ }
2170
+ throw new Error("unknown quote token");
2171
+ }
2172
+ };
2173
+
2027
2174
  //#endregion
2028
2175
  //#region src/swap-vm/instructions/concentrate/index.ts
2029
2176
  var concentrate_exports = {};
2030
2177
  __export(concentrate_exports, {
2031
2178
  ConcentrateGrowLiquidity2DArgs: () => ConcentrateGrowLiquidity2DArgs,
2179
+ ConcentrateLiquidityCalculator: () => ConcentrateLiquidityCalculator,
2032
2180
  ONE_E18: () => ONE_E18,
2033
2181
  bigintSqrt: () => bigintSqrt,
2034
2182
  computeBalances: () => computeBalances,
@@ -4082,12 +4230,6 @@ exports.AquaAMMStrategy = AquaAMMStrategy;
4082
4230
  exports.AquaPeggedAmmStrategy = AquaPeggedAmmStrategy;
4083
4231
  exports.AquaProgramBuilder = AquaProgramBuilder;
4084
4232
  exports.AquaXYCAmmStrategy = AquaXYCAmmStrategy;
4085
- Object.defineProperty(exports, 'CallInfo', {
4086
- enumerable: true,
4087
- get: function () {
4088
- return __1inch_sdk_core.CallInfo;
4089
- }
4090
- });
4091
4233
  Object.defineProperty(exports, 'HexString', {
4092
4234
  enumerable: true,
4093
4235
  get: function () {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { decodeAbiParameters, decodeEventLog, encodeAbiParameters, encodeFunctionData, hashTypedData, keccak256 } from "viem";
2
- import { Address, Address as Address$1, AddressHalf, CallInfo, HexString, HexString as HexString$1, Interaction, NetworkEnum, NetworkEnum as NetworkEnum$1 } from "@1inch/sdk-core";
2
+ import { Address, Address as Address$1, AddressHalf, HexString, HexString as HexString$1, Interaction, NetworkEnum, NetworkEnum as NetworkEnum$1 } from "@1inch/sdk-core";
3
3
  import { BN, BitMask, BytesBuilder, BytesIter, UINT_16_MAX, UINT_24_MAX, UINT_256_MAX, UINT_32_MAX, UINT_40_MAX, UINT_64_MAX, UINT_8_MAX, UINT_96_MAX, add0x, trim0x } from "@1inch/byte-utils";
4
4
  import assert from "assert";
5
5
  import { UINT_64_MAX as UINT_64_MAX$1 } from "@1inch/byte-utils/dist/constants";
@@ -706,18 +706,18 @@ var SwapVMContract = class SwapVMContract {
706
706
  * @see "../swap-vm/programs/aqua-program-builder"
707
707
  */
708
708
  const AQUA_SWAP_VM_CONTRACT_ADDRESSES = {
709
- [NetworkEnum$1.ETHEREUM]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
710
- [NetworkEnum$1.BINANCE]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
711
- [NetworkEnum$1.POLYGON]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
712
- [NetworkEnum$1.ARBITRUM]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
713
- [NetworkEnum$1.AVALANCHE]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
714
- [NetworkEnum$1.GNOSIS]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
715
- [NetworkEnum$1.COINBASE]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
716
- [NetworkEnum$1.OPTIMISM]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
717
- [NetworkEnum$1.ZKSYNC]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
718
- [NetworkEnum$1.LINEA]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
719
- [NetworkEnum$1.UNICHAIN]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f"),
720
- [NetworkEnum$1.SONIC]: new Address$1("0x8fdd04dbf6111437b44bbca99c28882434e0958f")
709
+ [NetworkEnum$1.ETHEREUM]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
710
+ [NetworkEnum$1.BINANCE]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
711
+ [NetworkEnum$1.POLYGON]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
712
+ [NetworkEnum$1.ARBITRUM]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
713
+ [NetworkEnum$1.AVALANCHE]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
714
+ [NetworkEnum$1.GNOSIS]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
715
+ [NetworkEnum$1.COINBASE]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
716
+ [NetworkEnum$1.OPTIMISM]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
717
+ [NetworkEnum$1.ZKSYNC]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
718
+ [NetworkEnum$1.LINEA]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
719
+ [NetworkEnum$1.UNICHAIN]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa"),
720
+ [NetworkEnum$1.SONIC]: new Address$1("0xdfd05fe230bfe7b212878414270c72c8345506fa")
721
721
  };
722
722
 
723
723
  //#endregion
@@ -1123,8 +1123,8 @@ var TakerTraits = class TakerTraits {
1123
1123
  let flags = new BN(0n);
1124
1124
  flags = flags.setBit(TakerTraits.IS_EXACT_IN_BIT_FLAG, this.exactIn);
1125
1125
  flags = flags.setBit(TakerTraits.SHOULD_UNWRAP_BIT_FLAG, this.shouldUnwrap);
1126
- flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG, !this.preTransferInCallbackData.isEmpty());
1127
- flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG, !this.preTransferOutCallbackData.isEmpty());
1126
+ flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG, this.preTransferInCallbackEnabled || !this.preTransferInCallbackData.isEmpty());
1127
+ flags = flags.setBit(TakerTraits.HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG, this.preTransferOutCallbackEnabled || !this.preTransferOutCallbackData.isEmpty());
1128
1128
  flags = flags.setBit(TakerTraits.IS_STRICT_THRESHOLD_BIT_FLAG, this.strictThreshold);
1129
1129
  flags = flags.setBit(TakerTraits.IS_FIRST_TRANSFER_FROM_TAKER_BIT_FLAG, this.firstTransferFromTaker);
1130
1130
  flags = flags.setBit(TakerTraits.USE_TRANSFER_FROM_AND_AQUA_PUSH_FLAG, this.useTransferFromAndAquaPush);
@@ -2005,11 +2005,159 @@ function mulDiv(a, b, c) {
2005
2005
  return a * b / c;
2006
2006
  }
2007
2007
 
2008
+ //#endregion
2009
+ //#region src/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/concentrate-liquidity-calculator.ts
2010
+ /**
2011
+ * Calculator for concentrated liquidity: given two tokens and a price range (min, spot, max),
2012
+ * computes sqrt prices and token reserves for "max allocation" (use all available balances)
2013
+ * or "fixed allocation" (fix one token amount and solve for the other).
2014
+ *
2015
+ * Token ordering follows the pool convention: token0 = lower address, token1 = higher address.
2016
+ * Prices are supplied as ScaledPrices with scale 10^(token0Decimals + token1Decimals); they are
2017
+ * converted internally to P = token1/token0 in 1e18 and then to sqrt(P * 1e18) for the math.
2018
+ */
2019
+ var ConcentrateLiquidityCalculator = class ConcentrateLiquidityCalculator {
2020
+ static ONE_E18 = 10n ** 18n;
2021
+ constructor(tokenA, tokenB) {
2022
+ this.tokenA = tokenA;
2023
+ this.tokenB = tokenB;
2024
+ }
2025
+ /**
2026
+ * Token with the smaller address (token0 in pool convention; "Lt" in the math).
2027
+ */
2028
+ get token0() {
2029
+ return this.tokenA.address.lt(this.tokenB.address) ? this.tokenA : this.tokenB;
2030
+ }
2031
+ /**
2032
+ * Token with the larger address (token1 in pool convention; "Gt" in the math).
2033
+ */
2034
+ get token1() {
2035
+ return this.tokenA.address.lt(this.tokenB.address) ? this.tokenB : this.tokenA;
2036
+ }
2037
+ static new(data) {
2038
+ return new ConcentrateLiquidityCalculator(data.tokenA, data.tokenB);
2039
+ }
2040
+ /**
2041
+ * Compute reserves when one token amount is fixed: the position uses exactly
2042
+ * `fixedReserve` of `fixedReserveForToken` and the other token amount is derived
2043
+ * to keep the same liquidity L. Returns sqrt prices and token0/token1
2044
+ * reserves (raw amounts).
2045
+ * Due to integer math (floor division, sqrt), the fixed asset amount in the result
2046
+ * may be less than requested by a few wei.
2047
+ */
2048
+ computeFixedAllocation(scaledPrices, fixedReserveForToken, fixedReserve) {
2049
+ const { minPriceRaw, spotPriceRaw, maxPriceRaw } = this.computeRawPrices(scaledPrices);
2050
+ const sqrtPriceMin = bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2051
+ const sqrtPriceSpot = bigintSqrt(spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2052
+ const sqrtPriceMax = bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2053
+ const isFixedLt = fixedReserveForToken.equal(this.token0.address);
2054
+ const availableLt = isFixedLt ? fixedReserve : UINT_256_MAX;
2055
+ const availableGt = isFixedLt ? UINT_256_MAX : fixedReserve;
2056
+ const { actualLt, actualGt } = computeLiquidityFromAmounts(availableLt, availableGt, sqrtPriceSpot, sqrtPriceMin, sqrtPriceMax);
2057
+ return {
2058
+ sqrtPriceMin,
2059
+ sqrtPriceSpot,
2060
+ sqrtPriceMax,
2061
+ token0Reserve: actualLt,
2062
+ token1Reserve: actualGt
2063
+ };
2064
+ }
2065
+ /**
2066
+ * Compute reserves when both token amounts are taken from token info: uses
2067
+ * token0.maxAvailableLiquidity and token1.maxAvailableLiquidity to maximize
2068
+ * L. Returns sqrt prices and the token0/token1 reserves that achieve
2069
+ * that maximum.
2070
+ */
2071
+ computeMaxAllocation(scaledPrices) {
2072
+ const { minPriceRaw, spotPriceRaw, maxPriceRaw } = this.computeRawPrices(scaledPrices);
2073
+ const sqrtPriceMin = bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2074
+ const sqrtPriceSpot = bigintSqrt(spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2075
+ const sqrtPriceMax = bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18);
2076
+ const { actualLt, actualGt } = computeLiquidityFromAmounts(this.token0.maxAvailableLiquidity, this.token1.maxAvailableLiquidity, sqrtPriceSpot, sqrtPriceMin, sqrtPriceMax);
2077
+ return {
2078
+ sqrtPriceMin,
2079
+ sqrtPriceSpot,
2080
+ sqrtPriceMax,
2081
+ token0Reserve: actualLt,
2082
+ token1Reserve: actualGt
2083
+ };
2084
+ }
2085
+ /**
2086
+ * Implied spot sqrt price from token0/token1 balances and a scaled price range
2087
+ * (same convention as {@link computeMaxAllocation}). Inverse of the allocation math; wraps
2088
+ * {@link computeLiquidityAndPrice} from concentrate-liquidity-math.
2089
+ *
2090
+ * @returns sqrt(P_spot) in 1e18 fixed-point (same as {@link ConcentratedLiquidityInfo.sqrtPriceSpot}).
2091
+ */
2092
+ computeSpotPrice(token0Balance, token1Balance, scaledPriceBounds) {
2093
+ const { sqrtPriceMin, sqrtPriceMax } = this.computeSqrtPriceBounds(scaledPriceBounds);
2094
+ const { sqrtPriceSpot } = computeLiquidityAndPrice(token0Balance, token1Balance, sqrtPriceMin, sqrtPriceMax);
2095
+ return sqrtPriceSpot;
2096
+ }
2097
+ /**
2098
+ * Convert user-facing ScaledPrices (scale 10^(token0Decimals+token1Decimals)) into internal
2099
+ * raw prices P = token1/token0 (before sqrt), so that sqrt(P * 1e18) can be
2100
+ * passed to the liquidity math. Handles both quote = token0 and quote = token1.
2101
+ */
2102
+ computeRawPrices(scaledPrices) {
2103
+ const { minPriceRaw, maxPriceRaw } = this.computeRawPriceBounds(scaledPrices);
2104
+ const token0 = this.token0;
2105
+ const token1 = this.token1;
2106
+ if (scaledPrices.quoteToken.equal(token0.address)) {
2107
+ const numerator = 10n ** (token1.decimals + token1.decimals) * ConcentrateLiquidityCalculator.ONE_E18;
2108
+ return {
2109
+ minPriceRaw,
2110
+ spotPriceRaw: numerator / scaledPrices.spotPriceRaw,
2111
+ maxPriceRaw
2112
+ };
2113
+ }
2114
+ if (scaledPrices.quoteToken.equal(token1.address)) {
2115
+ const denominator = 10n ** (token0.decimals + token0.decimals);
2116
+ return {
2117
+ minPriceRaw,
2118
+ spotPriceRaw: scaledPrices.spotPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator,
2119
+ maxPriceRaw
2120
+ };
2121
+ }
2122
+ throw new Error("unknown quote token");
2123
+ }
2124
+ computeSqrtPriceBounds(scaledPriceBounds) {
2125
+ const { minPriceRaw, maxPriceRaw } = this.computeRawPriceBounds(scaledPriceBounds);
2126
+ return {
2127
+ sqrtPriceMin: bigintSqrt(minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18),
2128
+ sqrtPriceMax: bigintSqrt(maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18)
2129
+ };
2130
+ }
2131
+ /**
2132
+ * Internal P = token1/token0 (1e18) from scaled min/max only (same mapping as {@link computeRawPrices}).
2133
+ */
2134
+ computeRawPriceBounds(scaledPriceBounds) {
2135
+ const token0 = this.token0;
2136
+ const token1 = this.token1;
2137
+ if (scaledPriceBounds.quoteToken.equal(token0.address)) {
2138
+ const numerator = 10n ** (token1.decimals + token1.decimals) * ConcentrateLiquidityCalculator.ONE_E18;
2139
+ return {
2140
+ minPriceRaw: numerator / scaledPriceBounds.maxPriceRaw,
2141
+ maxPriceRaw: numerator / scaledPriceBounds.minPriceRaw
2142
+ };
2143
+ }
2144
+ if (scaledPriceBounds.quoteToken.equal(token1.address)) {
2145
+ const denominator = 10n ** (token0.decimals + token0.decimals);
2146
+ return {
2147
+ minPriceRaw: scaledPriceBounds.minPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator,
2148
+ maxPriceRaw: scaledPriceBounds.maxPriceRaw * ConcentrateLiquidityCalculator.ONE_E18 / denominator
2149
+ };
2150
+ }
2151
+ throw new Error("unknown quote token");
2152
+ }
2153
+ };
2154
+
2008
2155
  //#endregion
2009
2156
  //#region src/swap-vm/instructions/concentrate/index.ts
2010
2157
  var concentrate_exports = {};
2011
2158
  __export(concentrate_exports, {
2012
2159
  ConcentrateGrowLiquidity2DArgs: () => ConcentrateGrowLiquidity2DArgs,
2160
+ ConcentrateLiquidityCalculator: () => ConcentrateLiquidityCalculator,
2013
2161
  ONE_E18: () => ONE_E18,
2014
2162
  bigintSqrt: () => bigintSqrt,
2015
2163
  computeBalances: () => computeBalances,
@@ -4046,4 +4194,4 @@ var abi_exports = {};
4046
4194
  __export(abi_exports, { SWAP_VM_ABI: () => SWAP_VM_ABI });
4047
4195
 
4048
4196
  //#endregion
4049
- export { abi_exports as ABI, AQUA_SWAP_VM_CONTRACT_ADDRESSES, Address, AquaAMMStrategy, AquaPeggedAmmStrategy, AquaProgramBuilder, AquaXYCAmmStrategy, CallInfo, HexString, MakerTraits, NetworkEnum, Order, ProgramBuilder, RegularProgramBuilder, SwapVMContract, SwapVmProgram, SwappedEvent, TakerTraits, instructions_exports as instructions };
4197
+ export { abi_exports as ABI, AQUA_SWAP_VM_CONTRACT_ADDRESSES, Address, AquaAMMStrategy, AquaPeggedAmmStrategy, AquaProgramBuilder, AquaXYCAmmStrategy, HexString, MakerTraits, NetworkEnum, Order, ProgramBuilder, RegularProgramBuilder, SwapVMContract, SwapVmProgram, SwappedEvent, TakerTraits, instructions_exports as instructions };
@@ -0,0 +1,61 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ import type { ConcentratedLiquidityInfo, ConcentrateLiquidityCalculatorArgs, ConcentrateTokenInfo, ScaledPriceBounds, ScaledPrices } from './types';
3
+ /**
4
+ * Calculator for concentrated liquidity: given two tokens and a price range (min, spot, max),
5
+ * computes sqrt prices and token reserves for "max allocation" (use all available balances)
6
+ * or "fixed allocation" (fix one token amount and solve for the other).
7
+ *
8
+ * Token ordering follows the pool convention: token0 = lower address, token1 = higher address.
9
+ * Prices are supplied as ScaledPrices with scale 10^(token0Decimals + token1Decimals); they are
10
+ * converted internally to P = token1/token0 in 1e18 and then to sqrt(P * 1e18) for the math.
11
+ */
12
+ export declare class ConcentrateLiquidityCalculator {
13
+ private readonly tokenA;
14
+ private readonly tokenB;
15
+ static readonly ONE_E18: bigint;
16
+ constructor(tokenA: ConcentrateTokenInfo, tokenB: ConcentrateTokenInfo);
17
+ /**
18
+ * Token with the smaller address (token0 in pool convention; "Lt" in the math).
19
+ */
20
+ get token0(): ConcentrateTokenInfo;
21
+ /**
22
+ * Token with the larger address (token1 in pool convention; "Gt" in the math).
23
+ */
24
+ get token1(): ConcentrateTokenInfo;
25
+ static new(data: ConcentrateLiquidityCalculatorArgs): ConcentrateLiquidityCalculator;
26
+ /**
27
+ * Compute reserves when one token amount is fixed: the position uses exactly
28
+ * `fixedReserve` of `fixedReserveForToken` and the other token amount is derived
29
+ * to keep the same liquidity L. Returns sqrt prices and token0/token1
30
+ * reserves (raw amounts).
31
+ * Due to integer math (floor division, sqrt), the fixed asset amount in the result
32
+ * may be less than requested by a few wei.
33
+ */
34
+ computeFixedAllocation(scaledPrices: ScaledPrices, fixedReserveForToken: Address, fixedReserve: bigint): ConcentratedLiquidityInfo;
35
+ /**
36
+ * Compute reserves when both token amounts are taken from token info: uses
37
+ * token0.maxAvailableLiquidity and token1.maxAvailableLiquidity to maximize
38
+ * L. Returns sqrt prices and the token0/token1 reserves that achieve
39
+ * that maximum.
40
+ */
41
+ computeMaxAllocation(scaledPrices: ScaledPrices): ConcentratedLiquidityInfo;
42
+ /**
43
+ * Implied spot sqrt price from token0/token1 balances and a scaled price range
44
+ * (same convention as {@link computeMaxAllocation}). Inverse of the allocation math; wraps
45
+ * {@link computeLiquidityAndPrice} from concentrate-liquidity-math.
46
+ *
47
+ * @returns sqrt(P_spot) in 1e18 fixed-point (same as {@link ConcentratedLiquidityInfo.sqrtPriceSpot}).
48
+ */
49
+ computeSpotPrice(token0Balance: bigint, token1Balance: bigint, scaledPriceBounds: ScaledPriceBounds): bigint;
50
+ /**
51
+ * Convert user-facing ScaledPrices (scale 10^(token0Decimals+token1Decimals)) into internal
52
+ * raw prices P = token1/token0 (before sqrt), so that sqrt(P * 1e18) can be
53
+ * passed to the liquidity math. Handles both quote = token0 and quote = token1.
54
+ */
55
+ private computeRawPrices;
56
+ private computeSqrtPriceBounds;
57
+ /**
58
+ * Internal P = token1/token0 (1e18) from scaled min/max only (same mapping as {@link computeRawPrices}).
59
+ */
60
+ private computeRawPriceBounds;
61
+ }
@@ -0,0 +1,61 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ import type { ConcentratedLiquidityInfo, ConcentrateLiquidityCalculatorArgs, ConcentrateTokenInfo, ScaledPriceBounds, ScaledPrices } from './types';
3
+ /**
4
+ * Calculator for concentrated liquidity: given two tokens and a price range (min, spot, max),
5
+ * computes sqrt prices and token reserves for "max allocation" (use all available balances)
6
+ * or "fixed allocation" (fix one token amount and solve for the other).
7
+ *
8
+ * Token ordering follows the pool convention: token0 = lower address, token1 = higher address.
9
+ * Prices are supplied as ScaledPrices with scale 10^(token0Decimals + token1Decimals); they are
10
+ * converted internally to P = token1/token0 in 1e18 and then to sqrt(P * 1e18) for the math.
11
+ */
12
+ export declare class ConcentrateLiquidityCalculator {
13
+ private readonly tokenA;
14
+ private readonly tokenB;
15
+ static readonly ONE_E18: bigint;
16
+ constructor(tokenA: ConcentrateTokenInfo, tokenB: ConcentrateTokenInfo);
17
+ /**
18
+ * Token with the smaller address (token0 in pool convention; "Lt" in the math).
19
+ */
20
+ get token0(): ConcentrateTokenInfo;
21
+ /**
22
+ * Token with the larger address (token1 in pool convention; "Gt" in the math).
23
+ */
24
+ get token1(): ConcentrateTokenInfo;
25
+ static new(data: ConcentrateLiquidityCalculatorArgs): ConcentrateLiquidityCalculator;
26
+ /**
27
+ * Compute reserves when one token amount is fixed: the position uses exactly
28
+ * `fixedReserve` of `fixedReserveForToken` and the other token amount is derived
29
+ * to keep the same liquidity L. Returns sqrt prices and token0/token1
30
+ * reserves (raw amounts).
31
+ * Due to integer math (floor division, sqrt), the fixed asset amount in the result
32
+ * may be less than requested by a few wei.
33
+ */
34
+ computeFixedAllocation(scaledPrices: ScaledPrices, fixedReserveForToken: Address, fixedReserve: bigint): ConcentratedLiquidityInfo;
35
+ /**
36
+ * Compute reserves when both token amounts are taken from token info: uses
37
+ * token0.maxAvailableLiquidity and token1.maxAvailableLiquidity to maximize
38
+ * L. Returns sqrt prices and the token0/token1 reserves that achieve
39
+ * that maximum.
40
+ */
41
+ computeMaxAllocation(scaledPrices: ScaledPrices): ConcentratedLiquidityInfo;
42
+ /**
43
+ * Implied spot sqrt price from token0/token1 balances and a scaled price range
44
+ * (same convention as {@link computeMaxAllocation}). Inverse of the allocation math; wraps
45
+ * {@link computeLiquidityAndPrice} from concentrate-liquidity-math.
46
+ *
47
+ * @returns sqrt(P_spot) in 1e18 fixed-point (same as {@link ConcentratedLiquidityInfo.sqrtPriceSpot}).
48
+ */
49
+ computeSpotPrice(token0Balance: bigint, token1Balance: bigint, scaledPriceBounds: ScaledPriceBounds): bigint;
50
+ /**
51
+ * Convert user-facing ScaledPrices (scale 10^(token0Decimals+token1Decimals)) into internal
52
+ * raw prices P = token1/token0 (before sqrt), so that sqrt(P * 1e18) can be
53
+ * passed to the liquidity math. Handles both quote = token0 and quote = token1.
54
+ */
55
+ private computeRawPrices;
56
+ private computeSqrtPriceBounds;
57
+ /**
58
+ * Internal P = token1/token0 (1e18) from scaled min/max only (same mapping as {@link computeRawPrices}).
59
+ */
60
+ private computeRawPriceBounds;
61
+ }
@@ -18,6 +18,11 @@ export type ScaledPrices = {
18
18
  spotPriceRaw: bigint;
19
19
  maxPriceRaw: bigint;
20
20
  };
21
+ /**
22
+ * Price range only (no spot): same scaling and quote convention as {@link ScaledPrices}.
23
+ * Used when deriving spot from balances and bounds.
24
+ */
25
+ export type ScaledPriceBounds = Pick<ScaledPrices, 'quoteToken' | 'minPriceRaw' | 'maxPriceRaw'>;
21
26
  /**
22
27
  * Result of allocation: sqrt prices and the token0/token1 reserves
23
28
  * (raw amounts) to use for the concentrated liquidity position.
@@ -18,6 +18,11 @@ export type ScaledPrices = {
18
18
  spotPriceRaw: bigint;
19
19
  maxPriceRaw: bigint;
20
20
  };
21
+ /**
22
+ * Price range only (no spot): same scaling and quote convention as {@link ScaledPrices}.
23
+ * Used when deriving spot from balances and bounds.
24
+ */
25
+ export type ScaledPriceBounds = Pick<ScaledPrices, 'quoteToken' | 'minPriceRaw' | 'maxPriceRaw'>;
21
26
  /**
22
27
  * Result of allocation: sqrt prices and the token0/token1 reserves
23
28
  * (raw amounts) to use for the concentrated liquidity position.
@@ -1,5 +1,6 @@
1
1
  export * from './opcodes';
2
2
  export { ConcentrateGrowLiquidity2DArgs, ONE_E18 } from './concentrate-grow-liquidity-2d-args';
3
3
  export { computeLiquidityFromAmounts, computeBalances, computeLiquidityAndPrice, } from './concentrate-liquidity-math/concentrate-liquidity-math';
4
- export type { ConcentrateTokenInfo, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
4
+ export { ConcentrateLiquidityCalculator } from './concentrate-liquidity-calculator/concentrate-liquidity-calculator';
5
+ export type { ConcentrateTokenInfo, ConcentrateLiquidityCalculatorArgs, ScaledPriceBounds, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
5
6
  export * from './bigint-sqrt';
@@ -1,5 +1,6 @@
1
1
  export * from './opcodes';
2
2
  export { ConcentrateGrowLiquidity2DArgs, ONE_E18 } from './concentrate-grow-liquidity-2d-args';
3
3
  export { computeLiquidityFromAmounts, computeBalances, computeLiquidityAndPrice, } from './concentrate-liquidity-math/concentrate-liquidity-math';
4
- export type { ConcentrateTokenInfo, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
4
+ export { ConcentrateLiquidityCalculator } from './concentrate-liquidity-calculator/concentrate-liquidity-calculator';
5
+ export type { ConcentrateTokenInfo, ConcentrateLiquidityCalculatorArgs, ScaledPriceBounds, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
5
6
  export * from './bigint-sqrt';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1inch/swap-vm-sdk",
3
- "version": "0.1.2-rc.3",
3
+ "version": "0.1.2-rc.5",
4
4
  "description": "1inch Swap VM SDK",
5
5
  "author": "@1inch",
6
6
  "license": "LicenseRef-Degensoft-SwapVM-1.1",