@logswap/sdk 0.5.77 → 0.5.78

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
@@ -16,7 +16,7 @@ wrong is silent:
16
16
  | `src/keys.ts` | `PoolKey` and `poolId = keccak256(abi.encode(key))` — market identity |
17
17
  | `src/ids.ts` | the ERC-6909 id namespace: position-class ids, token-claim ids, floor/cap packing |
18
18
  | `src/client.ts` | the handle, plus `assertVersion` — refuse a deployment the ABI was not built for |
19
- | `src/pools.ts` | market discovery from `Initialize` logs, pool state, `lpEdge` = F − Σ/2 |
19
+ | `src/pools.ts` | market discovery from `MarketCreated` logs, pool state, `lpEdge` = F − Σ/2 |
20
20
  | `src/positions.ts` | classes, balances, claimable fees, the bit-255 position/claim split |
21
21
  | `src/swap.ts` | exact-in/out, multi-hop, and exact quotes via the revert-quoter |
22
22
  | `src/liquidity.ts` | mint, blended mint, zap, update, move, **harvest**, burn |
@@ -30,7 +30,7 @@ Both are computed **offline** — no RPC, no deployment needed to address a mark
30
30
  - `positionsOf(c, key, owner)` — the **uncapped** book in one lens call (the ladder bitmap
31
31
  enumerates floors; an uncapped id is a pure function of the floor).
32
32
  - `holdingsOf(c, key, owner)` — the **complete** book, capped classes included: replays
33
- `IdRegistered` (every class is registered once, with its floor and cap) and checks the owner's
33
+ `ClassRegistered` (every class is registered once, with its floor and cap) and checks the owner's
34
34
  balance on each. Use this for "my positions"; a capped mint is invisible to `positionsOf`.
35
35
  - `getHolderPosition(c, key, owner, floor, cap?)` — one class by (floor, cap); `move(...)` /
36
36
  `update(...)` / `harvest(...)` / `burn(...)` / `claimFees(...)` act on it.
@@ -88,7 +88,7 @@ nothing has to scan the node from block 0 — which the devnet node, pruning log
88
88
  answers only partly.
89
89
 
