import { type Context } from 'hono'; import * as z from 'zod/mini'; import type * as App from '../../../App.js'; import * as Response from '../../../internal/Response.js'; import * as Schema from '../../../internal/Schema.js'; import * as VerifiedTokens from '../../../internal/VerifiedTokens.js'; /** Mainnet chain id used by the coherent token OpenAPI example. */ export declare const tokenExampleChainId = 4217; /** Coherent mainnet token metadata used by generated OpenAPI examples. */ export declare const tokenExample: { readonly address: '0x20c000000000000000000000b9537d11c60e8b50'; readonly currency: 'USD'; readonly decimals: 6; readonly id: '0x20c000000000000000000000b9537d11c60e8b50'; readonly logoUri: string; readonly name: 'Bridged USDC (Stargate)'; readonly symbol: 'USDC.e'; readonly totalSupply: '10850791186630'; readonly verified: true; }; /** Zod schemas owned by the token handlers. */ export declare namespace schema { /** Schemas for the getToken operation. */ namespace getToken { /** Path parameters for token metadata requests. */ const Params: z.ZodMiniObject<{ token: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; }, z.core.$strip>; /** Optional expensive fields that callers opt into via `include`. */ const Include: z.ZodMiniEnum<{ admin: "admin"; createdAt: "createdAt"; holderCount: "holderCount"; quoteToken: "quoteToken"; transferStats: "transferStats"; }>; /** * Parses a comma-separated `include` query value into a list of optional * fields. Expensive computations (the `createdAt`/`admin`/`quoteToken` * indexer lookups, holder counts, and transfer statistics) are only run * when explicitly requested, keeping the base response fast. */ const includeQuery: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; /** Query parameters for token metadata requests. */ const Query: z.ZodMiniObject<{ chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; include: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; }, z.core.$strip>; /** TIP-20 token metadata returned by token endpoints. */ const Response: z.ZodMiniObject<{ address: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; admin: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; currency: z.ZodMiniString; createdAt: z.ZodMiniOptional; decimals: z.ZodMiniNumber; holderCount: z.ZodMiniOptional>; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; quoteToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; symbol: z.ZodMiniString; totalSupply: z.ZodMiniOptional>; transferStats: z.ZodMiniOptional; firstAt: z.ZodMiniNullable; lastAt: z.ZodMiniNullable; }, z.core.$strip>>; verified: z.ZodMiniBoolean; }, z.core.$strip>; } /** * Trimmed TIP-20 token reference embedded in list/feed responses via * `include=token`. Carries identity and display fields only; supply-level and * temporal facts (`totalSupply`, `holderCount`, `createdAt`) belong on the * token detail endpoint, not in feed rows. */ const Token: z.ZodMiniObject<{ address: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; /** RPC token metadata embedded in resources, with optional curated fields. */ const TokenReference: z.ZodMiniObject<{ address: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; logoUri: z.ZodMiniOptional>>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniOptional>; }, z.core.$strip>; /** Schemas for the getTokenBySymbol operation. */ namespace getTokenBySymbol { /** Hono route pattern for verified token symbols. */ const routePattern = "[A-Za-z][A-Za-z0-9._]{0,63}"; /** Path parameters for token symbol metadata requests. */ const Params: z.ZodMiniObject<{ symbol: z.ZodMiniString; }, z.core.$strip>; } /** Schemas for the getTokenLogo operation. */ namespace getTokenLogo { /** Path parameters for token logo image requests. */ const Params: z.ZodMiniObject<{ token: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; }, z.core.$strip>; /** Query parameters for token logo image requests. */ const Query: z.ZodMiniObject<{ chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; }, z.core.$strip>; } /** Schemas for the getTokens operation. */ namespace getTokens { /** Query parameters for token list requests. */ const Query: z.ZodMiniObject<{ addresses: z.ZodMiniOptional, z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>>; chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; currency: z.ZodMiniOptional>; cursor: z.ZodMiniOptional>; include: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; limit: z.ZodMiniDefault, z.ZodMiniTransform>>; order: z.ZodMiniDefault>; page: z.ZodMiniOptional>; verified: z.ZodMiniOptional, z.ZodMiniTransform>>; }, z.core.$strict>; /** Page of TIP-20 tokens. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; admin: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; currency: z.ZodMiniString; createdAt: z.ZodMiniOptional; decimals: z.ZodMiniNumber; holderCount: z.ZodMiniOptional>; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; quoteToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; symbol: z.ZodMiniString; totalSupply: z.ZodMiniOptional>; transferStats: z.ZodMiniOptional; firstAt: z.ZodMiniNullable; lastAt: z.ZodMiniNullable; }, z.core.$strip>>; verified: z.ZodMiniBoolean; }, z.core.$strip>>; nextCursor: z.ZodMiniNullable>; }, z.core.$strip>; } /** Schemas for the getTokenHolders operation. */ namespace getTokenHolders { /** Path parameters for token holder requests. */ const Params: z.ZodMiniObject<{ token: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; }, z.core.$strip>; /** Optional related resources that callers opt into via `include`. */ const Include: z.ZodMiniEnum<{ token: "token"; totalCount: "totalCount"; }>; /** * Parses a comma-separated `include` query value into a list of optional * resources to embed. Extra lookups (token metadata, the holder total) only * run when explicitly requested, keeping the base holder page fast. */ const includeQuery: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; /** Query parameters for token holder requests. */ const Query: z.ZodMiniObject<{ chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; cursor: z.ZodMiniOptional>; include: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; limit: z.ZodMiniDefault, z.ZodMiniTransform>>; page: z.ZodMiniOptional>; }, z.core.$strict>; /** A single TIP-20 token holder. */ const Holder: z.ZodMiniObject<{ address: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; balance: z.ZodMiniString; id: z.ZodMiniString; }, z.core.$strip>; /** Resources embedded on demand via `include`. */ const Meta: z.ZodMiniObject<{ totalCountCapped: z.ZodMiniOptional>; token: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>>; totalCount: z.ZodMiniOptional>; }, z.core.$strip>; /** Page of TIP-20 token holders, ordered by balance descending. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; balance: z.ZodMiniString; id: z.ZodMiniString; }, z.core.$strip>>; meta: z.ZodMiniOptional>; token: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>>; totalCount: z.ZodMiniOptional>; }, z.core.$strip>>; nextCursor: z.ZodMiniNullable>; }, z.core.$strip>; } /** Schemas for the getTokenTransactions operation. */ namespace getTokenTransactions { /** Path parameters for token transaction requests. */ const Params: z.ZodMiniObject<{ token: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; }, z.core.$strip>; /** Optional scoped-token resources and fee-token fields requested via `include`. */ const Include: z.ZodMiniEnum<{ "feeToken.logoUri": "feeToken.logoUri"; "feeToken.verified": "feeToken.verified"; token: "token"; totalCount: "totalCount"; }>; /** * Parses a comma-separated `include` query value into a list of optional * resources to embed. Extra lookups only run when explicitly requested, * keeping the base transaction page fast. */ const includeQuery: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; /** Query parameters for token transaction requests. */ const Query: z.ZodMiniObject<{ 'blockNumber.from': z.ZodMiniOptional>; 'blockNumber.to': z.ZodMiniOptional>; chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; cursor: z.ZodMiniOptional>; feePayer: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; feeToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; include: z.ZodMiniPipe, z.ZodMiniTransform>, z.ZodMiniArray>>; limit: z.ZodMiniDefault, z.ZodMiniTransform>>; order: z.ZodMiniDefault>; page: z.ZodMiniOptional>; 'timestamp.from': z.ZodMiniOptional>>; 'timestamp.to': z.ZodMiniOptional>>; }, z.core.$strict>; /** Resources embedded on demand via `include`. */ const Meta: z.ZodMiniObject<{ totalCountCapped: z.ZodMiniOptional>; token: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>>; totalCount: z.ZodMiniOptional>; }, z.core.$strip>; /** * Page of transactions touching the token contract. Each row is the * humanized transaction shape returned by `GET /transactions/:transactionHash`; * the optional `meta.token` embed is the token being scoped to. * * The `data` schema is wrapped in `z.lazy` because `transactions.ts` * already imports `Tokens.schema` at module init; a direct reference * here would close the import cycle and crash during evaluation. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniNullable>; calls: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; to: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$strip>>>; chainId: z.ZodMiniOptional>; feeToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; logoUri: z.ZodMiniOptional>>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniOptional>; }, z.core.$strip>>>; gas: z.ZodMiniNumber; gasPrice: z.ZodMiniOptional>; hash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; input: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; maxFeePerGas: z.ZodMiniOptional>; maxPriorityFeePerGas: z.ZodMiniOptional>; meta: z.ZodMiniObject<{ receipt: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniNumber; contractAddress: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; cumulativeGasUsed: z.ZodMiniNumber; effectiveGasPrice: z.ZodMiniString; feeAmount: z.ZodMiniObject<{ baseUnits: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; formatted: z.ZodMiniString; valuation: z.ZodMiniOptional; currency: z.ZodMiniString; }, z.core.$strip>>>; }, z.core.$strip>; feePayer: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; feeToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; logoUri: z.ZodMiniOptional>>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniOptional>; }, z.core.$strip>>>; gasUsed: z.ZodMiniNumber; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; logs: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; blockHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniNullable>; blockTimestamp: z.ZodMiniOptional>>; data: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, string>>; logIndex: z.ZodMiniNullable>; removed: z.ZodMiniBoolean; topics: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionIndex: z.ZodMiniNullable>; }, z.core.$loose>>; meta: z.ZodMiniObject<{ valuation: z.ZodMiniOptional; source: z.ZodMiniString; }, z.core.$strip>>; rpc: z.ZodMiniObject<{ blobGasPrice: z.ZodMiniOptional>; blobGasUsed: z.ZodMiniOptional>; blockHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniTemplateLiteral<`0x${string}`>; blockTimestamp: z.ZodMiniOptional>>; contractAddress: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; cumulativeGasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; effectiveGasPrice: z.ZodMiniTemplateLiteral<`0x${string}`>; feePayer: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; feeToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; from: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; gasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; logs: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; blockHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniNullable>; blockTimestamp: z.ZodMiniOptional>>; data: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, string>>; logIndex: z.ZodMiniNullable>; removed: z.ZodMiniBoolean; topics: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionIndex: z.ZodMiniNullable>; }, z.core.$loose>>; logsBloom: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; root: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; status: z.ZodMiniTemplateLiteral<`0x${string}`>; to: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; transactionIndex: z.ZodMiniTemplateLiteral<`0x${string}`>; type: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, string>>; }, z.core.$loose>; }, z.core.$strip>; recipient: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; sender: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; status: z.ZodMiniEnum<{ reverted: "reverted"; success: "success"; }>; timestamp: z.ZodMiniNullable; transactionHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; transactionIndex: z.ZodMiniNumber; type: z.ZodMiniLazy>; }, z.core.$strip>>>; rpc: z.ZodMiniObject<{ aaAuthorizationList: z.ZodMiniOptional>>; accessList: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; storageKeys: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$loose>>>; authorizationList: z.ZodMiniOptional>>; blobVersionedHashes: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; blockHash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; blockNumber: z.ZodMiniNullable>; blockTimestamp: z.ZodMiniOptional>>; calls: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; input: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; to: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; value: z.ZodMiniOptional>>; }, z.core.$loose>>, z.ZodMiniNull]>>; chainId: z.ZodMiniOptional>; feePayer: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; feePayerSignature: z.ZodMiniOptional>; }, z.core.$loose>>>; feeToken: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; from: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; gas: z.ZodMiniTemplateLiteral<`0x${string}`>; gasPrice: z.ZodMiniOptional>; hash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; input: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; keyAuthorization: z.ZodMiniOptional>>; maxFeePerBlobGas: z.ZodMiniOptional>; maxFeePerGas: z.ZodMiniOptional>; maxPriorityFeePerGas: z.ZodMiniOptional>; nonce: z.ZodMiniTemplateLiteral<`0x${string}`>; nonceKey: z.ZodMiniOptional>; r: z.ZodMiniOptional>; s: z.ZodMiniOptional>; signature: z.ZodMiniOptional>; }, z.core.$loose>>; to: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; transactionIndex: z.ZodMiniNullable>; type: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, string>>; v: z.ZodMiniOptional>; validAfter: z.ZodMiniOptional>>; validBefore: z.ZodMiniOptional>>; value: z.ZodMiniOptional>; yParity: z.ZodMiniOptional>; }, z.core.$loose>; }, z.core.$strip>; nonce: z.ZodMiniNumber; nonceKey: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; recipient: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; sender: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; timestamp: z.ZodMiniNullable; transactionIndex: z.ZodMiniNullable>; type: z.ZodMiniEnum<{ eip1559: "eip1559"; eip2930: "eip2930"; eip4844: "eip4844"; eip7702: "eip7702"; legacy: "legacy"; tempo: "tempo"; unknown: "unknown"; }>; validAfter: z.ZodMiniOptional>; validBefore: z.ZodMiniOptional>; value: z.ZodMiniString; }, z.core.$strip>>>; meta: z.ZodMiniOptional>; token: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; id: z.ZodMiniString; logoUri: z.ZodMiniOptional>; name: z.ZodMiniString; symbol: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>>; totalCount: z.ZodMiniOptional>; }, z.core.$strip>>; nextCursor: z.ZodMiniNullable>; }, z.core.$strip>; } } /** Creates token handlers. */ export declare function tokens(): import("hono/hono-base").HonoBase; declare function getToken(c: Context, options: getToken.Options): Promise<(Response & import("hono").TypedResponse<{ error: { code: "token_not_found"; details?: readonly Response.error.Detail[] | undefined; message: string; }; requestId: string; }, 404, "json">) | (Response & import("hono").TypedResponse<{ error: { code: "upstream_error"; details?: readonly Response.error.Detail[] | undefined; message: string; }; requestId: string; }, 502, "json">) | (Response & import("hono").TypedResponse<{ address: `0x${string}`; admin?: `0x${string}` | undefined; currency: string; createdAt?: string | undefined; decimals: number; holderCount?: number | undefined; id: string; logoUri?: string | undefined; name: string; quoteToken?: `0x${string}` | undefined; symbol: string; totalSupply?: string | undefined; transferStats?: { count: number; firstAt: string | null; lastAt: string | null; } | undefined; verified: boolean; }, 200, "json">)>; declare namespace getToken { type Options = { address: z.output; chainId: z.output; createdAtByAddress?: Record | undefined; /** Pre-fetched `TokenCreated` extras (`admin`/`quoteToken`) for page callers. */ createdByAddress?: Record | undefined; /** Pre-fetched holder counts for page callers. */ holderCountByAddress?: Record | undefined; include?: readonly z.output[] | undefined; snapshot?: VerifiedTokens.Snapshot | undefined; /** Pre-fetched transfer statistics for page callers. */ transferStatsByAddress?: Record | undefined; }; } /** * Resolves the token metadata object. Throws on upstream failure / not found so * callers can map the error (e.g. `getToken` → 404/502). Shared by `getToken`, * the holder page's `include=token`, and the per-row address balance `token`. * * Page-level callers that enrich many tokens at once should pre-fetch * `createdAtByAddress` (one `IN (...)` TIDX query for the whole page) and pass * it in to avoid N separate `getTokenCreatedAtByAddress` round-trips. The same * applies to the verified-token `snapshot` and the other batch enrichments * (`createdByAddress`, `holderCountByAddress`, `transferStatsByAddress`). */ export declare function resolveToken(c: Context, options: resolveToken.Options): Promise>; export declare namespace resolveToken { type Options = getToken.Options; } /** Resolves unique token addresses with RPC metadata and requested curated fields. */ export declare function resolveTokens(c: Context, options: resolveTokens.Options): Promise; export declare namespace resolveTokens { /** Options for resolving page token metadata. */ type Options = { /** Token addresses to resolve. */ addresses: readonly z.output[]; /** Tempo chain id. */ chainId: z.output; /** Curated token fields to include. */ include: readonly ('token.logoUri' | 'token.verified')[]; /** Token metadata already resolved by the enclosing resource. */ metadata?: ReadonlyMap, Metadata> | undefined; /** Preloaded verified-token state. */ snapshot?: VerifiedTokens.Snapshot | undefined; }; /** Token metadata required by compact references. */ type Metadata = Pick, 'currency' | 'decimals' | 'logoUri' | 'name' | 'symbol'>; /** Token metadata keyed by lowercase address. */ type ReturnType = Map, Token>; /** Token metadata with opt-in curated fields. */ type Token = Omit, 'verified'> & { /** Whether the token is curated, when requested. */ verified?: boolean | undefined; }; } /** * Resolves a token's on-chain metadata (`name`/`symbol`/`decimals`/`currency`/ * `logoUri`/`totalSupply`) via a single `token.getMetadata` RPC, memoized under the shared * `token:v1:{chainId}:{address}:metadata` key. Exported so feed enrichers (e.g. * `activities`) reuse the same cache entry as the token resource rather than * fetching metadata through a parallel path. */ export declare function getTokenMetadata(c: Context, options: getTokenMetadata.Options): Promise<{ currency: string; decimals: number; logoUri: string | undefined; name: string; symbol: string; totalSupply: string; }>; declare namespace getTokenMetadata { type Options = { address: z.output; chainId: z.output; }; } /** * Resolves a token's curated R2 icon URI, memoized per `(chainId, address)` * so page enrichers (balances, holders, transfers `include=token.logoUri`) don't * re-fetch the asset per row on every request. Misses are memoized as `null` * too — most tokens have no curated icon, and the negative lookup is exactly * what page enrichment would otherwise repeat N times per page. * * The public URI embeds the request origin, so the origin is part of the * cache key; cardinality stays bounded by the number of public hostnames. */ export declare function getTokenLogo(c: Context, options: getTokenLogo.Options): Promise; declare namespace getTokenLogo { type Options = { address: z.output; chainId: z.output; }; } declare function getTransferStats(c: Context, options: getTransferStats.Options): Promise<{ count: number; firstAt: string | null; lastAt: string | null; } | null>; declare namespace getTransferStats { /** Lifetime `Transfer` statistics for one token, as surfaced on the token resource. */ type Stats = Exclude['transferStats'], undefined>; type Options = { address: z.output; chainId: z.output; }; } /** * Resolves `createdAt` for many tokens in one TIDX round-trip while keeping * cache entries keyed per-address, so two pages sharing N-1 of N tokens * naturally reuse most of the cache. We: * * 1. Look up each requested address in the per-address cache. * 2. Issue a single `IN (…)` query for the misses only. * 3. Write each freshly-resolved address back to the per-address cache. * * Token creation timestamps are immutable, so successful entries are cached * for a day. Addresses the indexer answered but did not resolve (no * `TokenCreated` row — e.g. genesis tokens) are negative-cached briefly so * they do not re-run the `logs` decode CTE on every request; the short TTL * covers tokens that are simply not indexed yet. */ export declare function getTokenCreatedAtByAddress(c: Context, options: getTokenCreatedAtByAddress.Options): Promise>; export declare namespace getTokenCreatedAtByAddress { type Options = { addresses: readonly z.output[]; chainId: z.output; }; } /** * Resolves the `TokenCreated` extras (`admin`/`quoteToken`, plus the event's * `createdAt` timestamp) for many tokens in one TIDX round-trip while keeping * cache entries keyed per-address, mirroring {@link getTokenCreatedAtByAddress}. * The deployed indexer's `tokencreated` event CTE cannot serve the * `quoteToken`/`admin` columns (selecting them returns `db error`), so this * reads the raw `logs` table by topic0 and ABI-decodes the non-indexed event * data instead. * * Token creation payloads are immutable, so successful entries are cached for * a day. Addresses the indexer answered but did not resolve (no `TokenCreated` * log — e.g. genesis tokens) are negative-cached briefly so they do not * re-scan `logs` on every request; the short TTL covers tokens that are simply * not indexed yet. */ declare function getTokenCreatedByAddress(c: Context, options: getTokenCreatedByAddress.Options): Promise>; declare namespace getTokenCreatedByAddress { /** `TokenCreated` payload fields resolved per token. */ type Created = { /** Token admin address from the `TokenCreated` event. */ admin: z.output; /** Token creation timestamp (ISO 8601). */ createdAt: string; /** Quote token address from the `TokenCreated` event. */ quoteToken: z.output; }; type Options = { addresses: readonly z.output[]; chainId: z.output; }; } /** Matches metadata-read failures for addresses that are not TIP-20 tokens. */ export declare function isTokenNotFound(cause: unknown): boolean; export {}; //# sourceMappingURL=tokens.d.ts.map