@logswap/sdk 0.5.102 → 0.5.103

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 (64) hide show
  1. package/README.md +14 -418
  2. package/dist/actions.d.ts +0 -39
  3. package/dist/actions.js +0 -39
  4. package/dist/admin.d.ts +0 -106
  5. package/dist/admin.js +1 -96
  6. package/dist/chains.d.ts +0 -49
  7. package/dist/chains.js +0 -30
  8. package/dist/claims.d.ts +0 -32
  9. package/dist/claims.js +0 -30
  10. package/dist/client.d.ts +0 -116
  11. package/dist/client.js +1 -231
  12. package/dist/fees.d.ts +1 -45
  13. package/dist/fees.js +0 -44
  14. package/dist/fpool.d.ts +4 -612
  15. package/dist/fpool.js +14 -490
  16. package/dist/generated.js +0 -30
  17. package/dist/history.d.ts +0 -61
  18. package/dist/history.js +5 -74
  19. package/dist/ids.d.ts +0 -30
  20. package/dist/ids.js +0 -31
  21. package/dist/index.d.ts +0 -7
  22. package/dist/index.js +0 -7
  23. package/dist/indexer.d.ts +0 -68
  24. package/dist/indexer.js +1 -77
  25. package/dist/keys.d.ts +0 -50
  26. package/dist/keys.js +0 -35
  27. package/dist/liquidity.d.ts +0 -128
  28. package/dist/liquidity.js +1 -107
  29. package/dist/onboard.d.ts +0 -52
  30. package/dist/onboard.js +1 -59
  31. package/dist/pools.d.ts +3 -157
  32. package/dist/pools.js +1 -164
  33. package/dist/positions.d.ts +0 -102
  34. package/dist/positions.js +1 -90
  35. package/dist/quote.d.ts +0 -14
  36. package/dist/quote.js +0 -14
  37. package/dist/swap.d.ts +0 -31
  38. package/dist/swap.js +5 -37
  39. package/dist/tokencache.d.ts +0 -48
  40. package/dist/tokencache.js +1 -73
  41. package/dist/write.d.ts +1 -87
  42. package/dist/write.js +1 -87
  43. package/package.json +3 -8
  44. package/src/actions.ts +0 -208
  45. package/src/admin.ts +0 -350
  46. package/src/chains.ts +0 -278
  47. package/src/claims.ts +0 -111
  48. package/src/client.ts +0 -436
  49. package/src/fees.ts +0 -138
  50. package/src/fpool.ts +0 -2049
  51. package/src/generated.ts +0 -4345
  52. package/src/history.ts +0 -383
  53. package/src/ids.ts +0 -78
  54. package/src/index.ts +0 -26
  55. package/src/indexer.ts +0 -264
  56. package/src/keys.ts +0 -138
  57. package/src/liquidity.ts +0 -456
  58. package/src/onboard.ts +0 -253
  59. package/src/pools.ts +0 -465
  60. package/src/positions.ts +0 -297
  61. package/src/quote.ts +0 -36
  62. package/src/swap.ts +0 -181
  63. package/src/tokencache.ts +0 -178
  64. package/src/write.ts +0 -236
package/README.md CHANGED
@@ -1,430 +1,26 @@
1
- # logswap-sdk
1
+ # @logswap/sdk
2
2
 
