import * as z from 'zod/mini' import type { Hex } from 'ox' import type { Address } from 'viem' import type * as EarnVaults from '../internal/EarnVaults.js' import type * as Campaigns from '../internal/rewards/Campaigns.js' import type * as routes_Catalog from '../internal/routes/Catalog.js' import type * as routes_Deposit from '../internal/routes/Deposit.js' import type * as routes_DepositAddress from '../internal/routes/DepositAddress.js' import type * as routes_Provider from '../internal/routes/Provider.js' import type * as routes_Transfer from '../internal/routes/Transfer.js' import type * as routes_TransferSubsidy from '../internal/routes/TransferSubsidy.js' import type * as internal_Schema from '../internal/Schema.js' import type * as Webhooks from '../internal/Webhooks.js' /** One authenticated administrator access to a protected admin API route. */ export const AdminAuditLog = z.object({ actor: z.string().check(z.describe('Verified administrator email.')), createdAt: z.string().check(z.describe('When the access completed (ISO 8601).')), id: z.string().check(z.describe('Opaque audit event id (`aud_…`).')), method: z.string().check(z.describe('HTTP method used for the access.')), path: z.string().check(z.describe('Admin API path accessed, without query parameters.')), query: z .nullable(z.string()) .check(z.describe('Query string used for the lookup, or null when absent.')), requestId: z.string().check(z.describe('Request id correlating the access with request logs.')), status: z .number() .check(z.int(), z.describe('HTTP response status returned to the administrator.')), }) /** Columns of the `admin_audit_logs` table. */ export type AdminAuditLog = z.output /** A durable fence for API keys attributed to a deleted organization or project. */ export const ApiKeyOwnerTombstone = z.object({ createdAt: z.string().check(z.describe('When the owner deletion committed (ISO 8601).')), id: z.string().check(z.describe('Deterministic organization or project owner key.')), }) /** Columns of the `api_key_owner_tombstones` table. */ export type ApiKeyOwnerTombstone = z.output /** Legacy aggregate API-key admission count retained for migration compatibility. */ export const ApiKeyOwnerAdmission = z.object({ liveKeys: z.number().check(z.int(), z.nonnegative()), orgId: z.string(), updatedAt: z.string(), }) /** Columns of the `api_key_owner_admissions` table. */ export type ApiKeyOwnerAdmission = z.output /** One API key counted toward its organization's live-key admission limit. */ export const ApiKeyAdmission = z.object({ expiresAt: z.nullable(z.string()), id: z.string(), orgId: z.string(), projectId: z.nullable(z.string()), }) /** Columns of the `api_key_admissions` table. */ export type ApiKeyAdmission = z.output /** Records an organization's latest bounded legacy-key admission reconciliation. */ export const ApiKeyAdmissionBootstrap = z.object({ bootstrappedAt: z.string(), orgId: z.string(), }) /** Columns of the `api_key_admission_bootstraps` table. */ export type ApiKeyAdmissionBootstrap = z.output /** A retained revocation fence for one stable API-key id. */ export const ApiKeyRevocation = z.object({ expiresAt: z.string(), id: z.string(), orgId: z.nullable(z.string()), revokedAt: z.string(), }) /** Columns of the `api_key_revocations` table. */ export type ApiKeyRevocation = z.output /** A Better Auth login method linked to a Tempo user. */ export const AuthAccount = z.object({ accessToken: z.nullable(z.string()).check(z.describe('OAuth access token, or null.')), accessTokenExpiresAt: z .nullable(z.date()) .check(z.describe('When the OAuth access token expires, or null.')), accountId: z.string().check(z.describe('Provider-side account identifier.')), createdAt: z.date().check(z.describe('When Better Auth created the account.')), id: z.string().check(z.describe('Better Auth account row id.')), idToken: z.nullable(z.string()).check(z.describe('OpenID Connect identity token, or null.')), issuer: z.string().check(z.describe('Issuer namespace for the provider account.')), password: z.nullable(z.string()).check(z.describe('Credential password hash, or null.')), providerId: z.string().check(z.describe('Authentication provider identifier.')), refreshToken: z.nullable(z.string()).check(z.describe('OAuth refresh token, or null.')), refreshTokenExpiresAt: z .nullable(z.date()) .check(z.describe('When the OAuth refresh token expires, or null.')), scope: z.nullable(z.string()).check(z.describe('Granted OAuth scopes, or null.')), updatedAt: z.date().check(z.describe('When Better Auth last changed the account.')), userId: z.string().check(z.describe('Tempo user id that owns the login method.')), }) /** Columns of the `auth_accounts` table. */ export type AuthAccount = z.output /** A Better Auth session row for the pinned package schema. */ export const AuthSession = z.object({ createdAt: z.date().check(z.describe('When Better Auth created the session.')), expiresAt: z.date().check(z.describe('When the Better Auth session expires.')), id: z.string().check(z.describe('Better Auth session row id.')), ipAddress: z.nullable(z.string()).check(z.describe('Client IP address, or null.')), provider: z .nullable(z.string()) .check(z.describe('Authentication provider that established the session, or null.')), token: z.string().check(z.describe('Opaque Better Auth session token.')), updatedAt: z.date().check(z.describe('When Better Auth last changed the session.')), userAgent: z.nullable(z.string()).check(z.describe('Client user agent, or null.')), userId: z.string().check(z.describe('Owning Better Auth user id.')), }) /** Columns of the `auth_sessions` table. */ export type AuthSession = z.output /** A Better Auth verification row for the pinned package schema. */ export const AuthVerification = z.object({ createdAt: z.date().check(z.describe('When Better Auth created the verification.')), expiresAt: z.date().check(z.describe('When the verification expires.')), id: z.string().check(z.describe('Better Auth verification row id.')), identifier: z.string().check(z.describe('Lookup key for the verification purpose.')), updatedAt: z.date().check(z.describe('When Better Auth last changed the verification.')), value: z.string().check(z.describe('Stored verification credential.')), }) /** Columns of the `auth_verifications` table. */ export type AuthVerification = z.output /** An organization's billing configuration; source-agnostic (limits apply to any billing source). */ export const BillingSettings = z.object({ createdAt: z.string().check(z.describe('When the settings row was created (ISO 8601).')), currency: z .enum(['usd']) .check(z.describe('ISO 4217 currency (lowercase) both limits are denominated in.')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Environment these settings apply to; `production` or `sandbox`.')), orgId: z.string().check(z.describe('Organization id (`org_…`) these settings belong to.')), period: z .enum(['month']) .check(z.describe('Window the spend limit applies over; `month` is a UTC calendar month.')), spendLimit: z .nullable(z.string()) .check(z.describe('Spend limit per period as a decimal string in `currency` units, or null for no limit.')), // prettier-ignore txFeeLimit: z .nullable(z.string()) .check(z.describe('Per-transaction fee cap as a decimal string in `currency` units, or null for the platform default.')), // prettier-ignore updatedAt: z.string().check(z.describe('When the settings last changed (ISO 8601).')), }) /** Columns of the `billing_settings` table. */ export type BillingSettings = z.output /** An early-access allowlist entry: a lowercase domain or exact email. */ export const EarlyAccessEntry = z.object({ createdAt: z.string().check(z.describe('When the entry was added (ISO 8601).')), createdBy: z .string() .check(z.describe('Admin email that added the entry, or `migration` for seeded rows.')), entry: z .string() .check(z.describe('Lowercase domain or exact email (contains `@`) granted early access.')), }) /** Columns of the `early_access` table. */ export type EarlyAccessEntry = z.output /** One curated Earn vault. */ export const EarnVault = z .object({ chainId: z.number().check(z.int(), z.describe('Chain the deployment belongs to.')), createdAt: z.string().check(z.describe('When the vault was registered (ISO 8601).')), description: z .nullable(z.string()) .check(z.describe('Curated vault description, or null when absent.')), label: z.string().check(z.describe('Curated vault label.')), privateInputTokens: z .custom() .check(z.describe('Tokens accepted for private deposits (`jsonb`).')), privateOutputTokens: z .custom() .check(z.describe('Tokens supported for private redemptions (`jsonb`).')), slug: z.string().check(z.describe('Stable URL slug assigned when the vault is registered.')), updatedAt: z.string().check(z.describe('When the vault registration last changed (ISO 8601).')), vaultAddress: z.custom
().check(z.describe('Earn vault address (lowercase).')), zones: z .custom() .check(z.describe('Curated private Zone routes (`jsonb`).')), }) .check(z.describe('One curated Earn vault row.')) /** Columns of the `earn_vaults` table. */ export type EarnVault = z.output /** One billing-source type enabled for an organization. */ export const EnabledBillingSource = z.object({ createdAt: z.string().check(z.describe('When the billing source was enabled (ISO 8601).')), createdBy: z .string() .check(z.describe('Identity that enabled the source, or `migration` for backfilled rows.')), orgId: z.string().check(z.describe('Organization id (`org_…`) this source is enabled for.')), source: z .enum(['stripe', 'tempo']) .check(z.describe('Enabled billing-source type; `stripe` or `tempo`.')), }) /** Columns of the `enabled_billing_sources` table. */ export type EnabledBillingSource = z.output /** A pending, expiring offer of organization membership. */ export const Invitation = z.object({ acceptedAt: z .nullable(z.string()) .check(z.describe('When the invitation was accepted (ISO 8601), or null while pending.')), createdAt: z.string().check(z.describe('When the invitation was created (ISO 8601).')), email: z .string() .check(z.describe('Invitee email (stored lowercase); matched against verified emails.')), expiresAt: z.string().check(z.describe('When the invitation expires (ISO 8601).')), grantsEarlyAccess: z .boolean() .check(z.describe("Whether the invitation grants early access; stamped from the inviter's own access at creation.")), // prettier-ignore id: z .string() .check( z.describe('Opaque invitation id (`inv_…`).'), z.meta({ examples: ['inv_1a2b3c4d5e6f7g8h9j0k1m2n'] }), ), invitedBy: z.string().check(z.describe('User or API key id that created the invitation.')), orgId: z.string().check(z.describe('Organization id (`org_…`) the invitation joins.')), revokedAt: z .nullable(z.string()) .check(z.describe('When the invitation was revoked (ISO 8601), or null.')), role: z .enum(['admin', 'member', 'owner']) .check(z.describe('Role granted when the invitation is accepted.')), }) /** Columns of the `invitations` table. */ export type Invitation = z.output /** A reusable bearer link granting organization membership. */ export const InviteLink = z.object({ allowedEmailDomains: z .nullable(z.readonly(z.array(z.string()))) .check(z.describe('Lowercase email domains allowed to redeem, or null for unrestricted.')), createdAt: z.string().check(z.describe('When the link was created (ISO 8601).')), createdBy: z.string().check(z.describe('User id that created the link, or `super_admin`.')), deletedAt: z.nullable(z.string()).check(z.describe('When the link was soft deleted, or null.')), enabled: z.boolean().check(z.describe('Whether the link is enabled.')), expiresAt: z.nullable(z.string()).check(z.describe('When the link expires, or null.')), id: z.string().check(z.describe('Opaque invite-link resource id (`iln_…`).')), lastUsedAt: z .nullable(z.string()) .check(z.describe('When the link last created a membership, or null.')), maxUses: z .nullable(z.number().check(z.int(), z.positive())) .check(z.describe('Maximum redemptions, or null.')), name: z.string().check(z.describe('Link name.')), orgId: z.string().check(z.describe('Organization id (`org_…`).')), role: z.literal('member').check(z.describe('Non-privileged role granted by the link.')), token: z.string().check(z.describe('Opaque invite-link bearer token (`lnk_…`).')), updatedAt: z.string().check(z.describe('When the link was last changed (ISO 8601).')), useCount: z.number().check(z.int(), z.nonnegative(), z.describe('Successful redemption count.')), }) /** Columns of the `invite_links` table. */ export type InviteLink = z.output /** An audit record for one membership created through an invite link. */ export const InviteLinkRedemption = z.object({ createdAt: z.string().check(z.describe('When the link was redeemed (ISO 8601).')), email: z.string().check(z.describe('Verified email used for redemption.')), id: z.string().check(z.describe('Opaque redemption id (`ilr_…`).')), inviteLinkId: z.string().check(z.describe('Invite-link id.')), inviteLinkName: z.string().check(z.describe('Invite-link name at redemption time.')), orgId: z.string().check(z.describe('Organization id.')), userId: z.string().check(z.describe('Redeeming user id.')), }) /** Columns of the `invite_link_redemptions` table. */ export type InviteLinkRedemption = z.output /** A user's role within an organization. */ export const Membership = z.object({ createdAt: z.string().check(z.describe('When the membership was created (ISO 8601).')), orgId: z.string().check(z.describe('Organization id (`org_…`).')), role: z .enum(['admin', 'member', 'owner']) .check(z.describe("The member's role within the organization.")), updatedAt: z.string().check(z.describe('When the membership was last updated (ISO 8601).')), userId: z.string().check(z.describe('Member user id (`usr_…`).')), }) /** Columns of the `memberships` table. */ export type Membership = z.output /** An organization, the top-level tenant that owns API keys. */ export const Organization = z.object({ createdAt: z.string().check(z.describe('When the organization was created (ISO 8601).')), createdBy: z .nullable(z.string()) .check(z.describe('Identity that created the organization (e.g. admin email), or null.')), id: z .string() .check( z.describe('Opaque organization id (`org_…`).'), z.meta({ examples: ['org_1a2b3c4d5e6f7g8h9j0k1m2n'] }), ), name: z .string() .check(z.describe('Human-readable organization name.'), z.meta({ examples: ['Acme, Inc.'] })), sponsorshipSubsidyDurationDays: z .nullable(z.number().check(z.int(), z.positive())) .check(z.describe('Promotional sponsorship duration in days, or null when disabled.')), // The persisted column name predates attribution-scoped promotion limits. sponsorshipSubsidyProjectSpendLimit: z .nullable(z.string()) .check( z.describe('Per-attribution promotional spend cap in decimal USD, or null when disabled.'), ), updatedAt: z.string().check(z.describe('When the organization was last updated (ISO 8601).')), userId: z .nullable(z.string()) .check( z.describe('Owning user id (`usr_…`), or null for organizations created by the super admin.'), ), }) /** Columns of the `organizations` table. */ export type Organization = z.output /** An organization Routes subsidy policy. */ export const RoutesSubsidy = z.object({ createdAt: z.string().check(z.describe('When the Routes subsidy policy was created (ISO 8601).')), enabled: z.boolean().check(z.describe('Whether the organization enables Routes subsidies.')), frequency: z.literal('tx').check(z.describe('Interval over which the subsidy limit applies.')), maxAmount: z .nullable(z.string()) .check(z.describe('Maximum Routes subsidy gap in decimal USD, or null when disabled.')), orgId: z.string().check(z.describe('Organization id (`org_…`).')), updatedAt: z.string().check(z.describe('When the Routes subsidy policy was updated (ISO 8601).')), }) /** Columns of the `routes_subsidies` table. */ export type RoutesSubsidy = z.output /** A project: an app or integration within an organization. */ export const Project = z.object({ createdAt: z.string().check(z.describe('When the project was created (ISO 8601).')), id: z .string() .check( z.describe('Opaque project id (`prj_…`).'), z.meta({ examples: ['prj_1a2b3c4d5e6f7g8h9j0k1m2n'] }), ), name: z .string() .check(z.describe('Human-readable project name.'), z.meta({ examples: ['Checkout'] })), orgId: z.string().check(z.describe('Owning organization id (`org_…`).')), sponsorshipSubsidyStartsAt: z .nullable(z.string()) .check(z.describe('When the project first activated promotional sponsorship, or null.')), sponsorshipSubsidyEndsAt: z .nullable(z.string()) .check(z.describe('When the project promotional sponsorship ends, or null.')), sponsorshipSpendLimit: z .nullable(z.string()) .check(z.describe('Promotional spend cap in fee-token base units, or null.')), updatedAt: z.string().check(z.describe('When the project was last updated (ISO 8601).')), }) /** Columns of the `projects` table. */ export type Project = z.output /** A per-hour request-count watermark: the running total already reported to the meter. */ export const RequestUsageBucket = z.object({ bucketStart: z.string().check(z.describe('UTC hour start this bucket covers (ISO 8601).')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Environment the requests were served under; `production` or `sandbox`.')), orgId: z.string().check(z.describe('Organization id (`org_…`) the requests attribute to.')), reportedCount: z .number() .check(z.describe('Cumulative request count already reported to the meter for this bucket.')), updatedAt: z.string().check(z.describe('When the watermark last advanced (ISO 8601).')), }) /** Columns of the `request_usage_buckets` table. */ export type RequestUsageBucket = z.output /** One request-count meter event: a frozen additive delta with its exactly-once state. */ export const RequestUsageMeterEvent = z.object({ bucketStart: z.string().check(z.describe('UTC hour start this event bills for (ISO 8601).')), deltaCount: z .number() .check(z.describe('Frozen request count this event bills; a positive additive delta.')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Environment the requests were served under; `production` or `sandbox`.')), error: z.nullable(z.string()).check(z.describe('Last failure detail while `pending`, or null.')), firstAttemptedAt: z.string().check(z.describe('When this event was first claimed (ISO 8601).')), identifier: z .string() .check(z.describe('Deterministic id; also the Stripe meter-event identifier and idempotency key.')), // prettier-ignore orgId: z.string().check(z.describe('Organization id (`org_…`) the requests attribute to.')), reason: z .nullable(z.string()) .check(z.describe('Skip reason when `state` is `skipped` (`no_customer` | `customer_canceled`), or null.')), // prettier-ignore reportedAt: z .nullable(z.string()) .check(z.describe('When Stripe acknowledged the event (ISO 8601), or null.')), sequence: z .number() .check(z.describe('Reported-count watermark observed when this delta was claimed.')), state: z .enum(['pending', 'reported', 'skipped']) .check(z.describe('Exactly-once state: `pending` retries, `reported` is done, `skipped` is audited.')), // prettier-ignore stripeCustomerId: z.string().check(z.describe('Stripe customer id the event bills against.')), }) /** Columns of the `request_usage_meter_events` table. */ export type RequestUsageMeterEvent = z.output /** One reward campaign bound to a verified Earn vault. */ export const RewardCampaign = z.object({ assetAddress: z.custom
().check(z.describe('Vault base-asset address (lowercase).')), assetDecimals: z .number() .check(z.int(), z.nonnegative(), z.lte(255), z.describe('Vault base-asset decimals.')), chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), config: z.custom().check(z.describe('Active campaign configuration.')), controllerAddress: z .nullable(z.custom
()) .check(z.describe('Target-yield controller, or null.')), createdAt: z.string().check(z.describe('When the campaign was created (ISO 8601).')), deliveredThrough: z.string().check(z.regex(/^\d+$/), z.describe('Last delivered Unix boundary.')), distributorAddress: z .nullable(z.custom
()) .check(z.describe('Merkle distributor, or null.')), earnShareAddress: z.custom
().check(z.describe('Vault EarnShare address (lowercase).')), earnShareDecimals: z .number() .check(z.int(), z.nonnegative(), z.lte(255), z.describe('Vault EarnShare decimals.')), eventCursor: z .nullable(z.custom()) .check(z.describe('Last applied TIDX event, or null.')), paused: z.boolean().check(z.describe('Whether new campaign work is paused.')), pendingConfig: z .nullable(z.custom()) .check(z.describe('Future configuration, or null.')), pendingEffectiveAt: z.nullable(z.string()).check(z.describe('Pending Unix boundary, or null.')), provisioningError: z .nullable(z.string()) .check(z.describe('Actionable provisioning error, or null.')), signerAddress: z .nullable(z.custom
()) .check(z.describe('Signer permanently bound when reward periphery is first provisioned.')), updatedAt: z.string().check(z.describe('When campaign state last changed (ISO 8601).')), vaultAddress: z.custom
().check(z.describe('Verified EarnVault address (lowercase).')), }) /** Columns of the `reward_campaigns` table. */ export type RewardCampaign = z.output /** One verified reward distributor retained for historical payout recognition. */ export const RewardCampaignDistributor = z.object({ chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), createdAt: z.string().check(z.describe('When the distributor was first recorded (ISO 8601).')), distributorAddress: z.custom
().check(z.describe('Verified reward distributor address.')), vaultAddress: z.custom
().check(z.describe('Verified EarnVault address (lowercase).')), }) /** Columns of the `reward_campaign_distributors` table. */ export type RewardCampaignDistributor = z.output /** One current delivered recipient projection. */ export const RewardAccount = z.object({ accrualRemainder: z .string() .check(z.regex(/^\d+$/), z.describe('Carried reward arithmetic remainder.')), allocatedPrincipalAssets: z .string() .check(z.regex(/^\d+$/), z.describe('Principal allocated against campaign caps.')), chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), cumulativeEntitlement: z .string() .check(z.regex(/^\d+$/), z.describe('Cumulative EarnShare entitlement.')), cumulativePaid: z.string().check(z.regex(/^\d+$/), z.describe('Cumulative EarnShare paid.')), deferral: z.nullable(z.string()).check(z.describe('Current payout deferral reason, or null.')), eligibilityRegisteredAt: z .nullable(z.string()) .check(z.describe('Eligibility registration version consumed by this projection.')), lots: z .array(z.custom()) .check(z.describe('Surviving qualified deposit lots.')), pendingRewardAssets: z .string() .check(z.regex(/^\d+$/), z.describe('Unsettled base-asset reward units.')), publicEarnShares: z .string() .check(z.regex(/^\d+$/), z.describe('Current attributable public EarnShare balance.')), qualifiedEarnShares: z .string() .check(z.regex(/^\d+$/), z.describe('Current qualified EarnShare balance.')), recipient: z.custom
().check(z.describe('Registered reward recipient (lowercase).')), registrationOrder: z .string() .check(z.regex(/^\d+$/), z.describe('Eligibility registration order.')), updatedAt: z.string().check(z.describe('When delivered account state last changed (ISO 8601).')), vaultAddress: z.custom
().check(z.describe('EarnVault address (lowercase).')), }) /** Columns of the `reward_accounts` table. */ export type RewardAccount = z.output /** One run-once manual reward credit added to a recipient's pending rewards. */ export const RewardCredit = z.object({ assets: z.string().check(z.regex(/^\d+$/), z.describe('Credited base-asset reward units.')), chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), createdAt: z.string().check(z.describe('When the credit was applied (ISO 8601).')), recipient: z.custom
().check(z.describe('Credited reward recipient (lowercase).')), reference: z .string() .check(z.describe('Operator reference identifying the credit batch; unique per recipient.')), vaultAddress: z.custom
().check(z.describe('EarnVault address (lowercase).')), }) /** Columns of the `reward_credits` table. */ export type RewardCredit = z.output /** One durable reward execution. */ export const RewardRun = z.object({ chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), config: z .custom() .check(z.describe('Configuration snapshot consumed by the run.')), createdAt: z.string().check(z.describe('When the run was created (ISO 8601).')), endsAt: z.string().check(z.regex(/^\d+$/), z.describe('Exclusive final Unix boundary.')), error: z.nullable(z.string()).check(z.describe('Actionable run error, or null.')), evidence: z .nullable(z.custom()) .check(z.describe('Resumable or completed calculation evidence, or null.')), fence: z.string().check(z.regex(/^\d+$/), z.describe('Monotonic lease fencing token.')), fundedAssets: z .nullable(z.string()) .check(z.describe('Base assets pulled for boost settlement, or null.')), id: z.string().check(z.describe('Opaque reward run id (`rrn_…`).')), leaseExpiresAt: z .nullable(z.string()) .check(z.describe('Worker lease expiry (ISO 8601), or null.')), liability: z .nullable(z.string()) .check(z.describe('Published cumulative EarnShare liability, or null.')), mintedEarnShares: z.nullable(z.string()).check(z.describe('Measured EarnShare mint, or null.')), phase: z .enum([ 'indexing', 'calculating', 'targetYield', 'statement', 'settling', 'publishing', 'paying', 'delivered', 'failed', ]) .check(z.describe('Recoverable execution phase.')), root: z.nullable(z.custom()).check(z.describe('Published Merkle root, or null.')), rootVersion: z.nullable(z.string()).check(z.describe('Published root version, or null.')), startsAfter: z .string() .check(z.regex(/^\d+$/), z.describe('Previously delivered Unix boundary.')), statement: z .nullable(z.custom()) .check(z.describe('Latest cumulative statement, or null.')), statementHash: z .nullable(z.custom()) .check(z.describe('Statement content hash, or null.')), updatedAt: z.string().check(z.describe('When run state last changed (ISO 8601).')), vaultAddress: z.custom
().check(z.describe('EarnVault address (lowercase).')), }) /** Columns of the `reward_runs` table. */ export type RewardRun = z.output /** One append-only signed reward transaction attempt. */ export const RewardTransactionAttempt = z.object({ chainId: z.number().check(z.int(), z.positive(), z.describe('Chain receiving the transaction.')), confirmedBlockHash: z .nullable(z.custom()) .check(z.describe('Confirmed canonical block hash, or null.')), createdAt: z.string().check(z.describe('When the attempt was created (ISO 8601).')), expiresAt: z .nullable(z.string()) .check(z.describe('Expiring nonce deadline (ISO 8601), or null.')), id: z.string().check(z.describe('Opaque transaction attempt id (`rat_…`).')), intent: z.custom().check(z.describe('Typed signer intent.')), intentId: z.custom().check(z.describe('Deterministic typed intent id.')), nonce: z.nullable(z.string()).check(z.describe('Signer nonce, or null before signing.')), receipt: z .nullable(z.custom()) .check(z.describe('Canonical receipt, or null.')), replacementOf: z.nullable(z.string()).check(z.describe('Replaced attempt id, or null.')), runId: z .nullable(z.string()) .check(z.describe('Owning reward run id, or null for provisioning.')), signedBytes: z .nullable(z.custom()) .check(z.describe('Exact signed transaction bytes, or null.')), signer: z.custom
().check(z.describe('Signing account (lowercase).')), state: z .enum(['created', 'signed', 'broadcast', 'confirmed', 'expired', 'ineffective', 'reverted']) .check(z.describe('Attempt lifecycle state.')), transactionHash: z.nullable(z.custom()).check(z.describe('Transaction hash, or null.')), updatedAt: z.string().check(z.describe('When attempt state last changed (ISO 8601).')), vaultAddress: z.custom
().check(z.describe('Bound EarnVault address (lowercase).')), }) /** Columns of the `reward_transaction_attempts` table. */ export type RewardTransactionAttempt = z.output /** One wallet and Earn vault association eligible for rewards. */ export const RewardEligibilityAssociation = z .object({ chainId: z.number().check(z.int(), z.positive(), z.describe('Chain containing the vault.')), firstRegisteredAt: z .string() .check(z.describe('When the association was first registered (ISO 8601).')), latestRegisteredAt: z .string() .check(z.describe('When the association was most recently registered (ISO 8601).')), registrationOrder: z .string() .check(z.regex(/^\d+$/), z.describe('Monotonic registration order.')), transactionHash: z.optional( z.custom().check(z.describe('Latest registration transaction hash.')), ), vaultAddress: z.custom
().check(z.describe('Earn vault address (lowercase).')), walletAddress: z.custom
().check(z.describe('Eligible wallet address (lowercase).')), }) .check(z.describe('One persisted reward eligibility association.')) /** Columns of the `reward_eligibility_associations` table. */ export type RewardEligibilityAssociation = z.output /** A transaction sponsored by the managed fee payer — the billable unit of fee payer spend. */ export const SponsoredTransaction = z.object({ apiKeyId: z.string().check(z.describe('API key id (`key_…`) that requested sponsorship.')), sponsorshipAttributionId: z .nullable(z.string()) .check(z.describe('Canonical sponsorship attribution id snapshotted at sponsorship, or null.')), billable: z .boolean() .check(z.describe('Whether the sponsorship accrues billable spend; false for sandbox.')), chainId: z.number().check(z.describe('Chain the sponsored transaction targets.')), createdAt: z.string().check(z.describe('When the sponsorship was recorded (ISO 8601).')), currency: z .nullable(z.string()) .check(z.describe('Lowercase fee currency the sponsorship settles in (`usd`), or null when the fee token is unverified.')), // prettier-ignore environment: z .enum(['production', 'sandbox']) .check(z.describe('Key environment the sponsorship was requested under.')), feeAmount: z .nullable(z.string()) .check(z.describe('Actual fee paid in fee-token base units, or null until finalized.')), feeMax: z .nullable(z.string()) .check(z.describe('Signed fee cap (`gas × maxFeePerGas`) in base units; pending rows count it against spend limits.')), // prettier-ignore feeToken: z .nullable(z.string()) .check(z.describe('Fee token address, or null when the chain default applied.')), finalizationAttemptedAt: z .nullable(z.string()) .check(z.describe('When finalization last claimed this pending row (ISO 8601), or null.')), finalizedAt: z .nullable(z.string()) .check(z.describe('When the sponsorship reached a terminal status (ISO 8601), or null.')), id: z .string() .check( z.describe('Opaque sponsored-transaction id (`stx_…`).'), z.meta({ examples: ['stx_1a2b3c4d5e6f7g8h9j0k1m2n'] }), ), meterReportedAt: z .nullable(z.string()) .check(z.describe('When the row was reported to the billing meter (ISO 8601), or null; exactly-once marker.')), // prettier-ignore orgId: z.string().check(z.describe('Organization id (`org_…`) the spend attributes to.')), projectId: z .nullable(z.string()) .check(z.describe('Project id (`prj_…`) the spend attributes to, or null for organization-level spend.')), // prettier-ignore signPayload: z .string() .check(z.describe('Fee-payer sign payload — a stable identity for the sponsored envelope.')), status: z .enum(['failed', 'finalized', 'pending']) .check(z.describe('Pending until a receipt finalizes it or the pending TTL fails it.')), transaction: z .string() .check(z.describe('Serialized sponsored transaction, kept for durable observability.')), transactionHash: z .nullable(z.string()) .check(z.describe('Transaction hash, or null for fill intents until reconciled.')), }) /** Columns of the `sponsored_transactions` table. */ export type SponsoredTransaction = z.output /** Durable position for failed sponsorship reconciliation. */ export const SponsorshipReconciliationCursor = z.object({ blockNumber: z.string().check(z.regex(/^\d+$/), z.describe('Last scanned block number.')), chainId: z.number().check(z.int(), z.describe('Chain whose fee-payer transactions are scanned.')), complete: z .boolean() .check(z.describe('Whether the next scan starts from the newest candidate.')), feePayer: z.custom
().check(z.describe('Lowercase managed fee-payer address.')), retryCount: z .number() .check(z.int(), z.nonnegative(), z.describe('Failed attempts for the blocked candidate.')), retryKey: z .nullable(z.string()) .check(z.describe('Blocked candidate block number and transaction index.')), revision: z.string().check(z.describe('Revision fencing overlapping reconciliation passes.')), transactionIndex: z.number().check(z.int(), z.nonnegative(), z.describe('Last scanned transaction index.')), // prettier-ignore updatedAt: z.string().check(z.describe('When reconciliation saved this position (ISO 8601).')), }) /** Columns of the `sponsorship_reconciliation_cursors` table. */ export type SponsorshipReconciliationCursor = z.output /** A canonical sponsorship attribution resolved from an external id or Tempo Project. */ export const SponsorshipAttribution = z.object({ createdAt: z.string().check(z.describe('When the attribution was created (ISO 8601).')), endsAt: z .nullable(z.string()) .check(z.describe('When promotional sponsorship ends (ISO 8601), or null before activation.')), externalId: z.nullable(z.string()).check(z.describe('External partner attribution id, or null.')), id: z.string().check(z.describe('Sponsorship attribution id (`sat_…`).')), orgId: z.string().check(z.describe('Owning Tempo organization id (`org_…`).')), projectId: z.nullable(z.string()).check(z.describe('Tempo Project id (`prj_…`), or null.')), spendLimit: z .nullable(z.string()) .check(z.describe('Promotional spend cap in fee-token base units, or null.')), startsAt: z .nullable(z.string()) .check( z.describe('When promotional sponsorship started (ISO 8601), or null before activation.'), ), updatedAt: z.string().check(z.describe('When the attribution was last updated (ISO 8601).')), }) /** Columns of the `sponsorship_attributions` table. */ export type SponsorshipAttribution = z.output /** An organization's Stripe billing source: the customer link and derived status. */ export const StripeCustomer = z.object({ createdAt: z.string().check(z.describe('When the Stripe source was connected (ISO 8601).')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Environment this Stripe source backs; `production` (live) or `sandbox` (test).')), // prettier-ignore orgId: z.string().check(z.describe('Organization id (`org_…`) this Stripe source belongs to.')), status: z .enum(['active', 'canceled', 'none', 'past_due']) .check(z.describe('Billing status derived from Stripe state; gates production sponsorship.')), stripeCustomerId: z .string() .check(z.describe('Stripe customer id backing this source; never deleted by us.')), updatedAt: z.string().check(z.describe('When the billing status last changed (ISO 8601).')), }) /** Columns of the `stripe_customers` table. */ export type StripeCustomer = z.output /** A developer identity. */ export const User = z.object({ address: z .nullable(z.string()) .check( z.describe( 'Wallet address that signs in as this user (stored lowercase), or null for non-wallet identities.', ), ), createdAt: z.string().check(z.describe('When the user was created (ISO 8601).')), email: z .nullable(z.string()) .check(z.describe('Normalized verified email, or null for a wallet-only identity.')), emailVerified: z.boolean().check(z.describe('Whether the email was verified.')), id: z .string() .check( z.describe('Opaque user id (`usr_…`).'), z.meta({ examples: ['usr_1a2b3c4d5e6f7g8h9j0k1m2n'] }), ), image: z.nullable(z.string()).check(z.describe('Profile image URL, or null.')), name: z.string().check(z.describe('Display name.')), updatedAt: z.string().check(z.describe('When the user was last updated (ISO 8601).')), }) /** Columns of the `users` table. */ export type User = z.output /** Metadata for the current route catalog snapshot. */ export const RoutesCatalog = z.object({ id: z.string().check(z.describe('Singleton route catalog id.')), updatedAt: z.string().check(z.describe('When the route catalog was last published.')), version: z.string().check(z.describe('Opaque route catalog version.')), }) /** Columns of the `routes_catalogs` table. */ export type RoutesCatalog = z.output /** One chain available to the route catalog. */ export const RoutesChain = z.object({ aliases: z .readonly(z.array(z.string())) .check(z.describe('Caller-facing aliases accepted for the route chain.')), id: z.string().check(z.describe('CAIP-2 route chain identifier.')), name: z.string().check(z.describe('Human-readable route chain name.')), parentChainId: z .nullable(z.string()) .check(z.describe('Parent route chain identifier for a Zone, or null.')), rpcUrls: z ._default(z.readonly(z.array(z.url())), []) .check(z.describe('Public RPC endpoints used for routes-chain evidence.')), slug: z.string().check(z.describe('Stable route chain slug.')), }) /** Columns of the `routes_chains` table. */ export type RoutesChain = z.output /** One token available to the route catalog. */ export const RoutesToken = z.object({ currency: z.string().check(z.describe('Monetary denomination represented by the token.')), id: z.string().check(z.describe('Stable route token identifier.')), name: z.string().check(z.describe('Human-readable route token name.')), symbol: z.string().check(z.describe('Route token ticker symbol.')), }) /** Columns of the `routes_tokens` table. */ export type RoutesToken = z.output /** Chain-specific metadata for one route token. */ export const RoutesChainToken = z.object({ address: z.string().check(z.describe('Token address on the route chain.')), chainId: z.string().check(z.describe('CAIP-2 identifier of the route chain.')), decimals: z.number().check(z.int(), z.nonnegative(), z.describe('Token decimal precision.')), name: z.nullable(z.string()).check(z.describe('Chain-specific token name override, or null.')), standard: z.string().check(z.describe('Token standard on the route chain.')), tokenId: z.string().check(z.describe('Stable route token identifier.')), }) /** Columns of the `routes_chain_tokens` table. */ export type RoutesChainToken = z.output /** One source-to-destination route supported by a route provider. */ export const RoutesRoute = z.object({ capabilities: z .nullable(z.custom()) .check(z.describe('Executable capability (`jsonb`), or null for indicative-only routes.')), configuration: z .nullable(z.custom()) .check(z.describe('Provider-specific route configuration (`jsonb`), or null.')), destinationChainId: z.string().check(z.describe('Destination route chain identifier.')), destinationTokenId: z.string().check(z.describe('Destination route token identifier.')), providerId: z.string().check(z.describe('Route provider identifier.')), sourceChainId: z.string().check(z.describe('Source route chain identifier.')), sourceTokenId: z.string().check(z.describe('Source route token identifier.')), }) /** Columns of the `routes_routes` table. */ export type RoutesRoute = z.output /** * A reusable route deposit address. Public route fields live in `snapshot`; * provider routing and correlation remain private. */ export const RoutesDepositAddress = z.object({ address: z.string().check(z.describe('Reusable source-chain deposit address.')), createdAt: z.string().check(z.describe('When the address was created (ISO 8601).')), creatorUserId: z .nullable(z.string()) .check(z.describe('Canonical creator user retained after organization deletion, or null.')), deliveryStrategy: z .custom() .check(z.describe('Whether the provider or Tempo delivers the requested destination token.')), destinationTokenKey: z.string().check(z.describe('Customer destination token key.')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Key environment the address belongs to.')), id: z.string().check(z.describe('Route deposit address id (`rda_…`).')), lastPolledAt: z .nullable(z.string()) .check(z.describe('When provider reconciliation last completed successfully, or null.')), nextPollAt: z.string().check(z.describe('When provider reconciliation is next due.')), orgId: z.string().check(z.describe('Owning organization id (`org_…`).')), pollFailureCount: z.number().check(z.int(), z.describe('Consecutive reconciliation failures.')), pollLeaseUntil: z .nullable(z.string()) .check(z.describe('When the current reconciliation lease expires, or null.')), pollLeaseVersion: z .number() .check(z.int(), z.describe('Fencing token for reconciliation leases.')), projectId: z.nullable(z.string()).check(z.describe('Attributed project id (`prj_…`), or null.')), providerOutputToken: z .custom() .check(z.describe('Token that the provider outputs on Tempo (`jsonb`).')), providerId: z.string().check(z.describe('Selected route provider id.')), providerRequestIds: z .readonly(z.array(z.string())) .check(z.describe('Private provider request identifiers (`jsonb`).')), providerState: z .nullable(z.custom()) .check(z.describe('Bounded private provider state (`jsonb`), or null.')), recipient: z.string().check(z.describe('Tempo account that receives completed deposits.')), refundAddress: z.string().check(z.describe('Source-chain refund address.')), snapshot: z .custom() .check(z.describe('Public address fields (`jsonb`).')), sourceChainId: z.string().check(z.describe('Source chain CAIP-2 id.')), sourceTokenKey: z.string().check(z.describe('Source token key.')), status: z.custom().check(z.describe('Lifecycle status.')), statusUpdatedAt: z .nullable(z.string()) .check(z.describe('When the address entered its current status, or null for legacy rows.')), subsidize: z.boolean().check(z.describe('Whether Tempo guarantees normalized 1:1 delivery.')), updatedAt: z.string().check(z.describe('When the address last materially changed (ISO 8601).')), version: z.number().check(z.int(), z.describe('Material version used to guard updates.')), }) /** Columns of the `routes_deposit_addresses` table. */ export type RoutesDepositAddress = z.output /** First Tempo observations of one provider request through polling and webhooks. */ export const RoutesDepositRequestObservation = z.object({ depositAddressId: z.string().check(z.describe('Route deposit address id (`rda_…`).')), pollObservedAt: z .nullable(z.string()) .check(z.describe('When polling first observed the provider request, or null.')), providerRequestId: z.string().check(z.describe('Provider request identifier.')), webhookReceivedAt: z .nullable(z.string()) .check(z.describe('When Tempo first received an authenticated webhook, or null.')), }) /** Columns of the `routes_deposit_request_observations` table. */ export type RoutesDepositRequestObservation = z.output /** * One provider-observed deposit. Public route and evidence live in `snapshot`; * reconciliation and settlement state is private. */ export const RoutesDeposit = z.object({ createdAt: z.string().check(z.describe('When the deposit was detected (ISO 8601).')), depositAddressId: z.string().check(z.describe('Route deposit address id (`rda_…`).')), detectionTrigger: z .nullable(z.custom()) .check(z.describe('Mechanism that first detected the deposit, or null for legacy rows.')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Key environment inherited from the deposit address.')), id: z.string().check(z.describe('Route deposit id (`rdp_…`).')), orgId: z.string().check(z.describe('Owning organization id (`org_…`).')), pollObservedAt: z .nullable(z.string()) .check(z.describe('When polling first observed the provider request, or null.')), projectId: z.nullable(z.string()).check(z.describe('Attributed project id (`prj_…`), or null.')), providerDeliveredAt: z .nullable(z.string()) .check(z.describe('When provider delivery was first verified, or null.')), providerOutputAmount: z .nullable(z.custom>()) .check(z.describe('Provider output amount verified on Tempo (`jsonb`), or null.')), providerOutputToken: z .custom() .check(z.describe('Token output by the provider on Tempo (`jsonb`).')), providerRequestId: z .nullable(z.string()) .check(z.describe('Provider request that first reported the deposit, or null if unavailable.')), providerRequestIds: z .readonly(z.array(z.string())) .check(z.describe('Private provider request identifiers (`jsonb`).')), providerState: z .nullable(z.custom()) .check(z.describe('Bounded private provider state (`jsonb`), or null.')), providerSubsidy: z .nullable(z.custom()) .check(z.describe('Provider-paid subsidy amount and token (`jsonb`), or null.')), providerTransactionHashes: z .readonly(z.array(z.string())) .check(z.describe('Private provider-leg transaction references (`jsonb`).')), providerTransferIndex: z .number() .check(z.int(), z.nonnegative(), z.describe('Deposit position within the provider request.')), retryState: z .nullable(z.custom()) .check(z.describe('Bounded private retry state (`jsonb`), or null.')), settlementTransaction: z .nullable(z.string()) .check(z.describe('Persisted settlement transaction bytes, or null.')), settlementTransactionHash: z .nullable(z.string()) .check(z.describe('Persisted settlement transaction hash, or null.')), snapshot: z .custom() .check(z.describe('Public deposit fields (`jsonb`).')), sourceChainId: z.string().check(z.describe('Source chain CAIP-2 id.')), sourceTransactionHash: z .string() .check(z.describe('Provider-observed source transaction reference.')), sourceTransferIndex: z .nullable(z.number().check(z.int())) .check(z.describe('Verified transfer position in the source transaction, or null.')), status: z.custom().check(z.describe('Lifecycle status.')), statusReason: z .nullable(z.custom()) .check(z.describe('Customer-safe status reason (`jsonb`), or null.')), statusUpdatedAt: z .nullable(z.string()) .check(z.describe('When the deposit entered its current status, or null for legacy rows.')), subsidyAmount: z .nullable(z.custom>()) .check(z.describe('Destination token amount supplied by Tempo (`jsonb`), or null.')), subsidyMeterReportedAt: z .nullable(z.string()) .check(z.describe('Effective Stripe meter-event time, or null before acknowledgement.')), tempoGasPaid: z.nullable(z.string()).check(z.describe('Tempo gas paid for settlement, or null.')), updatedAt: z.string().check(z.describe('When the deposit last materially changed (ISO 8601).')), version: z.number().check(z.int(), z.describe('Material version used to guard updates.')), webhookReceivedAt: z .nullable(z.string()) .check(z.describe('When Tempo first received an authenticated provider webhook, or null.')), }) /** Columns of the `routes_deposits` table. */ export type RoutesDeposit = z.output /** * A durable route transfer. Lifecycle state lives in typed columns; the * public quote terms and reconciled fields live in the `snapshot` jsonb and * merge in at serialization (`Transfer.toPublic`). */ export const RoutesTransfer = z.object({ apiKeyId: z.string().check(z.describe('API key id (`key_…`) that created the transfer.')), createdAt: z.string().check(z.describe('When the transfer was created (ISO 8601).')), environment: z .enum(['production', 'sandbox']) .check(z.describe('Key environment the transfer belongs to.')), id: z.string().check(z.describe('Transfer id (`rtr_…`, lexically time-ordered).')), method: z .custom() .check(z.describe('Route method selected at creation.')), mode: z .custom() .check(z.describe('Amount mode selected at creation.')), orgId: z.string().check(z.describe('Owning organization id (`org_…`).')), projectId: z .nullable(z.string()) .check(z.describe('Attributed project id (`prj_…`), or null for organization-attributed keys.')), // prettier-ignore providerDeliveredAt: z .nullable(z.string()) .check(z.describe('When destination provider delivery was first verified, or null.')), providerId: z.string().check(z.describe('Selected route provider id.')), providerState: z .nullable(z.custom()) .check(z.describe('Private provider state (`jsonb`), or null. Never serialized publicly.')), // prettier-ignore quoteExpiresAt: z .string() .check(z.describe('When the quoted terms stop being executable (ISO 8601).')), snapshot: z .custom() .check(z.describe('Public quote terms and reconciled fields (`jsonb`).')), status: z.custom().check(z.describe('Lifecycle status.')), statusReason: z .nullable(z.custom()) .check(z.describe('Customer-safe status reason (`jsonb`), or null.')), statusUpdatedAt: z .nullable(z.string()) .check(z.describe('When the transfer entered its current status, or null for legacy rows.')), subsidyAccount: z .nullable(z.string()) .check(z.describe('Destination subsidy signer address, or null before reservation.')), subsidyAmount: z .nullable(z.custom>()) .check(z.describe('Destination token amount supplied by Tempo (`jsonb`), or null.')), subsidyChainId: z .nullable(z.string()) .check(z.describe('Destination subsidy chain id, or null before reservation.')), subsidyCommitmentAmount: z .nullable(z.custom>()) .check(z.describe('Maximum destination subsidy authorized at action creation, or null.')), subsidyMeterReportedAt: z .nullable(z.string()) .check(z.describe('Effective Stripe meter-event time, or null before acknowledgement.')), subsidyNativeAmount: z .nullable(z.string()) .check(z.describe('Native gas amount reserved by the signed transaction, or null.')), subsidyTokenAddress: z .nullable(z.string()) .check(z.describe('Destination subsidy token address, or null before reservation.')), subsidyTransactionHash: z .nullable(z.string()) .check(z.describe('Persisted destination subsidy transaction hash, or null.')), updatedAt: z.string().check(z.describe('When the transfer last materially changed (ISO 8601).')), version: z .number() .check(z.int(), z.describe('Increments on every material change; guards transitions.')), }) /** Columns of the `routes_transfers` table. */ export type RoutesTransfer = z.output /** One immutable public snapshot of a route transfer at a material version. */ export const RoutesTransferEvent = z.object({ createdAt: z.string().check(z.describe('When the version was committed (ISO 8601).')), snapshot: z .custom() .check(z.describe('The complete public transfer at this version (`jsonb`).')), status: z.custom().check(z.describe('Status at this version.')), transferId: z.string().check(z.describe('Transfer id (`rtr_…`) the event belongs to.')), version: z.number().check(z.int(), z.describe('Material version the event records.')), }) /** Columns of the `routes_transfer_events` table. */ export type RoutesTransferEvent = z.output /** One verified transaction reference associated with a route transfer. */ export const RoutesTransferTransaction = z.object({ chainId: z.string().check(z.describe('CAIP-2 chain the transaction executed on.')), createdAt: z.string().check(z.describe('When the reference was accepted (ISO 8601).')), environment: z.string().check(z.describe('Environment derived from the owning transfer.')), orgId: z.string().check(z.describe('Organization derived from the owning transfer.')), projectId: z.nullable(z.string()).check(z.describe('Project derived from the owning transfer.')), role: z .custom() .check(z.describe('What the transaction evidences: `source`, `destination`, or `refund`.')), transactionRef: z .string() .check(z.describe('EVM transaction hash or case-sensitive Solana signature.')), transferId: z.string().check(z.describe('Transfer id (`rtr_…`) the reference belongs to.')), }) /** Columns of the `routes_transfer_transactions` table. */ export type RoutesTransferTransaction = z.output /** One globally deduplicated destination subsidy for a verified source transaction. */ export const RoutesTransferSubsidy = z.object({ createdAt: z.string().check(z.describe('When the signed subsidy was persisted (ISO 8601).')), destinationChainId: z .string() .check(z.describe('Destination CAIP-2 chain receiving the subsidy.')), recipient: z.string().check(z.describe('Lowercase destination recipient address.')), sourceChainId: z .string() .check(z.describe('Source CAIP-2 chain containing the verified payment.')), tokenAddress: z.string().check(z.describe('Lowercase destination token address.')), transaction: z .custom() .check(z.describe('Signed subsidy retained for replay, including after transfer deletion.')), transactionRef: z.string().check(z.describe('Canonical source execution transaction reference.')), transferId: z .string() .check(z.describe('Transfer responsible for this subsidy and its billing.')), }) /** Columns of the `routes_transfer_subsidies` table. */ export type RoutesTransferSubsidy = z.output /** One durable next nonce for a destination subsidy signer on an EVM chain. */ export const RoutesTransferSubsidyNonce = z.object({ account: z.string().check(z.describe('Lowercase destination subsidy signer address.')), blockedAt: z .nullable(z.string()) .check(z.describe('When this signer lane became blocked, or null.')), blockedReason: z .nullable(z.literal('broadcast_rejected')) .check(z.describe('Bounded reason this signer lane is blocked, or null.')), blockedTransferId: z .nullable(z.string()) .check(z.describe('Transfer holding the blocked signer nonce, or null.')), chainId: z.string().check(z.describe('Destination EVM chain CAIP-2 id.')), nextNonce: z.string().check(z.regex(/^\d+$/), z.describe('Next unreserved EOA nonce.')), updatedAt: z.string().check(z.describe('When the nonce was last reserved (ISO 8601).')), }) /** Columns of the `routes_transfer_subsidy_nonces` table. */ export type RoutesTransferSubsidyNonce = z.output /** * An API-key-scoped idempotency claim for route resource creation. The row * retains recovery checkpoints and completed responses until `expiresAt`. */ export const RoutesIdempotencyRequest = z.object({ apiKeyId: z.string().check(z.describe('API key id (`key_…`) the claim is scoped to.')), createdAt: z.string().check(z.describe('When the claim was taken (ISO 8601).')), expiresAt: z.string().check(z.describe('Scheduled claim replay expiry (ISO 8601).')), irrevocable: z.boolean().check(z.describe('Whether provider success creates durable liability.')), keyHash: z.string().check(z.describe('SHA-256 of the caller Idempotency-Key.')), matchHash: z .nullable(z.string()) .check(z.describe('Canonical reusable deposit-address identity, or null before selection.')), operation: z .nullable(z.union([z.literal('deposit_address'), z.literal('transfer')])) .check(z.describe('Route creation operation owning the claim, or null for legacy rows.')), orgId: z .nullable(z.string()) .check(z.describe('Organization reserving deposit-address capacity, or null.')), requestHash: z.string().check(z.describe('SHA-256 fingerprint of the canonical request.')), response: z .nullable(z.string()) .check(z.describe('Serialized checkpoint or success response, or null while pending.')), status: z .enum(['completed', 'pending', 'provisioned']) .check(z.describe('Claim state for execution, recovery, or replay.')), transferId: z .nullable(z.string()) .check(z.describe('Transfer id (`rtr_…`) the completed claim created, or null.')), }) /** Columns of the `routes_idempotency_requests` table. */ export type RoutesIdempotencyRequest = z.output /** * A verified token: one row per curated token, ordered by `position` (list * order is canonical and surfaced to clients). Addresses are stored lowercase; * case-insensitive symbol uniqueness is enforced by a functional index on * `lower(symbol)`. */ export const VerifiedToken = z.object({ address: z.string().check(z.describe('Verified TIP-20 token contract address (lowercase).')), chainId: z.number().check(z.int(), z.describe('Chain the token belongs to.')), currency: z.string().check(z.describe('Display currency, e.g. `USD`.')), decimals: z.number().check(z.int(), z.describe('Decimal precision.')), logoUri: z.nullable(z.string()).check(z.describe('Curated HTTPS logo URL, or null.')), name: z.string().check(z.describe('Display name.')), position: z .number() .check(z.int(), z.describe("Zero-based position in the chain's canonical list order.")), symbol: z.string().check(z.describe('Ticker symbol.'), z.meta({ examples: ['USDC'] })), }) /** Columns of the `verified_tokens` table. */ export type VerifiedToken = z.output /** * A chain's verified-token list metadata — the opaque `version` that drives * the soft-refresh cache and `If-Match` preconditions, bumped on every publish. */ export const VerifiedTokenList = z.object({ chainId: z.number().check(z.int(), z.describe('Chain the list belongs to.')), updatedAt: z.string().check(z.describe('ISO timestamp of the last publish.')), version: z .string() .check(z.describe('Opaque list version (`_`); changes on every publish.')), }) /** Columns of the `verified_token_lists` table. */ export type VerifiedTokenList = z.output /** * An organization's request to add a token to the curated verified list. * Addresses are stored lowercase; a partial unique index allows at most one * pending request per (chain, address) globally. */ export const VerifiedTokenRequest = z.object({ address: z.string().check(z.describe('Requested TIP-20 token contract address (lowercase).')), chainId: z.number().check(z.int(), z.describe('Chain the token belongs to.')), createdAt: z.string().check(z.describe('When the request was created (ISO 8601).')), currency: z.string().check(z.describe('Display currency, e.g. `USD`.')), decimals: z.number().check(z.int(), z.describe('Decimal precision.')), id: z.string().check(z.describe('Opaque request id (`vtr_…`).')), logo: z .nullable(z.string()) .check(z.describe('Inline SVG logo markup uploaded by the requester, or null.')), logoUri: z.nullable(z.string()).check(z.describe('HTTPS logo URL from chain metadata, or null.')), name: z.string().check(z.describe('Display name.')), note: z.nullable(z.string()).check(z.describe('Requester note to reviewers, or null.')), orgId: z.string().check(z.describe('Requesting organization id (`org_…`).')), requestedBy: z .string() .check(z.describe('User id that submitted the request, or `super_admin`.')), reviewNote: z.nullable(z.string()).check(z.describe('Reviewer note shown on denial, or null.')), reviewedAt: z.nullable(z.string()).check(z.describe('When the request was reviewed, or null.')), reviewedBy: z.nullable(z.string()).check(z.describe('Reviewing admin email, or null.')), status: z.enum(['approved', 'denied', 'pending']).check(z.describe('Review status.')), symbol: z.string().check(z.describe('Ticker symbol.'), z.meta({ examples: ['USDC'] })), updatedAt: z.string().check(z.describe('When the request was last changed (ISO 8601).')), }) /** Columns of the `verified_token_requests` table. */ export type VerifiedTokenRequest = z.output /** * A webhook delivery attempt. Rows are invisible past `expiresAt` (the * retention deadline that replaces the old store TTL) and pruned by the * poller; deleting a subscription cascades to its rows. */ export const WebhookDelivery = z.object({ attempt: z .number() .check( z.int(), z.describe('Consecutive attempt number (1-based) at the time of the delivery.'), ), createdAt: z.string().check(z.describe('ISO timestamp the attempt was recorded.')), envelope: z .custom() .check(z.describe('The exact envelope that was sent (`jsonb`), for verbatim replay.')), error: z .nullable(z.string()) .check(z.describe('Failure reason when `status` is `failed`, or null.')), eventId: z.string().check(z.describe('Idempotent event id the delivery carried (`evt_…`).')), expiresAt: z .string() .check(z.describe('ISO retention deadline; rows past it are invisible and pruned.')), id: z .string() .check( z.describe('Delivery id (`whd_…`, lexically time-ordered).'), z.meta({ examples: ['whd_001718668800000_C1yJkk7CuML98HFthEDk9PsY'] }), ), requestUrl: z.string().check(z.describe('Subscriber callback URL the attempt targeted.')), responseMs: z .nullable(z.number()) .check(z.describe('Wall-clock duration of the attempt in ms, or null.')), responseStatus: z .nullable(z.number()) .check(z.describe('HTTP response status, or null when no response was received.')), status: z.custom().check(z.describe('Outcome status.')), subscriptionId: z .string() .check(z.describe('Owning subscription id (`wh_…`); FK with `ON DELETE CASCADE`.')), }) /** Columns of the `webhook_deliveries` table. */ export type WebhookDelivery = z.output /** An insert-only dedupe record marking a delivery obligation terminal. */ export const WebhookQueueCompletion = z.object({ eventId: z.string().check(z.describe('Idempotent event id (`evt_...`).')), expiresAt: z .string() .check(z.describe('ISO dedupe retention deadline; rows past it are invisible and pruned.')), status: z .enum(['failed', 'skipped', 'succeeded']) .check(z.describe('Terminal delivery-obligation outcome.')), subscriptionId: z .string() .check(z.describe('Owning subscription id (`wh_...`); FK with `ON DELETE CASCADE`.')), }) /** Columns of the `webhook_queue_completions` table. */ export type WebhookQueueCompletion = z.output /** A durable webhook envelope staged before its compact Queue reference is admitted. */ export const WebhookQueueEvent = z.object({ attemptCount: z.number().check(z.describe('Delivery attempts claimed so far.')), attemptingAt: z .nullable(z.string()) .check(z.describe('ISO timestamp of the current claim, or null when unclaimed.')), createdAt: z.string().check(z.describe('ISO timestamp when the envelope was staged.')), envelope: z .custom() .check(z.describe('The full webhook envelope retained outside Cloudflare Queues.')), eventId: z.string().check(z.describe('Idempotent event id (`evt_...`).')), expiresAt: z .nullable(z.string()) .check( z.describe( 'Unwritten since completions took over dedupe; non-null only on rows staged before the split.', ), ), nextAttemptAt: z .nullable(z.string()) .check(z.describe('ISO retry due time, or null when due immediately.')), observedAt: z .nullable(z.string()) .check( z.describe( 'ISO timestamp the coordinator observed the head owing this event, or null on replays.', ), ), status: z .enum(['failed', 'pending', 'skipped', 'succeeded']) .check( z.describe( 'Always `pending` since completions took over terminal state; other values occur only on rows completed before the split.', ), ), subscriptionId: z .string() .check(z.describe('Owning subscription id (`wh_...`); FK with `ON DELETE CASCADE`.')), }) /** Columns of the `webhook_queue_events` table. */ export type WebhookQueueEvent = z.output /** * A webhook subscription. The `Webhooks.Owner` union maps to (`ownerType`, * `ownerId`); jsonb object columns round-trip as parsed values. `pollerCursor` * replaces the old per-subscription cursor key. */ export const WebhookSubscription = z.object({ chainId: z.number().check(z.int(), z.describe('Chain the subscription listens on.')), context: z .nullable(z.custom()) .check(z.describe('Human context (`jsonb`), or null.')), createdAt: z.string().check(z.describe('ISO timestamp of creation.')), destination: z .custom() .check(z.describe('Delivery destination (`jsonb`).')), environment: z .nullable(z.enum(['production', 'sandbox'])) .check(z.describe('API-key environment for private resource events, or null.')), eventType: z .custom() .check(z.describe('Event type the subscription listens to.')), expiresAt: z .nullable(z.string()) .check(z.describe('ISO expiry timestamp (MPP-owned subscriptions), or null.')), failureCount: z .number() .check(z.int(), z.describe('Consecutive delivery failures; drives auto-disable.')), filters: z .custom() .check(z.describe('Event-type-specific filter predicates (`jsonb`).')), id: z .string() .check( z.describe('Subscription id (`wh_…`, lexically time-ordered).'), z.meta({ examples: ['wh_001718668800000_2ZPE2gvateYEQ0dQslgvkhjx'] }), ), lastDeliveryAt: z .nullable(z.string()) .check(z.describe('ISO timestamp of the last successful delivery, or null.')), ownerId: z .string() .check(z.describe('Owner identifier: `orgId` for `api_key` owners, `payer` for `mpp`.')), ownerType: z.custom().check(z.describe('Owner kind.')), pollerCursor: z .nullable(z.string()) .check(z.describe('Poller keyset cursor, or null before the first tick.')), projectId: z .nullable(z.string()) .check(z.describe('API-key project attribution for private resource events, or null.')), secret: z.string().check(z.describe('HMAC signing secret.')), status: z.custom().check(z.describe('Lifecycle status.')), updatedAt: z .string() .check(z.describe('ISO timestamp of the last mutation (`pollerCursor` writes excluded).')), }) /** Columns of the `webhook_subscriptions` table. */ export type WebhookSubscription = z.output