@nradko/metric-omm-sdk-v1 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +96 -12
  2. package/dist/abis/MetricOmmSimpleRouter.d.ts +44 -0
  3. package/dist/abis/MetricOmmSimpleRouter.d.ts.map +1 -1
  4. package/dist/abis/MetricOmmSimpleRouter.js +58 -0
  5. package/dist/abis/MetricOmmSimpleRouter.js.map +1 -1
  6. package/dist/abis/MetricOmmSwapQuoter.d.ts +26 -2
  7. package/dist/abis/MetricOmmSwapQuoter.d.ts.map +1 -1
  8. package/dist/abis/MetricOmmSwapQuoter.js +34 -2
  9. package/dist/abis/MetricOmmSwapQuoter.js.map +1 -1
  10. package/dist/abis/index.d.ts +0 -1
  11. package/dist/abis/index.d.ts.map +1 -1
  12. package/dist/abis/index.js +0 -1
  13. package/dist/abis/index.js.map +1 -1
  14. package/dist/addresses.d.ts +0 -2
  15. package/dist/addresses.d.ts.map +1 -1
  16. package/dist/addresses.js +8 -9
  17. package/dist/addresses.js.map +1 -1
  18. package/dist/dataProvider/index.d.ts +1 -1
  19. package/dist/dataProvider/index.d.ts.map +1 -1
  20. package/dist/dataProvider/index.js +1 -1
  21. package/dist/dataProvider/index.js.map +1 -1
  22. package/dist/dataProvider/read.d.ts +1 -3
  23. package/dist/dataProvider/read.d.ts.map +1 -1
  24. package/dist/dataProvider/read.js +1 -3
  25. package/dist/dataProvider/read.js.map +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +3 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/pool/liquidity.d.ts +83 -7
  31. package/dist/pool/liquidity.d.ts.map +1 -1
  32. package/dist/pool/liquidity.js +63 -3
  33. package/dist/pool/liquidity.js.map +1 -1
  34. package/dist/router/fromRoute.d.ts +93 -0
  35. package/dist/router/fromRoute.d.ts.map +1 -0
  36. package/dist/router/fromRoute.js +187 -0
  37. package/dist/router/fromRoute.js.map +1 -0
  38. package/dist/router/index.d.ts +8 -1
  39. package/dist/router/index.d.ts.map +1 -1
  40. package/dist/router/index.js +8 -1
  41. package/dist/router/index.js.map +1 -1
  42. package/dist/router/nativeSwap.d.ts +47 -0
  43. package/dist/router/nativeSwap.d.ts.map +1 -0
  44. package/dist/router/nativeSwap.js +89 -0
  45. package/dist/router/nativeSwap.js.map +1 -0
  46. package/dist/router/swap.d.ts +82 -1
  47. package/dist/router/swap.d.ts.map +1 -1
  48. package/dist/router/swap.js +51 -1
  49. package/dist/router/swap.js.map +1 -1
  50. package/dist/router/swapPath.d.ts +46 -1
  51. package/dist/router/swapPath.d.ts.map +1 -1
  52. package/dist/router/swapPath.js +34 -0
  53. package/dist/router/swapPath.js.map +1 -1
  54. package/dist/router/utils.d.ts +9 -0
  55. package/dist/router/utils.d.ts.map +1 -0
  56. package/dist/router/utils.js +27 -0
  57. package/dist/router/utils.js.map +1 -0
  58. package/package.json +2 -2
  59. package/src/abis/MetricOmmSimpleRouter.ts +58 -0
  60. package/src/abis/MetricOmmSwapQuoter.ts +34 -2
  61. package/src/abis/index.ts +0 -1
  62. package/src/addresses.ts +8 -11
  63. package/src/dataProvider/index.ts +0 -1
  64. package/src/dataProvider/read.ts +1 -4
  65. package/src/index.ts +22 -2
  66. package/src/pool/liquidity.ts +83 -7
  67. package/src/router/fromRoute.ts +318 -0
  68. package/src/router/index.ts +36 -1
  69. package/src/router/nativeSwap.ts +123 -0
  70. package/src/router/swap.ts +82 -1
  71. package/src/router/swapPath.ts +47 -1
  72. package/src/router/utils.ts +31 -0
  73. package/dist/abis/MetricOmmPoolStateView.d.ts +0 -238
  74. package/dist/abis/MetricOmmPoolStateView.d.ts.map +0 -1
  75. package/dist/abis/MetricOmmPoolStateView.js +0 -315
  76. package/dist/abis/MetricOmmPoolStateView.js.map +0 -1
  77. package/src/abis/MetricOmmPoolStateView.ts +0 -314
