interface ManagementClientConfig { /** Service key (sk_live_...) for authenticating management API calls */ serviceKey: string; /** Override base URL (default: https://api.relai.fi) */ baseUrl?: string; } interface RelaiApi { apiId: string; name: string; description?: string; baseUrl: string; subdomain?: string | null; network: string; facilitator: string; x402Version: number; status: string; merchantWallet: string; solanaWallet?: string | null; /** EVM wallet for cross-chain payments. Only relevant when network is Solana. */ evmCrossChainWallet?: string | null; websiteUrl?: string; logoUrl?: string; createdAt: string; updatedAt: string; } interface ApiEndpointInput { path: string; method: string; usdPrice: number; enabled?: boolean; } interface ApiEndpoint extends ApiEndpointInput { network: string; enabled: boolean; } interface CreateApiInput { name: string; baseUrl: string; merchantWallet: string; /** Solana wallet for cross-chain payments. Only relevant when network is EVM. */ solanaWallet?: string; /** EVM wallet for cross-chain payments. Only relevant when network is Solana. */ evmCrossChainWallet?: string; network: string; description?: string; websiteUrl?: string; logoUrl?: string; endpoints?: ApiEndpointInput[]; } interface UpdateApiInput { name?: string; description?: string; baseUrl?: string; merchantWallet?: string; /** Solana wallet for cross-chain payments. Set to null to remove. */ solanaWallet?: string | null; /** EVM wallet for cross-chain payments. Set to null to remove. */ evmCrossChainWallet?: string | null; websiteUrl?: string; logoUrl?: string; } interface ApiStats { apiId: string; totalRequests: number; totalRevenue: number; currency: string; } interface ApiPayment { transaction: string; path: string; method: string; amount: number; currency: string; network: string; status: string; success: boolean; payer: string; createdAt: string; } interface ApiPaymentsResult { apiId: string; payments: ApiPayment[]; nextCursor: string | null; } interface ApiLogItem { id: string; timestamp: string; method: string; path: string; status: string; cost: number; currency: string; duration: number; transaction: string; network: string; success: boolean; payer: string; } interface ApiLogsResult { items: ApiLogItem[]; nextCursor: string | null; } interface BridgeQuoteResult { inputAmount: number; outputAmount: number; fee: number; feeBps: number; inputUsd: number; outputUsd: number; direction: 'solana-to-skale' | 'skale-to-solana'; from: string; to: string; } interface BridgeBalances { solana: { atomic: number; usd: number; }; skaleBase: { atomic: number; usd: number; }; base: { atomic: number; usd: number; }; } interface BridgeResult { success: boolean; direction: 'solana-to-skale' | 'skale-to-solana'; destinationWallet: string; amountOut: number; amountOutUsd: number; txHash: string; explorerUrl: string; } interface AgentBootstrapResult { key: string; label: string; active: boolean; createdAt: string; } /** * Bootstrap a service key for a Solana agent. * Run once — store the returned key securely. * * @param keypair A Solana Keypair (from @solana/web3.js) * @param label Human-readable label for the key */ declare function bootstrapAgentKeySolana(keypair: { publicKey: { toBase58(): string; }; secretKey: Uint8Array; }, label?: string): Promise; /** * Bootstrap a service key for an EVM agent. * Run once — store the returned key securely. * * @param wallet An ethers.js Wallet or Signer with address + signMessage * @param label Human-readable label for the key */ declare function bootstrapAgentKeyEvm(wallet: { address: string; signMessage(message: string): Promise; }, label?: string): Promise; interface RelaiManagementClient { createApi(input: CreateApiInput): Promise; listApis(): Promise; getApi(apiId: string): Promise; updateApi(apiId: string, input: UpdateApiInput): Promise; deleteApi(apiId: string): Promise<{ success: boolean; apiId: string; }>; getPricing(apiId: string): Promise<{ apiId: string; endpoints: ApiEndpoint[]; }>; setPricing(apiId: string, endpoints: ApiEndpointInput[]): Promise<{ success: boolean; apiId: string; updated: number; }>; getStats(apiId: string): Promise; getPayments(apiId: string, options?: { limit?: number; from?: string; cursor?: string; }): Promise; getLogs(apiId: string, options?: { limit?: number; from?: string; cursor?: string; }): Promise; /** * Get a bridge quote — fee and net output for a given USD amount. * @param amount Amount in USD (e.g. 10.0) * @param from Source network: 'solana' | 'skale-base' (default: 'solana') */ getBridgeQuote(amount: number, from?: 'solana' | 'skale-base'): Promise; /** * Get current USDC liquidity on all bridge networks. * Use this before bridging to confirm availability. */ getBridgeBalances(): Promise; /** * Bridge USDC from Solana to SKALE Base via x402 payment. * This call returns HTTP 402 — pass a createX402Client instance to handle payment automatically. * * @param amount Amount in USD * @param destinationWallet EVM address on SKALE Base * @param x402Client A configured createX402Client instance for Solana */ bridgeSolanaToSkale(amount: number, destinationWallet: string, x402Client: { fetch(url: string, init?: RequestInit): Promise; }): Promise; /** * Bridge USDC from SKALE Base to Solana via x402 payment. * * @param amount Amount in USD * @param destinationWallet Solana public key (base58) * @param x402Client A configured createX402Client instance for EVM/SKALE Base */ bridgeSkaleToSolana(amount: number, destinationWallet: string, x402Client: { fetch(url: string, init?: RequestInit): Promise; }): Promise; } /** * Create a RelAI Management API client. * * @example * ```typescript * import { createManagementClient } from '@relai-fi/x402/management'; * * const mgmt = createManagementClient({ serviceKey: process.env.RELAI_SERVICE_KEY! }); * * const api = await mgmt.createApi({ * name: 'My ML API', * baseUrl: 'https://inference.example.com', * merchantWallet: '0xYourWallet', * network: 'base', * endpoints: [{ path: '/v1/predict', method: 'post', usdPrice: 0.05 }], * }); * ``` */ declare function createManagementClient(config: ManagementClientConfig): RelaiManagementClient; export { type AgentBootstrapResult, type ApiEndpoint, type ApiEndpointInput, type ApiLogItem, type ApiLogsResult, type ApiPayment, type ApiPaymentsResult, type ApiStats, type BridgeBalances, type BridgeQuoteResult, type BridgeResult, type CreateApiInput, type ManagementClientConfig, type RelaiApi, type RelaiManagementClient, type UpdateApiInput, bootstrapAgentKeyEvm, bootstrapAgentKeySolana, createManagementClient };