hookr-sdk 0.2.1 → 1.0.0

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 (66) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/LICENSE +21 -0
  3. package/MIGRATING.md +89 -0
  4. package/README.md +286 -105
  5. package/dist/core/abi.d.ts +10930 -0
  6. package/dist/core/abi.js +455 -0
  7. package/dist/core/advisories.d.ts +184 -0
  8. package/dist/core/advisories.js +291 -0
  9. package/dist/core/client.d.ts +55 -0
  10. package/dist/core/client.js +107 -0
  11. package/dist/core/generated.d.ts +14295 -0
  12. package/dist/core/generated.js +1058 -0
  13. package/dist/core/index.d.ts +17 -0
  14. package/dist/core/index.js +17 -0
  15. package/dist/core/launch.d.ts +200 -0
  16. package/dist/core/launch.js +427 -0
  17. package/dist/core/pair.d.ts +64 -0
  18. package/dist/core/pair.js +136 -0
  19. package/dist/core/params.d.ts +415 -0
  20. package/dist/core/params.js +1235 -0
  21. package/dist/core/policies.d.ts +136 -0
  22. package/dist/core/policies.js +125 -0
  23. package/dist/core/proofs.d.ts +25 -0
  24. package/dist/core/proofs.js +118 -0
  25. package/dist/core/quotes.d.ts +185 -0
  26. package/dist/core/quotes.js +550 -0
  27. package/dist/core/referrals.d.ts +32 -0
  28. package/dist/core/referrals.js +36 -0
  29. package/dist/core/registry.d.ts +357 -0
  30. package/dist/core/registry.js +378 -0
  31. package/dist/core/rules.d.ts +675 -0
  32. package/dist/core/rules.js +1049 -0
  33. package/dist/core/schema.d.ts +358 -0
  34. package/dist/core/schema.js +105 -0
  35. package/dist/core/stocks.generated.d.ts +11 -0
  36. package/dist/core/stocks.generated.js +1228 -0
  37. package/dist/core/vault.d.ts +59 -0
  38. package/dist/core/vault.js +112 -0
  39. package/dist/core/wallet.d.ts +142 -0
  40. package/dist/core/wallet.js +304 -0
  41. package/dist/deployments.d.ts +8 -0
  42. package/dist/deployments.js +26 -0
  43. package/dist/index.d.ts +6 -15
  44. package/dist/index.js +6 -15
  45. package/dist/releases.d.ts +172 -0
  46. package/dist/releases.js +268 -0
  47. package/package.json +46 -10
  48. package/provenance.json +31 -0
  49. package/dist/abi.d.ts +0 -6404
  50. package/dist/abi.js +0 -8300
  51. package/dist/chain.d.ts +0 -87
  52. package/dist/chain.js +0 -86
  53. package/dist/claims.d.ts +0 -32
  54. package/dist/claims.js +0 -31
  55. package/dist/fees.d.ts +0 -59
  56. package/dist/fees.js +0 -142
  57. package/dist/links.d.ts +0 -48
  58. package/dist/links.js +0 -93
  59. package/dist/market.d.ts +0 -264
  60. package/dist/market.js +0 -310
  61. package/dist/reads.d.ts +0 -136
  62. package/dist/reads.js +0 -219
  63. package/dist/rules.d.ts +0 -84
  64. package/dist/rules.js +0 -296
  65. package/dist/swap.d.ts +0 -108
  66. package/dist/swap.js +0 -144
