/** * AIFINP-223 — SDK Environment & Protocol Version resolver (EVM). * * A single place that answers "which deployment does the SDK use?" so no other * module has to reason about environment, protocol version or fallback. Given * an environment, a network and a requested version, it returns the concrete * deployment to settle against, or throws a typed error explaining why it * cannot. * * Two axes: * environment — "dev" | "prod". Development supports Amoy only and uses the * v1.4 artifacts sourced from evm-contract's dev branch. Production uses the * configured production networks. * version — "v1.2" | "v1.4" | "auto". "auto" uses an enabled v1.4 * deployment for the exact environment+network and otherwise falls back * to a valid legacy v1.2 deployment. An explicit version never changes. * * Addresses live in data files (v14Deployments.generated.ts and the legacy * SPLITTER_DEPLOYMENTS table), never inline here — this module is selection * logic only, so a payout address can never be changed by editing control flow. */ import { type SplitterDeployment } from "./unifiedAgent.js"; import { type V14Deployment } from "./generated/v14Deployments.generated.js"; import { DeploymentResolverError } from "./deploymentErrors.js"; export { DeploymentResolverError } from "./deploymentErrors.js"; export type SdkEnvironment = "dev" | "prod"; /** Selectable protocol versions. This is the request-side selector; the exact * on-chain contract version of a resolved v1.2 deployment is in its payload * (`SplitterDeployment.version`, which is "1.1" or "1.2" depending on chain). */ export type ProtocolVersion = "v1.2" | "v1.4"; /** What a caller may ask for. "auto" (the default) prefers enabled v1.4 and * falls back to a valid production v1.2 deployment. */ export type RequestedVersion = ProtocolVersion | "auto"; export interface ResolveDeploymentOptions { environment: SdkEnvironment; /** Network name, e.g. "polygon" or "amoy". Case-insensitive. */ network: string; /** Defaults to "auto". */ version?: RequestedVersion; } /** The resolved deployment. Discriminated by `version` so the caller gets the * correctly-shaped payload: the v1.4 role/tokenList/profiles record, or the * legacy single-splitter record. */ export type ResolvedDeployment = { version: "v1.4"; environment: SdkEnvironment; network: string; chainId: number; deployment: V14Deployment; } | { version: "v1.2"; environment: SdkEnvironment; network: string; chainId: number; deployment: SplitterDeployment; }; /** The development environment was asked for a network other than the ones it * supports (Amoy only). */ export declare class UnsupportedDevNetworkError extends DeploymentResolverError { readonly network: string; constructor(network: string); } /** An explicit version was requested but no deployment of it exists for this * environment+network. Thrown rather than downgrading, so an explicit choice * is never silently changed. */ export declare class VersionUnavailableError extends DeploymentResolverError { readonly requested: ProtocolVersion; constructor(requested: ProtocolVersion, environment: SdkEnvironment, network: string); } /** A deployment record exists, but is quarantined and must not receive money. */ export declare class DeploymentDisabledError extends DeploymentResolverError { readonly environment: SdkEnvironment; readonly network: string; readonly reason: string; constructor(environment: SdkEnvironment, network: string, reason: string); } /** No usable deployment of either supported version exists here. */ export declare class NoDeploymentError extends DeploymentResolverError { constructor(environment: SdkEnvironment, network: string); } /** Is a v1.4 deployment available for this environment+network? */ export declare function isV14Available(environment: SdkEnvironment, network: string): boolean; /** * Resolve the deployment the SDK should use. The single source of truth for * environment + protocol-version selection. * * @throws UnsupportedDevNetworkError dev asked for a non-Amoy network * @throws VersionUnavailableError an explicit version is not deployed here * @throws DeploymentDisabledError explicit v1.4 is quarantined, or auto * has no valid v1.2 fallback * @throws NoDeploymentError neither version is known here */ export declare function resolveDeployment(options: ResolveDeploymentOptions): ResolvedDeployment; //# sourceMappingURL=deploymentResolver.d.ts.map