import type { Hex } from 'ox'; import * as core_Provider from '../Provider.js'; import type * as Log from '../Log.js'; /** Exchange quote provider called after the native DEX cannot route a swap. */ export type Provider = core_Provider.Provider & { /** Converts a signed continuation into final executable calls. */ finalizeQuote?(this: void, input: FinalizeQuoteInput, signal: AbortSignal): Promise; /** Returns the approvals, signature, or executable calls needed to continue. */ quote(this: void, input: QuoteInput, signal: AbortSignal): Promise; }; /** Provider-neutral unsigned transaction call. */ export type Call = { /** ABI-encoded call data. */ data: Hex.Hex; /** Contract receiving the call. */ to: `0x${string}`; /** Native token value as a JSON-RPC quantity. */ value: Hex.Hex; }; /** Input used to finish a provider quote after signing. */ export type FinalizeQuoteInput = { /** Wallet signing and executing the swap. */ account: `0x${string}`; /** Tempo chain id. */ chainId: number; /** Opaque provider state returned by `quote`. */ continuation: string; /** EIP-712 signature requested by the quote result. */ signature: Hex.Hex; }; /** Final executable calls returned after a signature. */ export type FinalizeQuoteResult = { /** Calls to execute in order. */ calls: readonly Call[]; /** Quote constraints that the final calls must satisfy. */ execution: Execution; }; /** Constraints used to validate executable provider calls. */ export type Execution = QuoteAmounts & { /** Token received by the swap. */ destinationToken: `0x${string}`; /** Side whose requested amount remains exact. */ mode: 'exactDestination' | 'exactSource'; /** Token spent by the swap. */ sourceToken: `0x${string}`; }; /** Token movement observed while simulating provider calls. */ export type Transfer = { /** Amount moved in base units. */ amount: bigint; /** Account sending the tokens. */ from: `0x${string}`; /** Account receiving the tokens. */ to: `0x${string}`; /** Token contract that emitted the transfer. */ token: `0x${string}`; }; /** Provider-neutral quote input. */ export type QuoteInput = { /** Wallet receiving and executing the swap. */ account: `0x${string}`; /** Exact source or destination amount in base units. */ amount: string; /** Tempo chain id. */ chainId: number; /** Token received by the swap. */ destinationToken: `0x${string}`; /** Side whose requested amount remains exact. */ mode: 'exactDestination' | 'exactSource'; /** Maximum execution slippage in basis points. */ slippageBps: number; /** Token spent by the swap. */ sourceToken: `0x${string}`; }; /** Quote with the approvals, signature, or transaction needed for its next step. */ export type QuoteResult = (QuoteAmounts & { /** Calls that must confirm before requesting a fresh quote. */ approval: { calls: readonly Call[]; }; /** Onchain approval is required before this swap can be quoted for execution. */ status: 'approvalRequired'; }) | (QuoteAmounts & { /** Quote is ready for execution. */ status: 'ready'; /** Ordered calls required to execute the quote. */ transaction: { calls: readonly Call[]; }; }) | (QuoteAmounts & { /** Opaque provider state passed to `finalizeQuote`. */ continuation: string; /** Quote needs a wallet signature before final calldata can be built. */ status: 'signatureRequired'; /** EIP-712 payload the wallet must sign. */ typedData: TypedData; }); /** Defines an exchange provider while preserving its concrete identity. */ export declare function from(options: from.Options): Provider; export declare namespace from { /** Exchange provider definition. */ type Options = Omit, 'type'>; } /** Returns whether a registered provider implements exchange quotes. */ export declare function is(provider: core_Provider.Provider): provider is Provider; /** Returns bounded exchange-provider failure details for structured request logs. */ export declare function failure(cause: unknown, options: failure.Options): Log.ProviderFailure | undefined; export declare namespace failure { /** Exchange-provider context retained when a quote operation fails. */ type Options = { /** Chain selected by the quote request. */ chainId: number; /** Provider operation used when the error has no narrower operation. */ operation: string; /** Exchange provider that handled the request. */ provider: Provider; }; } /** Validates simulated token movements against an executable quote. */ export declare function validateExecution(options: validateExecution.Options): void; export declare namespace validateExecution { /** Simulated transfers and quote constraints to validate. */ type Options = { /** Wallet executing the provider calls. */ account: `0x${string}`; /** Quote constraints bound to the executable calls. */ execution: Execution; /** Token transfers emitted by the simulated calls. */ transfers: readonly Transfer[]; }; } /** Amount bounds returned by an exchange provider. */ export type QuoteAmounts = { /** Expected destination amount in base units. */ destinationAmount: string; /** Estimated execution gas units. */ gasUnits: string; /** Maximum source amount for an exact-destination quote. */ maximumSourceAmount?: string | undefined; /** Minimum destination amount for an exact-source quote. */ minimumDestinationAmount?: string | undefined; /** Expected source amount in base units. */ sourceAmount: string; }; /** Provider-neutral EIP-712 payload accepted by Privy and common wallet clients. */ export type TypedData = { /** EIP-712 signing domain. */ domain: Record; /** EIP-712 message values. */ message: Record; /** Root EIP-712 type. */ primaryType: string; /** EIP-712 type definitions. */ types: Record; }; /** Raised when a provider has no executable route for the requested swap. */ export declare class RouteUnavailableError extends Error { name: string; } /** Raised when a continuation cannot be decoded or validated. */ export declare class ProviderContinuationError extends Error { name: string; } /** Raised when required provider configuration is invalid. */ export declare class ProviderConfigurationError extends Error { name: string; } /** Raised when an upstream provider request fails before receiving a response. */ export declare class ProviderNetworkError extends Error { name: string; /** Upstream operation that failed. */ operation: string; constructor(options: ProviderNetworkError.Options); } export declare namespace ProviderNetworkError { /** Safe request details retained for operational reporting. */ type Options = { /** Original network error. */ cause: TypeError; /** Stable upstream operation identifier. */ operation: string; }; } /** Raised when an upstream provider returns an invalid payload. */ export declare class ProviderPayloadError extends Error { name: string; /** Stable validation code safe for operational reporting. */ code?: string | undefined; constructor(options?: ProviderPayloadError.Options); } export declare namespace ProviderPayloadError { /** Bounded invalid-payload details. */ type Options = { /** Stable validation code safe for operational reporting. */ code?: string | undefined; }; } /** Raised when an upstream provider request fails. */ export declare class ProviderResponseError extends Error { name: string; /** Upstream operation that returned the response. */ operation: string; /** Upstream HTTP status. */ status: number; constructor(options: ProviderResponseError.Options); } export declare namespace ProviderResponseError { /** Safe upstream response details retained for operational reporting. */ type Options = { /** Stable upstream operation identifier. */ operation: string; /** Upstream HTTP status. */ status: number; }; } //# sourceMappingURL=Provider.d.ts.map