@dcasegr/amm-client 0.39.0 → 0.42.2

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/dist/errors.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { SwapOutcome } from "./market/swapFlow.js";
2
2
  /** Every kind a `ClientError` names (D13). */
3
- export declare const CLIENT_ERROR_KINDS: readonly ["stale_pool", "fee_mismatch", "quote_mismatch", "slippage", "pool_spent", "user_rejected", "no_answer", "refused", "network"];
3
+ export declare const CLIENT_ERROR_KINDS: readonly ["stale_pool", "fee_mismatch", "quote_mismatch", "slippage", "pool_spent", "user_rejected", "no_answer", "below_minimum", "refused", "network"];
4
4
  export type ClientErrorKind = (typeof CLIENT_ERROR_KINDS)[number];
5
5
  /** An error of a named kind; `message` is the text the pages show. */
6
6
  export declare class ClientError extends Error {
package/dist/errors.js CHANGED
@@ -15,13 +15,16 @@
15
15
  * `pool_spent` refusal)
16
16
  * user_rejected the user declined in the wallet (the wallet's `ERR_PERMISSION_DENIED`, "denied")
17
17
  * no_answer the relay gave no settled answer yet ("no answer yet"; a timed-out swap record)
18
- * refused the validator, the relay or the host refused it (a refusal other than pool_spent)
18
+ * below_minimum (0.40.0) under a validator's minimum leg (its `below_minimum` refusal; a quote no
19
+ * pool takes for its size)
20
+ * refused the validator, the relay or the host refused it (a refusal other than pool_spent
21
+ * and below_minimum)
19
22
  * network the request did not get through (fetch threw)
20
23
  */
21
24
  import { PoolBuildError } from "./pool/index.js";
22
25
  import { RelayError } from "./market/relay.js";
23
26
  /** Every kind a `ClientError` names (D13). */
24
- export const CLIENT_ERROR_KINDS = ["stale_pool", "fee_mismatch", "quote_mismatch", "slippage", "pool_spent", "user_rejected", "no_answer", "refused", "network"];
27
+ export const CLIENT_ERROR_KINDS = ["stale_pool", "fee_mismatch", "quote_mismatch", "slippage", "pool_spent", "user_rejected", "no_answer", "below_minimum", "refused", "network"];
25
28
  /** An error of a named kind; `message` is the text the pages show. */