package/dist/reads.d.ts DELETED
@@ -1,136 +0,0 @@
1
- /**
2
- * Read a market from the coordinator, list markets from `MarketCreated` logs, and read a pool's
3
- * frozen rules from the stack registry.
4
- *
5
- * `readMarket` mirrors `HookrMarketCoordinatorV5.getMarket`; `listMarkets` mirrors the log shape
6
- * and scan-from block in the app's `src/lib/v2-discover-server.ts` (`v2MarketRowFromLog`,
7
- * `V2_MARKET_SCAN_FROM_BLOCK`); `readPoolRules` mirrors the registry read the app's agent skill
8
- * (`src/lib/agent-skill.ts`, "Read a pool's rules") describes in prose: `stack(poolId)` for the
9
- * module count and limits, then `moduleAt(poolId, i)` for each module, decoding the
10
- * native-mechanics module's `config` with `market.ts`'s `NativeConfig` tuple.
11
- */
12
- import { type Address, type Hex, type PublicClient } from "viem";
13
- import type { NativeConfig, StackLimits } from "./market.js";
14
- /** `HookrMarketCoordinatorV5.MarketOrigin`: 1 is a token the coordinator deployed, 2 an existing one. */
15
- export type MarketOrigin = "new-token" | "existing-token";
16
- export type Market = Readonly<{
17
- live: boolean;
18
- origin: MarketOrigin;
19
- subject: Address;
20
- quote: Address;
21
- creator: Address;
22
- kernel: Address;
23
- lpFeeRecipient: Address;
24
- kernelId: Hex;
25
- stackHash: Hex;
26
- poolId: Hex;
27
- sqrtPriceX96: bigint;
28
- tickSpacing: number;
29
- subjectSupplied: bigint;
30
- quoteSupplied: bigint;
31
- subjectUsed: bigint;
32
- quoteUsed: bigint;
33
- cumulativeFee0: bigint;
34
- cumulativeFee1: bigint;
35
- openedAtBlock: bigint;
36
- launchIntentId: Hex;
37
- initialBuyRouter: Address;
38
- creatorAllocation: bigint;
39
- initialBuyQuoteIn: bigint;
40
- initialBuySubjectOut: bigint;
41
- initialBuySubjectOutMinimum: bigint;
42
- initialBuyModuleDataHash: Hex;
43
- }>;
44
- /** `marketCoordinator.getMarket(poolId)`. `live` is false for a `poolId` the coordinator never opened. */
45
- export declare function readMarket(client: PublicClient, poolId: Hex): Promise<Market>;
46
- /** The coordinator's deploy block on chain 4663: no `MarketCreated` log can sit before it. */
47
- export declare const MARKET_SCAN_FROM_BLOCK = 57229676n;
48
- /**
49
- * Blocks per `eth_getLogs` window in `listMarkets`, the same width the app's own scanners use.
50
- * The chain's public node answers an over-wide window with an empty array rather than an error,
51
- * so one request over the whole history is a silent miss waiting to happen; a bounded window
52
- * keeps each answer small. Lower it further on a provider with a tighter range limit.
53
- */
54
- export declare const MARKET_SCAN_CHUNK_BLOCKS = 3000000n;
55
- export declare const MARKET_CREATED_TOPIC: Hex;
56
- /** One decoded `MarketCreated` log: every field the coordinator emitted, nothing derived. */
57
- export type MarketRow = Readonly<{
58
- poolId: Hex;
59
- subject: Address;
60
- quote: Address;
61
- creator: Address;
62
- origin: MarketOrigin;
63
- kernel: Address;
64
- sqrtPriceX96: bigint;
65
- tickSpacing: number;
66
- blockNumber: bigint;
67
- txHash: Hex;
68
- logIndex: number;
69
- }>;
70
- /**
71
- * Every `MarketCreated` log the coordinator emitted in `[fromBlock, toBlock]`, oldest first,
72
- * fetched in windows of `chunkBlocks` (`MARKET_SCAN_CHUNK_BLOCKS` by default).
73
- *
74
- * `root`, when given, is checked against every row's `kernel` rather than passed to the log
75
- * filter, because `kernel` is not an indexed topic. Pass `ADDRESSES.root` for markets on the
76
- * default root, `ADDRESSES.recaptureRoot` for markets on the recapture root, or nothing for
77
- * every market the coordinator opened, on any root.
78
- */
79
- export declare function listMarkets(client: PublicClient, options?: Readonly<{
80
- root?: Address;
81
- fromBlock?: bigint;
82
- toBlock?: bigint;
83
- chunkBlocks?: bigint;
84
- }>): Promise<readonly MarketRow[]>;
85
- /** The inverse of `market.ts`'s `encodeNativeBlockConfig`. */
86
- export declare function decodeNativeBlockConfig(data: Hex): NativeConfig;
87
- export type PoolRules = Readonly<{
88
- /** False when the registry has no stack for this `poolId` at all. */
89
- configured: boolean;
90
- limits: StackLimits | null;
91
- /** The native-mechanics module's decoded config; null when the pool carries no such module. */
92
- nativeConfig: NativeConfig | null;
93
- }>;
94
- /**
95
- * `stackRegistry.stack(poolId)` for `moduleCount`/`limits`, then `stackRegistry.moduleAt` for
96
- * each module, decoding the native-mechanics module's `config` bytes. Every other module (the
97
- * directional tax block, when a pool carries one) is skipped: its config schema is not modeled
98
- * by this package.
99
- */
100
- export declare function readPoolRules(client: PublicClient, poolId: Hex): Promise<PoolRules>;
101
- /**
102
- * True when the pool's frozen rules name a correction executor, so the root's kernel dispatches a
103
- * correction around every swap and the swap needs `CORRECTION_SWAP_GAS_FLOOR`. This is the pool's
104
- * own record rather than the root's identity: a pool on a superseded recapture root keeps its
105
- * executor and keeps correcting, which `isCorrectingRoot` (current root only) does not see. Pass
106
- * the result as `correcting` to the swap builders. It is also true for a pool whose lane cannot
107
- * run on ordinary gas (the first recapture root); the floor is then unused headroom, not a loss.
108
- */
109
- export declare function poolCorrects(rules: PoolRules): boolean;
110
- /** `HookrStackRegistryV1.KernelStatus`. */
111
- export type RootStatus = "unset" | "active" | "retired";
112
- /** One registered root (kernel) as the stack registry records it. */
113
- export type RootRow = Readonly<{
114
- kernelId: Hex;
115
- /** The root hook: `PoolKey.hooks` for every pool opened on it. */
116
- hook: Address;
117
- version: number;
118
- codeHash: Hex;
119
- hookFlags: bigint;
120
- status: RootStatus;
121
- /** True when the registry holds a sealed root profile for this kernel; the coordinator only
122
- * opens markets on a sealed profile. */
123
- sealed: boolean;
124
- profileId: Hex | null;
125
- moduleCount: number | null;
126
- }>;
127
- /**
128
- * Every kernel the stack registry has registered, in registration order: `kernelCount`, then
129
- * `kernelIdAt`, `kernel`, `kernelStatus` and `rootProfile` for each. Nothing here comes from a
130
- * list in this package, so a root this package has never heard of still appears. `rootProfile`
131
- * reverts for a kernel whose profile was never sealed; that reads as `sealed: false`.
132
- *
133
- * The registry never retires a root on its own, so an active, sealed root is not the same thing
134
- * as a current one: `ROOTS` names the two roots Hookr opens markets on today.
135
- */
136
- export declare function listRoots(client: PublicClient): Promise<readonly RootRow[]>;
package/dist/reads.js DELETED
@@ -1,219 +0,0 @@
1
- /**
2
- * Read a market from the coordinator, list markets from `MarketCreated` logs, and read a pool's
3
- * frozen rules from the stack registry.
4
- *
5
- * `readMarket` mirrors `HookrMarketCoordinatorV5.getMarket`; `listMarkets` mirrors the log shape
6
- * and scan-from block in the app's `src/lib/v2-discover-server.ts` (`v2MarketRowFromLog`,
7
- * `V2_MARKET_SCAN_FROM_BLOCK`); `readPoolRules` mirrors the registry read the app's agent skill
8
- * (`src/lib/agent-skill.ts`, "Read a pool's rules") describes in prose: `stack(poolId)` for the
9
- * module count and limits, then `moduleAt(poolId, i)` for each module, decoding the
10
- * native-mechanics module's `config` with `market.ts`'s `NativeConfig` tuple.
11
- */
12
- import { decodeAbiParameters, getAbiItem, toEventSelector } from "viem";
13
- import { hookrMarketCoordinatorV5Abi, hookrStackRegistryV2Abi } from "./abi.js";
14
- import { ADDRESSES, MODULE_ID, NATIVE_ADDRESS } from "./chain.js";
15
- function marketOrigin(value) {
16
- if (value === 1)
17
- return "new-token";
18
- if (value === 2)
19
- return "existing-token";
20
- throw new Error(`Unknown MarketOrigin ${value}.`);
21
- }
22
- /** `marketCoordinator.getMarket(poolId)`. `live` is false for a `poolId` the coordinator never opened. */
23
- export async function readMarket(client, poolId) {
24
- const m = (await client.readContract({
25
- address: ADDRESSES.coordinator,
26
- abi: hookrMarketCoordinatorV5Abi,
27
- functionName: "getMarket",
28
- args: [poolId],
29
- }));
30
- return Object.freeze({ ...m, origin: marketOrigin(m.origin) });
31
- }
32
- // -----------------------------------------------------------------------------------------------
33
- // listMarkets
34
- // -----------------------------------------------------------------------------------------------
35
- /** The coordinator's deploy block on chain 4663: no `MarketCreated` log can sit before it. */
36
- export const MARKET_SCAN_FROM_BLOCK = 57229676n;
37
- /**
38
- * Blocks per `eth_getLogs` window in `listMarkets`, the same width the app's own scanners use.
39
- * The chain's public node answers an over-wide window with an empty array rather than an error,
40
- * so one request over the whole history is a silent miss waiting to happen; a bounded window
41
- * keeps each answer small. Lower it further on a provider with a tighter range limit.
42
- */
43
- export const MARKET_SCAN_CHUNK_BLOCKS = 3000000n;
44
- const MARKET_CREATED_EVENT = getAbiItem({ abi: hookrMarketCoordinatorV5Abi, name: "MarketCreated" });
45
- export const MARKET_CREATED_TOPIC = toEventSelector(MARKET_CREATED_EVENT);
46
- /**
47
- * Every `MarketCreated` log the coordinator emitted in `[fromBlock, toBlock]`, oldest first,
48
- * fetched in windows of `chunkBlocks` (`MARKET_SCAN_CHUNK_BLOCKS` by default).
49
- *
50
- * `root`, when given, is checked against every row's `kernel` rather than passed to the log
51
- * filter, because `kernel` is not an indexed topic. Pass `ADDRESSES.root` for markets on the
52
- * default root, `ADDRESSES.recaptureRoot` for markets on the recapture root, or nothing for
53
- * every market the coordinator opened, on any root.
54
- */
55
- export async function listMarkets(client, options = {}) {
56
- const fromBlock = options.fromBlock ?? MARKET_SCAN_FROM_BLOCK;
57
- const toBlock = options.toBlock ?? (await client.getBlockNumber());
58
- const chunk = options.chunkBlocks ?? MARKET_SCAN_CHUNK_BLOCKS;
59
- if (chunk <= 0n)
60
- throw new Error("chunkBlocks must be positive.");
61
- const logs = [];
62
- for (let from = fromBlock; from <= toBlock; from += chunk) {
63
- const to = from + chunk - 1n < toBlock ? from + chunk - 1n : toBlock;
64
- logs.push(...(await client.getLogs({
65
- address: ADDRESSES.coordinator,
66
- event: MARKET_CREATED_EVENT,
67
- fromBlock: from,
68
- toBlock: to,
69
- strict: true,
70
- })));
71
- }
72
- const rows = [];
73
- for (const log of logs) {
74
- const args = log.args;
75
- const row = Object.freeze({
76
- poolId: args.poolId,
77
- subject: args.subject,
78
- quote: args.quote,
79
- creator: args.creator,
80
- origin: marketOrigin(args.origin),
81
- kernel: args.kernel,
82
- sqrtPriceX96: args.sqrtPriceX96,
83
- tickSpacing: args.tickSpacing,
84
- blockNumber: log.blockNumber,
85
- txHash: log.transactionHash,
86
- logIndex: log.logIndex ?? 0,
87
- });
88
- if (options.root && row.kernel.toLowerCase() !== options.root.toLowerCase())
89
- continue;
90
- rows.push(row);
91
- }
92
- rows.sort((a, b) => (a.blockNumber === b.blockNumber ? a.logIndex - b.logIndex : a.blockNumber < b.blockNumber ? -1 : 1));
93
- return Object.freeze(rows);
94
- }
95
- // -----------------------------------------------------------------------------------------------
96
- // readPoolRules
97
- // -----------------------------------------------------------------------------------------------
98
- const CONFIG_COMPONENTS = [
99
- { name: "poolId", type: "bytes32" },
100
- { name: "kernel", type: "address" },
101
- { name: "subject", type: "address" },
102
- { name: "quote", type: "address" },
103
- { name: "lockedLiquidityProvider", type: "address" },
104
- { name: "guardEndBlock", type: "uint40" },
105
- { name: "baseFeePips", type: "uint24" },
106
- { name: "maxFeePips", type: "uint24" },
107
- { name: "snipeTaxPips", type: "uint24" },
108
- { name: "surgeSens", type: "uint16" },
109
- { name: "burnBps", type: "uint16" },
110
- { name: "lpBps", type: "uint16" },
111
- { name: "potBps", type: "uint16" },
112
- { name: "royaltyBps", type: "uint16" },
113
- { name: "potEveryNBuys", type: "uint32" },
114
- { name: "maxBuyQuoteAmount", type: "uint96" },
115
- { name: "potMinBuyWei", type: "uint96" },
116
- { name: "royaltyTo", type: "address" },
117
- { name: "protocolRecipient", type: "address" },
118
- { name: "protocolShareBps", type: "uint24" },
119
- ];
120
- const CONFIG_ABI = [{ type: "tuple", components: CONFIG_COMPONENTS }];
121
- /** The inverse of `market.ts`'s `encodeNativeBlockConfig`. */
122
- export function decodeNativeBlockConfig(data) {
123
- const raw = decodeAbiParameters(CONFIG_ABI, data)[0];
124
- return Object.freeze({ ...raw, guardEndBlock: BigInt(raw.guardEndBlock) });
125
- }
126
- /**
127
- * `stackRegistry.stack(poolId)` for `moduleCount`/`limits`, then `stackRegistry.moduleAt` for
128
- * each module, decoding the native-mechanics module's `config` bytes. Every other module (the
129
- * directional tax block, when a pool carries one) is skipped: its config schema is not modeled
130
- * by this package.
131
- */
132
- export async function readPoolRules(client, poolId) {
133
- const core = (await client.readContract({
134
- address: ADDRESSES.registry,
135
- abi: hookrStackRegistryV2Abi,
136
- functionName: "stack",
137
- args: [poolId],
138
- }));
139
- if (!core.configured)
140
- return Object.freeze({ configured: false, limits: null, nativeConfig: null });
141
- let nativeConfig = null;
142
- for (let i = 0; i < core.moduleCount; i++) {
143
- const [snapshot, config] = (await client.readContract({
144
- address: ADDRESSES.registry,
145
- abi: hookrStackRegistryV2Abi,
146
- functionName: "moduleAt",
147
- args: [poolId, BigInt(i)],
148
- }));
149
- if (snapshot.moduleId.toLowerCase() === MODULE_ID.toLowerCase()) {
150
- nativeConfig = decodeNativeBlockConfig(config);
151
- break;
152
- }
153
- }
154
- return Object.freeze({ configured: true, limits: core.limits, nativeConfig });
155
- }
156
- /**
157
- * True when the pool's frozen rules name a correction executor, so the root's kernel dispatches a
158
- * correction around every swap and the swap needs `CORRECTION_SWAP_GAS_FLOOR`. This is the pool's
159
- * own record rather than the root's identity: a pool on a superseded recapture root keeps its
160
- * executor and keeps correcting, which `isCorrectingRoot` (current root only) does not see. Pass
161
- * the result as `correcting` to the swap builders. It is also true for a pool whose lane cannot
162
- * run on ordinary gas (the first recapture root); the floor is then unused headroom, not a loss.
163
- */
164
- export function poolCorrects(rules) {
165
- const executor = rules.limits?.correctionExecutor;
166
- return executor !== undefined && executor.toLowerCase() !== NATIVE_ADDRESS.toLowerCase();
167
- }
168
- function rootStatus(value) {
169
- if (value === 0)
170
- return "unset";
171
- if (value === 1)
172
- return "active";
173
- if (value === 2)
174
- return "retired";
175
- throw new Error(`Unknown KernelStatus ${value}.`);
176
- }
177
- /**
178
- * Every kernel the stack registry has registered, in registration order: `kernelCount`, then
179
- * `kernelIdAt`, `kernel`, `kernelStatus` and `rootProfile` for each. Nothing here comes from a
180
- * list in this package, so a root this package has never heard of still appears. `rootProfile`
181
- * reverts for a kernel whose profile was never sealed; that reads as `sealed: false`.
182
- *
183
- * The registry never retires a root on its own, so an active, sealed root is not the same thing
184
- * as a current one: `ROOTS` names the two roots Hookr opens markets on today.
185
- */
186
- export async function listRoots(client) {
187
- const registry = { address: ADDRESSES.registry, abi: hookrStackRegistryV2Abi };
188
- const count = (await client.readContract({ ...registry, functionName: "kernelCount" }));
189
- const rows = [];
190
- for (let i = 0n; i < count; i++) {
191
- const kernelId = (await client.readContract({ ...registry, functionName: "kernelIdAt", args: [i] }));
192
- const record = (await client.readContract({ ...registry, functionName: "kernel", args: [kernelId] }));
193
- const status = (await client.readContract({ ...registry, functionName: "kernelStatus", args: [kernelId] }));
194
- let sealed = false;
195
- let profileId = null;
196
- let moduleCount = null;
197
- try {
198
- const profile = (await client.readContract({ ...registry, functionName: "rootProfile", args: [kernelId] }));
199
- sealed = profile.isSealed;
200
- profileId = profile.profileId;
201
- moduleCount = profile.moduleCount;
202
- }
203
- catch {
204
- // Unsealed: the registry reverts rather than returning an empty profile.
205
- }
206
- rows.push(Object.freeze({
207
- kernelId,
208
- hook: record.implementation,
209
- version: record.version,
210
- codeHash: record.implementationCodeHash,
211
- hookFlags: record.hookFlags,
212
- status: rootStatus(status),
213
- sealed,
214
- profileId,
215
- moduleCount,
216
- }));
217
- }
218
- return rows;
219
- }
package/dist/rules.d.ts DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * The public rules a market's stack can carry, and their bounds.
3
- *
4
- * Copied from the Hookr app's `src/lib/hooks-model.ts`: `RULES` mirrors `HOOKS` reduced to
5
- * `{ key, name, summary, explanation }`, and `PARAMS` mirrors the bounds/step/default of the
6
- * app's `PARAMS[type]` (its display-only `fmt` function is not carried here; `unit` is a short,
7
- * human label instead — see the module doc below). Both are restricted to the app's
8
- * `PUBLIC_BUILDER_HOOK_ORDER`, which today is the five deployed blocks (`HOOK_ORDER`): the
9
- * directional tax module (`DIRECTIONAL_TAX_UI` in the app) is off and is not offered here either.
10
- * `src/test/hookr-sdk-parity.test.ts` in the app asserts the key order and every bound match.
11
- *
12
- * A rule compiles into the native block's `Config` (see `fees.ts` and `market.ts`); it is not a
13
- * separate contract call. At most five rules on a stack today, one per key, because there are
14
- * only five public rule keys — `validateStack` still checks the count explicitly so a future
15
- * sixth key does not silently raise the ceiling.
16
- */
17
- export type RuleKey = "snipe" | "fee" | "burn" | "lp" | "pot";
18
- /** The public rule keys, in the order the app's builder palette offers them. */
19
- export declare const RULE_ORDER: readonly RuleKey[];
20
- export type Rule = Readonly<{
21
- key: RuleKey;
22
- name: string;
23
- /** Compact catalogue tagline. */
24
- summary: string;
25
- /** One complete, plain-language sentence. */
26
- explanation: string;
27
- }>;
28
- export declare const RULES: readonly Rule[];
29
- export declare function ruleFor(key: RuleKey): Rule;
30
- export type Param = Readonly<{
31
- key: string;
32
- label: string;
33
- min: number;
34
- max: number;
35
- step: number;
36
- def: number;
37
- /** Short display unit, e.g. "%", "BLK", "ETH". Display-only; not asserted byte-for-byte
38
- * against the app's `fmt` function, which the app keeps as a closure, not exported data. */
39
- unit: string;
40
- hint: string;
41
- }>;
42
- export declare const PARAMS: Readonly<Record<RuleKey, readonly Param[]>>;
43
- export type RuleBlock = Readonly<{
44
- type: RuleKey;
45
- params: Readonly<Record<string, number>>;
46
- }>;
47
- /** The native block's `Config` rate fields a stack of rule blocks compiles into. */
48
- export type CompiledRules = Readonly<{
49
- guardBlocks: number;
50
- maxBuyBps: number;
51
- snipeTaxPips: number;
52
- baseFeePips: number;
53
- maxFeePips: number;
54
- surgeSens: number;
55
- burnBps: number;
56
- lpBps: number;
57
- potBps: number;
58
- potEveryNBuys: number;
59
- potMinBuyWei: bigint;
60
- }>;
61
- /**
62
- * Compile a stack of public rule blocks into the exact rate fields the native block's `Config`
63
- * carries, mirroring `compileStack` in the app's `src/lib/hooks-model.ts`.
64
- *
65
- * `baseFeePipsOverride` is the stack-level Base LP fee, chosen independently of whether a
66
- * Surge Fees rule is present — it always wins over the Surge block's own "Base fee" slider,
67
- * exactly like the app's builder. The block still supplies the surge ceiling and sensitivity.
68
- */
69
- export declare function compileRuleBlocks(blocks: readonly RuleBlock[], baseFeePipsOverride: number): CompiledRules;
70
- /** The default single block for one rule: every param at its `def`. */
71
- export declare function defaultBlock(key: RuleKey): RuleBlock;
72
- /** The starting stack a new configuration opens with: no rules, base fee only. */
73
- export declare function defaultStack(): readonly RuleBlock[];
74
- export declare const MAX_STACK_RULES = 5;
75
- export type ValidationResult = Readonly<{
76
- ok: boolean;
77
- errors: readonly string[];
78
- }>;
79
- /**
80
- * Validate a stack of rule blocks: unknown rule keys, duplicate rules, more than
81
- * `MAX_STACK_RULES` rules, an unknown parameter, or a parameter outside its bounds or off its
82
- * step grid. Every problem is reported, not just the first.
83
- */
84
- export declare function validateStack(blocks: readonly RuleBlock[]): ValidationResult;