import type { XyoGatewayRunner, XyoSigner } from '@xyo-network/xl1-protocol/protocol-lib';
import type { CreatableProviderFactory } from '../protocol-sdk/index-node.js';
import type { RpcTransport, XyoSignerRpcSchemas } from '../rpc/index.ts.js';
import type { RestGatewayConfig } from './getRestGateway.js';
/**
 * Non-signing portion of the write-capable REST runner config.
 * Superset of {@link RestGatewayConfig}: chain reads use the static S3 layout;
 * transaction submission goes through `rpcUrl` (mempool).
 */
export interface RestGatewayRunnerConfigBase extends RestGatewayConfig {
    /**
     * HTTP RPC endpoint used to submit signed transactions to the network mempool
     * (`mempoolRunner_submitTransactions` / `xyoRunner_broadcastTransaction`).
     * Not used for chain reads — those stay on the REST/S3 buckets.
     */
    rpcUrl: string;
}
/**
 * How the runner signs transactions before broadcast — exactly one of:
 * - `signer`: the caller owns an actual signer (e.g. the wallet UI); wrapped into a factory here.
 * - `signerFactory`: a pre-built signer provider factory, for callers that construct their own
 *   (e.g. an in-page local signer). Registered as-is on the runner locator.
 * - `signerTransport`: an RPC transport to a remote signer, for callers that don't own one
 *   (e.g. injected pages whose gateway carries a signer transport).
 */
export type RestGatewayRunnerSigning = {
    signer: XyoSigner;
    signerFactory?: never;
    signerTransport?: never;
} | {
    signer?: never;
    signerFactory: CreatableProviderFactory;
    signerTransport?: never;
} | {
    signer?: never;
    signerFactory?: never;
    signerTransport: RpcTransport<XyoSignerRpcSchemas>;
};
/**
 * Config for a REST/S3-backed **write-capable** client gateway.
 * Chain reads use the static S3 layout; transaction submission goes through `rpcUrl` (mempool),
 * and signing is provided by either an owned `signer` or a remote `signerTransport`.
 */
export type RestGatewayRunnerConfig = RestGatewayRunnerConfigBase & RestGatewayRunnerSigning;
/**
 * Minimal config for a REST/S3-backed **write-capable** client gateway — the runner
 * counterpart of `getRestGateway('https://…')`. The read buckets are derived from
 * `endpoint` via {@link restGatewayConfigFromEndpoint} (blocks.<domain>, state.<domain>,
 * indexes.<domain>); only the write path (`rpcUrl`, `signer`/`signerTransport`) is spelled out.
 */
export type SimpleRestGatewayRunnerConfig = Omit<RestGatewayRunnerConfigBase, 'blocks' | 'chainState' | 'finalized' | 'index'> & RestGatewayRunnerSigning & {
    /** Network root domain the standard bucket subdomains are derived from, e.g. `https://sample.mainnet.xyo.space`. */
    endpoint: string;
};
/**
 * Builds a write-capable `XyoGatewayRunner` backed by the S3 static REST layout for
 * reads and an RPC endpoint for mempool submission. Same consumer-facing write
 * surface as `GatewayBuilder.build(signer)` — `addPayloadsToChain`, `send`,
 * `sendMany`, `confirmSubmittedTransaction` — while chain state is still fetched
 * anonymously from CDN files (no RPC for reads).
 *
 * @example
 * // Simple form: network root domain (read buckets derived) + RPC for mempool + local signer.
 * const runner = await getRestGatewayRunner({
 *   endpoint: 'https://sample.mainnet.xyo.space',
 *   rpcUrl: 'https://sample.mainnet.xyo.space/rpc',
 *   signer,
 * })
 * // See also: getAccountBalance / transferXl1 in this package, and the live recipe in
 * // xyo-chain `src/e2e/spec/api-local-s3/RestGatewayRunner.spec.ts` (api-local-s3).
 *
 * @example
 * // Explicit buckets.
 * const runner = await getRestGatewayRunner({
 *   finalized: { readUrl: 'https://cdn.xl1.example/blocks' },
 *   chainState: { readUrl: 'https://cdn.xl1.example/chain-state' },
 *   rpcUrl: 'https://rpc.xl1.example',
 *   signer,
 * })
 *
 * @example
 * // Remote signer: an injected page whose gateway carries a signer transport (no owned signer).
 * const runner = await getRestGatewayRunner({
 *   endpoint: 'https://sample.mainnet.xyo.space',
 *   rpcUrl: 'https://sample.mainnet.xyo.space/rpc',
 *   signerTransport,
 * })
 *
 * @example
 * // Pre-built signer factory (e.g. an in-page local signer provider).
 * const runner = await getRestGatewayRunner({
 *   endpoint: 'https://sample.mainnet.xyo.space',
 *   rpcUrl: 'https://sample.mainnet.xyo.space/rpc',
 *   signerFactory,
 * })
 */
export declare function getRestGatewayRunner(config: RestGatewayRunnerConfig | SimpleRestGatewayRunnerConfig): Promise<XyoGatewayRunner>;
//# sourceMappingURL=getRestGatewayRunner.d.ts.map