import type { Hash } from '@ariestools/sdk';
import type { WithHashMeta, XyoAddress } from '@xyo-network/sdk';
import type { SignedHydratedTransactionWithHashMeta, StepIndex, StepWitness, TransactionOptions, XyoGateway, XyoGatewayRunner } from '@xyo-network/xl1-protocol/protocol-lib';
/** Options for witnessPreviousStep. */
export interface WitnessPreviousStepOptions {
    /** Also submit the witness to chain as an off-chain payload on a transaction; requires a runner */
    addToChain?: boolean;
    /** Step level to witness (index into StepSizes); defaults to 2 (size 211) */
    step?: StepIndex;
    /** Options forwarded to addPayloadsToChain when addToChain is set */
    transactionOptions?: TransactionOptions;
    /** Explicit observer address; defaults to the runner's signer address when a runner is supplied */
    witness?: XyoAddress;
}
/** Result of witnessPreviousStep. */
export interface WitnessPreviousStepResult {
    /** The submitted transaction, when addToChain was set */
    transaction?: SignedHydratedTransactionWithHashMeta;
    /** Hash of the submitted transaction, when addToChain was set */
    txHash?: Hash;
    /** The built StepWitness payload with hash meta */
    witness: WithHashMeta<StepWitness>;
}
/**
 * Witness the previous completed step at a given step level, as observed in the current block.
 *
 * Reads the current block once and pulls everything from it: the step hash comes directly from
 * the block's `step_hashes` entry for the requested step level, and the witness is anchored to
 * the observation block via its `blockHash`/`blockNumber`. Builds a
 * `network.xyo.chain.validation.step.witness` payload attesting
 * `{ blockHash, blockNumber, stepHash, stepSize, witness }`, and optionally submits it to chain
 * as an off-chain payload on a transaction.
 *
 * Accepts a read-only gateway or a write-capable runner, failing only on the parts that require
 * the runner: the observer's address defaults to the runner's signer, so a read-only caller must
 * pass `options.witness` explicitly, and `addToChain` throws without a runner.
 *
 * The observer does not re-derive the step boundary itself — the anchor makes the claim
 * independently verifiable: given `blockNumber` and `stepSize`, the boundary block is
 * `previousCompletedStepBlockNumber(blockNumber, step)` and its hash must equal `stepHash`.
 *
 * @returns The witness payload (with hash meta) and — when `addToChain` is set — the submitted
 * transaction and its hash. Call `runner.confirmSubmittedTransaction(txHash)` to wait for
 * inclusion in a block.
 *
 * @example
 * ```ts
 * import { getRestGatewayRunner, witnessPreviousStep } from '@xyo-network/xl1-sdk'
 *
 * const runner = await getRestGatewayRunner({
 *   endpoint: 'https://sample.mainnet.xyo.space',
 *   rpcUrl: 'https://sample.mainnet.xyo.space/rpc',
 *   signer,
 * })
 *
 * // witness the previous completed step (level 2, size 211) and record it on chain
 * const { txHash, witness } = await witnessPreviousStep(runner, { addToChain: true })
 * await runner.confirmSubmittedTransaction(assertEx(txHash))
 * ```
 *
 * @example
 * ```ts
 * // Read-only observation — no signer, so the observer address is passed explicitly
 * const gateway = await getRestGateway('https://sample.mainnet.xyo.space')
 * const { witness } = await witnessPreviousStep(gateway, { witness: myAddress })
 * ```
 */
export declare function witnessPreviousStep(gateway: XyoGateway | XyoGatewayRunner, options?: WitnessPreviousStepOptions): Promise<WitnessPreviousStepResult>;
//# sourceMappingURL=witnessPreviousStep.d.ts.map