90
90
  - `swapFees`, `holdingsOf`, `discoverMarkets` and `fPoolKeyOfPool` take `indexer` (the salt is not in
91
- `FInitialize`, so a pad's key is still rebuilt from its split with nonce 0).
91
+ `PoolCreated`, so a pad's key is still rebuilt from its split with nonce 0).
92
92
  - `getEventLogs` takes several emitters (`address: [...]`); a policy outside the artifact names its
93
93
  shared tables with `contract: indexedContractOf(kind, event)` (or `kind` on `getEventsLogs`).
94
94
  - `tokensCreated` lists the factory's tokens (`addresses.tokenFactory`): the token list's provenance.
package/dist/admin.d.ts CHANGED
@@ -104,7 +104,7 @@ export declare function setPolicyApproved(c: LogswapClient, policy: Address, app
104
104
  * answer); the operator and the lists void; no swap lands in the block.
105
105
  *
106
106
  * Pass the pool's `key` when in hand. Given only `poolId`, the key is rebuilt from the pool's
107
- * `FInitialize` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
107
+ * `PoolCreated` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
108
108
  * the id — the log does not carry the salt, so a salted pool needs it named.
109
109
  */
110
110
  export declare function fPoolMigrate(c: LogswapClient, a: {
package/dist/admin.js CHANGED
@@ -157,7 +157,7 @@ export async function setPolicyApproved(c, policy, approved) {
157
157
  * answer); the operator and the lists void; no swap lands in the block.
158
158
  *
159
159
  * Pass the pool's `key` when in hand. Given only `poolId`, the key is rebuilt from the pool's
160
- * `FInitialize` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
160
+ * `PoolCreated` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
161
161
  * the id — the log does not carry the salt, so a salted pool needs it named.
162
162
  */
163
163
  export async function fPoolMigrate(c, a) {
package/dist/client.d.ts CHANGED
@@ -115,8 +115,11 @@ export declare function clientChainId(c: LogswapClient): Promise<number>;
115
115
  * each market's, answered by the gate (`PublicPolicy.swapFeeTax`, the LOG Authority's) at birth and
116
116
  * read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
117
117
  * permissionless and pays the treasury. No pool id moved.
118
+ * 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
119
+ * takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
120
+ * `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
118
121
  */
119
- export declare const EXPECTED_VERSION = 8n;
122
+ export declare const EXPECTED_VERSION = 9n;
120
123
  /**
121
124
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
122
125
  * 4 was the income-only harvest cut).
@@ -128,7 +131,7 @@ export declare const EXPECTED_VERSION = 8n;
128
131
  * passes it; when one lands, raise this constant in the same change, which is the discipline
129
132
  * `EXPECTED_VERSION` enforces mechanically and this one asks for.
130
133
  */
131
- export declare const EXPECTED_F_VERSION = 29n;
134
+ export declare const EXPECTED_F_VERSION = 30n;
132
135
  export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
133
136
  /**
134
137
  * The versions say the managers are the right code; this says the rest of the addresses belong
package/dist/client.js CHANGED
@@ -109,8 +109,11 @@ function guardChain(wallet, pub) {
109
109
  * each market's, answered by the gate (`PublicPolicy.swapFeeTax`, the LOG Authority's) at birth and
110
110
  * read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
111
111
  * permissionless and pays the treasury. No pool id moved.
112
+ * 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
113
+ * takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
114
+ * `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
112
115
  */
113
- export const EXPECTED_VERSION = 8n;
116
+ export const EXPECTED_VERSION = 9n;
114
117
  /**
115
118
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
116
119
  * 4 was the income-only harvest cut).
@@ -199,8 +202,11 @@ export const EXPECTED_VERSION = 8n;
199
202
  // 29 (decision 068): the restructure guard and the registry's sunset read `block.timestamp` —
200
203
  // `Pool.restructureBlock` is `restructureTime` (unix seconds, same slot), `PolicyRegistry.sunset(policy, untilTime)`.
201
204
  // Names only: no pool id moved.
205
+ // 30 (decision 071): the events — `FSwap` is the shared `Swap` plus `FSwapState`, object-word names
206
+ // (`PoolCreated`, `GenerationSeeded`, `SharesMinted`, ...), `PoolCreated` carries the mint fee.
207
+ // No pool id moved.
202
208
  // A breaking bump: raised in the same change.
203
- export const EXPECTED_F_VERSION = 29n;
209
+ export const EXPECTED_F_VERSION = 30n;
204
210
  export async function assertVersion(c, expected = EXPECTED_VERSION) {
205
211
  const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");
206
212
  // three independent reads: one round trip, not three in a row
package/dist/fpool.d.ts CHANGED
@@ -1407,14 +1407,14 @@ export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): P
1407
1407
  */
1408
1408
  export declare function fPoolIdOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): Promise<Hex>;
1409
1409
  /**
1410
- * Rebuild a live pool's KEY from its id: the `FInitialize` log carries every field but the salt,
1410
+ * Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field but the salt,
1411
1411
  * which is taken from `opts.salt` (zero by default — every pool the SDK's create flow makes
1412
1412
  * without naming one; a pad's carries its split, so it is rebuilt from the policy's record with nonce 0 — pass `opts.salt` for another nonce). The result is checked against the id, so a wrong salt throws rather than
1413
1413
  * returning a key that names another pool. What {@link fPoolMigrate} needs when handed an id.
1414
1414
  */
1415
1415
  export declare function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts?: {
1416
1416
  salt?: Hex;
1417
- fromBlock?: bigint; /** The rindexer GraphQL endpoint: `FInitialize` from there, the node otherwise. The salt is in neither (the event does not carry it). */
1417
+ fromBlock?: bigint; /** The rindexer GraphQL endpoint: `PoolCreated` from there, the node otherwise. The salt is in neither (the event does not carry it). */
1418
1418
  indexer?: string;
1419
1419
  }): Promise<FPoolKey>;
1420
1420
  /**
@@ -1854,7 +1854,7 @@ export interface DiscoveredFPool {
1854
1854
  shape: FPoolShape;
1855
1855
  }
1856
1856
  /**
1857
- * Every F pool ever created, from `Initialize` logs alone — plus one `kind()` read per distinct
1857
+ * Every F pool ever created, from `PoolCreated` logs alone — plus one `kind()` read per distinct
1858
1858
  * policy, cached. Possible only because the event carries the full key preimage (bases,
1859
1859
  * weights, swapFee, policy, lnCapOverFloor) — the poolId is a hash and could never be inverted; contracts PR #17
1860
1860
  * exists for exactly this call. With `indexer`, the logs come from it (the node when it fails):
package/dist/fpool.js CHANGED
@@ -775,17 +775,17 @@ export async function fPoolIdOf(c, a) {
775
775
  return fPoolIdOfKey(fPoolKeyOf(c, a));
776
776
  }
777
777
  /**
778
- * Rebuild a live pool's KEY from its id: the `FInitialize` log carries every field but the salt,
778
+ * Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field but the salt,
779
779
  * which is taken from `opts.salt` (zero by default — every pool the SDK's create flow makes
780
780
  * without naming one; a pad's carries its split, so it is rebuilt from the policy's record with nonce 0 — pass `opts.salt` for another nonce). The result is checked against the id, so a wrong salt throws rather than
781
781
  * returning a key that names another pool. What {@link fPoolMigrate} needs when handed an id.
782
782
  */
783
783
  export async function fPoolKeyOfPool(c, poolId, opts = {}) {
784
- const ev = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "FInitialize");
784
+ const ev = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "PoolCreated");
785
785
  const { logs } = await getEventLogs(c, { indexer: opts.indexer, address: c.addresses.fPoolManager, event: ev, args: { poolId }, fromBlock: opts.fromBlock });
