import { Analyzer } from "../analyzer.mjs"; import "@mysten/bcs"; import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client"; //#region src/transaction-analyzer/rules/core.d.ts /** * The *extra* simulate fields {@link transactionResponse} can fetch. `effects` is * always included (this analyzer and its dependents rely on it), so it's omitted * here and can't be turned off — `Include` only ever widens what's fetched. */ type SimulateExtraInclude = Omit; /** * {@link transactionResponse}'s request-scoped options for a given extra-`Include`. * `transactionResponse` and `include` are mutually exclusive *in effect*: injecting a * pre-computed response skips the dry-run, so `include` (which only shapes a * simulation) is ignored — inject one or the other, not both. When simulating, * `include` is required exactly when `Include` names a field that must be present (so * a dependent that needs, say, `balanceChanges` forces it to be passed). `effects` is * always added on top either way. * * The exclusivity can't be a type-level union here: the analyzer framework merges a * dependency's options with `UnionToIntersection`, which would collapse the two * branches to `never` and break every dependent. So both stay optional and the * precedence is enforced at runtime. */ type TransactionResponseOptions = { client: ClientWithCoreApi; /** * Inject a pre-computed response to skip the dry-run entirely (e.g. a host that * already simulated). Must carry at least the requested fields. Takes precedence * over `include` — providing both ignores `include`. */ transactionResponse?: SuiClientTypes.Transaction; } & ({} extends Include ? { include?: Include; } : { include: Include; }); /** * The dry-run analyzer, generic over the *extra* simulate `include` fields. Calling * it returns the one shared analyzer instance (above) retyped for `Include`, so its * result exposes exactly the fields you asked for and `include` becomes a required * option when `Include` names one — all without duplicating the analyzer or running * the simulation more than once. `effects` is always included. * * ```ts * // Reusable, deduped, and typed to what you requested: * createAnalyzer({ * dependencies: { tx: transactionResponse<{ balanceChanges: true }>() }, * analyze: () => ({ tx }) => ({ result: tx.balanceChanges }), // typed `BalanceChange[]` * }); * ``` */ declare function transactionResponse(): Analyzer, TransactionResponseOptions, { bytes: Uint8Array; }>; //#endregion export { transactionResponse }; //# sourceMappingURL=core.d.mts.map