import { Hex } from 'ox'; import { type Address, type LocalAccount } from 'viem'; import type * as Chain from './Chain.js'; import type * as Provider from './Provider.js'; /** Read-only destination subsidy inventory available during action creation. */ export type Inventory = { /** Account that supplies destination USDC and native gas. */ account: Address; /** Verifies token and gas capacity without accessing signing material. */ check(parameters: Inventory.check.Parameters): Promise; /** Operational maximum applied in addition to organization policy. */ policy: { maxAmount: string; }; }; /** Contracts for checking destination subsidy inventory. */ export declare namespace Inventory { /** Contracts for one inventory check. */ namespace check { /** Inputs used to reserve worst-case destination inventory. */ type Parameters = { /** Destination token quantity promised by Tempo. */ amount: bigint; /** Destination EVM chain. */ chain: Chain.Chain; /** Final transfer recipient. */ recipient: Address; /** Inventory already promised by active transfers. */ reservations: Settler.prepare.Reservations; /** Destination ERC-20 token. */ token: Address; }; /** Native gas amount reserved for the promised transfer. */ type Result = { nativeAmount: string; }; } } /** Signed destination-chain subsidy persisted before broadcast. */ export type Transaction = { /** Destination token quantity supplied by Tempo. */ amount: string; /** Destination-chain signer account. */ account: Address; /** Destination chain CAIP-2 id. */ chainId: string; /** Hash of the signed transaction. */ hash: Hex.Hex; /** EOA nonce reserved for this transaction. */ nonce: number; /** Worst-case native gas amount reserved for this transaction. */ nativeAmount?: string | undefined; /** Signed EVM transaction bytes. */ transaction: Hex.Hex; }; /** Reads a persisted destination subsidy transaction from private route state. */ export declare function read(value: unknown): Transaction | undefined; /** Prepares and submits ERC-20 destination subsidy transactions. */ export type Settler = { /** Account that supplies destination USDC and native gas. */ account: Address; /** Broadcasts one previously persisted signed transaction. */ broadcast(parameters: { chain: Chain.Chain; transaction: Transaction; }): Promise; /** Reads the next nonce visible at the destination RPC. */ pendingNonce(parameters: { chain: Chain.Chain; }): Promise; /** Operational maximum applied in addition to the scoped API-key policy. */ policy: { maxAmount: string; }; /** Prepares one signed ERC-20 transfer without broadcasting it. */ prepare(parameters: Settler.prepare.Parameters): Promise; /** Reads and verifies one persisted subsidy transaction. */ status(parameters: Settler.status.Parameters): Promise; }; /** Contracts for destination subsidy settlement operations. */ export declare namespace Settler { /** Contracts for preparing one destination subsidy transaction. */ namespace prepare { /** Inputs used to construct the signed ERC-20 transfer. */ type Parameters = { /** Destination token quantity supplied by Tempo. */ amount: bigint; /** Destination EVM chain. */ chain: Chain.Chain; /** EOA nonce durably reserved for this transfer. */ nonce: number; /** Final transfer recipient. */ recipient: Address; /** Inventory already promised by unsettled transactions. */ reservations: Settler.prepare.Reservations; /** Destination ERC-20 token. */ token: Address; }; /** Inventory reserved while serializing transactions for one signer. */ type Reservations = { /** Native gas amount promised by unsettled transactions. */ nativeAmount: bigint; /** Token amount promised by unsettled transactions. */ tokenAmount: bigint; }; } /** Contracts for reading a destination subsidy receipt. */ namespace status { /** Persisted transaction and expected transfer terms. */ type Parameters = { /** Destination EVM chain. */ chain: Chain.Chain; /** Final transfer recipient. */ recipient: Address; /** Persisted subsidy transaction. */ transaction: Transaction; /** Destination ERC-20 token. */ token: Address; }; /** Receipt state used by transfer reconciliation. */ type ReturnType = { broadcast: boolean; type: 'pending'; } | { type: 'reverted' | 'success'; }; } } /** Returns the normalized 1:1 destination amount for two USD stablecoins. */ export declare function requiredAmount(options: requiredAmount.Options): bigint; export declare namespace requiredAmount { /** Source amount and stablecoin metadata used for 1:1 normalization. */ type Options = { /** Token delivered on the destination chain. */ destinationToken: Provider.TokenRef; /** Source token quantity in base units. */ sourceAmount: string; /** Token spent on the source chain. */ sourceToken: Provider.TokenRef; }; } /** Creates a read-only EVM destination subsidy inventory checker. */ export declare function createInventory(options: createInventory.Options): Inventory; export declare namespace createInventory { /** Dependencies for one destination subsidy inventory checker. */ type Options = { /** EVM account funded with destination USDC and native gas. */ account: Address; /** Fetch implementation used for destination RPC requests. */ fetch: typeof globalThis.fetch; /** Operational maximum destination deficit in decimal USD. */ policy: { maxAmount: string; }; }; } /** Creates an EVM destination subsidy settler. */ export declare function create(options: create.Options): Settler; export declare namespace create { /** Dependencies for one destination subsidy settler. */ type Options = { /** EVM account funded with destination USDC and native gas. */ account: LocalAccount; /** Fetch implementation used for destination RPC requests. */ fetch: typeof globalThis.fetch; /** Operational maximum destination deficit in decimal USD. */ policy: { maxAmount: string; }; }; } /** Returns whether preparing a fresh transaction cannot recover. */ export declare function isPermanentPreparationError(cause: unknown): boolean; /** Returns whether rebroadcasting the same signed transaction cannot recover. */ export declare function isPermanentBroadcastError(cause: unknown): boolean; /** The subsidy account lacks destination token inventory or native gas. */ export declare class BalanceUnavailableError extends Error { name: string; } /** A destination RPC prevented inventory verification. */ export declare class InventoryUpstreamError extends Error { name: string; constructor(cause: unknown); } /** The route cannot preserve its denomination across the selected tokens. */ export declare class UnsupportedTokenError extends Error { name: string; } /** The source amount cannot be represented exactly in destination base units. */ export declare class UnsupportedAmountError extends Error { name: string; } /** The destination chain cannot execute an EVM subsidy transfer. */ export declare class UnsupportedChainError extends Error { name: string; } /** The RPC returned a hash that differs from the persisted transaction. */ export declare class TransactionHashMismatchError extends Error { name: string; } //# sourceMappingURL=TransferSubsidy.d.ts.map