786
786
  const l = logs[0];
787
787
  if (!l)
788
- throw new Error(`logswap: no FInitialize for F pool ${poolId}`);
788
+ throw new Error(`logswap: no PoolCreated for F pool ${poolId}`);
789
789
  const a = l.args;
790
790
  const key = {
791
791
  quote: a.quote,
@@ -1330,17 +1330,17 @@ export async function fPoolTransferShares(c, a) {
1330
1330
  return wallet.writeContract(request);
1331
1331
  }
1332
1332
  /**
1333
- * Every F pool ever created, from `Initialize` logs alone — plus one `kind()` read per distinct
1333
+ * Every F pool ever created, from `PoolCreated` logs alone — plus one `kind()` read per distinct
1334
1334
  * policy, cached. Possible only because the event carries the full key preimage (bases,
1335
1335
  * weights, swapFee, policy, lnCapOverFloor) — the poolId is a hash and could never be inverted; contracts PR #17
1336
1336
  * exists for exactly this call. With `indexer`, the logs come from it (the node when it fails):
1337
1337
  * a scan from block 0 per call is what made the first load wait on the node.
1338
1338
  */
1339
1339
  export async function discoverFPools(c, opts = {}) {
1340
- const ev = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "FInitialize");
1340
+ const ev = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "PoolCreated");
1341
1341
  if (!ev)
1342
- throw new Error("logswap: F Initialize event missing from the generated ABI");
1343
- const seedEv = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "Seeded");
1342
+ throw new Error("logswap: F PoolCreated event missing from the generated ABI");
1343
+ const seedEv = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "GenerationSeeded");
1344
1344
  const range = { indexer: opts.indexer, address: c.addresses.fPoolManager, fromBlock: opts.fromBlock, toBlock: opts.toBlock };
1345
1345
  const [{ logs }, { logs: seeds }] = await Promise.all([
1346
1346
  getEventLogs(c, { ...range, event: ev }),