@logswap/sdk 0.5.101 → 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/dist/chains.d.ts CHANGED
@@ -1,14 +1,5 @@
1
- /**
2
- * chains.ts — the chains log(swap) runs on, and their deployments.
3
- *
4
- * The release chains carry the contracts at ONE address each (CREATE3 through CreateX, contracts
5
- * decision 069): the same `LogswapAddresses` on every chain. What differs per chain is the deploy
6
- * block, the quote tokens, the explorer and the indexer. An address therefore names a contract only
7
- * together with a chain id; every cache and every indexer URL in this SDK is per chain.
8
- */
9
1
  import { type Address, type Chain } from "viem";
10
2
  import type { LogswapAddresses } from "./client.js";
11
- /** A quote token a chain's policies list at deployment (`deployments/config/<chainId>.json`). */
12
3
  export interface LogswapQuote {
13
4
  symbol: string;
14
5
  address: Address;
@@ -16,27 +7,18 @@ export interface LogswapQuote {
16
7
  }
17
8
  export interface LogswapChain {
18
9
  chainId: number;
19
- /** The deployment artifact's `network` (`deployments/<chainId>.json`). */
20
10
  network: string;
21
11
  name: string;
22
- /** The viem chain, for `createPublicClient({ chain })`. */
23
12
  chain: Chain;
24
13
  nativeCurrency: Chain["nativeCurrency"];
25
- /** Block explorer root URL. */
26
14
  explorer?: string;
27
- /** A public JSON-RPC endpoint: rate-limited, for reads at low volume; production reads bring their own. */
28
15
  publicRpc?: string;
29
- /** A development chain: wiped and redeployed at the same addresses, so nothing keyed on its addresses persists. */
30
16
  devnet: boolean;
31
17
  testnet: boolean;
32
- /** The quotes the deploy config lists, verified on chain (symbol, decimals). Empty where none is configured. */
33
18
  quotes: readonly LogswapQuote[];
34
- /** The quote pads launch against on this chain. */
35
19
  padQuote?: Address;
36
- /** Block span of one `eth_getLogs` call on this chain; the client's default {@link LogswapClient.maxLogRange}. */
37
20
  maxLogRange: bigint;
38
21
  }
39
- /** The logswap devnet (anvil, persisted with `--state`). No public RPC. */
40
22
  export declare const logswapDevnet: {
41
23
  blockExplorers?: {
42
24
  [key: string]: {
@@ -93,29 +75,17 @@ export declare const logswapDevnet: {
93
75
  serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
94
76
  verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
95
77
  };
96
- /** Default block span per `eth_getLogs` call: public endpoints refuse wider ranges (or cap the result). */
97
78
  export declare const DEFAULT_MAX_LOG_RANGE = 2000n;
98
- /** Every chain this SDK knows, by chain id. */
99
79
  export declare const LOGSWAP_CHAINS: Readonly<Record<number, LogswapChain>>;
100
- /** The production chains, in release order. */
101
80
  export declare const RELEASE_CHAIN_IDS: readonly [1, 8453, 42161, 4663];
102
- /** The registry entry for `chainId`, or undefined for a chain this SDK does not list. */
103
81
  export declare function logswapChain(chainId: number): LogswapChain | undefined;
104
- /** A quote of `chainId` by symbol (case-insensitive), or undefined. */
105
82
  export declare function quoteOf(chainId: number, symbol: string): LogswapQuote | undefined;
106
- /**
107
- * A deployment artifact: `deployments/<chainId>.json` as the contracts' `DeployChain.s.sol` writes
108
- * it. `DeployLocal`'s artifact carries the same fields (without `deployTag` and `createX`) plus its
109
- * devnet extras, of which `tokenFactory` is kept.
110
- */
111
83
  export interface LogswapDeployment {
112
84
  chainId: number;
113
85
  network: string;
114
- /** The first block of the deployment: where every log scan starts. */
115
86
  deployBlock: bigint;
116
87
  cVersion: bigint;
117
88
  fVersion: bigint;
118
- /** The CREATE3 salt namespace (`logswap.v1`); absent on a local deployment. */
119
89
  deployTag?: string;
120
90
  deployer: Address;
121
91
  createX?: Address;
@@ -127,38 +97,19 @@ export interface LogswapDeployment {
127
97
  managerF: Address;
128
98
  routerF: Address;
129
99
  lensF: Address;
130
- /** The C stack (decision 096): absent while the chain has not opted into C (the artifact carries `address(0)` and `cVersion` 0). */
131
100
  managerC?: Address;
132
101
  routerC?: Address;
133
102
  lensC?: Address;
134
- /** The LOG's open F policy (`PolicyF`, `open`: anyone creates at salt zero, no gate ever; policy.md). */
135
103
  publicPolicy: Address;
136
- /** The LOG's desk on F (`PolicyF`, closed: the LOG creates, gates by pool). The artifact key predates 098 and is kept. */
137
104
  privatePolicy: Address;
138
- /** The LOG's POL policy on F (`PolicyF`: one base, a bid buffer, an income tax). */
139
105
  polPolicy: Address;
140
- /** The LOG's pad policy on F (`PolicyF`, `seedToDead`: income-only harvests, never closes). */
141
106
  padPolicy: Address;
142
- /** The LOG's open policy on C (`PolicyC`, `open`: anyone creates at salt zero, no gate ever). Absent while the chain has no C stack. */
143
107
  publicPolicyC?: Address;
144
- /** The devnet's token factory; local deployments only. */
145
108
  tokenFactory?: Address;
146
109
  }
147
- /**
148
- * The published deployments, by chain id. Empty until the release chains are deployed; a
149
- * deployment is added here from its artifact in the release that ships it.
150
- */
151
110
  export declare const LOGSWAP_DEPLOYMENTS: Readonly<Record<number, LogswapDeployment>>;
152
- /** The published deployment on `chainId`, or undefined. */
153
111
  export declare function deploymentFor(chainId: number): LogswapDeployment | undefined;
154
- /**
155
- * Validate a deployment artifact (parsed JSON) and return it typed. Throws on a missing or
156
- * malformed field, and on a `chainId` other than `opts.chainId` when given: one address set is valid
157
- * on every release chain, so an artifact read for the wrong chain would otherwise load cleanly and
158
- * scan from the wrong `deployBlock`.
159
- */
160
112
  export declare function deploymentFromArtifact(json: unknown, opts?: {
161
113
  chainId?: number;
162
114
  }): LogswapDeployment;
163
- /** The client's address set from a deployment. */
164
115
  export declare function addressesOfDeployment(d: LogswapDeployment): LogswapAddresses;
package/dist/chains.js CHANGED
@@ -1,14 +1,5 @@
1
- /**
2
- * chains.ts — the chains log(swap) runs on, and their deployments.
3
- *
4
- * The release chains carry the contracts at ONE address each (CREATE3 through CreateX, contracts
5
- * decision 069): the same `LogswapAddresses` on every chain. What differs per chain is the deploy
6
- * block, the quote tokens, the explorer and the indexer. An address therefore names a contract only
7
- * together with a chain id; every cache and every indexer URL in this SDK is per chain.
8
- */
9
1
  import { defineChain, getAddress, isAddress, zeroAddress } from "viem";
10
2
  import { arbitrum, base, foundry, mainnet, robinhood, robinhoodTestnet } from "viem/chains";
11
- /** The logswap devnet (anvil, persisted with `--state`). No public RPC. */
12
3
  export const logswapDevnet = defineChain({
13
4
  id: 31339,
14
5
  name: "log(swap) devnet",
@@ -16,9 +7,7 @@ export const logswapDevnet = defineChain({
16
7
  rpcUrls: { default: { http: [] } },
17
8
  testnet: true,
18
9
  });
19
- /** Default block span per `eth_getLogs` call: public endpoints refuse wider ranges (or cap the result). */
20
10
  export const DEFAULT_MAX_LOG_RANGE = 2000n;
21
- /** A local node answers any range. */
22
11
  const LOCAL_MAX_LOG_RANGE = 1000000n;
23
12
  const USDC = (address) => ({ symbol: "USDC", address, decimals: 6 });
24
13
  const WETH = (address) => ({ symbol: "WETH", address, decimals: 18 });
@@ -33,7 +22,6 @@ function entry(chain, e) {
33
22
  ...e,
34
23
  };
35
24
  }
36
- /** Every chain this SDK knows, by chain id. */
37
25
  export const LOGSWAP_CHAINS = Object.freeze({
38
26
  1: entry(mainnet, {
39
27
  network: "mainnet",
@@ -59,7 +47,6 @@ export const LOGSWAP_CHAINS = Object.freeze({
59
47
  quotes: [USDC("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"), WETH("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1")],
60
48
  padQuote: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
61
49
  }),
62
- // no native USDC: USDG is the dollar quote
63
50
  4663: entry(robinhood, {
64
51
  network: "robinhood",
65
52
  explorer: "https://robinhoodchain.blockscout.com",
@@ -78,23 +65,15 @@ export const LOGSWAP_CHAINS = Object.freeze({
78
65
  31337: entry(foundry, { network: "local", publicRpc: "http://127.0.0.1:8545", devnet: true, quotes: [], maxLogRange: LOCAL_MAX_LOG_RANGE }),
79
66
  31339: entry(logswapDevnet, { network: "devnet", devnet: true, quotes: [], maxLogRange: LOCAL_MAX_LOG_RANGE }),
80
67
  });
81
- /** The production chains, in release order. */
82
68
  export const RELEASE_CHAIN_IDS = [1, 8453, 42161, 4663];
83
- /** The registry entry for `chainId`, or undefined for a chain this SDK does not list. */
84
69
  export function logswapChain(chainId) {
85
70
  return LOGSWAP_CHAINS[chainId];
86
71
  }
87
- /** A quote of `chainId` by symbol (case-insensitive), or undefined. */
88
72
  export function quoteOf(chainId, symbol) {
89
73
  const s = symbol.toLowerCase();
90
74
  return LOGSWAP_CHAINS[chainId]?.quotes.find((q) => q.symbol.toLowerCase() === s);
91
75
  }
92
- /**
93
- * The published deployments, by chain id. Empty until the release chains are deployed; a
94
- * deployment is added here from its artifact in the release that ships it.
95
- */
96
76
  export const LOGSWAP_DEPLOYMENTS = Object.freeze({});
97
- /** The published deployment on `chainId`, or undefined. */
98
77
  export function deploymentFor(chainId) {
99
78
  return LOGSWAP_DEPLOYMENTS[chainId];
100
79
  }
@@ -114,9 +93,7 @@ const REQUIRED_ADDRESSES = [
114
93
  "padPolicy",
115
94
  ];
116
95
  const OPTIONAL_ADDRESSES = ["createX", "tokenFactory"];
117
- /** Policies an artifact may carry as `address(0)` (no C stack): zero is absent. An `orphanPolicy` key on an older artifact is ignored (F 41 has none). */
118
96
  const OPTIONAL_POLICIES = ["publicPolicyC"];
119
- /** The C stack: all three, or none (`address(0)` — the chain has not opted into C yet). */
120
97
  const C_STACK = ["managerC", "routerC", "lensC"];
121
98
  function uint(o, k) {
122
99
  const v = o[k];
@@ -135,12 +112,6 @@ function address(o, k) {
135
112
  }
136
113
  return getAddress(v);
137
114
  }
138
- /**
139
- * Validate a deployment artifact (parsed JSON) and return it typed. Throws on a missing or
140
- * malformed field, and on a `chainId` other than `opts.chainId` when given: one address set is valid
141
- * on every release chain, so an artifact read for the wrong chain would otherwise load cleanly and
142
- * scan from the wrong `deployBlock`.
143
- */
144
115
  export function deploymentFromArtifact(json, opts = {}) {
145
116
  if (typeof json !== "object" || json === null || Array.isArray(json))
146
117
  throw new Error("logswap: deployment artifact is not a JSON object");
@@ -180,7 +151,6 @@ export function deploymentFromArtifact(json, opts = {}) {
180
151
  d[k] = address(o, k);
181
152
  return d;
182
153
  }
183
- /** The client's address set from a deployment. */
184
154
  export function addressesOfDeployment(d) {
185
155
  return {
186
156
  managerF: d.managerF,
package/dist/claims.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * claims.ts — fee claims, and the ERC-6909 operator grant every router write depends on.
3
- *
4
- * Note the two unrelated meanings of "claim" in this protocol, kept apart here:
5
- * - a FEE claim — `claimFees`, withdrawing accrued quote while the position stays whole
6
- * - a TOKEN claim — a bearer IOU (bit-255-clear id) for inventory parked inside the manager
7
- */
8
1
  import type { Address, Hash } from "viem";
9
2
  import { type LogswapClient } from "./client.js";
10
3
  import { type PoolKey } from "./keys.js";
@@ -13,34 +6,9 @@ export interface ClaimFeesArgs extends WriteOptions {
13
6
  key: PoolKey;
14
7
  ids: readonly bigint[];
15
8
  }
16
- /**
17
- * Claim accrued fees across one or more classes: one transfer, positions untouched.
18
- *
19
- * **Every id must be REGISTERED** — one the manager has seen minted. An id for a class that has
20
- * never existed reverts the whole batch with `WrongPool`, because an unregistered id has
21
- * `poolId == 0` and cannot be shown to belong to this pool. In a contract holding every market's
22
- * assets, "cannot be shown to belong" must not be read as "belongs". A class that exists but which
23
- * the caller does not hold is fine — that is a no-op, not a revert.
24
- */
25
9
  export declare function claimFees(c: LogswapClient, a: ClaimFeesArgs): Promise<Hash>;
26
- /**
27
- * Grant the router operator rights over your ERC-6909 positions.
28
- *
29
- * **Required before any burn, update, move or harvest** — those pull the shares to the router
30
- * first. Without it they revert on the transfer, which reads as an unrelated balance error. Swaps
31
- * and mints do not need it.
32
- *
33
- * One grant covers every market, because the positions all live in the one manager.
34
- */
35
10
  export declare function approveRouterAsOperator(c: LogswapClient, approved?: boolean): Promise<Hash>;
36
- /** Is the router already an operator for `owner`? Check before prompting for a signature. */
37
11
  export declare function isRouterApproved(c: LogswapClient, owner: Address): Promise<boolean>;
38
- /**
39
- * What a wallet still has to approve before a given action.
40
- *
41
- * Surfacing this up front is the difference between one prompt and a failed transaction: the ERC-20
42
- * allowances and the 6909 operator grant are separate approvals with separate failure modes.
43
- */
44
12
  export interface Readiness {
45
13
  needsOperator: boolean;
46
14
  needsBaseAllowance: boolean;
package/dist/claims.js CHANGED
@@ -1,24 +1,8 @@
1
- /**
2
- * claims.ts — fee claims, and the ERC-6909 operator grant every router write depends on.
3
- *
4
- * Note the two unrelated meanings of "claim" in this protocol, kept apart here:
5
- * - a FEE claim — `claimFees`, withdrawing accrued quote while the position stays whole
6
- * - a TOKEN claim — a bearer IOU (bit-255-clear id) for inventory parked inside the manager
7
- */
8
1
  import { managerCAbi, routerCAbi } from "./generated.js";
9
2
  import { managerC, routerC } from "./client.js";
10
3
  import { poolId as keyId } from "./keys.js";
11
4
  import { isPosition } from "./ids.js";
12
5
  import { requireWallet, resolveDeadline, resolveRecipient, sendRouterWrite } from "./write.js";
13
- /**
14
- * Claim accrued fees across one or more classes: one transfer, positions untouched.
15
- *
16
- * **Every id must be REGISTERED** — one the manager has seen minted. An id for a class that has
17
- * never existed reverts the whole batch with `WrongPool`, because an unregistered id has
18
- * `poolId == 0` and cannot be shown to belong to this pool. In a contract holding every market's
19
- * assets, "cannot be shown to belong" must not be read as "belongs". A class that exists but which
20
- * the caller does not hold is fine — that is a no-op, not a revert.
21
- */
22
6
  export async function claimFees(c, a) {
23
7
  for (const id of a.ids) {
24
8
  if (!isPosition(id)) {
@@ -32,15 +16,6 @@ export async function claimFees(c, a) {
32
16
  args: [keyId(a.key), a.key.quote, a.ids, resolveRecipient(c, a), resolveDeadline(a)],
33
17
  });
34
18
  }
35
- /**
36
- * Grant the router operator rights over your ERC-6909 positions.
37
- *
38
- * **Required before any burn, update, move or harvest** — those pull the shares to the router
39
- * first. Without it they revert on the transfer, which reads as an unrelated balance error. Swaps
40
- * and mints do not need it.
41
- *
42
- * One grant covers every market, because the positions all live in the one manager.
43
- */
44
19
  export async function approveRouterAsOperator(c, approved = true) {
45
20
  const { account } = requireWallet(c);
46
21
  return c.wallet.writeContract({
@@ -52,7 +27,6 @@ export async function approveRouterAsOperator(c, approved = true) {
52
27
  chain: c.wallet.chain,
53
28
  });
54
29
  }
55
- /** Is the router already an operator for `owner`? Check before prompting for a signature. */
56
30
  export async function isRouterApproved(c, owner) {
57
31
  return c.public.readContract({
58
32
  address: managerC(c),
@@ -62,10 +36,6 @@ export async function isRouterApproved(c, owner) {
62
36
  });
63
37
  }
64
38
  export async function checkReadiness(c, key, owner, need = {}) {
65
- // A token is ready when BOTH legs of its pull path are: the ERC-20 allowance to whoever pulls
66
- // (Permit2 when wired) and, with Permit2, its unexpired allowance to the router. This used to
67
- // read the ERC-20 allowance to the ROUTER, which on a Permit2 deployment is never granted — so
68
- // it said "approve" forever, and approving the router changed nothing.
69
39
  const { checkTokenReadiness } = await import("./onboard.js");
70
40
  const ready = async (token, amount) => {
71
41
  if (amount === undefined)
package/dist/client.d.ts CHANGED
@@ -1,164 +1,48 @@
1
- /**
2
- * client.ts — the SDK handle: addresses + viem clients.
3
- *
4
- * Construct once and pass to every helper. `wallet` is optional: read helpers need only `public`.
5
- *
6
- * **One stack per manager, permanently** (decision 096): a manager, its router and its lens, for F and for
7
- * C. Not per market — every market lives in the one manager of its side, and a market is an
8
- * `initialize` call rather than a deployment. F ships first, so the C stack is optional: a chain
9
- * that has not opted into C carries `address(0)` for it, and every C call throws a plain error there.
10
- */
11
1
  import type { Address, PublicClient, WalletClient } from "viem";
12
2
  import { type LogswapDeployment } from "./chains.js";
13
- /** The two singletons: `C` is the concentrated one (a floor per position, a tick ladder), `F` the fungible one. */
14
3
  export type Side = "C" | "F";
15
4
  export interface LogswapAddresses {
16
- /** The F singleton — fungible claims, one shared floor, n bases. ERC-6909 shares and token claims live here. */
17
5
  managerF: Address;
18
- /** F's user entry: swaps, zaps, roll-in, Permit2. Its own Permit2 spender. */
19
6
  routerF: Address;
20
- /** F's read-only lens: pool views and previews. */
21
7
  lensF: Address;
22
- /**
23
- * The C singleton — a floor per position, on a tick ladder. ERC-6909 positions and token claims live here.
24
- * The C stack is optional: F ships first, and a chain that has not opted into C carries none.
25
- */
26
8
  managerC?: Address;
27
- /** C's user entry: the batch, the named one-action entries, Permit2 (a market is opened on the manager). Its own Permit2 spender. */
28
9
  routerC?: Address;
29
- /** C's read-only lens: ladder derivations and views. */
30
10
  lensC?: Address;
31
- /**
32
- * The LOG's policies (decision 098: immutable, deployed by the LOG): every pool names one in its key for life, and the pool's
33
- * roles, gates and terms live on it. On F the four are instances of one contract, `PolicyF` (F 41, policy.md), told apart by
34
- * their immutables: `publicPolicy` is the open one (anyone creates at salt zero, no gate ever), `privatePolicy` the LOG's desk
35
- * (closed, gates by pool), `polPolicy` and `padPolicy` the treasury's and the launch's. The artifact keys predate 098 and are
36
- * kept. A deployment predating the policies carries none.
37
- */
38
11
  publicPolicy?: Address;
39
12
  privatePolicy?: Address;
40
13
  polPolicy?: Address;
41
14
  padPolicy?: Address;
42
- /** The LOG's open policy on C (`PolicyC`): the policy of a public market. Absent with no C stack. */
43
15
  publicPolicyC?: Address;
44
- /**
45
- * The policy registry: what a pool of each kind may be born under, and the
46
- * owner that may move a pool between policies. Read from the F manager (`registry()`) when
47
- * absent; a deployment with none asks nobody.
48
- */
49
16
  policyRegistry?: Address;
50
- /** The devnet's token factory (`TokenFactory`, a mock): where launchable tokens come from. Optional. */
51
17
  tokenFactory?: Address;
52
- /** Optional — each router falls back to plain approvals when absent. */
53
18
  permit2?: Address;
54
19
  }
55
- /** Whether the deployment carries the C stack. */
56
20
  export declare function hasC(c: LogswapClient): boolean;
57
- /** The C manager; throws where the deployment has none. */
58
21
  export declare function managerC(c: LogswapClient): Address;
59
- /** The C router; throws where the deployment has none. */
60
22
  export declare function routerC(c: LogswapClient): Address;
61
- /** The C lens; throws where the deployment has none. */
62
23
  export declare function lensC(c: LogswapClient): Address;
63
- /** The router of `side` — the contract that pulls the caller's tokens, and the spender to approve. */
64
24
  export declare function routerOf(c: LogswapClient, side: Side): Address;
65
25
  export interface LogswapClient {
66
26
  public: PublicClient;
67
27
  wallet?: WalletClient;
68
28
  addresses: LogswapAddresses;
69
- /** The chain the client reads: the deployment's, else the public client's. Unset when neither says. */
70
29
  chainId?: number;
71
- /** The deployment's first block: the default `fromBlock` of every log scan. */
72
30
  deployBlock?: bigint;
73
- /** Block span of one `eth_getLogs` call on the chain path; wider scans are split. {@link DEFAULT_MAX_LOG_RANGE} when unset. */
74
31
  maxLogRange?: bigint;
75
- /**
76
- * The rindexer GraphQL endpoint of THIS chain's indexer: the default `indexer` of every history
77
- * read. The contracts sit at one address on every release chain, so an indexer's rows carry no
78
- * chain a reader could filter on: one URL per chain.
79
- */
80
32
  indexerUrl?: string;
81
33
  }
82
34
  export interface CreateLogswapClientArgs {
83
35
  public: PublicClient;
84
36
  wallet?: WalletClient;
85
- /** The addresses; derived from `deployment` when absent. One of the two is required. */
86
37
  addresses?: LogswapAddresses;
87
- /** A deployment ({@link deploymentFromArtifact}, {@link deploymentFor}): addresses, chain and deploy block. */
88
38
  deployment?: LogswapDeployment;
89
- /** Overrides the deployment's. */
90
39
  deployBlock?: bigint;
91
- /** Overrides the chain's default ({@link LogswapChain.maxLogRange}, else {@link DEFAULT_MAX_LOG_RANGE}). */
92
40
  maxLogRange?: bigint;
93
41
  indexerUrl?: string;
94
42
  }
95
43
  export declare function createLogswapClient(args: CreateLogswapClientArgs): LogswapClient;
96
- /** The chain id the client reads: set at construction when known, else asked of the node. */
97
44
  export declare function clientChainId(c: LogswapClient): Promise<number>;
98
- /**
99
- * Assert the deployment matches the ABI this build was generated against.
100
- *
101
- * Cheap insurance worth taking at construction: without it, a manager from a different deployment
102
- * decodes into plausible-looking garbage rather than failing. `version` is bumped on any tier-1 or
103
- * tier-2 change (docs/app.md).
104
- *
105
- * **2** since 2026-09-01. It sat at 1 across a read surface that changed underneath it — the nine
106
- * `public constant` getters left the manager for `CParams`, `move` gained its settlement bounds,
107
- * `createMarket` arrived — so a 1 answered for two incompatible ABIs and this check passed against
108
- * a manager it should have rejected. Observed, not theorised: a local chain running a pre-trim
109
- * manager sailed through `assertVersion` while `FEE_MAX()` still answered on it. Move this in the
110
- * same change as `CParams.VERSION`, never after it.
111
- *
112
- * **3** since 2026-09-03: `burnById` and `update` take an `owner`, `update`
113
- * mints to `to`, `positions()` returns `aps` as uint128 — and a returned quote flow now carries the
114
- * swept fees, which is why `exit`'s settle-to-one-asset math changed with it.
115
- *
116
- * **4** since 2026-09-18: `PoolKey` is `(base, quote, tickSpacing, phi)` —
117
- * the variance kernel and its two key fields are gone, so every pool id changed; `phiEff` is
118
- * `phiOf`; `getPool` lost `sigma2Ema`; `Initialize` lost two fields; the cut is
119
- * `MINT_FEE_PROTOCOL_CUT` / `setFeeParams`.
120
- *
121
- * **6** since 2026-10-09 (logswap-contract#58): the whole mint fee is the protocol's
122
- * (`MINT_FEE_PROTOCOL_CUT` and `setFeeParams` are gone, decisions 058); the swap-fee tax at payout,
123
- * `swapFeeTax` / `setSwapFeeTax` (060); `phi` is `swapFee` and `phiOf` `swapFeeOf` (059) — field
124
- * names only, no pool id moved.
125
- *
126
- * **7** since 2026-10-12 (logswap-contract#60, decisions 064–065): the typed views (`getPool`,
127
- * `ticks`, `tickBitmapWord`, `positions`, `feeAcct`, `idInfo`) are behind `extsload` — the pool
128
- * reads through the lens's `getPools`, a class through `CPoolState`'s layout; a fee of 0 is no
129
- * fee (`swapFeeOf` and `DEFAULT_FEE` are gone); the mint fee is the market's, proposed at
130
- * `initialize` / `createMarket` and answered by the gate; the gate (`gate`, `setGate`) is the
131
- * public policy, set at construction. No pool id moved.
132
- *
133
- * **8** since 2026-10-13 (logswap-contract decision 066): the collector is split into two roles —
134
- * `feeCollector` / `proposeCollector` / `acceptCollector` are `treasury` / `proposeTreasury` (the
135
- * LOG Authority's) / `acceptTreasury`; `setSwapFeeTax` and `setGate` leave the manager: the tax is
136
- * each market's, answered by its policy at birth (`PolicyC.swapFeeTax`, an immutable; `SponsorPolicyC` before C 18) and
137
- * read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
138
- * permissionless and pays the treasury. No pool id moved.
139
- * 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
140
- * takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
141
- * `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
142
- */
143
45
  export declare const EXPECTED_VERSION = 20n;
144
- /**
145
- * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
146
- * 4 was the income-only harvest cut).
147
- *
148
- * A FLOOR, not an equality — unlike `EXPECTED_VERSION` above. The F primitive is iterating fast and
149
- * its bumps are mostly additive (6 is `multicall`, which nothing this SDK calls goes near), so an
150
- * exact match meant each one bricked every app on the deployment until the SDK was republished — a
151
- * version wall in front of a change that broke nothing. The cost is that a genuinely breaking bump
152
- * passes it; when one lands, raise this constant in the same change, which is the discipline
153
- * `EXPECTED_VERSION` enforces mechanically and this one asks for.
154
- */
155
46
  export declare const EXPECTED_F_VERSION = 44n;
156
47
  export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
157
- /**
158
- * The versions say the managers are the right code; this says the rest of the addresses belong
159
- * to THEM. A stale router or lens from a previous deployment passes every version check and then
160
- * fails in the worst way: approvals go to a router that pulls for another manager, or every pull
161
- * reverts because the router's Permit2 is not the one the user approved. Each side is checked on its
162
- * own: the router and the lens name their manager (`mgr()`), and the router its Permit2.
163
- */
164
48
  export declare function assertWiring(c: LogswapClient): Promise<void>;