@@ -1,4 +1,15 @@
1
1
  export const MetricOmmSwapQuoterAbi = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: "uint128",
6
+ name: "amount",
7
+ type: "uint128",
8
+ },
9
+ ],
10
+ name: "AmountTooLarge",
11
+ type: "error",
12
+ },
2
13
  {
3
14
  inputs: [
4
15
  {
@@ -78,6 +89,27 @@ export const MetricOmmSwapQuoterAbi = [
78
89
  name: "InvalidPriceLimitForDirection",
79
90
  type: "error",
80
91
  },
92
+ {
93
+ inputs: [
94
+ {
95
+ internalType: "bool",
96
+ name: "zeroForOne",
97
+ type: "bool",
98
+ },
99
+ {
100
+ internalType: "uint128",
101
+ name: "priceLimitX64",
102
+ type: "uint128",
103
+ },
104
+ ],
105
+ name: "InvalidPriceLimitForDirection",
106
+ type: "error",
107
+ },
108
+ {
109
+ inputs: [],
110
+ name: "InvalidSwapDeltas",
111
+ type: "error",
112
+ },
81
113
  {
82
114
  inputs: [],
83
115
  name: "InvalidSwapDeltas",
@@ -192,12 +224,12 @@ export const MetricOmmSwapQuoterAbi = [
192
224
  outputs: [
193
225
  {
194
226
  internalType: "uint256",
195
- name: "",
227
+ name: "totalIn",
196
228
  type: "uint256",
197
229
  },
198
230
  {
199
231
  internalType: "uint256",
200
- name: "",
232
+ name: "totalOut",
201
233
  type: "uint256",
202
234
  },
203
235
  ],
package/src/abis/index.ts CHANGED
@@ -5,7 +5,6 @@
5
5
  export { MetricOmmPoolAbi } from "./MetricOmmPool.js";
6
6
  export { MetricOmmPoolDataProviderAbi } from "./MetricOmmPoolDataProvider.js";
7
7
  export { MetricOmmSwapQuoterAbi } from "./MetricOmmSwapQuoter.js";
8
- export { MetricOmmPoolStateViewAbi } from "./MetricOmmPoolStateView.js";
9
8
  export { MetricOmmSimpleRouterAbi } from "./MetricOmmSimpleRouter.js";
10
9
  export { MetricOmmPoolLiquidityAdderAbi } from "./MetricOmmPoolLiquidityAdder.js";
11
10
  export { MetricOmmPoolFactoryAbi } from "./MetricOmmPoolFactory.js";
package/src/addresses.ts CHANGED
@@ -38,8 +38,6 @@ export interface ChainAddresses {
38
38
  liquidityAdder: Address;
39
39
  /** MetricOmmPoolDataProvider (pool reads, swap depth, revert quotes). */
40
40
  dataProvider: Address;
41
- /** MetricOmmPoolStateView (raw pool storage reads). */
42
- stateView: Address;
43
41
  /** MetricOmmSimpleRouter (single- and multi-hop ERC-20 swaps). */
44
42
  simpleRouter: Address;
45
43
  /** MetricOmmSwapQuoter (live pool quotes via revert callback). */
@@ -62,16 +60,15 @@ export interface ChainAddresses {
62
60
  const PROTOCOL_ADDRESSES = {
63
61
  factory: "0x567C7205107257650dC73a73d87b879a45F5b6F6",
64
62
  poolDeployer: "0xBe34D0cEb6CF1acbf55dEf35E4dC3e17BDfb6AE4",
65
- liquidityAdder: "0x323B95ABcE8b3025829980bb19d1Fd819808FCB2",
66
- dataProvider: "0x5A100da447833D94b8e50AeD1916D7488D15D3fc",
67
- stateView: "0xb40F8B0cfBB6a01c3232c6D063B1F87d1C0bE40f",
68
- simpleRouter: "0x18f85056444452E718cD680A08f219B2347FE672",
69
- quoter: "0x0000000000000000000000000000000000000000",
63
+ liquidityAdder: "0xA49acb20f33e4FB340f41d949fd7E4c48A242579",
64
+ dataProvider: "0x803Cb583c1FbE97e9cA7899bE77cC110A78B8737",
65
+ simpleRouter: "0x146D72ad62957F62ABCC14985aBFCC32a785F996",
66
+ quoter: "0x8A45A0239DE0C8f438392f2E5AFcbee316E64965",
70
67
  extensions: {
71
- depositAllowlistExtension: "0x088B0CCBdb17531132173a30428f66c1d5A73794",
72
- swapAllowlistExtension: "0x952D844e166E6FAaF73a5e56F0fB0C54543a0f69",
73
- oracleValueStopLossExtension: "0x9694959a452283d86eBF4EF4eB5651dEAa1eCec1",
74
- priceVelocityGuardExtension: "0xa53E5db6c18Ce258b3090F1470c5fE7f2e0215Fc",
68
+ depositAllowlistExtension: "0xEd246C7B6963E20aa4fCa4912Af8E2Bff6Ca5f4D",
69
+ swapAllowlistExtension: "0x54BF5ba3c5C6C513722a54771b2F2A609e2e3A75",
70
+ oracleValueStopLossExtension: "0x6063a740034E85d34cC55Bc7069BC7b7cdE888bf",
71
+ priceVelocityGuardExtension: "0xda4c0860d9fa8d254e425d485BD9C09BD2b051F7",
75
72
  },
76
73
  } as const satisfies Omit<ChainAddresses, "wrappedNative">;
77
74
 
@@ -10,7 +10,6 @@ export {
10
10
  getBinStatesScaled,
11
11
  getBinTotalShares,
12
12
  getPositionBinSharesFromDataProvider,
13
- getPositionBinSharesFromStateView,
14
13
  toPositionBinKey,
15
14
  getPositionBinSharesRange,
16
15
  getPriceProvider,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * MetricAMM SDK - DataProvider read functions
3
- * Batch reads via MetricOmmPoolDataProvider (mainnet lens; inherits StateView reads).
3
+ * Batch reads via MetricOmmPoolDataProvider.
4
4
  */
5
5
 
6
6
  import type { Address, PublicClient } from "viem";
@@ -341,6 +341,3 @@ export async function getPriceProvider(
341
341
  args: [poolAddress],
342
342
  })) as Address;
343
343
  }
344
-
345
- /** @deprecated Use getPositionBinSharesFromDataProvider */
346
- export const getPositionBinSharesFromStateView = getPositionBinSharesFromDataProvider;
package/src/index.ts CHANGED
@@ -47,7 +47,6 @@ export {
47
47
  MetricOmmPoolAbi,
48
48
  MetricOmmPoolDataProviderAbi,
49
49
  MetricOmmSwapQuoterAbi,
50
- MetricOmmPoolStateViewAbi,
51
50
  MetricOmmSimpleRouterAbi,
52
51
  MetricOmmPoolLiquidityAdderAbi,
53
52
  MetricOmmPoolFactoryAbi,
@@ -95,7 +94,6 @@ export {
95
94
  getBinStatesScaled,
96
95
  getBinTotalShares,
97
96
  getPositionBinSharesFromDataProvider,
98
- getPositionBinSharesFromStateView,
99
97
  toPositionBinKey,
100
98
  getPositionBinSharesRange,
101
99
  getPriceProvider,
@@ -170,6 +168,17 @@ export {
170
168
  prepareExactOutputSingleCalldata,
171
169
  prepareExactInputCalldata,
172
170
  prepareExactOutputCalldata,
171
+ encodeMulticallCalldata,
172
+ encodeRefundETHCalldata,
173
+ encodeUnwrapWETH9Calldata,
174
+ prepareExactInputSingleAndUnwrapCalldata,
175
+ prepareExactInputAndUnwrapCalldata,
176
+ prepareExactInputSingleSupportingNativePaymentCalldata,
177
+ prepareExactInputSupportingNativePaymentCalldata,
178
+ prepareExactOutputSupportingNativePaymentCalldata,
179
+ prepareExactOutputSingleSupportingNativePaymentCalldata,
180
+ prepareExactOutputSingleAndUnwrapCalldata,
181
+ prepareExactOutputAndUnwrapCalldata,
173
182
  type ExactInputSingleParams,
174
183
  type ExactOutputSingleParams,
175
184
  type ExactInputParams,
@@ -178,6 +187,17 @@ export {
178
187
  type BuildExactOutputSingleParams,
179
188
  type BuildExactInputParams,
180
189
  type BuildExactOutputParams,
190
+ prepareExactInputFromRoute,
191
+ prepareExactOutputFromRoute,
192
+ type TradeType,
193
+ type RouteType,
194
+ type RouteLegResponse,
195
+ type RouteOptionResponse,
196
+ type RouteResponse,
197
+ type PrepareExactInputFromRouteParams,
198
+ type PrepareExactOutputFromRouteParams,
199
+ type PreparedExactInputFromRoute,
200
+ type PreparedExactOutputFromRoute,
181
201
  } from "./router/index.js";
182
202
 
183
203
  // ============ Factory Functions ============
@@ -1,6 +1,16 @@
1
1
  /**
2
- * MetricAMM SDK - Liquidity
3
- * Unified liquidity calculations and position operations.
2
+ * Liquidity position builders and calldata encoders.
3
+ *
4
+ * **Add liquidity (recommended path):**
5
+ * 1. `buildModifyLiquidityArgsForAddition` / `ForUniformAddition` / `ForUniformAdditionWithTotalTokenAmount`
6
+ * 2. `buildAddLiquidityExactSharesParamsFromBinTargets` (optional convenience)
7
+ * 3. `encodeAddLiquidityExactSharesSelfCalldata` — target `addresses.liquidityAdder`
8
+ * 4. Approve token0 and token1 on the LiquidityAdder for `maxAmountToken0` / `maxAmountToken1`
9
+ *
10
+ * **Remove liquidity:** `buildModifyLiquidityArgsForRemoval` → `buildRemoveLiquidityPoolDelta`
11
+ * → `encodeRemoveLiquidityCalldata` — call the **pool** directly (no adder approval).
12
+ *
13
+ * Position identity is `(owner, salt)`; use the same `salt` for adds and removes.
4
14
  */
5
15
 
6
16
  import type { Address, PublicClient, Hex } from "viem";
@@ -40,19 +50,27 @@ function getLiquidityAdderFunction(name: string, inputCount: number) {
40
50
  return item;
41
51
  }
42
52
 
53
+ /** High-level removal options (used by UI helpers). Prefer {@link BuildModifyLiquidityArgsForRemovalParams} in SDK code. */
43
54
  export interface RemoveLiquidityParams {
55
+ /** Percent of each selected bin's shares to burn (0–100). */
44
56
  percentageToRemove: number;
57
+ /** Explicit bin list; when omitted, scans `lowerBin`–`upperBin` for position shares. */
45
58
  bins?: number[];
46
59
  lowerBin?: number;
47
60
  upperBin?: number;
48
61
  }
49
62
 
63
+ /** Per-bin removal: specify exactly one of `percentageToRemove` or `sharesToRemove`. */
50
64
  export interface BinRemovalSpec {
51
65
  bin: number;
52
66
  percentageToRemove?: number;
53
67
  sharesToRemove?: bigint;
54
68
  }
55
69
 
70
+ /**
71
+ * Sentinel passed as `specAmount0` / `specAmount1` on removals — no minimum output enforced.
72
+ * Same value the pool uses for "accept any amount" on `modifyLiquidity` removes.
73
+ */
56
74
  export const NO_SLIPPAGE_LIMIT = MAX_INT128;
57
75
 
58
76
  type ModifyLiquidityParams = {
@@ -62,30 +80,39 @@ type ModifyLiquidityParams = {
62
80
  specAmount1: bigint;
63
81
  };
64
82
 
83
+ /**
84
+ * Tuple for low-level `modifyLiquidity` on the pool:
85
+ * `[salt, deltas, specAmount0, specAmount1]`.
86
+ * Prefer LiquidityAdder encode helpers for additions.
87
+ */
65
88
  export type ModifyLiquidityArgs = readonly [bigint, LiquidityDelta[], bigint, bigint];
66
89
 
67
90
  export interface BuildModifyLiquidityArgsBase {
68
91
  publicClient: PublicClient;
69
- /** MetricOmmPoolDataProvider address (`addresses.dataProvider` on mainnet). */
92
+ /** MetricOmmPoolDataProvider (`addresses.dataProvider`). */
70
93
  dataProviderAddress: Address;
71
94
  poolAddress: Address;
95
+ /** Extra headroom on spec amounts (percent); `0` = exact computed caps. */
72
96
  specAmountBufferPercent?: number;
73
97
  }
74
98
 
75
- /** Addition builders read pool immutables via `getImmutables()` removal only needs the data provider lens. */
99
+ /** Addition builders need the factory to read pool immutables (decimals, bin range). */
76
100
  export interface BuildModifyLiquidityArgsWithFactory extends BuildModifyLiquidityArgsBase {
77
101
  factoryAddress: Address;
78
102
  }
79
103
 
104
+ /** Per-bin target amounts for {@link buildModifyLiquidityArgsForAddition}. */
80
105
  export interface BuildModifyLiquidityArgsForAdditionParams extends BuildModifyLiquidityArgsWithFactory {
81
106
  bins: LiquidityBinValueInput[];
82
- /** Human-readable price (token1 per token0). Omit when using currentPriceX64. */
107
+ /** Human price token1/token0; omit when `currentPriceX64` is set. */
83
108
  currentPrice?: number;
84
- /** On-chain Q64 price. Preferred over currentPrice when available from slot0 / oracle. */
109
+ /** Q64.64 price from slot0; preferred over `currentPrice`. */
85
110
  currentPriceX64?: bigint;
111
+ /** Position salt; default `0n`. Reuse across adds to the same position. */
86
112
  salt?: bigint;
87
113
  }
88
114
 
115
+ /** Same value in every bin from `lowerBin` through `upperBin` inclusive. */
89
116
  export interface BuildModifyLiquidityArgsForUniformAdditionParams extends BuildModifyLiquidityArgsWithFactory {
90
117
  amountInTokensPerBin: bigint;
91
118
  amountIsInToken0: boolean;
@@ -95,6 +122,7 @@ export interface BuildModifyLiquidityArgsForUniformAdditionParams extends BuildM
95
122
  salt?: bigint;
96
123
  }
97
124
 
125
+ /** Split a total token budget across `bins` (optional `weights`); calibrates share scaling on-chain. */
98
126
  export interface BuildModifyLiquidityArgsForUniformAdditionWithTotalTokenAmountParams extends BuildModifyLiquidityArgsWithFactory {
99
127
  bins: number[];
100
128
  weights?: number[];
@@ -104,6 +132,7 @@ export interface BuildModifyLiquidityArgsForUniformAdditionWithTotalTokenAmountP
104
132
  salt?: bigint;
105
133
  }
106
134
 
135
+ /** Remove the same percentage from all bins with liquidity (or from explicit `bins`). */
107
136
  export interface BuildModifyLiquidityArgsForPercentageRemovalParams extends BuildModifyLiquidityArgsBase {
108
137
  owner: Address;
109
138
  salt: bigint;
@@ -113,6 +142,7 @@ export interface BuildModifyLiquidityArgsForPercentageRemovalParams extends Buil
113
142
  upperBin?: number;
114
143
  }
115
144
 
145
+ /** Granular per-bin removal specs. */
116
146
  export interface BuildModifyLiquidityArgsForRemovalParams extends BuildModifyLiquidityArgsBase {
117
147
  owner: Address;
118
148
  salt: bigint;
@@ -130,7 +160,10 @@ function resolvePriceE18(params: { currentPrice?: number; currentPriceX64?: bigi
130
160
  }
131
161
 
132
162
  /**
133
- * Prepare uniform liquidity distribution across a bin range.
163
+ * Uniform liquidity: same token amount in every bin from `lowerBin` to `upperBin`.
164
+ * Delegates to {@link buildModifyLiquidityArgsForAddition}.
165
+ *
166
+ * @returns `[salt, deltas, specAmount0, specAmount1]` — max token caps for the adder.
134
167
  */
135
168
  export async function buildModifyLiquidityArgsForUniformAddition({
136
169
  publicClient,
@@ -517,6 +550,11 @@ export async function buildModifyLiquidityArgsForAddition({
517
550
  return toModifyLiquidityArgs(computed);
518
551
  }
519
552
 
553
+ /**
554
+ * Remove liquidity by explicit per-bin specs (percentage or absolute shares).
555
+ *
556
+ * `specAmount0` / `specAmount1` are set to {@link NO_SLIPPAGE_LIMIT} (accept any output).
557
+ */
520
558
  export async function buildModifyLiquidityArgsForRemoval(
521
559
  params: BuildModifyLiquidityArgsForRemovalParams,
522
560
  ): Promise<ModifyLiquidityArgs> {
@@ -598,6 +636,10 @@ export async function buildModifyLiquidityArgsForRemoval(
598
636
  return toModifyLiquidityArgs(computed);
599
637
  }
600
638
 
639
+ /**
640
+ * Remove the same `percentageToRemove` from every bin that has position shares.
641
+ * When `bins` is omitted, discovers bins via `getPositionBinSharesRange(lowerBin, upperBin)`.
642
+ */
601
643
  export async function buildModifyLiquidityArgsForPercentageRemoval({
602
644
  publicClient,
603
645
  dataProviderAddress,
@@ -650,6 +692,7 @@ export async function buildModifyLiquidityArgsForPercentageRemoval({
650
692
  });
651
693
  }
652
694
 
695
+ /** Convert positive `deltaShares` from a modify plan into `PoolLiquidityDelta` for the adder. */
653
696
  export function additionPlanToPoolLiquidityDelta(
654
697
  deltas: readonly LiquidityDelta[],
655
698
  ): PoolLiquidityDelta {
@@ -660,6 +703,7 @@ export function additionPlanToPoolLiquidityDelta(
660
703
  };
661
704
  }
662
705
 
706
+ /** Convert negative `deltaShares` from a modify plan into burn `PoolLiquidityDelta` for `removeLiquidity`. */
663
707
  export function removalPlanToPoolLiquidityDelta(
664
708
  deltas: readonly LiquidityDelta[],
665
709
  ): PoolLiquidityDelta {
@@ -698,6 +742,19 @@ export function scaleWeightedPoolDeltasToFitCaps(params: {
698
742
  return { binIdxs: weights.binIdxs, shares };
699
743
  }
700
744
 
745
+ /**
746
+ * Convenience wrapper: bin targets → adder-ready `{ salt, poolLiquidityDelta, maxAmountToken0, maxAmountToken1 }`.
747
+ *
748
+ * @example
749
+ * ```ts
750
+ * const add = await buildAddLiquidityExactSharesParamsFromBinTargets({
751
+ * publicClient, factoryAddress, dataProviderAddress, poolAddress,
752
+ * bins: [{ bin: 0, targetValueInToken: parseUnits("100", 6), targetValueInToken0: false }],
753
+ * currentPriceX64: slot0.priceX64,
754
+ * });
755
+ * const data = encodeAddLiquidityExactSharesSelfCalldata({ pool: poolAddress, ...add });
756
+ * ```
757
+ */
701
758
  export async function buildAddLiquidityExactSharesParamsFromBinTargets(
702
759
  params: BuildModifyLiquidityArgsForAdditionParams,
703
760
  ): Promise<{
@@ -715,6 +772,11 @@ export async function buildAddLiquidityExactSharesParamsFromBinTargets(
715
772
  };
716
773
  }
717
774
 
775
+ /**
776
+ * Encode `LiquidityAdder.addLiquidityExactShares(pool, salt, deltas, max0, max1, ext)`
777
+ * for `msg.sender` as position owner.
778
+ * Approve both pool tokens on the LiquidityAdder before sending.
779
+ */
718
780
  export function encodeAddLiquidityExactSharesSelfCalldata(params: {
719
781
  pool: Address;
720
782
  salt: bigint;
@@ -737,6 +799,10 @@ export function encodeAddLiquidityExactSharesSelfCalldata(params: {
737
799
  });
738
800
  }
739
801
 
802
+ /**
803
+ * Same as {@link encodeAddLiquidityExactSharesSelfCalldata} but credits liquidity to `owner`
804
+ * (e.g. router or vault acting on behalf of a user).
805
+ */
740
806
  export function encodeAddLiquidityExactSharesWithOwnerCalldata(params: {
741
807
  pool: Address;
742
808
  owner: Address;
@@ -761,6 +827,10 @@ export function encodeAddLiquidityExactSharesWithOwnerCalldata(params: {
761
827
  });
762
828
  }
763
829
 
830
+ /**
831
+ * Encode weighted add: `weightDeltas` are relative share weights; the adder scales to fit
832
+ * `maxAmountToken0` / `maxAmountToken1`. Use {@link scaleWeightedPoolDeltasToFitCaps} to pre-scale.
833
+ */
764
834
  export function encodeAddLiquidityWeightedSelfCalldata(params: {
765
835
  pool: Address;
766
836
  salt: bigint;
@@ -791,6 +861,7 @@ export function encodeAddLiquidityWeightedSelfCalldata(params: {
791
861
  });
792
862
  }
793
863
 
864
+ /** Weighted add with explicit `owner` (7-arg overload on LiquidityAdder). */
794
865
  export function encodeAddLiquidityWeightedWithOwnerCalldata(params: {
795
866
  pool: Address;
796
867
  owner: Address;
@@ -823,6 +894,10 @@ export function encodeAddLiquidityWeightedWithOwnerCalldata(params: {
823
894
  });
824
895
  }
825
896
 
897
+ /**
898
+ * Encode `Pool.removeLiquidity(owner, salt, deltas, extensionData)`.
899
+ * Send to the **pool** contract; no token approval required (tokens are sent out).
900
+ */
826
901
  export function encodeRemoveLiquidityCalldata(params: {
827
902
  owner: Address;
828
903
  salt: bigint;
@@ -841,6 +916,7 @@ export function encodeRemoveLiquidityCalldata(params: {
841
916
  });
842
917
  }
843
918
 
919
+ /** Build `{ salt, poolLiquidityDelta }` for {@link encodeRemoveLiquidityCalldata}. */
844
920
  export async function buildRemoveLiquidityPoolDelta(
845
921
  params: BuildModifyLiquidityArgsForRemovalParams,
846
922
  ): Promise<{ salt: bigint; poolLiquidityDelta: PoolLiquidityDelta }> {