import { Hex } from 'ox'; import { MultisigConfig } from 'ox/tempo'; import type { Address, Client } from 'viem'; import type { LocalAccount } from 'viem/accounts'; import * as core_Store from '../../internal/Store.js'; import * as Sponsorship from './sponsorship.js'; /** Default submission-claim TTL in milliseconds. */ export declare const defaultClaimTtl = 30000; /** Returns whether a raw transaction carries a native multisig signature. */ export declare function isMultisigTransaction(serialized: Hex.Hex): boolean; /** Handles a native multisig raw transaction submission. */ export declare function handleRawTransaction(options: handleRawTransaction.Options): Promise; export declare namespace handleRawTransaction { /** Options for handling a raw multisig transaction submission. */ type Options = collect.Options; /** Raw transaction handler return value. */ type ReturnType = Hex.Hex | unknown; } declare function collect(options: collect.Options): Promise; /** Resolves a multisig operation id for standard transaction lookup methods. */ export declare function handleGetTransaction(options: handleGetTransaction.Options): Promise; export declare namespace handleGetTransaction { /** Options for resolving a multisig operation id through transaction lookup methods. */ type Options = { /** Client resolver keyed by transaction `chainId`. */ getClient: (chainId?: number) => Client; /** Standard transaction lookup method to handle. */ method: 'eth_getTransactionByHash' | 'eth_getTransactionReceipt'; /** Incoming JSON-RPC request. */ request: { params?: readonly unknown[] | undefined; }; /** Pending multisig operation store. */ store: Store; }; /** Transaction lookup result wrapper. */ type ReturnType = { result: unknown; } | undefined; } declare namespace collect { type Options = { /** Submission claim TTL in milliseconds. @default 30000 */ claimTtl?: number | undefined; /** How to broadcast once quorum is met. @default 'sync' */ finalize?: 'submitted' | 'sync' | undefined; /** Client resolver keyed by transaction `chainId`. */ getClient: (chainId?: number) => Client; /** Raw transaction method to handle. */ method: 'eth_sendRawTransaction' | 'eth_sendRawTransactionSync'; /** Incoming JSON-RPC request. */ request: { params?: readonly unknown[] | undefined; }; /** Resolves the genesis multisig config for quorum checks. */ resolveConfig?: ResolveConfig | undefined; /** Optional fee payer used to sponsor finalized multisig transactions. */ sponsor?: Sponsor | undefined; /** Pending multisig operation store. */ store: Store; }; type ReturnType = { /** Raw broadcast result once quorum is met and this caller claimed submission. */ broadcastResult?: unknown; /** Structured operation claim status. */ status: ClaimSubmissionResult | { operation: Operation; status: 'claimed'; }; }; } /** Returns a stored native multisig operation status. */ export declare function getStatus(options: getStatus.Options): Promise; export declare namespace getStatus { /** Options for reading one multisig operation status. */ type Options = { /** Operation id returned by a pending multisig submission. */ id: Hex.Hex; /** Resolves the genesis multisig config for quorum status. */ resolveConfig?: ResolveConfig | undefined; /** Pending multisig operation store. */ store: Store; }; } /** Returns pending native multisig operation statuses for an account. */ export declare function listStatuses(options: listStatuses.Options): Promise; export declare namespace listStatuses { /** Options for listing multisig operation statuses. */ type Options = { /** Native multisig account address. */ account: Address; /** Resolves the genesis multisig config for quorum status. */ resolveConfig?: ResolveConfig | undefined; /** Pending multisig operation store. */ store: Store; }; } /** * Creates a multisig operation store backed by a Tempo API state store * (`Store.memory()`, a static-name Durable Object store, …). * * Approval merges and submission claims go through `Store.update`, so the * backing store needs the atomic `swap` compare-and-swap to serialize * concurrent writers (the get + put fallback is dev-only). It must also be * enumerable — `listPendingByAddress` scans a key prefix — so sharded Durable * Object stores and caches do not qualify. */ export declare function fromStore(state: core_Store.State): Store; /** Creates an in-memory multisig operation store for development and tests only. */ export declare function memoryStore(): Store; /** Native multisig relay options. */ export type Options = { /** Submission claim TTL in milliseconds. @default 30000 */ claimTtl?: number | undefined; /** How to broadcast once quorum is met. @default 'sync' */ finalize?: 'submitted' | 'sync' | undefined; /** Resolves the genesis multisig config for quorum checks. */ resolveConfig?: ResolveConfig | undefined; /** * State store holding pending multisig operations. Needs the store's atomic * `swap` for correctness (approval merges and submission claims serialize * through it) and must be enumerable, so sharded Durable Object stores and * caches do not qualify. */ store: core_Store.State; }; /** Resolves the genesis multisig config for quorum checks. */ export type ResolveConfig = (request: { /** Native multisig account address. */ account: Address; /** Transaction chain id. */ chainId: number; /** Bootstrap config carried by the transaction, when present. */ init?: MultisigConfig.Config | undefined; }) => MultisigConfig.Config | Promise | undefined; /** Optional fee payer used to sponsor finalized multisig transactions. */ export type Sponsor = { /** Account used as the fee payer. */ account: LocalAccount; /** Fee token to set before fee payer signing. */ feeToken?: Address | undefined; /** Called once the fee payer has signed, before any broadcast. */ onSponsored?: Sponsorship.handleRawTransaction.Options['onSponsored']; /** Resolves the default fee token for raw sponsorship. */ resolveFeeToken?: ((chainId: number) => Address | Promise
| undefined) | undefined; /** Optional sponsorship approval callback. */ validate?: Sponsorship.handleRawTransaction.Options['validate']; }; /** Storage for native multisig operation approvals and submission claims. */ export type Store = { /** Atomically claims submission for a quorum-ready operation. Only a `claimed` result may broadcast. */ claimSubmission: (operation: Operation, options: claimSubmission.Options) => Promise; /** Reads a stored operation. */ get: (id: Hex.Hex) => Promise; /** Lists non-submitted operations for a native multisig account address. */ listPendingByAddress: (address: Address) => Promise; /** Saves a pending operation, preserving already-stored approvals. */ savePending: (operation: Operation) => Promise; /** Marks a claimed operation submitted with its real transaction hash. */ setSubmitted: (id: Hex.Hex, submittedHash: Hex.Hex) => Promise; }; /** `Store.claimSubmission` types. */ export declare namespace claimSubmission { /** Options for claiming submission. */ type Options = { /** Claim TTL in milliseconds. */ ttl: number; }; } /** Result of atomically claiming a multisig operation for submission. */ export type ClaimSubmissionResult = { /** Operation this caller may broadcast. */ operation: Operation; /** Claim status. */ status: 'claimed'; } | { /** Current stored operation. */ operation: Operation; /** Current non-claimed status. */ status: 'pending' | 'submitting' | 'submitted'; }; /** Stored native multisig operation. */ export type Operation = { /** Native multisig account address. */ account: Address; /** Transaction chain id. */ chainId: number; /** Submission claim expiry timestamp in milliseconds. */ claimExpiresAt?: number | undefined; /** Resolved genesis config used for approval checks. */ config?: MultisigConfig.Config | undefined; /** Creation timestamp in milliseconds. */ createdAt: number; /** Deterministic operation id. */ id: Hex.Hex; /** Whether the finalized transaction must carry the genesis init config. */ init?: boolean | undefined; /** Genesis init config to attach when finalizing a bootstrap transaction. */ initConfig?: MultisigConfig.Config | undefined; /** Unsigned Tempo transaction sign payload. */ payload: Hex.Hex; /** Collected owner approval signatures. */ signatures: readonly Hex.Hex[]; /** Operation state. */ status: 'pending' | 'submitting' | 'submitted'; /** Transaction hash once submitted. */ submittedHash?: Hex.Hex | undefined; /** Last submitted serialized transaction carrying this operation. */ transaction: Hex.Hex; /** Last update timestamp in milliseconds. */ updatedAt: number; }; /** Native multisig operation status. */ export type Status = { /** Native multisig account address. */ account: Address; /** Transaction chain id. */ chainId: number; /** Deterministic operation id. */ id: Hex.Hex; /** Number of collected owner approvals. */ signatures: number; /** Operation state. */ status: Operation['status']; /** Submitted transaction hash. */ submittedHash?: Hex.Hex | undefined; /** Required owner weight. */ threshold?: number | undefined; /** Collected owner weight. */ weight?: number | undefined; }; export {}; //# sourceMappingURL=multisig.d.ts.map