3
- TypeScript SDK for [Logswap](https://logswap.org), the liquidity
4
- primitive introducing the **logarithmic invariant** — typed wrappers over the `ManagerF` / `ManagerC`,
5
- `RouterF` / `RouterC` and `LensF` / `LensC` surface (decision 096: one router and one lens per manager; the letter is
6
- a suffix on the contract and never a prefix on a function or an event).
3
+ TypeScript SDK for [log(swap)](https://logswap.org).
7
4
 
8
- **Status: identity, reads and writes for both singletons.** Indexer next.
9
-
10
- ## What is here now
11
-
12
- The two things the SDK must own because they are easy to get wrong by hand, and because getting them
13
- wrong is silent:
14
-
15
- | module | what it does |
16
- |---|---|
17
- | `src/keys.ts` | `PoolKey` and `poolId = keccak256(abi.encode(key))` — market identity; the fee list and the spacing list |
18
- | `src/ids.ts` | the ERC-6909 id namespace: position-class ids, token-claim ids, floor/cap packing |
19
- | `src/client.ts` | the handle, plus `assertVersion` — refuse a deployment the ABI was not built for |
20
- | `src/pools.ts` | market discovery from the C manager's `PoolCreated` logs, pool state, `lpEdge` = `feeGrowth` − Σ/2 |
21
- | `src/positions.ts` | classes, balances, claimable fees, the bit-255 position/claim split |
22
- | `src/swap.ts` | exact-in/out, multi-hop, and exact quotes via the revert-quoter |
23
- | `src/liquidity.ts` | mint, blended mint, zap, update, move, **harvest**, burn |
24
- | `src/claims.ts` | fee claims and the 6909 operator grant |
25
- | `src/onboard.ts` | the three approvals — ERC-20 → Permit2 → router, and the 6909 grant |
26
-
27
- Both are computed **offline** — no RPC, no deployment needed to address a market or a position.
28
-
29
- ## Reading a holder's book
30
-
31
- - `positionsOf(c, key, owner)` — the **uncapped** book in one lens call (the ladder bitmap
32
- enumerates floors; an uncapped id is a pure function of the floor).
33
- - `holdingsOf(c, key, owner)` — the **complete** book, capped classes included: replays
34
- `ClassRegistered` (every class is registered once, with its floor and cap) and checks the owner's
35
- balance on each. Use this for "my positions"; a capped mint is invisible to `positionsOf`.
36
- - `getHolderPosition(c, key, owner, floor, cap?)` — one class by (floor, cap); `move(...)` /
37
- `update(...)` / `harvest(...)` / `burn(...)` / `claimFees(...)` act on it.
38
- - F side: `discoverFPools(c)` (shape, and the `block` the pool was initialized in), `getFPool`,
39
- `fPoolShareBalance`, `fPoolShareValue`; `previewZapIn` reads the **lens** (the router's F flows
40
- live in a facet, its previews moved to the lens). Since F version 25 every F state read goes
41
- through the lens (`pool`, `getPools`, `bundleOf`, `dividendOf`, `lienOf`): the manager's
42
- typed views are behind `extsload` (decisions 062), and the lens decodes them with the contracts'
43
- `FPoolState`, so the SDK never hard-codes the storage layout.
44
- - F pool state names (F version 25): `swapFee` (was `phi`), `logFloor` θ — the log of the current
45
- floor price (was `theta`), `refLogFloor` θ₀ — the reference floor income counts from (was
46
- `theta0`), `cap` (d in 1e-6 log units, 0 uncapped), and per leg `virtualReserves` and `kappa`.
47
-
48
- ## C 20 / F 44 (contracts #146)
49
-
50
- - `PoolCreated` (both managers) indexes `poolId`, `quote`, `policy`; `creator` is data. `discoverMarkets` filters `quote`
51
- and `policy` by topic, `base` and `creator` after decoding.
52
- - C `FeesClaimed` names `to`. `RouterC.user()` is gone. `SameAsset` replaces `IdenticalTokens`; a zero C burn reverts
53
- `ZeroAmount`.
54
- - `LensC.params()` returns `(feeList, spacingList, noCap, cVersion)`; `LensF.params()` returns `(feeList, fVersion)`.
55
- - `EXPECTED_VERSION` 20, `EXPECTED_F_VERSION` 44.
56
-
57
- ## C 19 / F 43 (contracts #145)
58
-
59
- - `PoolCreated` (both managers) indexes `poolId`, `creator`, `policy`; `quote` is data. `discoverMarkets` takes
60
- `policy` and `creator` as topic filters and filters `quote` and `base` after decoding.
61
- - F: `SharesRedeemed` and `DividendClaimed` index `(poolId, owner, gen)`, as `SharesMinted` and `SharesBurned`.
62
- - F: `dps` and `incomeHeld` are no longer `ManagerF` functions; the SDK never read them by call.
63
- - `EXPECTED_VERSION` 19, `EXPECTED_F_VERSION` 43.
64
-
65
- ## C 18 / F 42 (decisions 099, 100): the C key by index, the backstop at `initialize`, `PolicyC`
66
-
67
- Contracts `logswap/logswap-contract#143`. **Every C pool id and position id moved**; F is unchanged (`EXPECTED_F_VERSION` stays 42).
68
- This is a breaking release for C. Where a section below describes the C key, C market creation, `SponsorPolicyC` or the
69
- registry's creation modes, this one supersedes it.
70
-
71
- - **The key.** `PoolKey = { quote, base, swapFeeIdx, spacingIdx, policy, salt }` (`PoolKeyC`), `poolId = keccak256(abi.encode(key))`.
72
- `swapFeeIdx` indexes `FEE_LIST` (1, 2, 5, 10, 20, 50, 100, 200 bp; one list for both managers, `F_FEE_LIST` is the same array), the
73
- mint fee is the next entry (the same at the top) and `spacingIdx` indexes `SPACING_LIST` (`[1e15, 1e16, 1e17]`). `creator`, `swapFee`,
74
- `mintFee` and `tickSpacing` are no key fields. The resolved values are `swapFeeOfKey(key)`, `mintFeeOfKey(key)` and
75
- `tickSpacingOf(key)`; `feeOfIdx`, `feeIdxOf`, `mintFeeIdxOf` and `spacingIdxOf` convert, and throw off a list. `poolId` throws for
76
- an index off its list. There is no fee-free market: `FEE_MIN` is 1 bp and `FEE_MAX` is now 200 bp.
77
- - **Creation is one manager call.** `initializeMarket(c, { key, initialLogPrice, account })` calls `ManagerC.initialize`, which mints
78
- the permanent backstop in the call: `account` pays dust of both tokens (and the mint fee on it) by **plain ERC-20 allowance to the
79
- manager**. `approveTokenForCManager(c, token, account, amount?)` grants it and `cManagerAllowanceOk` reads it; Permit2 and the router
80
- are not involved. `createMarket` and `CreateMarketArgs` are removed (`RouterC.createMarket` is gone), and so is the check that the
81
- account is the key's creator. `PoolState` has no `backstopSeeded`: an initialized market has its backstop.
82
- - **Discovery.** `PoolCreated` carries `swapFeeIdx` and `spacingIdx`; `discoverMarkets` and `discoverMarketsIndexed` rebuild the
83
- six-field key, and `DiscoveredMarket.creator` names who opened it. The indexer's `allCPoolManagerPoolCreateds` rows need the columns
84
- `swapFeeIdx` and `spacingIdx` (logswap-be follows); `tickSpacing`, `swapFee` and `mintFee` are no longer read.
85
- - **Policies.** `policyCAbi` (`PolicyC`) replaces `sponsorPolicyCAbi`. `PolicyC` has `PolicyF`'s gate surface (`authority`, `open`,
86
- `feeMask`, the quote list, the operator, the two modes, `rights`) plus `baseCurated` / `baseListed`, `swapFeeTax` and `mayInit`.
87
- `cGateRules(c, { key, creator, gate? })` reads it: the result is `{ creatorOk, quoteOk, baseOk, feeOk, saltOk, policyOk, exists,
88
- admitted }`; `creator` is required, `router` is not taken, and `mintFeeOk`, `spacingOk` and `routerTrusted` are gone (the mint fee
89
- follows the swap fee, the spacing is the manager's list). `policySpacingAllowed` is removed.
90
- - **Registry.** `CreationMode`, `registryCreationMode` and `registrySetCreationMode` are removed (`admit`, `creationMode`,
91
- `setCreationMode`, `sponsorOf` left the contract): who creates under a policy is the policy's rule. `gateErrorAbi` carries
92
- `PolicyC`'s and `PolicyF`'s errors and the registry's `NotListed`.
93
- - **Mint fee helpers.** `minMintFee`, `isValidMintFee` and `presetMintFee` are removed: the mint fee is not chosen. `mintFee(p, x,
94
- rate)` still previews it; pass `mintFeeOfKey(key)`.
95
- - **Errors.** `SpacingZero`, `BackstopTooSmall`, `BackstopMustBeUncapped` and `NotCreator` left `ManagerC`; `PolicyNotApproved` is new.
96
- - **Unchanged for a caller.** `claimFees` (the router's `claim`; the manager's own `claim` gained an `owner`, which the SDK does not
97
- call directly), every swap, mint, edit and burn, and all of F.
98
- - **Versions.** `EXPECTED_VERSION` is 18; `EXPECTED_F_VERSION` stays 42.
99
-
100
- ## C 17 / F 42 (decision 107): every event names its actor; `mint` takes a payer; the routers emit no event
101
-
102
- Contracts `logswap/logswap-contract#142`. No pool id and no position id moved; the manager bindings regenerate.
103
-
104
- - **`mint` takes a payer.** C `mint(poolId, payer, to, floor, cap, L)`, F `mint(poolId, payer, to, L, maxQuoteIn)`. `payer` is the
105
- account the caller declares as funding the mint; only the event reads it. `fPoolMint` passes its `account` (a direct call: the
106
- sender funds). The routed C mints (`mint`, `zapIn`, `execute`) are unchanged for a caller: the router declares its user.
107
- - **F `claim` takes an owner.** `claim(poolId, gen, owner, to)`: the owner or its ERC-6909 operator. `fPoolClaim` takes an
108
- optional `owner` (the `account` by default), as `fPoolBurn` and `fPoolRedeem` do.
109
- - **`Settle.to`.** `RouterC`'s entries and its `Settle` struct name the receiving account `to` (`recipient` before). The SDK's
110
- `Settle`, `settlement({ … to })` and `execute({ settle: { … to? } })` follow: **a caller that built a `Settle` with `recipient`
111
- must rename the field**. `settleInKind` / `settleOnly` take it positionally and do not move; `WriteOptions.recipient` (the SDK's
112
- own option on the named writers) is unchanged.
113
- - **The actor, per event.** No `RouterCall`: a router emits no event, and nothing is attributed through a per-transaction lookup.
114
- Read the user off the event itself:
115
-
116
- | Action | Event | Actor |
117
- |---|---|---|
118
- | swap (both) | `Swap` | `taker` when `sender` is the deployment's router, else `sender` |
119
- | mint (both) | `PositionMinted`, `SharesMinted` | `payer` when `sender` is the deployment's router, else `sender`; `to` holds the shares |
120
- | burn, update, claim (C) | `PositionBurned`, `PositionUpdated`, `FeesClaimed` | `owner` |
121
- | burn, redeem, claim (F) | `SharesBurned`, `SharesRedeemed`, `DividendClaimed` | `owner` |
122
- | birth | `PoolCreated` | `creator` (the third topic on both managers) |
123
- | deploy, harvest, close (F) | `LiquidityDeployed`, `IncomeHarvested`, `GenerationFrozen` | `operator` (a topic) |
124
- | `collectProtocolFees` (C) | `ProtocolFeesCollected` | `sender` (a topic) |
125
-
126
- - **Event shapes** (`getEventLogs` decodes by field name, so a consumer keyed on the old names follows):
127
- `PositionMinted(poolId, to, id, sender, payer, shares, dBase, dQuote)`;
128
- `SharesMinted(poolId, to, gen, sender, payer, L, shares, dQuote, poolL, supply)` and `SharesBurned` index `gen`;
129
- F `PoolCreated(poolId, quote, creator, policy, bases, swapFeeIdx, salt)` (`policy` is data now, so it no longer filters as a topic);
130
- `ProtocolFeesCollected(poolId, sender, to, amount)`; `ClassRegistered(poolId, id, floor, cap, capped)` (`poolId` first).
131
- Renamed to `owner`: `PositionBurned.from`, `SharesBurned.from`, and `holder` on `FeesClaimed`, `PositionUpdated`, `DividendClaimed`.
132
- `discoverFPools` rows carry `creator`.
133
- - **Errors.** `RouterF.BadToken` is `WrongToken`, the name `RouterC` already uses.
134
- - **Indexer.** The topic hashes moved (a pure rename's stands, and so does `SharesBurned`'s, whose `gen` is now a topic), and the columns follow the field names (`owner`, `sender`, `payer`,
135
- `creator`, `operator`): the rindexer tables must be rebuilt from this ABI (logswap-be follows). Until then a read falls back to the node.
136
- - **Versions.** `EXPECTED_VERSION` is 17 (C) and `EXPECTED_F_VERSION` is 42.
137
-
138
- ## F 41 (`policy.md`): one policy contract, the operator runs the pool, the fee is an index
139
-
140
- Follows contracts `f3d1420` (logswap-contract #120, squash-merged to main on 2026-11-07). A breaking release: every F pool id moved, and the F policy surface is replaced.
141
- The C side is untouched until Policy C follows.
142
-
143
- - **One policy.** `PolicyF` replaces `SponsorPolicyF`, `PolPolicy`, `PadPolicy` and `OrphanPolicyF`; `policyFAbi` replaces their four ABIs.
144
- Its kinds are parameter sets, every one an immutable: `fPolicyTermsOf(c, policy)` reads them once per policy (`FPolicyTerms`: `open`,
145
- `seedToDead`, `incomeHarvestOnly`, `incomeTaxRate`, `feeMask`, `lenMax`, `lnCapMin`, `quoteBuffer`, `quoteCurated`, `baseCurated`,
146
- `fixedAuthority`). `FPoolKind` is a LABEL off those terms — `"public" | "desk" | "pol" | "pad"` (`fPolicyKindOf`; the contract's `kind()` says
147
- `"f"` for every instance); `fPoolKindOfPolicy` keeps its name. `FPolicySlot` and the artifact keys (`publicPolicy`, `privatePolicy`,
148
- `polPolicy`, `padPolicy`) are unchanged; `orphanPolicy` is gone.
149
- - **Authority and operator** (`policy.md` §2). The authority is the policy's, immutable (the LOG Authority of the day on the LOG's instances),
150
- and appoints each pool's operator (`fPoolAppointOperator`; zero resets it to the authority). The operator runs the pool: `fPoolDeploy`,
151
- `fPoolHarvest`, `fPoolClose`, the modes and the name. `FPoolRoles` is `{ policy, authority, operator, swapMode, mintMode }` (`gateMint` and
152
- `maxHarvest` are gone); `fPoolRunners` is the operator alone.
153
- - **Gates.** Two modes per pool, `FPoolMode = "open" | "listed" | "operator"` (the on-chain order, `fPoolModes`; `mintMode ≥ swapMode`):
154
- `fPoolSetSwapMode` and `fPoolSetMintMode` (was `fPoolSetMintGate`), the operator's. The lists are per POLICY, not per pool:
155
- `fPolicySetRights(c, { policy, who, right: "none" | "swap" | "mint" })` and `fPolicyRightsOf` (was `fPoolSetListed` / `fPoolIsListed`);
156
- `mint` implies `swap`. `fPoolDeskOpening` is gone (`fPoolSetMintMode(…, "operator")`). Every gate write reverts `GatesUnavailable` on an open policy.
157
- - **The key** (`policy.md` §5) is `FPoolKey = { quote, bases, swapFeeIdx, policy, salt }` (`F_POOL_KEY_ABI` is exported): no `creator`, no
158
- `mintFee`. `FPoolCreateArgs` takes `swapFeeIdx` or a WAD `swapFee` on the list (`fFeeIndexOf` throws otherwise); `creator` and `mintFee` are gone.
159
- `fPoolKeyOfPool` rebuilds the whole key from `PoolCreated(poolId, quote, policy, bases, swapFeeIdx, salt)` — the salt is in the event, so the
160
- `salt` option and `padSalt` / `padSplitOfSalt` are gone.
161
- - **The fee list** (`policy.md` §6): `F_FEE_LIST_BP = [1, 2, 5, 10, 20, 50, 100, 200]`, `F_FEE_LIST` in WAD, `fFeeOf`, `fFeeIndexOf`,
162
- `fMintFeeIdxOf` / `fMintFeeOf` (the next entry, the same at the top), `fFeeListed` / `fFeesAllowed` over a policy's `feeMask`.
163
- `policyFeeAllowed(c, policy, swapFeeIdx)` reads the mask; `policyBaseAllowed` is new beside `policyQuoteAllowed`. `FPoolState.swapFee` /
164
- `mintFee` and `DiscoveredFPool.swapFee` / `mintFee` stay the resolved WAD values; `DiscoveredFPool` gains `swapFeeIdx` and `salt`, loses `creator`.
165
- - **The lifecycle** (`policy.md` §9): `fPoolDeploy` has no `to` (the operator pays and holds the shares) and runs on an inactive pool only;
166
- `fPoolHarvest(c, { poolId, extra?, to? })` takes the income and `extra` of capital (`amount` is gone); `fPoolClose` closes at any bid, harvesting
167
- first, and refuses a pad; `fPoolCloseRaw`, `fPoolEmptyingHarvests` and `fPoolRegenerate` are gone — `fPoolRelaunch` / `fPoolRelaunchCalls` is
168
- `multicall(close, redeem, deployLiquidity)`. `fPoolHarvestRoom(state, terms)` is what a harvest may take; `FPoolDescription` has `income`,
169
- `capitalRoom` and `harvestable` (the dead shares' dividend is gone). `fPoolLaunch` is the policy authority's (it is the operator at birth).
170
- - **Names** are events: `fPoolSetName` emits `NameSet`, `fPoolNameOf(c, poolId, { policy?, indexer? })` reads the last one; `FPoolState.name` is gone.
171
- - **Registry.** `fPoolMigrate`, `fPoolOrphan`, `registryOrphanPolicyOf`, `registrySetOrphanPolicy` and `MigrationPermissions` are gone; the key's
172
- policy is the pool's for life. `registryKindOf` returns the name recorded at approval (a string). `registryPolicies(c, kind?)` filters on the label.
173
- The pad readers (`padThresholdBases`, `padThresholdOf`, `padThreshold`, `padScheduleOf`) and `getFPoolRules` / `FPoolRules` / `PadRanges` are gone:
174
- the terms are `fPolicyTermsOf`; `FPoolControlled` carries `terms`, and `fPoolsControlledBy(c, who)` lists the pools `who` operates or sponsors.
175
- - **Events.** `IncomeHarvested(poolId, to, gen, income, capital, tax, toOperator, Q)`; `GenerationFrozen` from `close` alone; `PolicyMigrated` and
176
- `IncomeReleased` are gone. The policy emits `OperatorAppointed`, `SwapModeSet`, `MintModeSet`, `RightsSet(who, bits)`, `NameSet`. The indexer's
177
- `allFPoolManagerPoolCreateds` rows carry `swapFeeIdx` and `salt` (logswap-be follows).
178
- - **Versions.** `EXPECTED_F_VERSION` is 41; `EXPECTED_VERSION` stays 16.
179
-
180
- ## C 16 / F 40 (decision 098): immutable, LOG-deployed policies; one sponsored policy per manager
181
-
182
- (On C, superseded by C 18: `PolicyC` replaces `SponsorPolicyC` and the registry has no creation modes.)
183
-
184
- Follows contracts `99827f8`. This is a breaking release: the policy surface is replaced.
185
-
186
- - **Kinds.** `PublicPolicy` and `PrivatePolicy` are gone. A policy says it is `"sponsor"` (`SponsorPolicyF` / `SponsorPolicyC`: the LOG's own
187
- instances, the open canonical one and a gated one, and a third party's deployed by the LOG), `"pol"`, `"pad"` or `"orphan"` (`OrphanPolicyF`).
188
- `FPoolKind` is `"sponsor" | "pol" | "pad" | "orphan"`. `fPoolPolicyFor(c, slot)` and `FPoolCreateArgs.kind` take a deployment *slot*
189
- (`FPolicySlot`: `"public"`, `"private"`, `"pol"`, `"pad"`, the artifact's keys: `publicPolicy` / `privatePolicy` are the LOG's open and gated
190
- `SponsorPolicyF` instances). New optional addresses: `publicPolicyC` (the open `SponsorPolicyC`) and `orphanPolicy`.
191
- `sponsorPolicyFAbi`, `sponsorPolicyCAbi` and `orphanPolicyFAbi` replace `publicPolicyAbi` / `privatePolicyAbi`.
192
- - **A policy has no setter.** Its numbers (fee tiers as masks over the family's table, quotes, the C spacings, the swap-fee tax, `canonical`,
193
- `gatesAvailable`, `bornGated`, a pad's schedule and income tax rate, a POL's reserve ratio) are constructor immutables: a change is a new policy,
194
- which the LOG approves (`registryApprove`) and moves pools to (`fPoolMigrate`). The wrappers for the old setters are removed
195
- (`padSetSchedule`, `padSetThresholdBase`, `padSetIncomeTaxRate`, `polSetMinQuoteRatio`, `polSetIncomeTaxRate`, `policySetQuoteListed`,
196
- `policySetQuoteCurated`, `policySetFeeListed`, `policySetFeeCurated`, `gateSetPairListed`, `gateSetPairCurated`, `gateSetSpacingListed`,
197
- `policySetSpacingListed`, `policySetSpacingCurated`, `setCSwapFeeTax`, `setCGate`, `registrySetInitializerListed`). Readers remain:
198
- `policyQuoteAllowed`, `policyFeeAllowed(c, policy, fee, "swap" | "mint")`, `policySpacingAllowed`, `cSwapFeeTax(c, policy?)`, `padScheduleOf`,
199
- `padThresholdBases`, `padThresholdOf`, `padThreshold`, and `getFPoolRules` (which now returns the sponsored policy's immutables).
200
- - **Authority and operator.** The authority is `key.creator` for life: no handover (`fPoolProposeAuthority` / `fPoolAcceptAuthority` are removed;
201
- `FPoolRoles` loses `creator`, `pendingAuthority` and `swapExecutor`). The authority appoints a per-pool operator (`fPoolAppointOperator`, was
202
- `fPoolSetPoolOperator`), sets the swap mode (`fPoolSetSwapMode`: `"open" | "operator" | "listed"`, no executor), the mint gate
203
- (`fPoolSetMintGate`) and the whitelist (`fPoolSetListed(who, listed)` and `fPoolIsListed`; the minter and taker lists are gone). The same
204
- functions exist on `SponsorPolicyC`: pass `policy: key.policy` for a C market. `fPoolDeskOpening` is now the one mint-gate write.
205
- - **Gates.** `Pool.asks` is `Pool.flags` (`FPoolState.flags`; `GATE_SWAP` 1, `GATE_MINT` 2, `GATES` 3, `SEED_TO_DEAD` 4; `ASK_SWAP` / `ASK_MINT` are
206
- gone) and `FPoolState.operator` is the operator the manager caches (admitted by a gated swap or mint with no policy call). `setPermissions` /
207
- `PermissionsSet` are `setGates(poolId, gates, operator)` / `GatesSet` on both managers; the indexer's shared table is `GatesSet`.
208
- - **Registry.** `CreationMode` is `"open" | "sponsorOnly"` (`Restricted`, the initializer list and `InitializerNotListed` are gone; the initializer
209
- must be `key.creator`, `NotCreator`). `fPoolMigrate(c, { key, to, permissions? })` installs the new policy's swap mode, operator, mint gate and
210
- whitelist in the same transaction (`MigrationPermissions`; `migratePrivate` is gone). New: `fPoolOrphan` (`PolicyRegistry.orphan`, final),
211
- `registryOrphanPolicyOf`, `registrySetOrphanPolicy`.
212
- - **C gate.** `cGateRules` reads the sponsored C policy: `pairOk` is gone, `mintFeeOk` is new, `saltOk` binds only a canonical policy;
213
- `gateErrorAbi` carries `FeeNotListed`, `MintFeeNotListed`, `QuoteNotListed`, `GatesUnavailable`, `NotCanonical`.
214
- - **Versions.** `EXPECTED_VERSION` is 16 (C) and `EXPECTED_F_VERSION` is 40. No pool id moved.
215
-
216
- ## C 15 / F 39 (decisions 096, 097): a router and a lens per manager, and a C market has a creator and a salt
217
-
218
- (The policy parts of this section are superseded by the one above; the C key and `createMarket` by C 18.)
219
-
220
- Follows contracts `f3164de` (096 + #112 + #113 + #115 + #116). What changes for a consumer:
221
-
222
- - **Addresses.** `LogswapAddresses` is `managerF`, `routerF`, `lensF` (required) and `managerC`, `routerC`, `lensC` (optional:
223
- F ships first, so a chain may have no C stack; the artifact then carries `address(0)` and `cVersion` 0). `managerC(c)`,
224
- `routerC(c)`, `lensC(c)` throw where the stack is absent, and `hasC(c)` says whether it is there. The artifact's keys are the same names.
225
- - **ABIs.** `managerCAbi` / `managerFAbi`, `routerCAbi` / `routerFAbi`, `lensCAbi` / `lensFAbi`, `routerActionsAbi`. Each router is its
226
- own Permit2 spender: `approveToken`, `approvePermit2ForRouter`, `onboardToken`, `checkTokenReadiness`, `spenderFor` and
227
- `permit2SigCalls` take the side (`"C"` or `"F"`) after the client, and `sendRouterWrite*` take `side` in their arguments.
228
- - **Names.** The 095 `c`-prefixed C functions are back to the plain 096 names (`getPool`, `discoverMarkets`, `swapExactIn`, ...); the event
229
- `PoolCreated`, `Swap` and `SwapState` are the same on both managers (declared once in `ManagerBase`). `TickCrossed`, `BackstopSeeded` and
230
- `Stamped` are gone from the ABIs.
231
- - **A C key has a creator and a salt** (decision 097): `PoolKey = { base, quote, tickSpacing, policy, creator, salt, swapFee, mintFee }`,
232
- so every C pool id is new. Only the creator may `initialize` and make the first mint (the backstop seed; `NotCreator`), and `initializeMarket`
233
- refuses an account that is not `key.creator` before sending. `PoolCreated` carries a trailing `salt`; the indexer rows carry `creator` and `salt`.
234
- A malformed policy answer is `BadTerms` (#115). The public policy is canonical per exact key (`salt` 0, `NotCanonical`); `marketOf` and
235
- `MarketExists` are gone, and `cGateRules` reads `getPool(key).initialized` for `exists` and adds `saltOk`.
236
- - **Registry and policies.** `registryUserOf(c, caller)` reads `PolicyRegistry.userOf` (the account a routed caller acts for);
237
- `policySpacingAllowed` reads the tick-spacing list (since 098 only on `SponsorPolicyC`, and read-only).
238
- - **Versions.** `EXPECTED_VERSION` is 15 (C) and `EXPECTED_F_VERSION` is 39; `assertVersion` checks C only where the deployment has it, and
239
- `assertWiring` checks each router and lens against its own manager.
240
-
241
- ## C 13 (decisions 088–090): a C market is addressed by its pool id
242
-
243
- (The router and lens naming in this section is superseded by the one above.)
244
-
245
- The consumer API still takes a `PoolKey`; the SDK hashes it (`poolId(key)`) and calls the contracts with the id.
246
- What changes for a consumer:
247
-
248
- - **Names.** `PoolState.x` is `logPrice`, `PoolState.F` is `feeGrowth` (`lpEdge`, `feesQuote`, `edgeQuote`, `priceOf`,
249
- `floorDistance` follow). `DiscoveredMarket.x0` and `createMarket` / `initializeMarket`'s `x0` are `initialLogPrice`.
250
- `FPoolState.weights` is `liquidityWeights` (each base asset's derived fraction of `L`; the sponsor's `weights`
251
- inputs to `fPoolBook` keep their name).
252
- - **Events and discovery.** The C manager's `MarketCreated` is `PoolCreated`, in the F manager's field order
253
- (`poolId, quote, creator, base, swapFee, policy, mintFee, tickSpacing, initialLogPrice, swapFeeTax`). `base` is no
254
- longer an indexed topic, so `discoverMarkets({ base })` filters it client-side. Both managers emit `PoolCreated`, so an
255
- indexer table is prefixed by its contract (`allCPoolManagerPoolCreateds`, `allFPoolManagerPoolCreateds`).
256
- - **Router.** The named entries pass the tokens the caller expects (`WrongToken` on a mismatch); `execute` batches
257
- carry the pool id in each action. `LogswapRouter` is `Router` and `LogswapLens` is `Lens` (the ABI exports are `routerAbi` / `lensAbi`;
258
- the `logswap*` names stay as deprecated aliases for one minor). The router runs the trade path inline (swap, mint, zap-in, quote);
259
- the management of an existing position (burn, claim, update, move, createMarket, F zap-out and roll-in) is `LiquidityFacet`, reached
260
- by `fallback` at the same router address, so `routerAbi` is the merge and Permit2 still has one spender. `facetC()` is
261
- `liquidityFacet()`; the `encode*` helpers left the contract for the ABI-only `routerActionsAbi`. Prefer the managers directly when
262
- you need no recipient, deadline or Permit2 (decision 091).
263
- - **Layout.** F `getPool` has `swapFee` / `mintFee` as `uint56`; the `extsload` words are in the contracts' `FPoolState`.
264
-
265
- ## Who may create what: the gate, the menus (C version 7, F version 26; superseded by decision 098 above)
266
-
267
- Since logswap-contract #60 (decisions 064–065) creation is curated at launch, on both managers:
268
-
269
- - **The C gate is the public policy**, set in the C manager's constructor. A C market is admitted if
270
- its creator, quote, pair, swap-fee tier (2, 5, 10, 25, 50, 100 bp) and tick spacing (10 or 100 bp)
271
- are listed, and only one market per (base, quote, fee) exists. `cGateRules(c, { key, creator })`
272
- reads every check in one round; `gateErrorAbi` decodes the refusals (`CreatorNotListed`,
273
- `MarketExists`, `SpacingNotListed`, `PairNotListed`, `NoForwardedUser`,
274
- `PadExists`).
275
- - **`createMarket` stays one transaction**: the router is a trusted forwarder, so the gate checks
276
- the router's `user()` — the wallet that sent the call — against the creator list.
277
- - **The mint fee is a key field** (C 12 / F 38, decision 078): the creator's pick, fixed for the pool's life and
278
- part of its id (`PoolKey.mintFee`, `FPoolKey.mintFee`; `mintFee?` on `fPoolInitialize` / `fPoolLaunch`). The
279
- managers require `2 * swapFee <= mintFee <= MINT_FEE_MAX` (2%) and revert `BadParam`; `isValidMintFee`,
280
- `minMintFee` and `MINT_FEE_MAX` are exported, and `presetMintFee(swapFee)` is the least the managers accept,
281
- twice the swap fee. `initialize`, `initializeMarket` and `createMarket` take no separate argument, the policies
282
- keep no menu, and C's `getPool` no longer returns it (read `key.mintFee`; `getFPool(...).mintFee` still reads
283
- an F pool's). `mintFee(p, x, rate)` previews it at the market's rate.
284
- - **A fee of 0 is no fee**: `swapFeeOf` and `DEFAULT_FEE` are gone; `marketSwapFee` returns the key's
285
- own fee for an initialized market.
286
- - **C reads**: `getPool` reads the lens's `getPools`; `getPositionClass` reads the class through
287
- `extsload` at `CPoolState`'s slot (the manager's typed views are gone).
288
- - **Creation** (098): the registry's creation mode per policy (`open`, or `sponsorOnly`: the policy's own immutable sponsor creates);
289
- `registrySetCreationMode` and `registrySetForwarderTrusted` are the LOG Authority's helpers. The creator list, the pair list and
290
- the policy setters are gone.
291
- - **Two roles (decision 066, C 8 / F 27).** `logAuthority()` reads the LOG Authority (the
292
- registry's `logAuthority`; `proposeLogAuthority` / `acceptLogAuthority`), which administers the
293
- registry, both managers and every policy. `logTreasury(side)` reads a manager's treasury, which
294
- only receives; `proposeTreasury` is the authority's, `acceptTreasury` the incoming treasury's own
295
- call. `collectCProtocolFees(key)` may be sent by anyone and pays the treasury. The C swap-fee tax is each
296
- market's from birth (`getPool(key).swapFeeTax`, `cMarketSwapFeeTax`); since 098 the level is the policy's
297
- immutable (`cSwapFeeTax(c, policy?)` reads it; a different level is a different policy). `registryOwner`,
298
- `registryProposeOwner` / `registryAcceptOwner` and `proposeCollector` / `acceptCollector` remain
299
- as deprecated aliases.
300
-
301
- ## History from the indexer (indexer phase 1)
302
-
303
- Every event read goes through `getEventLogs` (one event) or `getEventsLogs` (several, tagged by
304
- `eventName`): the rindexer GraphQL endpoint when one is given, the node otherwise or when it fails.
305
- Since logswap-be #43 the indexer also holds the four policies (one `Policy` table per event, tracked
306
- from the registry's `Approved`), the registry, the token factory and the managers' admin events, so
307
- nothing has to scan the node from block 0 — which the devnet node, pruning logs after about a day,
308
- answers only partly.
309
-
310
- - `swapFees`, `holdingsOf`, `discoverMarkets` and `fPoolKeyOfPool` take `indexer` (since F 41 `PoolCreated` carries the whole key, the salt included).
311
- - `getEventLogs` takes several emitters (`address: [...]`); a policy outside the artifact names its
312
- shared tables with `contract: indexedContractOf(kind, event)` (or `kind` on `getEventsLogs`).
313
- - `tokensCreated` lists the factory's tokens (`addresses.tokenFactory`): the token list's provenance.
314
-
315
- ## Indexer views
316
-
317
- The SDK reads the indexer's event tables (`getEventLogs`, `indexer.ts`) and nothing above them. The derived views
318
- (logswap-backend `devnet/VIEWS.md`: every F pool's replayed state, swap flows, candles, holders, positions, rules,
319
- revenue) are read by the app's `@logswap/base` (`packages/base/src/indexer.ts` in logswap-app), which follows their
320
- schema; the readers that lived here (`views.ts`) asked columns the indexer no longer has and are gone.
321
-
322
- What stays a live read: every unclaimed fee or dividend (the lens: `dividendOf`). It accrues without events.
323
-
324
- ## The F pool's life: four calls (F 41, `policy.md` §9–10)
325
-
326
- - **`fPoolInitialize`** lists the pool, inactive. Its key is `(quote, bases, swapFeeIdx, policy, salt)`: no weights, no cap, no
327
- creator and no mint fee; the set of `bases` is fixed for the pool's life. Anyone under an open policy (at salt zero), the policy's
328
- authority under a closed one. The policy's authority is the pool's OPERATOR at birth; the authority may re-appoint it.
329
- - **`fPoolDeploy`** (`deployLiquidity`) is the operator's and SETS THE BOOK of a generation, on an INACTIVE pool — listed and never
330
- funded, or closed. Each `baseAssets[j]` is the base reserve of asset `j` (`0` leaves the leg dormant) and the price that values it
331
- (`priceX36`), `quoteAmount` the bid; the operator pays them all by plain allowance and holds the shares (all to 0xdead on a pad). Pass the
332
- book outright (`baseAssets`, `lnCapOverSeed`) or the terms (`bases`, `weights`, `L0` and the wanted marks `x0` or the reserves `r0`;
333
- `fPoolBook` builds the book). The policy bounds it: `quoteAmount ≥ quoteBuffer · L`, a cap at least `lnCapMin` above the seed, at most
334
- `lenMax` legs; a sunset policy refuses it.
335
- - **`fPoolHarvest`** takes the generation's income and `extra` of capital out of the bid — a dividend to every share, the operator's slice paid
336
- to `to` in the same call, the income taxed on the payer's slice. `fPoolHarvestRoom` says how much.
337
- - **`fPoolClose`** closes at any bid: the income is harvested first, the reserves and the bid are frozen into the generation's bundle
338
- (`fPoolRedeem`), the counter moves to `gen + 1`; the pool keeps its id, its policy and its roles. A pad never closes.
339
- - **`fPoolRelaunch`** is what `regenerate` was: `close`, the operator's own `redeem`, the next `deployLiquidity`, in one `multicall` — every
340
- other holder is frozen into the bundle; the new book may re-weight the key's bases and pick its own cap.
341
- - **The cap** (decisions 061, 075) is the pool's one log ratio `lnCapOverSeed` = ln(cap price / seed price) in 1e-6 log
342
- units, chosen at each deployment: each asset's maximum price is its own seed price times it.
343
- `fPoolCapOfLeverage(λ)` gives it for a leverage (λ = 2 → the cap at twice the seed price),
344
- `fPoolLeverageOfCap(d)` the inverse, and `fPoolCapK(d)` = e^{−d} the constant that scales each reserve by (1 − k)
345
- and divides the base value by (1 − k) to give the liquidity. A pad is uncapped (`PadUncapped`).
346
- - **`LiquidityDeployed`** echoes the deployment: `(quoteAmount, baseAssets, lnCapOverSeed)`.
347
- `fPoolBookWeights` and `fPoolBookL` derive the allocation and the liquidity from it. A regeneration emits no
348
- such event; the freeze-out is read from `GenerationRetired` and `IncomeReleased`.
349
- - **Income and income tax** (decision 085): the dead shares' dividend and the share of it the treasury takes are
350
- the income and the income tax (`IncomeReleased`, `incomeHeld`, `incomeTax`; the rate is the policy's `incomeTaxRate`, an immutable since 098).
351
-
352
- - **The lien** (decisions 063): a lending contract locks an owner's shares in place.
353
- `fPoolApproveShares` (the owner's per-id allowance), `fPoolLock` / `fPoolUnlock` (the locker's;
354
- `to` = owner is a release, anyone else a seizure), `fPoolBankLien` (bank the locked dividend
355
- now), `fPoolLienOf` (locker, amount, and the dividend the lien holds). The dividend the locked
356
- amount earns is held by the lien: a repaid loan gets it back, a seizer takes it.
5
+ ## Install
357
6
 
358
- ## Chains and deployments (F version 29)
7
+ ```bash
8
+ npm i @logswap/sdk viem
9
+ ```
359
10
 
360
- log(swap) releases on Ethereum (1), Base (8453), Arbitrum One (42161) and Robinhood Chain (4663),
361
- with Robinhood Chain Testnet (46630) for testing. The contracts are deployed through CreateX
362
- (CREATE3, contracts decision 069) at the SAME addresses on every chain, so an address names a
363
- contract only together with a chain id.
11
+ `viem` is a peer dependency.
364
12
 
365
- - **`LOGSWAP_CHAINS`** (`src/chains.ts`): one entry per chain — the viem `chain`, `network` (the
366
- artifact's), `nativeCurrency`, `explorer`, `publicRpc` (rate-limited), `devnet`, `testnet`, the
367
- verified `quotes` (symbol, address, decimals) and `padQuote`, and `maxLogRange`. Also 31337 (local
368
- anvil) and 31339 (the devnet). `logswapChain(id)`, `quoteOf(id, "USDC")`, `RELEASE_CHAIN_IDS`.
369
- - **`LogswapDeployment`** is the contracts' `deployments/<chainId>.json` (`DeployChain.s.sol`; the
370
- local `DeployLocal` artifact has the same fields plus its devnet extras).
371
- `deploymentFromArtifact(json, { chainId })` validates it and refuses an artifact for another chain;
372
- `LOGSWAP_DEPLOYMENTS` / `deploymentFor(id)` hold the published ones (none yet: nothing is deployed
373
- on the release chains).
374
- - **`createLogswapClient({ public, deployment, indexerUrl })`** takes the addresses from the
375
- deployment and keeps its `chainId` and `deployBlock`; `addresses` still works on its own.
13
+ ## Example
376
14
 
377
15
  ```ts
378
16
  import { createPublicClient, http } from "viem";
379
- import { createLogswapClient, deploymentFromArtifact, logswapChain } from "@logswap/sdk";
380
-
381
- const chain = logswapChain(8453)!;
382
- const c = createLogswapClient({
383
- public: createPublicClient({ chain: chain.chain, transport: http(process.env.BASE_RPC_URL) }),
384
- deployment: deploymentFromArtifact(artifactJson, { chainId: 8453 }),
385
- indexerUrl: "https://…/graphql", // this chain's indexer
386
- });
387
- ```
388
-
389
- What changes for readers:
390
-
391
- - **Log scans start at `deployBlock`** where they started at block 0 (`discoverMarkets`,
392
- `discoverFPools`, `fPoolKeyOfPool`, `holdingsOf`, `fPoolShareHolders`, `getEventLogs`,
393
- `getEventsLogs`); an explicit `fromBlock` still wins.
394
- - **The chain path is chunked**: `eth_getLogs` over spans of `maxLogRange` blocks (2 000 on the
395
- release chains, per-client override), at most four in flight (`getLogsChunked`). Public RPCs refuse
396
- an unbounded range.
397
- - **The indexer is per chain**: `indexerUrl` on the client is the default `indexer` of every history
398
- read and of `discoverMarketsBest`. Its rows are filtered by contract address, which is the same on
399
- every chain, so one URL must serve one chain.
400
- - **Caches key on the chain id**: the policy-terms cache asks the node for the chain id when the
401
- client has none; `RESETTABLE_CHAINS` is every registry chain flagged `devnet` (plus 1337 and 31338),
402
- extended with `addResettableChain`.
403
- - **F version 29** (decision 068): `FPoolState.restructureTime` (unix seconds; was
404
- `restructureBlock`), `registrySunset(c, policy, untilTime)` and `RegistryEntry.until` are
405
- timestamps. `EXPECTED_F_VERSION` is 29.
17
+ import { createLogswapClient, assertVersion } from "@logswap/sdk";
406
18
 
407
- - **F version 31** (decision 072): `DividendClaimed` carries the generation (`gen`, indexed); `lock` and
408
- `unlock` emit `LienLocked` / `LienUnlocked`, so a lien is readable from the log stream with
409
- `getEventLogs`. `EXPECTED_F_VERSION` is 31.
410
-
411
- ## Conventions
412
-
413
- - **The SDK hides the manager/router/lens split.** Which contract hosts which action is currently
414
- decided by EIP-170 headroom, not by design — so a future re-homing must be an SDK patch, not a
415
- breaking change for consumers.
416
- - **Address a market by its exact key.** The key carries indices (`swapFeeIdx`, `spacingIdx`), never resolved values; two keys
417
- that differ in any field, the salt included, are **different markets with different ids**.
418
- - **Split every ERC-6909 `Transfer` on bit 255.** Clear means a token claim, not a position; an
419
- indexer that ignores this reports phantom LP positions for market makers parking inventory.
420
-
421
- ## Install
422
-
423
- ```bash
424
- npm i @logswap/sdk viem
19
+ const publicClient = createPublicClient({ transport: http(RPC_URL) });
20
+ const c = createLogswapClient({ public: publicClient, deployment }); // deployment: the chain's addresses
21
+ await assertVersion(c); // refuses a deployment this release was not built for
425
22
  ```
426
23
 
427
- Published as **`@logswap/sdk`** from v0.5.35; earlier versions used another name.
24
+ ## License
428
25
 
429
- `viem` is a peer dependency. The package ships `dist/` plus `src/`, including the generated ABIs, so
430
- the contract surface it was built against travels with it.
26
+ GPL-2.0-or-later.
package/dist/actions.d.ts CHANGED
@@ -1,32 +1,10 @@
1
- /**
2
- * actions.ts — the router's transaction: a BATCH.
3
- *
4
- * `execute(actions, settle)` runs a list of actions — mint, burn, update, claim, swap, path, in any
5
- * order, across any C markets — under ONE manager lock. Each action accrues deltas on the router
6
- * and settles nothing; the batch settles once per token in `settle.tokens`, pulling at most
7
- * `maxIn[i]` from the caller and taking at least `minOut[i]` to `settle.to`. A touched token
8
- * left off the list fails the manager's own close (`TokensNotSettled`), so the list is also the
9
- * caller's statement of which tokens may move.
10
- *
11
- * `OPEN_DELTA` as a swap amount means "the router's open delta of that token": what earlier
12
- * actions left it holding (exact-in, path) or owing (exact-out). It is what lets action i+1
13
- * consume action i's proceeds — a harvest funds a buy, a burn exits to one asset, a deepen is paid
14
- * in base — each moving ONE token.
15
- *
16
- * Payloads are `abi.encode` of the router's `*Act` structs. Their tuple types are read from the
17
- * generated ABI (the router's pure `encode*` helpers exist for exactly this), so nothing here is
18
- * hand-written and a struct change is a `tsc`/vector failure, not a runtime surprise.
19
- */
20
1
  import { type Address, type Hash, type Hex } from "viem";
21
2
  import type { LogswapClient } from "./client.js";
22
3
  import { type PoolKey } from "./keys.js";
23
4
  import type { Hop } from "./swap.js";
24
5
  import { type WriteOptions } from "./write.js";
25
- /** "The router's open delta of that token" — the swap-amount sentinel. `type(uint256).max`. */
26
6
  export declare const OPEN_DELTA: bigint;
27
- /** No bound. The same word as the sentinel, kept apart because it means something else. */
28
7
  export declare const UNBOUNDED: bigint;
29
- /** The router's op tags — `OpType` in `RouterOps.sol`, C actions only (the F ops have their own lock). */
30
8
  export declare enum Op {
31
9
  MintBlended = 0,
32
10
  Burn = 1,
@@ -44,42 +22,35 @@ export interface Settle {
44
22
  tokens: readonly Address[];
45
23
  maxIn: readonly bigint[];
46
24
  minOut: readonly bigint[];
47
- /** Receives whatever is taken, and the shares the actions mint (`Settle.to`; `recipient` before C 17). */
48
25
  to: Address;
49
26
  }
50
- /** Mint exposure `L` at `targetFloor` (off-grid blends the two adjacent rungs), `cap` optional. */
51
27
  export declare function mintAction(a: {
52
28
  key: PoolKey;
53
29
  targetFloor: bigint;
54
30
  cap?: bigint;
55
31
  L: bigint;
56
32
  }): Action;
57
- /** Burn `shares[i]` of `ids[i]`; accrued fees are swept into the same batch. Needs the operator grant. */
58
33
  export declare function burnAction(a: {
59
34
  key: PoolKey;
60
35
  ids: readonly bigint[];
61
36
  shares: readonly bigint[];
62
37
  }): Action;
63
- /** Exact-in swap. `amountIn` may be `OPEN_DELTA`: the input an earlier action left the router holding. */
64
38
  export declare function swapExactInAction(a: {
65
39
  key: PoolKey;
66
40
  baseIn: boolean;
67
41
  amountIn: bigint;
68
42
  minOut?: bigint;
69
43
  }): Action;
70
- /** Exact-out swap. `amountOut` may be `OPEN_DELTA`: the output an earlier action left the router owing. */
71
44
  export declare function swapExactOutAction(a: {
72
45
  key: PoolKey;
73
46
  baseOut: boolean;
74
47
  amountOut: bigint;
75
48
  maxIn?: bigint;
76
49
  }): Action;
77
- /** Collect the caller's fees on `ids`; positions untouched. */
78
50
  export declare function claimAction(a: {
79
51
  key: PoolKey;
80
52
  ids: readonly bigint[];
81
53
  }): Action;
82
- /** The general edit — set `shares` of `fromId` to (`toFloor`, `toCap`, `newL`); `newL = 0` exits. */
83
54
  export declare function updateAction(a: {
84
55
  key: PoolKey;
85
56
  fromId: bigint;
@@ -88,13 +59,11 @@ export declare function updateAction(a: {
88
59
  toCap?: bigint;
89
60
  newL: bigint;
90
61
  }): Action;
91
- /** Multi-hop exact-in route; `amountIn` may be `OPEN_DELTA`. Intermediate tokens never move. */
92
62
  export declare function pathAction(a: {
93
63
  hops: readonly Hop[];
94
64
  amountIn: bigint;
95
65
  minOut?: bigint;
96
66
  }): Action;
97
- /** A settlement over explicit tokens; missing bounds default to unbounded in, zero out. */
98
67
  export declare function settlement(a: {
99
68
  tokens: readonly Address[];
100
69
  maxIn?: readonly bigint[];
@@ -107,12 +76,7 @@ export interface PairBounds {
107
76
  minBaseOut?: bigint;
108
77
  minQuoteOut?: bigint;
109
78
  }
110
- /** Settle both of a market's tokens, in kind. */
111
79
  export declare function settleInKind(key: PoolKey, to: Address, b?: PairBounds): Settle;
112
- /**
113
- * Settle in ONE of a market's tokens: the other is bound to zero both ways, so the batch must have
114
- * netted it — which is what a trailing `OPEN_DELTA` swap does.
115
- */
116
80
  export declare function settleOnly(key: PoolKey, to: Address, side: "base" | "quote", b?: {
117
81
  maxIn?: bigint;
118
82
  minOut?: bigint;
@@ -122,12 +86,9 @@ export interface ExecuteArgs extends WriteOptions {
122
86
  settle: Omit<Settle, "to"> & {
123
87
  to?: Address;
124
88
  };
125
- /** Tokens the batch may pull, for the Permit2 signatures. Defaults to every token with `maxIn > 0`. */
126
89
  pullTokens?: readonly Address[];
127
90
  }
128
- /** Run a batch: one lock, one settlement per token, one transaction (Permit2 signatures ride inside). */
129
91
  export declare function execute(c: LogswapClient, a: ExecuteArgs): Promise<Hash>;
130
- /** Simulate a batch: the per-action returns and the signed flows (+ = paid in), without sending. */
131
92
  export declare function simulateExecute(c: LogswapClient, a: ExecuteArgs & {
132
93
  account?: Address;
133
94
  }): Promise<{