26
29
  export class ClientError extends Error {
27
30
  kind;
@@ -65,7 +68,7 @@ export function kindOfOutcome(o) {
65
68
  case "accepted":
66
69
  return undefined;
67
70
  case "refused":
68
- return o.reason.startsWith("pool_spent") ? "pool_spent" : "refused";
71
+ return o.reason.startsWith("pool_spent") ? "pool_spent" : o.reason.startsWith("below_minimum") ? "below_minimum" : "refused";
69
72
  case "timeout":
70
73
  case "unknown":
71
74
  return "no_answer";
package/dist/index.d.ts CHANGED
@@ -15,11 +15,23 @@ export { SWAP_BASKET } from "./wallet/color.js";
15
15
  export { SWAP_PROTOCOL } from "./wallet/color.js";
16
16
  /** The keyID prefix of an `amm-swap` row's key (`amm-swap-`). */
17
17
  export { SWAP_KEY_PREFIX } from "./market/activeSwap.js";
18
- /** The keyID of a staged `amm-swap` row: `amm-swap-<pool txid>.<vout>` (token row) or `…:sats` (its sats row). */
19
- export { swapKeyID } from "./market/activeSwap.js";
20
- /** customInstructions of an `amm-swap` token row (asset, amount and the key that spends it). */
18
+ /** A staged `amm-swap` row's keyID (0.40.0): `amm-swap-<16 random bytes, hex>`. */
19
+ export { newSwapKeyID } from "./market/activeSwap.js";
20
+ /** The label of a staging action that carries tokens (`amm-swap-stage`, 0.40.0). */
21
+ export { SWAP_STAGE_LABEL } from "./market/activeSwap.js";
22
+ /** The marker a staged token output's description ends with (` · amm-swap <hex>`): it names the key id. */
23
+ export { SWAP_KEY_MARK } from "./market/activeSwap.js";
24
+ /** A staged token output's description: the readable text, then `SWAP_KEY_MARK` and the keyID's hex. */
25
+ export { swapKeyDescription } from "./market/activeSwap.js";
26
+ /** The keyID a staged token output's description names, or null. */
27
+ export { swapKeyIdOfDescription } from "./market/activeSwap.js";
28
+ /** The keyID of a leg's change kept in `amm-swap`: `amm-swap-<txid>.<vout>:change`, the leg's first input of that kind. */
29
+ export { changeKeyID } from "./market/swapAction.js";
30
+ /** An order's payout, own-commission and last-leg change derivation: from the order's key input. */
31
+ export { legDerivation } from "./market/swapAction.js";
32
+ /** customInstructions of an `amm-swap` token row (asset, amount, the key that spends it; a change row's `order`). */
21
33
  export { swapInstructions } from "./wallet/color.js";
22
- /** customInstructions of an `amm-swap` sats row (`sats: true`, the token it was staged for, its key). */
34
+ /** customInstructions of an `amm-swap` sats row (`sats: true`, its key; a change row's `order`). */
23
35
  export { swapSatsInstructions } from "./wallet/color.js";
24
36
  /** The key protocol of a pool's LP key (BRC-29, to self): the `amm-pools` row's protocolID. */
25
37
  export { LP_KEY_PROTOCOL } from "./lp/poolDeploy.js";
package/dist/index.js CHANGED
@@ -17,11 +17,23 @@ export { SWAP_BASKET } from "./wallet/color.js";
17
17
  export { SWAP_PROTOCOL } from "./wallet/color.js";
18
18
  /** The keyID prefix of an `amm-swap` row's key (`amm-swap-`). */
19
19
  export { SWAP_KEY_PREFIX } from "./market/activeSwap.js";
20
- /** The keyID of a staged `amm-swap` row: `amm-swap-<pool txid>.<vout>` (token row) or `…:sats` (its sats row). */
21
- export { swapKeyID } from "./market/activeSwap.js";
22
- /** customInstructions of an `amm-swap` token row (asset, amount and the key that spends it). */
20
+ /** A staged `amm-swap` row's keyID (0.40.0): `amm-swap-<16 random bytes, hex>`. */
21
+ export { newSwapKeyID } from "./market/activeSwap.js";
22
+ /** The label of a staging action that carries tokens (`amm-swap-stage`, 0.40.0). */
23
+ export { SWAP_STAGE_LABEL } from "./market/activeSwap.js";
24
+ /** The marker a staged token output's description ends with (` · amm-swap <hex>`): it names the key id. */
25
+ export { SWAP_KEY_MARK } from "./market/activeSwap.js";
26
+ /** A staged token output's description: the readable text, then `SWAP_KEY_MARK` and the keyID's hex. */
27
+ export { swapKeyDescription } from "./market/activeSwap.js";
28
+ /** The keyID a staged token output's description names, or null. */
29
+ export { swapKeyIdOfDescription } from "./market/activeSwap.js";
30
+ /** The keyID of a leg's change kept in `amm-swap`: `amm-swap-<txid>.<vout>:change`, the leg's first input of that kind. */
31
+ export { changeKeyID } from "./market/swapAction.js";
32
+ /** An order's payout, own-commission and last-leg change derivation: from the order's key input. */
33
+ export { legDerivation } from "./market/swapAction.js";
34
+ /** customInstructions of an `amm-swap` token row (asset, amount, the key that spends it; a change row's `order`). */
23
35
  export { swapInstructions } from "./wallet/color.js";
24
- /** customInstructions of an `amm-swap` sats row (`sats: true`, the token it was staged for, its key). */
36
+ /** customInstructions of an `amm-swap` sats row (`sats: true`, its key; a change row's `order`). */
25
37
  export { swapSatsInstructions } from "./wallet/color.js";
26
38
  /** The key protocol of a pool's LP key (BRC-29, to self): the `amm-pools` row's protocolID. */
27
39
  export { LP_KEY_PROTOCOL } from "./lp/poolDeploy.js";
@@ -15,7 +15,9 @@ export declare function ammLookupService(tokenId: string): string;
15
15
  export declare function parseTokenTopic(name: string): TokenTopic | null;
16
16
  /** A pool row on the wire (P2, P3, P4's `current`): JSON numbers, bigints here. */
17
17
  interface WirePool {
18
+ poolId?: string;
18
19
  lpPubKey?: string;
20
+ swaps?: number | string;
19
21
  outpoint: string;
20
22
  bsvReserve: number | string;
21
23
  tokenReserve: number | string;
@@ -28,9 +30,13 @@ interface WirePool {
28
30
  }
29
31
  /** The engine's PoolState from a wire row (the reserves and fees as bigints). */
30
32
  export declare function toPoolState(raw: WirePool): PoolState;
31
- /** A pool of the pools routes: the engine's PoolState, its LP key (the pool's id, D2), and (P2) its validator's peer ID. */
33
+ /** A pool of the pools routes: the engine's PoolState, its id (0.40.0: the deploy outpoint `<txid>_<vout>`), its LP key, its swap count, and (P2) its validator's peer ID. */
32
34
  export interface PoolRow extends PoolState {
35
+ /** The pool's id: its deploy outpoint, `<txid>_<vout>` (0.40.0). */
36
+ poolId: string;
33
37
  lpPubKey: string;
38
+ /** The pool's swaps so far (0 at the deploy). */
39
+ swaps: number;
34
40
  /** P2: the validator's libp2p peer ID, from its beat (what the relay dials). */
35
41
  validatorPeerId?: string;
36
42
  /** P1: the token. */
@@ -43,10 +49,11 @@ export interface Market {
43
49
  commissionPkh: string | null;
44
50
  minCommissionBps: number;
45
51
  }
46
- /** A validator beating on the token's topic now (P2's `validators`, 0.34.1): its identity key and libp2p peer ID. */
52
+ /** A validator beating on the token's topic now (P2's `validators`, 0.34.1): its identity key and libp2p peer ID; 0.40.0, the minimum leg its terms announce (sats on the leg's sats side; absent: none). */
47
53
  export interface BeatingValidator {
48
54
  identity: string;
49
55
  peerId: string;
56
+ minLegSats?: bigint;
50
57
  }
51
58
  /** P2's answer: the market, the pools a swap may use now, and (0.34.1) the validators beating on the token's topic now. */
52
59
  export interface PoolsAnswer {
@@ -87,43 +94,35 @@ export interface SignedFetch {
87
94
  type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
88
95
  /** P1 / P2's URL: `<base>/pools` (the swap instance's app base: every token; a token instance's: that token). */
89
96
  export declare function poolsUrl(base: string): string;
90
- /** P2 once (a one-shot reader; the Swap page holds the stream, `watchPools`). */
97
+ /** P2: the token's pools as the host lists them now (0.41.0: a plain read only). */
91
98
  export declare function readPools(base: string, fetchFn?: FetchFn): Promise<PoolsAnswer>;
92
- /** What `watchPools` needs of the browser's `EventSource` (tests pass a fake). */
99
+ /** What `watchPoolEvents` needs of the browser's `EventSource` (tests pass a fake). */
93
100
  export interface EventSourceLike {
94
101
  addEventListener(type: string, fn: (e: {
95
102
  data?: unknown;
96
103
  }) => void): void;
97
104
  close(): void;
98
105
  onerror?: ((e: unknown) => void) | null;
99
- onopen?: ((e: unknown) => void) | null;
100
106
  }
101
107
  export type EventSourceCtor = new (url: string) => EventSourceLike;
108
+ /** E1's URL: `<base>/events` (a token instance's app base: that token's; the swap app's: every token's). */
109
+ export declare function eventsUrl(base: string): string;
102
110
  /**
103
- * Holds a pools route as an event stream (D16; 0.39.0, D7): `GET <url>` with `Accept:
104
- * text/event-stream` (the browser's EventSource sends it). The event `pools` carries the whole
105
- * answer (first the current one; again when the host cannot say what changed): it replaces the held
106
- * answer. With `change` (P2), the event `change` carries one pool change: `change(held, x)` applies
107
- * it to the held answer (null: it cannot); one it cannot apply (no answer held yet, an unknown
108
- * kind, a row it names not held) → the route is read again ONCE (a plain GET) and that answer is
109
- * held (changes arriving while it is read are dropped: the answer read is the newer state). Each
110
- * new held answer goes to `onAnswer`. Without an EventSource (an old browser, a test): ONE plain
111
- * GET, no poll. → the unsubscribe.
111
+ * Listens to a host's pool event feed (E1, 0.41.0): each `pool` message parsed
112
+ * (`parsePoolEventMessage`) to `onEvent`; one it cannot parse is passed over. Reconnecting is the
113
+ * browser's EventSource's. Without an EventSource: nothing. → the unsubscribe.
112
114
  */
113
- export declare function watchPools<T>(url: string, parse: (x: unknown) => T, onAnswer: (a: T) => void, o?: {
115
+ export declare function watchPoolEvents(url: string, onEvent: (e: PoolEventMessage) => void, o?: {
114
116
  onError?: (e: unknown) => void;
115
- onOpen?: () => void;
116
117
  EventSource?: EventSourceCtor | null;
117
- fetch?: FetchFn;
118
- change?: (held: T, x: unknown) => T | null;
119
118
  }): () => void;
120
- /** P3's answer: the LP keys' current pools and one BEEF of their transactions. */
119
+ /** P3's answer: the pools' current outputs and one BEEF of their transactions. */
121
120
  export interface PoolsBeef {
122
121
  pools: PoolRow[];
123
122
  beef: number[];
124
123
  }
125
- /** P3: `GET <base>/pools/beef?lp=k1,k2` (no `lpKeys`: every live pool). */
126
- export declare function readPoolsBeef(base: string, lpKeys?: string[], fetchFn?: FetchFn): Promise<PoolsBeef>;
124
+ /** P3: `GET <base>/pools/beef?pool=id1,id2` (0.40.0: by pool id; no `poolIds`: every live pool). */
125
+ export declare function readPoolsBeef(base: string, poolIds?: string[], fetchFn?: FetchFn): Promise<PoolsBeef>;
127
126
  /** One output of a pool transaction with its BEEF (Atomic, the transaction its subject): what a spend of the pool is built from. */
128
127
  export interface LookupOutput {
129
128
  beef: number[];
@@ -131,9 +130,12 @@ export interface LookupOutput {
131
130
  }
132
131
  /** The pool `outpoint` (`<txid>_<vout>`) out of P3's BEEF, as an Atomic BEEF of its transaction; null when the BEEF lacks it. */
133
132
  export declare function poolOutputOf(pb: PoolsBeef, outpoint: string): LookupOutput | null;
134
- /** One LP key's pool and fees (P4): `live` (its live pool), `rescinded` (the validator's Rescind wrote `outpoint`: the LP's Close takes it back), `closed`. */
133
+ /** One pool's state and fees (P4, 0.40.0: by pool id): `live` (its live output), `rescinded` (the validator's Rescind wrote `outpoint`: the LP's Close takes it back), `closed`. */
135
134
  export interface LpPool {
136
- lpPubKey: string;
135
+ /** The pool's id, `<txid>_<vout>` (its deploy outpoint). */
136
+ poolId: string;
137
+ /** Its LP key (null for an id this instance does not know). */
138
+ lpPubKey: string | null;
137
139
  status: "live" | "rescinded" | "closed";
138
140
  /** The output a Close acts on, `<txid>_<vout>` (live and rescinded). */
139
141
  outpoint: string | null;
@@ -145,16 +147,18 @@ export interface LpPool {
145
147
  tokens: bigint;
146
148
  swaps: number;
147
149
  }
148
- /** P4: `GET <base>/positions?lp=k1,k2` → one record per key in the same order. */
149
- export declare function readPositions(base: string, lpPubKeys: string[], fetchFn?: FetchFn): Promise<LpPool[]>;
150
+ /** P4: `GET <base>/positions?pool=id1,id2` (0.40.0) → one record per pool id in the same order. */
151
+ export declare function readPositions(base: string, poolIds: string[], fetchFn?: FetchFn): Promise<LpPool[]>;
150
152
  /** P7's answer: this instance's validator terms (null: none set, a market only) and its market. */
151
153
  export interface InstanceTerms {
154
+ /** 0.40.0: `minLegSats` the minimum leg (sats on the leg's sats side), 0 = none. */
152
155
  validator: {
153
156
  identity: string;
154
157
  peerId: string | null;
155
158
  lpFeeBps: number;
156
159
  validatorFeeBps: number;
157
160
  commissionBps: number;
161
+ minLegSats: number;
158
162
  } | null;
159
163
  market: Market;
160
164
  }
@@ -201,7 +205,11 @@ export interface Price {
201
205
  /** A Swap's trade row (H1; the `swap` change's `trade`): amounts in base units, fees in the input asset, the pool's reserves after it. */
202
206
  export interface Trade {
203
207
  txid: string;
208
+ /** The pool's id, `<txid>_<vout>` (0.40.0). */
209
+ poolId: string;
204
210
  lpPubKey: string;
211
+ /** The hash160 (hex) the payout went to (the call's `userPkh`, 0.40.0): an order's legs share it. */
212
+ payoutPkh: string;
205
213
  /** `buy`: sats in, tokens out; `sell`: tokens in. */
206
214
  side: "buy" | "sell";
207
215
  amountIn: bigint;
@@ -237,8 +245,17 @@ export type CandleTf = "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
237
245
  /** A token at the read's time (H3, H4): the changes in bps (null without a trade at or before the window's start). */
238
246
  export interface TokenStats {
239
247
  tokenId: string;
240
- /** The last trade's, else the deepest live pool's, else null. */
248
+ /**
249
+ * 0.40.0 (the host's): the midpoint of what a buy and a sell of 1% of the pooled sats would pay
250
+ * now (the engine's `priceOf(listed pools).mid`), null with no pool.
251
+ */
241
252
  price: Price | null;
253
+ /** What that buy would pay (sats per tokens), null with no pool. */
254
+ buyPrice: Price | null;
255
+ /** What that sell would pay, null with no pool. */
256
+ sellPrice: Price | null;
257
+ /** The last trade's price, null without one. */
258
+ lastTradePrice: Price | null;
242
259
  change1h: number | null;
243
260
  change24h: number | null;
244
261
  volume24hSats: bigint;
@@ -262,44 +279,28 @@ export interface Holders {
262
279
  export interface TokenPosition extends LpPool {
263
280
  tokenId: string;
264
281
  }
265
- /** One pool change on P2's stream (event `change`, D7). */
266
- export interface PoolChange {
267
- kind: "deploy" | "swap" | "close" | "rescind";
268
- /** The new pool output (deploy, swap) or the one gone (close, rescind). */
269
- outpoint: string;
270
- /** deploy, swap: the pool's row. */
271
- pool?: PoolRow;
272
- /** swap: its trade row. */
273
- trade?: Trade;
274
- }
275
282
  /** A trade row, or null when it is not one. */
276
283
  export declare function toTrade(x: unknown): Trade | null;
277
284
  /** A stats record (H3), or null when it is not one. */
278
285
  export declare function toStats(x: unknown): TokenStats | null;
279
- /** A `change` event's data, or null when it is not one this client knows. */
280
- export declare function parseChange(x: unknown): PoolChange | null;
281
- /**
282
- * One `change` applied to a held P2 answer (D7) → the new answer, or null when it cannot be applied
283
- * (the caller reads the route again): `swap` — the row of `trade.lpPubKey` replaced by `pool` (its
284
- * outpoint moved); `deploy` — `pool` added; `close` / `rescind` — the row at `outpoint` removed.
285
- * The market and the validators are kept (a change of either comes as a whole `pools` answer).
286
- */
287
- export declare function applyPoolChange(held: PoolsAnswer, x: unknown): PoolsAnswer | null;
288
- /** H1: `GET <base>/trades?from=&to=&limit=&before=&lp=` → the page, newest first. */
286
+ /** H1: `GET <base>/trades?from=&to=&limit=&before=&pool=` (0.40.0: `pool` one pool's) → the page, newest first. */
289
287
  export declare function readTrades(base: string, o?: {
290
288
  from?: number;
291
289
  to?: number;
292
290
  limit?: number;
293
291
  before?: string;
294
- lp?: string;
292
+ pool?: string;
295
293
  }, fetchFn?: FetchFn): Promise<TradesPage>;
296
294
  /** H1 with `txid`: one Swap's trade row; null when the transaction has none (404). */
297
295
  export declare function readTrade(base: string, txid: string, fetchFn?: FetchFn): Promise<Trade | null>;
298
- /** H2: `GET <base>/candles?tf=&from=&to=` → one candle per non-empty bucket, oldest first. */
296
+ /** The candle series (0.40.0): `fill` the trades' prices (the instance's), `market` the price after each pool event (the host's). */
297
+ export type CandleSeries = "fill" | "market";
298
+ /** H2: `GET <base>/candles?tf=&from=&to=&series=` → one candle per non-empty bucket, oldest first. */
299
299
  export declare function readCandles(base: string, o: {
300
300
  tf: CandleTf;
301
301
  from: number;
302
302
  to: number;
303
+ series?: CandleSeries;
303
304
  }, fetchFn?: FetchFn): Promise<Candle[]>;
304
305
  /** H3: `GET <base>/stats`. */
305
306
  export declare function readStats(base: string, fetchFn?: FetchFn): Promise<TokenStats>;
@@ -310,6 +311,87 @@ export declare function readHolders(base: string, tokenId: string, o?: {
310
311
  limit?: number;
311
312
  skip?: number;
312
313
  }, fetchFn?: FetchFn): Promise<Holders>;
313
- /** H5: `GET <swap base>/positions?lp=k1,k2` → every enabled token's rows for the keys, each with its token. */
314
- export declare function readAllPositions(swapBase: string, lpPubKeys: string[], fetchFn?: FetchFn): Promise<TokenPosition[]>;
314
+ /** H5: `GET <swap base>/positions?pool=id1,id2` (0.40.0) → every enabled token's rows for the pools, each with its token. */
315
+ export declare function readAllPositions(swapBase: string, poolIds: string[], fetchFn?: FetchFn): Promise<TokenPosition[]>;
316
+ /** A pool as it was listed at a time (H7): its id, output, reserves, keys, rates, the event's time and its swap count. */
317
+ export interface PoolAt extends PoolRow {
318
+ /** The time of the pool's last event at or before the read's `t`, ms. */
319
+ at: number;
320
+ }
321
+ /** H7: `GET <base>/pools/at?t=<ms>` → every pool listed at `t`. */
322
+ export declare function readPoolsAt(base: string, t: number, fetchFn?: FetchFn): Promise<PoolAt[]>;
323
+ /** One event of a pool's history (H8): a deploy, a swap (with its trade fields), a close or a rescind, at the admitting step's time. */
324
+ export interface PoolEvent {
325
+ kind: "deploy" | "swap" | "close" | "rescind";
326
+ txid: string;
327
+ poolId: string;
328
+ /** The pool's output after the event (deploy, swap, rescind), `<txid>_<vout>`. */
329
+ outpoint?: string;
330
+ bsvReserve?: bigint;
331
+ tokenReserve?: bigint;
332
+ lpPubKey: string;
333
+ liquidityFeeBps: bigint;
334
+ validationFeeBps: bigint;
335
+ commissionBps: bigint;
336
+ validatorIdentityKey: string;
337
+ at: number;
338
+ swaps: number;
339
+ /** A swap's trade. */
340
+ side?: "buy" | "sell";
341
+ amountIn?: bigint;
342
+ amountOut?: bigint;
343
+ feeLp?: bigint;
344
+ feeValidator?: bigint;
345
+ feeCommission?: bigint;
346
+ commissionPkh?: string;
347
+ payoutPkh?: string;
348
+ }
349
+ /** H8's page: the events oldest first, `next` the cursor to pass as `after` for the page after (null: none left). */
350
+ export interface PoolHistoryPage {
351
+ events: PoolEvent[];
352
+ next: string | null;
353
+ }
354
+ /**
355
+ * A revert (0.41.0): an admitted transaction later rejected — `txid` the rejected transaction, `at`
356
+ * the step's time, and the pool as it stands after the undo (its outpoint, reserves, fields,
357
+ * `swaps`), or none of those when the pool no longer exists.
358
+ */
359
+ export interface PoolRevert {
360
+ kind: "revert";
361
+ txid: string;
362
+ poolId: string;
363
+ at: number;
364
+ outpoint?: string;
365
+ bsvReserve?: bigint;
366
+ tokenReserve?: bigint;
367
+ lpPubKey?: string;
368
+ liquidityFeeBps?: bigint;
369
+ validationFeeBps?: bigint;
370
+ commissionBps?: bigint;
371
+ validatorIdentityKey?: string;
372
+ swaps?: number;
373
+ }
374
+ /** One message of a pool event feed (E1, 0.41.0): `{tokenId, …row}`, the row an H8 event or a revert. */
375
+ export type PoolEventMessage = {
376
+ tokenId: string;
377
+ } & (PoolEvent | PoolRevert);
378
+ /** A pool event feed message's data, or null when it is not one. */
379
+ export declare function parsePoolEventMessage(x: unknown): PoolEventMessage | null;
380
+ /** H8: `GET <base>/pools/history?from=&to=&pool=&limit=&after=` → the page, oldest first. */
381
+ export declare function readPoolHistory(base: string, o?: {
382
+ from?: number;
383
+ to?: number;
384
+ pool?: string;
385
+ limit?: number;
386
+ after?: string;
387
+ }, fetchFn?: FetchFn): Promise<PoolHistoryPage>;
388
+ /** One outpoint's spender as the host's H9 answers it: the token whose instance named it. */
389
+ export interface SpendAll {
390
+ /** `<txid>.<vout>` */
391
+ outpoint: string;
392
+ tokenId?: string;
393
+ spentBy?: string;
394
+ }
395
+ /** H9: `GET <swap base>/spends?outpoint=a,b` (the host's: every enabled token's `/spends`, the first naming a spender) → one record per outpoint. */
396
+ export declare function readSpendsAll(swapBase: string, outpoints: string[], fetchFn?: FetchFn): Promise<SpendAll[]>;
315
397
  export {};