/** * `vana app escrow balance|fund` - what the app can spend, and funding it. * * Funding is deliberately one command for both halves: the on-chain * `depositNative(account)` transaction and the gateway deposit * registration. Either half alone produces a contract that looks funded * while every read still answers 402. * * An ERC20 that supports EIP-3009 (USDC.e does) goes through the gateway * relayer instead: the app key signs an authorization, the gateway broadcasts * the deposit and pays the gas, and it records the deposit itself. So an app * wallet holding only USDC.e can fund its escrow. `--self-pay-gas` keeps the * old path (approve + deposit sent from the app wallet, which needs VANA). */ import { type GatewayClient } from "@opendatalabs/vana-sdk"; import { resolveAsset } from "../../core/assets.js"; import { resolveAppKey, type ResolvedAppKey } from "../../core/app-key.js"; import { type ResolvedNetwork } from "../../core/network.js"; import { type AppCommandOptions } from "./outcome.js"; export interface EscrowFundOptions extends AppCommandOptions { /** Amount to deposit, decimal, in units of the chosen asset. */ amount?: string; /** * ERC20 to deposit instead of native VANA. Reads are priced in USDC.e on * mainnet, so funding native alone leaves every read answering 402. */ asset?: string; /** * Send the ERC20 deposit from the app wallet and pay its gas, instead of * signing an authorization for the gateway relayer. */ selfPayGas?: boolean; } export interface EscrowDeps { createClient?: (gatewayUrl: string) => GatewayClient; resolveKey?: typeof resolveAppKey; /** Injectable chain senders for tests. */ sendDeposit?: (params: { network: ResolvedNetwork; key: ResolvedAppKey; escrowContract: `0x${string}`; amountWei: bigint; asset?: string; }) => Promise<{ txHash: `0x${string}`; }>; /** Injectable settlement wait for tests; the real one polls the gateway. */ awaitSettlement?: (network: ResolvedNetwork, account: `0x${string}`, txHash: `0x${string}`) => Promise<"finalized" | "failed" | "pending">; /** Injectable asset lookup for tests; the real one reads the chain. */ resolveAsset?: typeof resolveAsset; /** Injectable gasless sender for tests: sign, then hand to the relayer. */ sendGaslessDeposit?: (params: { network: ResolvedNetwork; key: ResolvedAppKey; escrowContract: `0x${string}`; amountWei: bigint; asset: `0x${string}`; }) => Promise<{ txHash: `0x${string}`; status: string; }>; } export declare function runAppEscrowBalance(options: AppCommandOptions, deps?: EscrowDeps): Promise; export declare class InsufficientFundsError extends Error { readonly balanceWei: bigint; readonly neededWei: bigint; readonly asset?: string | undefined; constructor(balanceWei: bigint, neededWei: bigint, asset?: string | undefined); } export declare function runAppEscrowFund(options: EscrowFundOptions, deps?: EscrowDeps): Promise; //# sourceMappingURL=escrow.d.ts.map