import type { RequestFn } from './client.js'; import type { paths } from './generated.js'; /** * Extracts the query-parameter type for a given chifra endpoint * from the generated OpenAPI types. The `query?: infer Q` form * matches both required (`query: { … }`) and optional (`query?: { … }`) * spec definitions, returning the inner object type either way. */ export type Query
= paths[P]['get'] extends { parameters: { query?: infer Q; }; } ? Q : never; /** * True at type level when a chifra endpoint's `query` parameter is * required (the OpenAPI spec did not mark it optional). Used to * narrow `VerbFn
` to a required-arg signature for endpoints like * `/blocks` (which mandates `blocks: string[]`) while keeping a * no-arg-allowed signature for endpoints like `/status`. */ export type IsRequiredQuery
= paths[P]['get'] extends { parameters: { query: unknown; }; } ? true : false; /** * Extracts the JSON response body type for a given chifra endpoint. */ export type Response
= paths[P]['get'] extends { responses: { 200: { content: { 'application/json': infer R; }; }; }; } ? R : never; /** * The callable signature of a verb. Distinguishes endpoints whose * `query` is required (call MUST pass an arg, e.g. `client.blocks({ blocks: [...] })`) * from those whose `query` is optional (call MAY omit the arg, e.g. * `client.status()`). Required fields inside the query object remain * required regardless. */ export type VerbFn
= IsRequiredQuery
extends true ? (query: Query
) => Promise ) => Promise (request: RequestFn, path: P): VerbFn ;
/**
* Returns the full chifra verb surface, one method per OpenAPI path.
* Each method is typed against its endpoint's parameters and
* response. JSDoc on each property surfaces the chifra description
* in editor tooltips.
*/
export declare function createVerbs(request: RequestFn): {
/**
* `GET /list` — list every appearance of an address (or
* addresses) anywhere on the chain. Mirrors `chifra list`.
*/
list: (query: {
addrs: string[];
count?: boolean;
noZero?: boolean;
bounds?: boolean;
unripe?: boolean;
silent?: boolean;
firstRecord?: number;
maxRecords?: number;
reversed?: boolean;
firstBlock?: number;
lastBlock?: number;
chain?: string;
noHeader?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["appearance"] | import("./generated.js").components["schemas"]["bounds"] | import("./generated.js").components["schemas"]["monitor"])[];
}>;
/**
* `GET /export` — export full transaction details for one or
* more monitored addresses. Callable directly for the
* polymorphic union; attached variants (`.appearances`,
* `.receipts`, `.logs`, `.approvals`, `.traces`, `.neighbors`,
* `.statements`, `.transfers`, `.assets`, `.balances`,
* `.withdrawals`, `.count`) preselect the corresponding flag
* and narrow the return. Mirrors `chifra export`.
*/
export: import("./variants/export.js").ExportVerb;
/**
* `GET /monitors` — manage and inspect address monitors. Mirrors
* `chifra monitors`.
*/
monitors: (query?: {
addrs?: string[];
delete?: boolean;
undelete?: boolean;
remove?: boolean;
clean?: boolean;
list?: boolean;
count?: boolean;
staged?: boolean;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
} | undefined) => Promise<{
data?: (import("./generated.js").components["schemas"]["message"] | import("./generated.js").components["schemas"]["monitor"] | import("./generated.js").components["schemas"]["monitorClean"])[];
}>;
/**
* `GET /names` — query and manage address-to-name mappings.
* Mirrors `chifra names`.
*/
names: (query: {
terms: string[];
expand?: boolean;
matchCase?: boolean;
all?: boolean;
custom?: boolean;
prefund?: boolean;
addr?: boolean;
tags?: boolean;
clean?: boolean;
regular?: boolean;
count?: boolean;
dryRun?: boolean;
autoname?: string;
create?: string;
update?: string;
delete?: string;
undelete?: string;
remove?: string;
chain?: string;
noHeader?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["message"] | import("./generated.js").components["schemas"]["name"])[];
}>;
/**
* `GET /abis` — fetch ABIs for known contracts. Mirrors
* `chifra abis`.
*/
abis: (query: {
addrs: string[];
known?: boolean;
proxyFor?: string;
list?: boolean;
details?: boolean;
count?: boolean;
find?: string[];
hint?: string[];
encode?: string;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["abi"] | import("./generated.js").components["schemas"]["function"] | import("./generated.js").components["schemas"]["parameter"])[];
}>;
/**
* `GET /blocks` — retrieve one or more blocks from chain or
* local cache. Callable directly for the polymorphic response
* (10-type union from the OpenAPI spec); attached variants
* (`.hashes`, `.uncles`, `.traces`, `.uniq`, `.logs`,
* `.withdrawals`, `.count`) preselect the corresponding flag
* and narrow the return to a single concrete type. Mirrors
* `chifra blocks` with its various output modes.
*/
blocks: import("./variants/blocks.js").BlocksVerb;
/**
* `GET /transactions` — retrieve one or more transactions by
* hash, block.txid, or block.address. Callable directly for
* the polymorphic union; attached variants (`.traces`, `.uniq`,
* `.logs`) preselect the corresponding flag and narrow the
* return. Mirrors `chifra transactions`.
*/
transactions: import("./variants/transactions.js").TransactionsVerb;
/**
* `GET /receipts` — retrieve receipts for one or more
* transactions. Mirrors `chifra receipts`.
*/
receipts: (query: {
transactions: string[];
articulate?: boolean;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["function"] | import("./generated.js").components["schemas"]["parameter"] | import("./generated.js").components["schemas"]["receipt"])[];
}>;
/**
* `GET /logs` — retrieve event logs for one or more
* transactions. Mirrors `chifra logs`.
*/
logs: (query: {
transactions: string[];
emitter?: string[];
topic?: string[];
articulate?: boolean;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["function"] | import("./generated.js").components["schemas"]["log"] | import("./generated.js").components["schemas"]["message"] | import("./generated.js").components["schemas"]["parameter"])[];
}>;
/**
* `GET /traces` — retrieve execution traces for one or more
* transactions. Callable directly; `.count` variant returns
* trace counts only. Mirrors `chifra traces`.
*/
traces: import("./variants/traces.js").TracesVerb;
/**
* `GET /when` — block-by-time / block-by-date queries; map
* timestamps and named events to block numbers. Mirrors
* `chifra when`.
*/
when: (query?: {
blocks?: string[];
list?: boolean;
timestamps?: boolean;
count?: boolean;
repair?: boolean;
check?: boolean;
update?: boolean;
deep?: number;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
} | undefined) => Promise<{
data?: (import("./generated.js").components["schemas"]["count"] | import("./generated.js").components["schemas"]["message"] | import("./generated.js").components["schemas"]["namedBlock"] | import("./generated.js").components["schemas"]["timestamp"])[];
}>;
/**
* `GET /state` — read account state at a block (balance, nonce,
* code, storage). Callable directly; `.call` variant performs
* an `eth_call`-style read. Mirrors `chifra state`.
*/
state: import("./variants/state.js").StateVerb;
/**
* `GET /tokens` — read token balances for accounts at given
* block(s). Mirrors `chifra tokens`.
*/
tokens: (query: {
addrs: string[];
blocks?: string[];
approvals?: boolean;
parts?: ("name" | "symbol" | "decimals" | "totalSupply" | "version" | "some" | "all")[];
byAcct?: boolean;
changes?: boolean;
noZero?: boolean;
chain?: string;
noHeader?: boolean;
cache?: boolean;
decache?: boolean;
fmt?: string;
}) => Promise<{
data?: (import("./generated.js").components["schemas"]["approval"] | import("./generated.js").components["schemas"]["token"])[];
}>;
/**
* `GET /config` — daemon configuration; read effective settings
* or list known chains. Mirrors `chifra config`.
*/
config: (query?: {
mode?: "show" | "edit";
paths?: boolean;
dump?: boolean;
chain?: string;
noHeader?: boolean;
fmt?: string;
} | undefined) => Promise<{
data?: import("./generated.js").components["schemas"]["chain"][];
}>;
/**
* `GET /status` — daemon health and per-cache status. Mirrors
* `chifra status`.
*/
status: (query?: {
modes?: ("index" | "blooms" | "blocks" | "transactions" | "traces" | "logs" | "statements" | "results" | "state" | "tokens" | "monitors" | "names" | "abis" | "slurps" | "staging" | "unripe" | "maps" | "some" | "all")[];
diagnose?: boolean;
firstRecord?: number;
maxRecords?: number;
chains?: boolean;
caches?: boolean;
healthcheck?: boolean;
chain?: string;
noHeader?: boolean;
fmt?: string;
} | undefined) => Promise<{
data?: (import("./generated.js").components["schemas"]["cacheItem"] | import("./generated.js").components["schemas"]["chain"] | import("./generated.js").components["schemas"]["status"])[];
}>;
/**
* `GET /chunks` — manage and inspect index chunks. Callable
* directly; mode variants (`.manifest`, `.index`, `.blooms`,
* `.pins`, `.addresses`, `.appearances`, `.stats`) preselect
* the chunks `mode` enum and narrow the return. Mirrors
* `chifra chunks`.
*/
chunks: import("./variants/chunks.js").ChunksVerb;
/**
* `GET /init` — initialize the daemon's index by downloading
* pinned chunks. Mirrors `chifra init`.
*/
init: (query?: {
all?: boolean;
example?: string;
dryRun?: boolean;
firstBlock?: number;
sleep?: number;
chain?: string;
} | undefined) => Promise<{
data?: (import("./generated.js").components["schemas"]["chunkRecord"] | import("./generated.js").components["schemas"]["manifest"])[];
}>;
/**
* `GET /slurp` — fetch transactions for an address from a
* 3rd-party source (e.g. Etherscan). Callable directly;
* `.appearances` and `.count` variants narrow to specific
* output modes. Mirrors `chifra slurp`.
*/
slurp: import("./variants/slurp.js").SlurpVerb;
};
export type Verbs = ReturnType