/**
 * Generated by orval v7.21.0 🍺
 * Do not edit manually.
 * Coinbase Developer Platform APIs
 * The Coinbase Developer Platform APIs - leading the world's transition onchain.
 * OpenAPI spec version: 2.0.0
 */
/**
 * The type of the Account.
 */
export type AccountType = (typeof AccountType)[keyof typeof AccountType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AccountType = {
  prime: "prime",
  business: "business",
  cdp: "cdp",
} as const;

/**
 * The ID of the Account, which is a UUID prefixed by the string `account_`.
 * @pattern ^account_[a-f0-9\-]{36}$
 */
export type AccountId = string;

/**
 * The Owner ID of the Account.
Owner IDs are UUIDs prefixed with the Owner Type as follows:
* **Entity**: `entity_` - If the Owner is your Entity, e.g. `entity_af2937b0-9846-4fe7-bfe9-ccc22d935114`.
Support for Customer-owned accounts (`customer_` prefix) is in development.
 * @pattern ^(entity|customer)_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
 */
export type Owner = string;

/**
 * An optional name for the account. Must be 1-64 characters and can only contain alphanumeric characters, hyphens, and spaces.
 * @maxLength 64
 * @pattern ^[a-zA-Z0-9 -]{1,64}$
 */
export type AccountName = string;

export interface Account {
  accountId: AccountId;
  type: AccountType;
  owner: Owner;
  name?: AccountName;
  /** The timestamp when the account was created. */
  createdAt: string;
  /** The timestamp when the account was last updated. */
  updatedAt: string;
}

export interface ListResponse {
  /** The token for the next page of items, if any. */
  nextPageToken?: string;
}

/**
 * The code that indicates the type of error that occurred. These error codes can be used to determine how to handle the error.
 */
export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ErrorType = {
  already_exists: "already_exists",
  authorization_expired: "authorization_expired",
  bad_gateway: "bad_gateway",
  capture_expired: "capture_expired",
  client_closed_request: "client_closed_request",
  customer_not_authorized: "customer_not_authorized",
  endpoint_unavailable: "endpoint_unavailable",
  faucet_limit_exceeded: "faucet_limit_exceeded",
  forbidden: "forbidden",
  idempotency_error: "idempotency_error",
  internal_server_error: "internal_server_error",
  invalid_request: "invalid_request",
  invalid_sql_query: "invalid_sql_query",
  invalid_signature: "invalid_signature",
  malformed_transaction: "malformed_transaction",
  not_found: "not_found",
  payment_method_required: "payment_method_required",
  payment_required: "payment_required",
  settlement_failed: "settlement_failed",
  rate_limit_exceeded: "rate_limit_exceeded",
  request_canceled: "request_canceled",
  service_unavailable: "service_unavailable",
  timed_out: "timed_out",
  unauthorized: "unauthorized",
  unsupported_tos_language: "unsupported_tos_language",
  policy_violation: "policy_violation",
  policy_in_use: "policy_in_use",
  account_limit_exceeded: "account_limit_exceeded",
  network_not_tradable: "network_not_tradable",
  guest_permission_denied: "guest_permission_denied",
  guest_region_forbidden: "guest_region_forbidden",
  guest_transaction_limit: "guest_transaction_limit",
  guest_transaction_count: "guest_transaction_count",
  phone_number_verification_expired: "phone_number_verification_expired",
  otp_verification_code_invalid: "otp_verification_code_invalid",
  otp_verification_destination_mismatch: "otp_verification_destination_mismatch",
  otp_verification_expired: "otp_verification_expired",
  otp_verification_invalid: "otp_verification_invalid",
  otp_verification_not_found: "otp_verification_not_found",
  otp_verification_required: "otp_verification_required",
  document_verification_failed: "document_verification_failed",
  recipient_allowlist_violation: "recipient_allowlist_violation",
  recipient_allowlist_pending: "recipient_allowlist_pending",
  refund_expired: "refund_expired",
  travel_rules_recipient_violation: "travel_rules_recipient_violation",
  source_account_invalid: "source_account_invalid",
  target_account_invalid: "target_account_invalid",
  source_account_not_found: "source_account_not_found",
  target_account_not_found: "target_account_not_found",
  source_asset_not_supported: "source_asset_not_supported",
  target_asset_not_supported: "target_asset_not_supported",
  target_email_invalid: "target_email_invalid",
  target_onchain_address_invalid: "target_onchain_address_invalid",
  transfer_amount_invalid: "transfer_amount_invalid",
  transfer_asset_not_supported: "transfer_asset_not_supported",
  transfer_quote_expired: "transfer_quote_expired",
  insufficient_balance: "insufficient_balance",
  metadata_too_many_entries: "metadata_too_many_entries",
  metadata_key_too_long: "metadata_key_too_long",
  metadata_value_too_long: "metadata_value_too_long",
  travel_rules_field_missing: "travel_rules_field_missing",
  asset_mismatch: "asset_mismatch",
  mfa_already_enrolled: "mfa_already_enrolled",
  mfa_invalid_code: "mfa_invalid_code",
  mfa_flow_expired: "mfa_flow_expired",
  mfa_required: "mfa_required",
  mfa_not_enrolled: "mfa_not_enrolled",
  order_quote_expired: "order_quote_expired",
  order_already_filled: "order_already_filled",
  order_already_canceled: "order_already_canceled",
  account_not_ready: "account_not_ready",
  insufficient_liquidity: "insufficient_liquidity",
  insufficient_allowance: "insufficient_allowance",
  transaction_simulation_failed: "transaction_simulation_failed",
  delegation_not_found: "delegation_not_found",
  delegation_expired: "delegation_expired",
  delegation_revoked: "delegation_revoked",
  delegation_not_authorized: "delegation_not_authorized",
  delegation_not_enabled: "delegation_not_enabled",
  network_mismatch: "network_mismatch",
  already_enabled: "already_enabled",
  payment_session_already_canceled: "payment_session_already_canceled",
  payment_session_already_authorized: "payment_session_already_authorized",
  payment_session_action_pending: "payment_session_action_pending",
  no_capturable_balance: "no_capturable_balance",
  no_voidable_balance: "no_voidable_balance",
  no_refundable_balance: "no_refundable_balance",
  entity_not_configured_for_payment_acceptance: "entity_not_configured_for_payment_acceptance",
  daily_transaction_limit_exceeded: "daily_transaction_limit_exceeded",
  daily_amount_limit_exceeded: "daily_amount_limit_exceeded",
  stale_attestation: "stale_attestation",
  moderation_rejected: "moderation_rejected",
} as const;

/**
 * A valid HTTP or HTTPS URL.
 * @minLength 11
 * @maxLength 2048
 * @pattern ^https?://.*$
 */
export type Url = string;

/**
 * The name of a capability. Capabilities represent granular functional permissions
that determine what actions a customer can perform. Each capability must be
explicitly requested before use.

 */
export type CapabilityName = (typeof CapabilityName)[keyof typeof CapabilityName];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CapabilityName = {
  custodyCrypto: "custodyCrypto",
  custodyFiat: "custodyFiat",
  custodyStablecoin: "custodyStablecoin",
  tradeCrypto: "tradeCrypto",
  tradeStablecoin: "tradeStablecoin",
  transferCrypto: "transferCrypto",
  transferFiat: "transferFiat",
  transferStablecoin: "transferStablecoin",
} as const;

/**
 * An error response including the code for the type of error and a human-readable message describing the error.
 */
export interface Error {
  errorType: ErrorType;
  /** The error message. */
  errorMessage: string;
  /** A unique identifier for the request that generated the error. This can be used to help debug issues with the API. */
  correlationId?: string;
  /** A link to the corresponding error documentation. */
  errorLink?: Url;
  /** The capability code(s) that were not authorized for the customer on
this request. Present only when `errorType` is
`customer_not_authorized`; absent for every other error type.

Use this list to render onboarding UX for the listed capabilities, or
fetch `GET /v2/customers/{customerId}` and inspect each entry's
`status` / `requirements` to discover what (if anything) can be
submitted to resolve the block.
 */
  unauthorizedCapabilities?: CapabilityName[];
}

export interface CreateAccountRequest {
  name?: AccountName;
}

/**
 * The symbol of the asset (e.g., eth, usd, usdc, usdt).
 * @minLength 1
 * @maxLength 42
 */
export type Asset = string;

/**
 * The type of the asset.
 */
export type AssetType = (typeof AssetType)[keyof typeof AssetType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AssetType = {
  fiat: "fiat",
  crypto: "crypto",
} as const;

/**
 * An asset, e.g. fiat or crypto.
 */
export interface BalancesAsset {
  symbol: Asset;
  type: AssetType;
  /** The name of the asset. */
  name: string;
  /** The number of decimals (i.e. significant digits to the right of the decimal point) supported for the asset. */
  decimals: number;
}

/**
 * Available and total amounts for a specific currency.
 */
export interface AmountDetail {
  /** The amount that is currently available to be used. */
  available: string;
  /** The total amount, including the amount that is currently on hold. */
  total: string;
}

/**
 * Amount details denominated in different assets. 
- The keys represent the asset symbols (e.g., "btc", "usd"), - Each value contains available and total amounts. - There will always be an entry for the asset specified in the `asset` field.
 */
export type BalanceAmount = { [key: string]: AmountDetail };

/**
 * A balance of an asset.
 */
export interface Balance {
  asset: BalancesAsset;
  /** Amount details denominated in different assets. 
- The keys represent the asset symbols (e.g., "btc", "usd"), - Each value contains available and total amounts. - There will always be an entry for the asset specified in the `asset` field. */
  amount: BalanceAmount;
}

/**
 * A list of balances for an account.
 */
export interface Balances {
  /** The list of balances. */
  balances: Balance[];
}

/**
 * The type of deposit destination.
 */
export type DepositDestinationType = string;

/**
 * The ID of the Deposit Destination, which is a UUID prefixed by the string `depositDestination_`.
 * @pattern ^depositDestination_[a-f0-9\-]{36}$
 */
export type DepositDestinationId = string;

/**
 * The blockchain network for the payment. Supported networks depend on the account type. See [API and Network Support](https://docs.cdp.coinbase.com/api-reference/payment-apis/supported-networks-assets#by-asset-and-network) for more details.
 */
export type Network = (typeof Network)[keyof typeof Network];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const Network = {
  base: "base",
  ethereum: "ethereum",
  solana: "solana",
  aptos: "aptos",
  arbitrum: "arbitrum",
  "arbitrum-sepolia": "arbitrum-sepolia",
  optimism: "optimism",
  polygon: "polygon",
  world: "world",
  "world-sepolia": "world-sepolia",
} as const;

/**
 * A blockchain address. Format varies by network (e.g., 0x-prefixed for EVM, base58 for Solana).
 * @minLength 1
 * @maxLength 128
 */
export type BlockchainAddress = string;

/**
 * Crypto-specific deposit destination details. In responses, this object is always present. Contains the network and address for the deposit destination.
 */
export interface DepositDestinationCrypto {
  network: Network;
  address: BlockchainAddress;
}

/**
 * The account and asset where incoming deposits should be credited.
 */
export interface DepositDestinationTargetAccount {
  /** The ID of the CDP Account to which deposited funds should be transferred. */
  accountId?: AccountId;
  /** The symbol of the asset that should land in the target account. */
  asset: Asset;
}

/**
 * The intended target for deposited funds.
 */
export type DepositDestinationTarget = DepositDestinationTargetAccount;

/**
 * The status of the deposit destination.
 */
export type DepositDestinationStatus =
  (typeof DepositDestinationStatus)[keyof typeof DepositDestinationStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const DepositDestinationStatus = {
  active: "active",
  inactive: "inactive",
  pending: "pending",
} as const;

/**
 * Optional metadata as key-value pairs. Use this to store additional structured information on a resource, such as customer IDs, order references, or any application-specific data. Up to 10 key/value pairs may be provided. Keys and values are both strings. Keys must be ≤ 40 characters; values must be ≤ 500 characters.
 */
export interface Metadata {
  [key: string]: string;
}

export type CryptoDepositDestinationType =
  (typeof CryptoDepositDestinationType)[keyof typeof CryptoDepositDestinationType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CryptoDepositDestinationType = {
  crypto: "crypto",
} as const;

/**
 * A cryptocurrency deposit destination.
 */
export interface CryptoDepositDestination {
  depositDestinationId: DepositDestinationId;
  accountId: AccountId;
  type: CryptoDepositDestinationType;
  /** Crypto-specific details for this deposit destination. Always populated in responses. Contains the network and address. */
  crypto: DepositDestinationCrypto;
  target?: DepositDestinationTarget;
  status: DepositDestinationStatus;
  metadata?: Metadata;
  /** The timestamp when the deposit destination was created. */
  createdAt: string;
  /** The timestamp when the deposit destination was last updated. */
  updatedAt: string;
}

/**
 * A deposit destination for receiving funds to an account.
 */
export type DepositDestination = CryptoDepositDestination;

/**
 * Common fields for creating a deposit destination.
 */
export interface CreateDepositDestinationRequestBase {
  /** The ID of the Account, which is a UUID prefixed by the string `account_`, that owns the deposit destination. */
  accountId: AccountId;
  type: DepositDestinationType;
  target?: DepositDestinationTarget;
  metadata?: Metadata;
}

/**
 * Crypto-specific details for creating a deposit destination.
 */
export interface CreateDepositDestinationCrypto {
  network: Network;
}

export type CreateCryptoDepositDestinationRequestAllOfType =
  (typeof CreateCryptoDepositDestinationRequestAllOfType)[keyof typeof CreateCryptoDepositDestinationRequestAllOfType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreateCryptoDepositDestinationRequestAllOfType = {
  crypto: "crypto",
} as const;

export type CreateCryptoDepositDestinationRequestAllOf = {
  type?: CreateCryptoDepositDestinationRequestAllOfType;
  /** Crypto-specific details. Required when `type` is `crypto`. */
  crypto: CreateDepositDestinationCrypto;
};

export type CreateCryptoDepositDestinationRequestType =
  (typeof CreateCryptoDepositDestinationRequestType)[keyof typeof CreateCryptoDepositDestinationRequestType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreateCryptoDepositDestinationRequestType = {
  crypto: "crypto",
} as const;

export type CreateCryptoDepositDestinationRequest = CreateDepositDestinationRequestBase &
  CreateCryptoDepositDestinationRequestAllOf & {
    type: CreateCryptoDepositDestinationRequestType;
  };

/**
 * Request to create a new deposit destination. Provide the type-specific details matching the chosen `type`.
 */
export type CreateDepositDestinationRequest = CreateCryptoDepositDestinationRequest;

/**
 * The current status of the transfer, indicating what action you need to take next. Required when validateOnly is false.
 */
export type TransferStatus = (typeof TransferStatus)[keyof typeof TransferStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const TransferStatus = {
  /** Transfer was created with `execute: true`, but is momentarily being quoted before executing _or_ the transfer was created with `execute: false`. It can be executed by calling `\/v2\/transfers\/{transferId}\/execute` with `execute: true`. */
  quoted: "quoted",
  /** Transfer is executing after being quoted. No action needed - monitor progress via the transfers webhook. */
  processing: "processing",
  /** Transfer completed successfully. */
  completed: "completed",
  /** Transfer failed. See `failureReason` for details. */
  failed: "failed",
} as const;

/**
 * An email address. Maximum length 254 characters per [RFC 5321](https://www.rfc-editor.org/rfc/rfc5321).
 * @maxLength 254
 * @pattern ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}/-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$
 */
export type Email = string;

/**
 * The Account specific details for the transfer.
 */
export interface TransfersAccount {
  /** The ID of the Account. */
  accountId: string;
  asset: Asset;
}

/**
 * The Payment Method specific details for the transfer.
 */
export interface PaymentMethod {
  /** The ID of the Payment Method. */
  paymentMethodId: string;
  asset: Asset;
}

/**
 * The target of the payment is an onchain address.
 */
export interface OnchainAddress {
  /** The onchain crypto address of the recipient.

Examples:
- EVM address: 0xabc1234567890abcdef1234567890abcdef123456
- Solana address: HpabPRRCFbBKSuJr5PdkVvQc85FyxyTWkFM2obBRSvHT
- XRP address: rhccc5p23aKiCGFcEqqnjEfLRZ6xEvfy3s
 */
  address: BlockchainAddress;
  network: Network;
  /** The destination tag of the onchain address. Destination tags are used by certain networks
(primarily XRP/Ripple) to identify specific recipients when multiple users share a single address.
The tag ensures funds are credited to the correct account within the shared address.

Examples by network:
- XRP/Ripple: Numeric values like "1234567890" or "123456"
- Stellar (XLM): Memos which can be text, ID, or hash format

Note: Most networks (Ethereum, Bitcoin, Solana) do not use destination tags.
 */
  destinationTag?: string;
  /** Asset symbol of the payment received by the recipient. */
  asset: Asset;
}

/**
 * The originating US bank account details for the transfer source. Present when funds were deposited from an external bank account into a deposit destination. Only the last 4 digits of the account number are exposed.
 */
export interface OriginatingBankAccountUS {
  /** The name of the bank that originated the deposit. */
  bankName: string;
  /**
   * The last 4 digits of the originating bank account number.
   * @pattern ^[0-9]{4}$
   */
  accountLast4: string;
  /** The fiat currency of the deposit (e.g., `usd`). */
  currency: string;
}

/**
 * The source of the transfer.
 */
export type TransferSource =
  | TransfersAccount
  | PaymentMethod
  | OnchainAddress
  | OriginatingBankAccountUS;

/**
 * The target of the payment is an email address.
 */
export interface EmailAddress {
  /** The email address of the recipient. The recipient will need to have an account with Coinbase or onboard to Coinbase to receive the payment. */
  email: Email;
}

export type EmailInstrumentAllOf = {
  /** Asset symbol of the payment received by the recipient. */
  asset: Asset;
};

/**
 * The target of the payment is an email address.
 */
export type EmailInstrument = EmailAddress & EmailInstrumentAllOf;

/**
 * The target of the transfer.
 */
export type TransferTarget = TransfersAccount | PaymentMethod | OnchainAddress | EmailInstrument;

/**
 * Exchange rate information for currency conversion. The rate indicates how much of the target asset is equivalent to one unit of the source asset.
 */
export interface TransferExchangeRate {
  /** The asset being converted from. */
  sourceAsset: Asset;
  /** The asset being converted to. */
  targetAsset: Asset;
  /** The exchange rate value as a decimal string. Indicates how many units of the target asset equal one unit of the source asset. */
  rate: string;
}

/**
 * The type of the fee, indicating its purpose.
 */
export type TransferFeeType = (typeof TransferFeeType)[keyof typeof TransferFeeType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const TransferFeeType = {
  BankFee: "bank",
  ConversionFee: "conversion",
  NetworkFee: "network",
  OtherFee: "other",
} as const;

/**
 * A single fee for a transfer.
 */
export interface TransferFee {
  /** The type of the fee, indicating its purpose. */
  type: TransferFeeType;
  /** The amount of the fee in units of the asset specified by `asset`. */
  amount: string;
  /** The asset symbol. */
  asset: Asset;
}

/**
 * The fees associated with this transfer. Different transfer types have different fee structures.

**NOTE:** These examples are not exhaustive.

Common examples:
* **Crypto transfers**: Network fees (gas) paid in the native token
* **Fiat conversions**: Processing fees + exchange fees in USD
* **Wire transfers**: Wire fees ($15) + processing fees ($5) in USD
* **Crypto conversions**: Spread fees paid in the source asset.
 */
export type TransferFees = TransferFee[];

/**
 * Captures estimated values for transfers where amounts can't be guaranteed (e.g., USDC -> EURC).

The values in `estimate` are not modified after a transfer is executed. They are preserved as an immutable record of the original pre-execution snapshot.

The actual executed values are populated in the `transfer` resource post-execution.
 */
export interface TransferEstimate {
  /** The estimated exchange rate at the time this estimate was captured. */
  exchangeRate?: TransferExchangeRate;
  /** Estimated amount of the target asset that will be received, as a decimal string in standard unit denomination. */
  targetAmount?: string;
  /** The asset symbol of the estimated target amount. */
  targetAsset?: Asset;
  /** The estimated fees at the time this estimate was captured. */
  fees?: TransferFees;
  /** The date and time when this estimate was captured. */
  estimatedAt: string;
}

/**
 * A reference to the deposit destination associated with the transfer.
 */
export interface DepositDestinationReference {
  id: DepositDestinationId;
}

/**
 * The status of a travel rule submission.
 */
export type TravelRuleStatus = (typeof TravelRuleStatus)[keyof typeof TravelRuleStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const TravelRuleStatus = {
  /** Additional fields are required before the transfer can proceed. */
  TravelRuleStatusIncomplete: "incomplete",
  /** All requirements are satisfied and the transfer will proceed. */
  TravelRuleStatusCompleted: "completed",
} as const;

/**
 * An onchain transaction associated with the transfer.
 */
export type TransferDetailsOnchainTransactionsItem = {
  /** The transaction hash. */
  transactionHash: string;
  network: Network;
};

/**
 * Travel rule compliance status for deposit transfers. Present when the transfer requires travel rule information.
 */
export type TransferDetailsTravelRule = {
  status?: TravelRuleStatus;
  /** Additional details about the current travel rule status. For example, when status is `incomplete`, this may indicate the specific missing information required to proceed. */
  statusMessage?: string;
};

/**
 * Additional details about the transfer. For example, if the transfer was sent to a deposit destination, the information about that destination will be included in this field.
 */
export interface TransferDetails {
  depositDestination?: DepositDestinationReference;
  /** The onchain transactions associated with the transfer. */
  onchainTransactions?: TransferDetailsOnchainTransactionsItem[];
  /** Travel rule compliance status for deposit transfers. Present when the transfer requires travel rule information. */
  travelRule?: TransferDetailsTravelRule;
}

/**
 * A Transfer represents all the information needed to execute a transfer and tracks the lifecycle of a transfer from initiation through completion or failure.
 */
export interface Transfer {
  /** The ID of the transfer. Required when validateOnly is false. */
  transferId?: string;
  status?: TransferStatus;
  source: TransferSource;
  target: TransferTarget;
  /** The amount of the source asset that will be transferred out, as a decimal string in standard unit denomination. */
  sourceAmount?: string;
  /** The asset symbol of the source amount. */
  sourceAsset?: Asset;
  /** The amount of the target asset received, as a decimal string in standard unit denomination. May be omitted in the `quoted` state if the value cannot be guaranteed; see `estimate.targetAmount` for the expected value. Populated with the actual executed amount once the transfer completes. */
  targetAmount?: string;
  /** The asset symbol of the target amount. */
  targetAsset?: Asset;
  /** Exchange rate information for currency conversion. The rate indicates how much of the target asset is equivalent to one unit of the source asset. May be omitted in the `quoted` state if the rate cannot be guaranteed; see `estimate.exchangeRate` for the expected rate. Populated with the actual executed rate once the transfer completes. */
  exchangeRate?: TransferExchangeRate;
  /** The fees associated with this transfer. Different transfer types have different fee structures. May be omitted in the `quoted` state if the fees cannot be guaranteed; see `estimate.fees` for the expected fees. Populated with the actual fees once the transfer completes. */
  fees?: TransferFees;
  estimate?: TransferEstimate;
  /** The date and time the transfer was completed. */
  completedAt?: string;
  /** The reason for failure, if the transfer failed. Only present when status is `failed`. */
  failureReason?: string;
  /** The date and time when this transfer will expire if not executed. Only present for `quoted` status. A new transfer must be created to obtain an updated quote after expiration. Required when validateOnly is false. */
  expiresAt?: string;
  /** The date and time the transfer was executed and moved to processing. Only present when status has progressed beyond `quoted`. */
  executedAt?: string;
  /** The date and time the transfer was created. Required when validateOnly is false. */
  createdAt?: string;
  /** The date and time the transfer was last updated. Required when validateOnly is false. */
  updatedAt?: string;
  metadata?: Metadata;
  details?: TransferDetails;
}

/**
 * The source of the transfer.
 */
export type CreateTransferSource = TransfersAccount | PaymentMethod;

/**
 * A physical address with standard address components including street, city, state/province, postal code, and country.
 */
export interface PhysicalAddress {
  /** Primary street address. */
  line1?: string;
  /** Secondary address information. */
  line2?: string;
  /** City or locality. */
  city?: string;
  /** State, province, or region. */
  state?: string;
  /** Postal or ZIP code. */
  postCode?: string;
  /**
   * ISO 3166-1 alpha-2 country code (2 characters). See https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes.
   * @minLength 2
   * @maxLength 2
   */
  countryCode?: string;
}

/**
 * Information about a party (originator or beneficiary) for travel rule compliance.
 */
export interface TravelRuleParty {
  /** Name of the financial institution. */
  financialInstitution?: string;
  /** Full name of the party. */
  name?: string;
  address?: PhysicalAddress;
}

/**
 * Date of birth.
 */
export interface DateOfBirth {
  /**
   * Day of birth (01-31).
   * @minLength 2
   * @maxLength 2
   * @pattern ^[0-9]{2}$
   */
  day?: string;
  /**
   * Month of birth (01-12).
   * @minLength 2
   * @maxLength 2
   * @pattern ^[0-9]{2}$
   */
  month?: string;
  /**
   * Year of birth (four digits).
   * @minLength 4
   * @maxLength 4
   * @pattern ^[0-9]{4}$
   */
  year?: string;
}

/**
 * Information about the originating Virtual Asset Service Provider (VASP) that handles cryptocurrency or other virtual assets on behalf of customers.
 */
export type TravelRuleOriginatorAllOfVirtualAssetServiceProvider = {
  /** The name of the originating Virtual Asset Service Provider (VASP). */
  name?: string;
  /** The address of the originating Virtual Asset Service Provider (VASP). */
  address?: PhysicalAddress;
  /** The Legal Entity Identifier of the originating Virtual Asset Service Provider (VASP). */
  identifier?: string;
};

export type TravelRuleOriginatorAllOf = {
  /** Information about the originating Virtual Asset Service Provider (VASP) that handles cryptocurrency or other virtual assets on behalf of customers. */
  virtualAssetServiceProvider?: TravelRuleOriginatorAllOfVirtualAssetServiceProvider;
  /** Personal identifier for travel rule compliance. For individuals: passport number, national ID, or driver's license. For institutions: LEI (Legal Entity Identifier). */
  personalId?: string;
  /** Date of birth of the originator. Required by certain jurisdictions (such as Coinbase Luxembourg) to satisfy Travel Rule reporting obligations. */
  dateOfBirth?: DateOfBirth;
};

/**
 * Originator (sender) party.
 */
export type TravelRuleOriginator = TravelRuleParty & TravelRuleOriginatorAllOf;

/**
 * The type of the beneficiary's wallet.
 */
export type TravelRuleBeneficiaryAllOfWalletType =
  (typeof TravelRuleBeneficiaryAllOfWalletType)[keyof typeof TravelRuleBeneficiaryAllOfWalletType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const TravelRuleBeneficiaryAllOfWalletType = {
  custodial: "custodial",
  self_custody: "self_custody",
} as const;

export type TravelRuleBeneficiaryAllOf = {
  /** The type of the beneficiary's wallet. */
  walletType?: TravelRuleBeneficiaryAllOfWalletType;
};

/**
 * Beneficiary (receiver) party.
 */
export type TravelRuleBeneficiary = TravelRuleParty & TravelRuleBeneficiaryAllOf;

/**
 * Required Travel Rule fields differ by region. These requirements are determined based on which Coinbase entity the customer has signed the service agreement for.
 */
export interface TravelRule {
  /** Indicates whether the user attests that the receiving wallet belongs to them. */
  isSelf?: boolean;
  /** Indicates whether Coinbase is being used as an intermediary Virtual Asset Service Provider (VASP) to send crypto on behalf of your customer.

**Background:**

The Travel Rule (FATF Recommendation 16) requires VASPs to share originator and beneficiary information for virtual asset transfers. When Coinbase acts as an intermediary, additional Travel Rule data must be provided to satisfy compliance requirements.

**Set to `true` when:**

- Your organization is a VASP using Coinbase to send crypto **on behalf of your end customer**
- In this scenario, Coinbase acts as an intermediary in the transfer chain and handles Travel Rule data exchange with the beneficiary VASP

**Set to `false` (or omit) when:**

- You are transferring funds directly from your own Coinbase account, where **Coinbase is your primary VASP** rather than an intermediary for another institution

**Impact on required fields:**

When `isIntermediary` is `true`, you must provide the `originator` object with details about the **original sender**, including:
- Originator name
- Originator address
- Your VASP information (`virtualAssetServiceProvider` object with `name`, `address`, and `identifier`)

For jurisdictions that require them (such as Coinbase Luxembourg), `personalIdentification` and `dateOfBirth` must also reflect the **original sender's** identity — not the intermediary's. These fields will not be auto-populated from any internal KYC data when `isIntermediary` is `true`.
 */
  isIntermediary?: boolean;
  originator?: TravelRuleOriginator;
  beneficiary?: TravelRuleBeneficiary;
}

/**
 * Specifies whether the given amount is to be received by the target or taken from the source.

- `target`: The transfer `target` receives the exact value specified in `amount`. Fees are added to the amount taken from the transfer `source`.
- `source`: The transfer `target` receives the value specified in `amount`, minus any fees.

 */
export type TransferRequestAmountType =
  (typeof TransferRequestAmountType)[keyof typeof TransferRequestAmountType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const TransferRequestAmountType = {
  target: "target",
  source: "source",
} as const;

/**
 * A request to create a transfer.
 */
export interface TransferRequest {
  source: CreateTransferSource;
  target: TransferTarget;
  /** The amount of the transfer, as a decimal string in standard unit denomination of the asset specified by `asset` (e.g., "100.00" for 100 USD, "0.05" for 0.05 ETH). */
  amount: string;
  /** The symbol of the asset for the amount. This must be one of the assets of the source or target. */
  asset: Asset;
  /** Specifies whether the given amount is to be received by the target or taken from the source.

- `target`: The transfer `target` receives the exact value specified in `amount`. Fees are added to the amount taken from the transfer `source`.
- `source`: The transfer `target` receives the value specified in `amount`, minus any fees.
 */
  amountType?: TransferRequestAmountType;
  /** If true, validates the transfer without initiating it.  If the request is valid, a 2xx will be returned. If the request is invalid, a 4xx error will be returned. The response will include an errorType, for e.g. invalid_target if the specified target cannot receive funds. */
  validateOnly?: boolean;
  /** Whether to immediately execute the transfer. If false, the transfer will be created in quoted status and must be executed manually via the /execute endpoint. */
  execute: boolean;
  metadata?: Metadata;
  /** Travel Rule compliance information for this transfer. Required for transfers to external wallets above regulatory thresholds. Fields required differ by region and Coinbase contracting entity. */
  travelRule?: TravelRule;
}

/**
 * Information about the Virtual Asset Service Provider (VASP) for a deposit travel rule submission.
 */
export interface DepositTravelRuleVasp {
  /** The Legal Entity Identifier (LEI) of the Virtual Asset Service Provider (VASP). */
  identifier?: string;
  /** The name of the Virtual Asset Service Provider (VASP). */
  name?: string;
}

/**
 * The type of the originator's wallet.
 */
export type DepositTravelRuleOriginatorWalletType =
  (typeof DepositTravelRuleOriginatorWalletType)[keyof typeof DepositTravelRuleOriginatorWalletType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const DepositTravelRuleOriginatorWalletType = {
  /** The originator\'s wallet is held by a custodial service. */
  custodial: "custodial",
  /** The originator\'s wallet is self-custodied. */
  self_custody: "self_custody",
} as const;

/**
 * Originator information for a deposit travel rule submission.
 */
export interface DepositTravelRuleOriginator {
  /** Full name of the originator. */
  name?: string;
  address?: PhysicalAddress;
  /** The type of the originator's wallet. */
  walletType?: DepositTravelRuleOriginatorWalletType;
  virtualAssetServiceProvider?: DepositTravelRuleVasp;
  /** Personal identifier for travel rule compliance. For individuals: passport number, national ID, or driver's license. For institutions: LEI (Legal Entity Identifier). */
  personalId?: string;
  /** Date of birth of the originator. */
  dateOfBirth?: DateOfBirth;
}

/**
 * Beneficiary information for a deposit travel rule submission.
 */
export interface DepositTravelRuleBeneficiary {
  /** Full name of the beneficiary. */
  name?: string;
}

/**
 * Request body for submitting travel rule information for a deposit transfer. Required fields vary by jurisdiction.
 */
export interface DepositTravelRuleRequest {
  /** Originator information for the travel rule submission. */
  originator?: DepositTravelRuleOriginator;
  /** Beneficiary information for the travel rule submission. */
  beneficiary?: DepositTravelRuleBeneficiary;
  /** Indicates whether the user attests that the originating wallet belongs to them. */
  isSelf?: boolean;
}

/**
 * Response from submitting travel rule information for a deposit transfer.
 */
export interface DepositTravelRuleResponse {
  status: TravelRuleStatus;
  /** List of field paths that are still required to complete travel rule compliance. Each entry is a dot-separated path (e.g., "originator.name", "originator.address.countryCode"). Empty when status is "completed". */
  missingFields?: string[];
  /** Additional context about the current status. Present when status is `incomplete` to explain what needs to be fixed before the transfer can proceed. */
  reason?: string;
}

/**
 * The type of authentication information.
 */
export type EmailAuthenticationType =
  (typeof EmailAuthenticationType)[keyof typeof EmailAuthenticationType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EmailAuthenticationType = {
  email: "email",
} as const;

/**
 * Information about an end user who authenticates using a one-time password sent to their email address.
 */
export interface EmailAuthentication {
  /** The type of authentication information. */
  type: EmailAuthenticationType;
  /** The email address of the end user. */
  email: Email;
}

/**
 * A phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
 * @pattern ^\+[1-9]\d{1,14}$
 */
export type PhoneNumber = string;

/**
 * The type of authentication information.
 */
export type SmsAuthenticationType =
  (typeof SmsAuthenticationType)[keyof typeof SmsAuthenticationType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SmsAuthenticationType = {
  sms: "sms",
} as const;

/**
 * Information about an end user who authenticates using a one-time password sent to their phone number via SMS.
 */
export interface SmsAuthentication {
  /** The type of authentication information. */
  type: SmsAuthenticationType;
  /** Phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. */
  phoneNumber: PhoneNumber;
}

/**
 * The type of authentication information.
 */
export type DeveloperJWTAuthenticationType =
  (typeof DeveloperJWTAuthenticationType)[keyof typeof DeveloperJWTAuthenticationType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const DeveloperJWTAuthenticationType = {
  jwt: "jwt",
} as const;

/**
 * Information about an end user who authenticates using a JWT issued by the developer.
 */
export interface DeveloperJWTAuthentication {
  /** The type of authentication information. */
  type: DeveloperJWTAuthenticationType;
  /** The key ID of the JWK used to sign the JWT. */
  kid: string;
  /** The unique identifier for the end user that is captured in the `sub` claim of the JWT. */
  sub: string;
}

/**
 * The type of OAuth2 provider.
 */
export type OAuth2ProviderType = (typeof OAuth2ProviderType)[keyof typeof OAuth2ProviderType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OAuth2ProviderType = {
  google: "google",
  apple: "apple",
  x: "x",
  telegram: "telegram",
  github: "github",
} as const;

/**
 * Information about an end user who authenticates using a third-party provider.
 */
export interface OAuth2Authentication {
  type: OAuth2ProviderType;
  /** The unique identifier for the end user that is captured in the `sub` claim of the JWT. */
  sub: string;
  /** The email address of the end user contained within the user's ID token, if available from third-party OAuth2 provider's token exchange. */
  email?: string;
  /** The full name of the end user if available from third-party OAuth2 provider's token exchange. */
  name?: string;
  /** The username of the end user if available from third-party OAuth2 provider's token exchange. */
  username?: string;
}

/**
 * Information about an end user who authenticates using Telegram.
 */
export interface TelegramAuthentication {
  type: OAuth2ProviderType;
  /** The Telegram ID for the end user. */
  id: number;
  /** The Telegram user's first name. */
  firstName?: string;
  /** The Telegram user's last name. */
  lastName?: string;
  /** The Telegram user's profile picture. */
  photoUrl?: string;
  /** The Telegram user's last login as a Unix timestamp. */
  authDate: number;
  /** The Telegram user's username. */
  username?: string;
}

/**
 * The type of authentication information.
 */
export type SiweAuthenticationType =
  (typeof SiweAuthenticationType)[keyof typeof SiweAuthenticationType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SiweAuthenticationType = {
  siwe: "siwe",
} as const;

/**
 * Information about an end user who authenticates using Sign In With Ethereum (EIP-4361).
 */
export interface SiweAuthentication {
  /** The type of authentication information. */
  type: SiweAuthenticationType;
  /** The ERC-55 checksummed Ethereum address of the end user. */
  address: BlockchainAddress;
}

/**
 * Information about how the end user is authenticated.
 */
export type AuthenticationMethod =
  | EmailAuthentication
  | SmsAuthentication
  | DeveloperJWTAuthentication
  | OAuth2Authentication
  | TelegramAuthentication
  | SiweAuthentication;

/**
 * The list of valid authentication methods linked to the end user.
 */
export type AuthenticationMethods = AuthenticationMethod[];

/**
 * An object containing information about the end user's TOTP enrollment.
 */
export type MFAMethodsTotp = {
  /** The date and time when the method was enrolled, in ISO 8601 format. */
  enrolledAt: string;
};

/**
 * An object containing information about the end user's SMS MFA enrollment.
 */
export type MFAMethodsSms = {
  /** The date and time when the method was enrolled, in ISO 8601 format. */
  enrolledAt: string;
};

/**
 * Information about the end user's MFA enrollments.

 */
export interface MFAMethods {
  /** The date and time when the end user was prompted for MFA enrollment, in ISO 8601 format. If the this field exists, and the user has no other enrolled MFA methods, then the user skipped MFA enrollment. */
  enrollmentPromptedAt?: string;
  /** An object containing information about the end user's TOTP enrollment. */
  totp?: MFAMethodsTotp;
  /** An object containing information about the end user's SMS MFA enrollment. */
  sms?: MFAMethodsSms;
}

/**
 * Information about an EVM account associated with an end user.
 */
export interface EndUserEvmAccount {
  /**
   * The address of the EVM account.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The date and time when the account was created, in ISO 8601 format. */
  createdAt: string;
}

/**
 * Information about an EVM smart account associated with an end user.
 */
export interface EndUserEvmSmartAccount {
  /**
   * The address of the EVM smart account.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The addresses of the EVM EOA accounts that own this smart account. Smart accounts can have multiple owners, such as when spend permissions are enabled. */
  ownerAddresses: string[];
  /** The date and time when the account was created, in ISO 8601 format. */
  createdAt: string;
}

/**
 * Information about a Solana account associated with an end user.
 */
export interface EndUserSolanaAccount {
  /**
   * The base58 encoded address of the Solana account.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /** The date and time when the account was created, in ISO 8601 format. */
  createdAt: string;
}

/**
 * Information about the end user.
 */
export interface EndUser {
  /**
   * A stable, unique identifier for the end user. The `userId` must be unique across all end users in the developer's CDP Project. It must be between 1 and 100 characters long and can only contain alphanumeric characters and hyphens.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  userId: string;
  authenticationMethods: AuthenticationMethods;
  mfaMethods?: MFAMethods;
  /**
   * **DEPRECATED**: Use `evmAccountObjects` instead for richer account information. The list of EVM account addresses associated with the end user. End users can have up to 10 EVM accounts.
   * @deprecated
   */
  evmAccounts: string[];
  /** The list of EVM accounts associated with the end user. End users can have up to 10 EVM accounts. */
  evmAccountObjects: EndUserEvmAccount[];
  /**
   * **DEPRECATED**: Use `evmSmartAccountObjects` instead for richer account information including owner relationships. The list of EVM smart account addresses associated with the end user. Each EVM EOA can own one smart account.
   * @deprecated
   */
  evmSmartAccounts: string[];
  /** The list of EVM smart accounts associated with the end user. Each EVM EOA can own one smart account. */
  evmSmartAccountObjects: EndUserEvmSmartAccount[];
  /**
   * **DEPRECATED**: Use `solanaAccountObjects` instead for richer account information. The list of Solana account addresses associated with the end user. End users can have up to 10 Solana accounts.
   * @deprecated
   */
  solanaAccounts: string[];
  /** The list of Solana accounts associated with the end user. End users can have up to 10 Solana accounts. */
  solanaAccountObjects: EndUserSolanaAccount[];
  /** The date and time when the end user was created, in ISO 8601 format. */
  createdAt: string;
}

/**
 * The ERC-7677 `context` object forwarded to the paymaster service as part of the `paymasterService` capability. The fields in this object are defined by the paymaster service provider; CDP forwards them to the paymaster unchanged. This field is only valid when a paymaster is configured for the request. Providing `paymasterContext` without a paymaster configured results in an `invalid_request` error.
 */
export interface PaymasterContext {
  [key: string]: unknown;
}

/**
 * The domain of the EIP-712 typed data.
 */
export interface EIP712Domain {
  /** The name of the DApp or protocol. */
  name?: string;
  /** The version of the DApp or protocol. */
  version?: string;
  /** The chain ID of the EVM network. */
  chainId?: number;
  /**
   * The 0x-prefixed EVM address of the verifying smart contract.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  verifyingContract?: string;
  /**
   * The optional 32-byte 0x-prefixed hex salt for domain separation.
   * @pattern ^0x[a-fA-F0-9]{64}$
   */
  salt?: string;
}

/**
 * A mapping of struct names to an array of type objects (name + type).
Each key corresponds to a type name (e.g., "`EIP712Domain`", "`PermitTransferFrom`").

 */
export interface EIP712Types {
  [key: string]: unknown;
}

/**
 * The message to sign. The structure of this message must match the `primaryType` struct in the `types` object.
 */
export type EIP712MessageMessage = { [key: string]: unknown };

/**
 * The message to sign using EIP-712.
 */
export interface EIP712Message {
  domain: EIP712Domain;
  types: EIP712Types;
  /** The primary type of the message. This is the name of the struct in the `types` object that is the root of the message. */
  primaryType: string;
  /** The message to sign. The structure of this message must match the `primaryType` struct in the `types` object. */
  message: EIP712MessageMessage;
}

/**
 * The network for the EIP-7702 delegation.
 */
export type EvmEip7702DelegationNetwork =
  (typeof EvmEip7702DelegationNetwork)[keyof typeof EvmEip7702DelegationNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmEip7702DelegationNetwork = {
  "base-sepolia": "base-sepolia",
  base: "base",
  arbitrum: "arbitrum",
  optimism: "optimism",
  polygon: "polygon",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
} as const;

/**
 * The network the user operation is for.
 */
export type EvmUserOperationNetwork =
  (typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmUserOperationNetwork = {
  "base-sepolia": "base-sepolia",
  base: "base",
  arbitrum: "arbitrum",
  optimism: "optimism",
  zora: "zora",
  polygon: "polygon",
  bnb: "bnb",
  avalanche: "avalanche",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
} as const;

export interface EvmCall {
  /**
   * The address the call is directed to.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  to: string;
  /** The amount of ETH to send with the call, in wei. */
  value: string;
  /**
   * The call data to send. This is the hex-encoded data of the function call consisting of the method selector and the function arguments.
   * @pattern ^0x[0-9a-fA-F]*$
   */
  data: string;
  /** The override gas limit to use for the call instead of the bundler's estimated gas limit. */
  overrideGasLimit?: string;
}

/**
 * The revert data if the user operation has reverted.
 */
export interface UserOperationReceiptRevert {
  /**
   * The 0x-prefixed raw hex string.
   * @pattern ^0x[0-9a-fA-F]*$
   */
  data: string;
  /** Human-readable revert reason if able to decode. */
  message: string;
}

/**
 * The receipt that contains information about the execution of user operation.
 */
export interface UserOperationReceipt {
  revert?: UserOperationReceiptRevert;
  /**
   * The hash of this transaction as 0x-prefixed string.
   * @pattern ^0x[a-fA-F0-9]{64}$
   */
  transactionHash?: string;
  /**
   * The block hash of the block including the transaction as 0x-prefixed string.
   * @pattern ^0x[0-9a-fA-F]{64}$|^$
   */
  blockHash?: string;
  /** The block height (number) of the block including the transaction. */
  blockNumber?: number;
  /** The gas used for landing this user operation. */
  gasUsed?: string;
}

/**
 * The status of the user operation.
 */
export type EvmUserOperationStatus =
  (typeof EvmUserOperationStatus)[keyof typeof EvmUserOperationStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmUserOperationStatus = {
  pending: "pending",
  signed: "signed",
  broadcast: "broadcast",
  complete: "complete",
  dropped: "dropped",
  failed: "failed",
} as const;

export interface EvmUserOperation {
  network: EvmUserOperationNetwork;
  /**
   * The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  userOpHash: string;
  /** The list of calls in the user operation. */
  calls: EvmCall[];
  /** The status of the user operation. */
  status: EvmUserOperationStatus;
  /**
   * The hash of the transaction that included this particular user operation. This gets set after the user operation is broadcasted and the transaction is included in a block.
   * @pattern ^0x[0-9a-fA-F]{64}$|^$
   */
  transactionHash?: string;
  /** The list of receipts associated with the user operation. */
  receipts?: UserOperationReceipt[];
  /** The timestamp at which the prepared user operation expires. */
  expiresAt?: string;
}

export interface EvmAccount {
  /**
   * The 0x-prefixed, checksum EVM address.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names are guaranteed to be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /** The list of policy IDs that apply to the account. This will include both the project-level policy and the account-level policy, if one exists. */
  policies?: string[];
  /** The UTC ISO 8601 timestamp at which the account was created. */
  createdAt?: string;
  /** The UTC ISO 8601 timestamp at which the account was last updated. */
  updatedAt?: string;
}

/**
 * The current status of the delegation operation.
UNSPECIFIED means the status has not been set. PENDING means the operation has been created but not yet submitted. SUBMITTED means the operation has been submitted to the network. COMPLETED means the operation has completed successfully. FAILED means the operation has failed.
 */
export type EvmEip7702DelegationOperationStatus =
  (typeof EvmEip7702DelegationOperationStatus)[keyof typeof EvmEip7702DelegationOperationStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmEip7702DelegationOperationStatus = {
  UNSPECIFIED: "UNSPECIFIED",
  PENDING: "PENDING",
  SUBMITTED: "SUBMITTED",
  COMPLETED: "COMPLETED",
  FAILED: "FAILED",
} as const;

/**
 * The status of an EIP-7702 delegation operation.
 */
export interface EvmEip7702DelegationOperation {
  /** The unique identifier for the delegation operation. */
  delegationOperationId: string;
  /** The current status of the delegation operation.
UNSPECIFIED means the status has not been set. PENDING means the operation has been created but not yet submitted. SUBMITTED means the operation has been submitted to the network. COMPLETED means the operation has completed successfully. FAILED means the operation has failed. */
  status: EvmEip7702DelegationOperationStatus;
  /**
   * The hash of the delegation transaction, if available. Present once the transaction has been submitted to the network.
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  transactionHash?: string;
  network: EvmEip7702DelegationNetwork;
  /**
   * The address the account has delegated to, if any. Only present when the account has an active delegation.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  delegateAddress?: string;
}

export interface EvmSmartAccount {
  /**
   * The 0x-prefixed, checksum address of the Smart Account.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** Today, only a single owner can be set for a Smart Account, but this is an array to allow having multiple owners in the future. The address is a 0x-prefixed, checksum address. */
  owners: string[];
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names are guaranteed to be unique across all Smart Accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /** The list of policy IDs that apply to the smart account. This will include both the project-level policy and the account-level policy, if one exists. */
  policies?: string[];
  /** The UTC ISO 8601 timestamp at which the account was created. */
  createdAt?: string;
  /** The UTC ISO 8601 timestamp at which the account was last updated. */
  updatedAt?: string;
}

/**
 * The network the spend permission is on.
 */
export type SpendPermissionNetwork =
  (typeof SpendPermissionNetwork)[keyof typeof SpendPermissionNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SpendPermissionNetwork = {
  base: "base",
  "base-sepolia": "base-sepolia",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
  optimism: "optimism",
  arbitrum: "arbitrum",
  avalanche: "avalanche",
  polygon: "polygon",
} as const;

/**
 * Request parameters for creating a Spend Permission.
 */
export interface CreateSpendPermissionRequest {
  network: SpendPermissionNetwork;
  /**
   * Entity that can spend account's tokens. Can be either a Smart Account or an EOA.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  spender: string;
  /**
   * ERC-7528 native token address (e.g. "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" for native ETH), or an  ERC-20 contract address.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  token: string;
  /** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
  allowance: string;
  /** Time duration for resetting used allowance on a recurring basis (seconds). */
  period: string;
  /** The start time for this spend permission, in Unix seconds. */
  start: string;
  /** The expiration time for this spend permission, in Unix seconds. */
  end: string;
  /** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
  salt?: string;
  /** Arbitrary data to include in the permission. */
  extraData?: string;
  /** The paymaster URL of the spend permission. */
  paymasterUrl?: Url;
}

/**
 * The core spend permission.
 */
export interface SpendPermission {
  /**
   * Smart account this spend permission is valid for.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  account: string;
  /**
   * Entity that can spend account's tokens.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  spender: string;
  /**
   * Token address (ERC-7528 native token address or ERC-20 contract).
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  token: string;
  /** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
  allowance: string;
  /** Time duration for resetting used allowance on a recurring basis (seconds). */
  period: string;
  /** The start time for this spend permission, in Unix seconds. */
  start: string;
  /** The expiration time for this spend permission, in Unix seconds. */
  end: string;
  /** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
  salt: string;
  /** Arbitrary data to include in the permission. */
  extraData: string;
}

export interface SpendPermissionResponseObject {
  permission: SpendPermission;
  /** Unique hash identifier for this permission. */
  permissionHash: string;
  /** Whether this permission has been revoked. */
  revoked: boolean;
  /** The UTC ISO 8601 timestamp when the permission was revoked (if applicable). */
  revokedAt?: string;
  /** The UTC ISO 8601 timestamp when the permission was created. */
  createdAt: string;
  network: SpendPermissionNetwork;
}

/**
 * Request parameters for revoking a Spend Permission.
 */
export interface RevokeSpendPermissionRequest {
  network: SpendPermissionNetwork;
  /** The hash of the spend permission to revoke. */
  permissionHash: string;
  /** The paymaster URL of the spend permission. */
  paymasterUrl?: Url;
}

/**
 * The network on which to perform the swap.
 */
export type EvmSwapsNetwork = (typeof EvmSwapsNetwork)[keyof typeof EvmSwapsNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmSwapsNetwork = {
  base: "base",
  ethereum: "ethereum",
  arbitrum: "arbitrum",
  optimism: "optimism",
  polygon: "polygon",
} as const;

/**
 * The 0x-prefixed contract address of the token to receive.
 * @pattern ^0x[a-fA-F0-9]{40}$
 */
export type ToToken = string;

/**
 * The 0x-prefixed contract address of the token to send.
 * @pattern ^0x[a-fA-F0-9]{40}$
 */
export type FromToken = string;

/**
 * The amount of the `fromToken` to send in atomic units of the token. For example, `1000000000000000000` when sending ETH equates to 1 ETH, `1000000` when sending USDC equates to 1 USDC, etc.
 * @pattern ^\d+$
 */
export type FromAmount = string;

/**
 * The 0x-prefixed address that holds the `fromToken` balance and has the `Permit2` allowance set for the swap.
 * @pattern ^0x[a-fA-F0-9]{40}$
 */
export type Taker = string;

/**
 * The 0x-prefixed Externally Owned Account (EOA) address that will sign the `Permit2` EIP-712 permit message. This is only needed if `taker` is a smart contract.
 * @pattern ^0x[a-fA-F0-9]{40}$
 */
export type SignerAddress = string;

/**
 * The target gas price for the swap transaction, in Wei. For EIP-1559 transactions, this value should be seen as the `maxFeePerGas` value. If not provided, the API will use an estimate based on the current network conditions.
 * @pattern ^\d+$
 */
export type GasPrice = string;

/**
 * The maximum acceptable slippage of the `toToken` in basis points. If this parameter is set to 0, no slippage will be tolerated. If not provided, the default slippage tolerance is 100 bps (i.e., 1%).
 * @minimum 0
 * @maximum 10000
 */
export type SlippageBps = number;

export interface TokenFee {
  /**
   * The estimated amount of the fee in atomic units of the `token`. For example, `1000000000000000` if the fee is in ETH equates to 0.001 ETH, `10000` if the fee is in USDC equates to 0.01 USDC, etc.
   * @pattern ^\d+$
   */
  amount: string;
  /**
   * The contract address of the token that the fee is paid in. The address `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` is used for the native token of the network (e.g. ETH).
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  token: string;
}

/**
 * The estimated gas fee for the swap.
 * @nullable
 */
export type CommonSwapResponseFeesGasFee = TokenFee | null;

/**
 * The estimated protocol fee for the swap.
 * @nullable
 */
export type CommonSwapResponseFeesProtocolFee = TokenFee | null;

/**
 * The estimated fees for the swap.
 */
export type CommonSwapResponseFees = {
  /**
   * The estimated gas fee for the swap.
   * @nullable
   */
  gasFee: CommonSwapResponseFeesGasFee;
  /**
   * The estimated protocol fee for the swap.
   * @nullable
   */
  protocolFee: CommonSwapResponseFeesProtocolFee;
};

/**
 * Details of the allowances that the taker must set in order to execute the swap successfully. Null if no allowance is required.
 * @nullable
 */
export type CommonSwapResponseIssuesAllowance = {
  /**
   * The current allowance of the `fromToken` by the `taker`.
   * @pattern ^\d+$
   */
  currentAllowance: string;
  /**
   * The 0x-prefixed address of to set the allowance on.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  spender: string;
} | null;

/**
 * Details of the balance of the `fromToken` that the `taker` must hold. Null if the `taker` has a sufficient balance.
 * @nullable
 */
export type CommonSwapResponseIssuesBalance = {
  /**
   * The 0x-prefixed contract address of the token.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  token: string;
  /**
   * The current balance of the `fromToken` by the `taker`.
   * @pattern ^\d+$
   */
  currentBalance: string;
  /**
   * The amount of the token that the `taker` must hold.
   * @pattern ^\d+$
   */
  requiredBalance: string;
} | null;

/**
 * An object containing potential issues discovered during validation that could prevent the swap from being executed successfully.
 */
export type CommonSwapResponseIssues = {
  /**
   * Details of the allowances that the taker must set in order to execute the swap successfully. Null if no allowance is required.
   * @nullable
   */
  allowance: CommonSwapResponseIssuesAllowance;
  /**
   * Details of the balance of the `fromToken` that the `taker` must hold. Null if the `taker` has a sufficient balance.
   * @nullable
   */
  balance: CommonSwapResponseIssuesBalance;
  /** This is set to true when the transaction cannot be validated. This can happen when the taker has an insufficient balance of the `fromToken`. Note that this does not necessarily mean that the trade will revert. */
  simulationIncomplete: boolean;
};

export interface CommonSwapResponse {
  /**
   * The block number at which the liquidity conditions were examined.
   * @pattern ^[1-9]\d*$
   */
  blockNumber: string;
  /**
   * The amount of the `toToken` that will be received in atomic units of the `toToken`. For example, `1000000000000000000` when receiving ETH equates to 1 ETH, `1000000` when receiving USDC equates to 1 USDC, etc.
   * @pattern ^(0|[1-9]\d*)$
   */
  toAmount: string;
  /**
   * The 0x-prefixed contract address of the token that will be received.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  toToken: string;
  /** The estimated fees for the swap. */
  fees: CommonSwapResponseFees;
  /** An object containing potential issues discovered during validation that could prevent the swap from being executed successfully. */
  issues: CommonSwapResponseIssues;
  /** Whether sufficient liquidity is available to settle the swap. All other fields in the response will be empty if this is false. */
  liquidityAvailable: boolean;
  /**
   * The minimum amount of the `toToken` that must be received for the swap to succeed, in atomic units of the `toToken`.  For example, `1000000000000000000` when receiving ETH equates to 1 ETH, `1000000` when receiving USDC equates to 1 USDC, etc. This value is influenced by the `slippageBps` parameter.
   * @pattern ^(0|[1-9]\d*)$
   */
  minToAmount: string;
  /**
   * The amount of the `fromToken` that will be sent in this swap, in atomic units of the `fromToken`. For example, `1000000000000000000` when sending ETH equates to 1 ETH, `1000000` when sending USDC equates to 1 USDC, etc.
   * @pattern ^(0|[1-9]\d*)$
   */
  fromAmount: string;
  /**
   * The 0x-prefixed contract address of the token that will be sent.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  fromToken: string;
}

export type GetSwapPriceResponseAllOf = {
  /**
   * The estimated gas limit that should be used to send the transaction to guarantee settlement.
   * @nullable
   * @pattern ^\d+$
   */
  gas: string | null;
  /**
   * The gas price, in Wei, that should be used to send the transaction. For EIP-1559 transactions, this value should be seen as the `maxFeePerGas` value. The transaction should be sent with this gas price to guarantee settlement.
   * @pattern ^\d+$
   */
  gasPrice: string;
};

export type GetSwapPriceResponse = CommonSwapResponse & GetSwapPriceResponseAllOf;

export interface SwapUnavailableResponse {
  /** Whether sufficient liquidity is available to settle the swap. All other fields in the response will be empty if this is false. */
  liquidityAvailable: boolean;
}

/**
 * A wrapper for the response of a swap price operation.
 */
export type GetSwapPriceResponseWrapper = GetSwapPriceResponse | SwapUnavailableResponse;

/**
 * The approval object which contains the necessary fields to submit an approval for this transaction. Null if the `fromToken` is the native token or the transaction is a native token wrap / unwrap.
 * @nullable
 */
export type CreateSwapQuoteResponseAllOfPermit2 = {
  /**
   * The hash for the approval according to [EIP-712](https://eips.ethereum.org/EIPS/eip-712). Computing the hash of the `eip712` field should match the value of this field.
   * @pattern ^0x[a-fA-F0-9]{64}$
   */
  hash: string;
  eip712: EIP712Message;
} | null;

/**
 * The details of the transaction to be signed and submitted to execute the swap.
 */
export type CreateSwapQuoteResponseAllOfTransaction = {
  /**
   * The 0x-prefixed address of the contract to call.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  to: string;
  /** The hex-encoded call data to send to the contract. */
  data: string;
  /**
   * The estimated gas limit that should be used to send the transaction to guarantee settlement.
   * @pattern ^\d+$
   */
  gas: string;
  /**
   * The gas price, in Wei, that should be used to send the transaction. For EIP-1559 transactions, this value should be seen as the `maxFeePerGas` value. The transaction should be sent with this gas price to guarantee settlement.
   * @pattern ^\d+$
   */
  gasPrice: string;
  /**
   * The value of the transaction in Wei.
   * @pattern ^\d+$
   */
  value: string;
};

export type CreateSwapQuoteResponseAllOf = {
  /**
   * The approval object which contains the necessary fields to submit an approval for this transaction. Null if the `fromToken` is the native token or the transaction is a native token wrap / unwrap.
   * @nullable
   */
  permit2: CreateSwapQuoteResponseAllOfPermit2;
  /** The details of the transaction to be signed and submitted to execute the swap. */
  transaction: CreateSwapQuoteResponseAllOfTransaction;
};

export type CreateSwapQuoteResponse = CreateSwapQuoteResponseAllOf & CommonSwapResponse;

/**
 * A wrapper for the response of a swap quote operation.
 */
export type CreateSwapQuoteResponseWrapper = CreateSwapQuoteResponse | SwapUnavailableResponse;

/**
 * The name of the supported EVM networks in human-readable format.
 */
export type ListEvmTokenBalancesNetwork =
  (typeof ListEvmTokenBalancesNetwork)[keyof typeof ListEvmTokenBalancesNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ListEvmTokenBalancesNetwork = {
  base: "base",
  "base-sepolia": "base-sepolia",
  ethereum: "ethereum",
} as const;

/**
 * Amount of a given token.
 */
export interface TokenAmount {
  /**
   * The amount is denominated in the smallest indivisible unit of the token. For ETH, the smallest indivisible unit is Wei (10^-18 ETH). For ERC-20s, the smallest unit is the unit returned from `function totalSupply() public view returns (uint256)`.
   * @pattern ^[0-9]+$
   */
  amount: string;
  /** 'decimals' is the exponential value N that satisfies the equation `amount * 10^-N = standard_denomination`. The standard denomination is the most commonly used denomination for the token.
- In the case of the native gas token, `decimals` is defined via convention. As an example, for ETH of Ethereum mainnet, the standard denomination is 10^-18 the smallest denomination (Wei). As such, for ETH on Ethereum mainnet, `decimals` is 18. - In the case of ERC-20 tokens, `decimals` is defined via configuration. `decimals` will be the number returned by `function decimals() public view returns (uint8)` on the underlying token contract.
Not all tokens have a `decimals` field, as this function is [optional in the ERC-20 specification](https://eips.ethereum.org/EIPS/eip-20#decimals). This field will be left empty if the underlying token contract doesn't implement `decimals`.
Further, this endpoint will only populate this value for a small subset of whitelisted ERC-20 tokens at this time. We intend to improve coverage in the future. */
  decimals: number;
}

/**
 * General information about a token. Includes the type, the network, and other identifying information.
 */
export interface Token {
  network: ListEvmTokenBalancesNetwork;
  /** The symbol of this token (ex: SOL, ETH, USDC).
The token symbol is not unique. It is possible for two different tokens to have the same symbol.
For native gas tokens, this symbol is defined via convention. As an example, for ETH on Ethereum mainnet, the symbol is "ETH". For ERC-20 tokens, this symbol is defined via configuration. `symbol` will be the string returned by `function symbol() public view returns (string)` on the underlying token contract.
Not all tokens have a symbol, as this function is [optional in the ERC-20 specification](https://eips.ethereum.org/EIPS/eip-20#symbol). This field will only be populated when the token's underlying ERC-20 contract has a `symbol()` function.
Further, this endpoint will only populate this value for a small subset of whitelisted ERC-20 tokens at this time. We intend to improve coverage in the future. */
  symbol?: string;
  /** The name of this token (ex: "Solana", "Ether", "USD Coin").
The token name is not unique. It is possible for two different tokens to have the same name.
For native gas tokens, this name is defined via convention. As an example, for ETH on Ethereum mainnet, the name is "Ether". For ERC-20 tokens, this name is defined via configuration. `name` will be the string returned by `function name() public view returns (string)` on the underlying token contract.
Not all tokens have a name, as this function is [optional in the ERC-20 specification](https://eips.ethereum.org/EIPS/eip-20#name). This field will only be populated when the token's underlying ERC-20 contract has a `name()` function.
Further, this endpoint will only populate this value for a small subset of whitelisted ERC-20 tokens at this time. We intend to improve coverage in the future. */
  name?: string;
  /**
   * The contract address of the token.
For Ether, the contract address is `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` per [EIP-7528](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7528.md). For ERC-20 tokens, this is the contract address where the token is deployed.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  contractAddress: string;
}

export interface TokenBalance {
  amount: TokenAmount;
  token: Token;
}

/**
 * The type of criterion to use. This should be `ethValue`.
 */
export type EthValueCriterionType =
  (typeof EthValueCriterionType)[keyof typeof EthValueCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EthValueCriterionType = {
  ethValue: "ethValue",
} as const;

/**
 * The operator to use for the comparison. The transaction's `value` field will be on the left-hand side of the operator, and the `ethValue` field will be on the right-hand side.
 */
export type EthValueCriterionOperator =
  (typeof EthValueCriterionOperator)[keyof typeof EthValueCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EthValueCriterionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * A schema for specifying a criterion for the `value` field of an EVM transaction.
 */
export interface EthValueCriterion {
  /** The type of criterion to use. This should be `ethValue`. */
  type: EthValueCriterionType;
  /**
   * The amount of ETH, in wei, that the transaction's `value` field should be compared to.
   * @maxLength 78
   * @pattern ^[0-9]+$
   */
  ethValue: string;
  /** The operator to use for the comparison. The transaction's `value` field will be on the left-hand side of the operator, and the `ethValue` field will be on the right-hand side. */
  operator: EthValueCriterionOperator;
}

/**
 * The type of criterion to use. This should be `evmAddress`.
 */
export type EvmAddressCriterionType =
  (typeof EvmAddressCriterionType)[keyof typeof EvmAddressCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmAddressCriterionType = {
  evmAddress: "evmAddress",
} as const;

/**
 * The operator to use for the comparison. The transaction's `to` field will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type EvmAddressCriterionOperator =
  (typeof EvmAddressCriterionOperator)[keyof typeof EvmAddressCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmAddressCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * A schema for specifying a criterion for the `to` field of an EVM transaction.
 */
export interface EvmAddressCriterion {
  /** The type of criterion to use. This should be `evmAddress`. */
  type: EvmAddressCriterionType;
  /** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of 300 addresses per criterion. */
  addresses: string[];
  /** The operator to use for the comparison. The transaction's `to` field will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: EvmAddressCriterionOperator;
}

/**
 * A reference to an established EIP standard. When referencing a `KnownAbiType` within a policy rule configuring an `EvmDataCriterion`, criteria will only decode function data officially documented in the standard. For more information on supported token standards, see the links below.
  - [erc20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20).
  - [erc721 - Non-Fungible Token Standard](https://eips.ethereum.org/EIPS/eip-721).
  - [erc1155 - Multi Token Standard](https://eips.ethereum.org/EIPS/eip-1155).
 */
export type KnownAbiType = (typeof KnownAbiType)[keyof typeof KnownAbiType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const KnownAbiType = {
  erc20: "erc20",
  erc721: "erc721",
  erc1155: "erc1155",
} as const;

/**
 * Parameter definition for ABI functions, errors, and constructors.
 */
export interface AbiParameter {
  /** The name of the parameter. */
  name?: string;
  /** The canonical type of the parameter. */
  type: string;
  /** The internal Solidity type used by the compiler. */
  internalType?: string;
  /** Used for tuple types. */
  components?: AbiParameter[];
}

/**
 * State mutability of a function in Solidity.
 */
export type AbiStateMutability = (typeof AbiStateMutability)[keyof typeof AbiStateMutability];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AbiStateMutability = {
  pure: "pure",
  view: "view",
  nonpayable: "nonpayable",
  payable: "payable",
} as const;

/**
 * The type of the ABI item, must be `function`.
 */
export type AbiFunctionType = (typeof AbiFunctionType)[keyof typeof AbiFunctionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AbiFunctionType = {
  function: "function",
} as const;

/**
 * ABI function type for contract functions.
 */
export interface AbiFunction {
  /** The type of the ABI item, must be `function`. */
  type: AbiFunctionType;
  /** The name of the ABI function. */
  name: string;
  /** The list of ABI parameters used for this function. */
  inputs: AbiParameter[];
  /** The values returned by this function. */
  outputs: AbiParameter[];
  /** Deprecated. Use pure or view from stateMutability instead. */
  constant?: boolean;
  /** Deprecated. Use payable or nonpayable from `stateMutability` instead. */
  payable?: boolean;
  stateMutability: AbiStateMutability;
  /** Deprecated. Vyper used to provide gas estimates. */
  gas?: number;
}

/**
 * The type of the ABI item.
 */
export type AbiInputType = (typeof AbiInputType)[keyof typeof AbiInputType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AbiInputType = {
  constructor: "constructor",
  error: "error",
  event: "event",
  fallback: "fallback",
  receive: "receive",
} as const;

/**
 * Generic ABI item type encapsulating all other types besides `function`.
 */
export interface AbiInput {
  /** The type of the ABI item. */
  type: AbiInputType;
  /** For additional information on the ABI JSON specification, see [the Solidity documentation](https://docs.soliditylang.org/en/latest/abi-spec.html#json). */
  additionalProperties?: unknown;
}

export type AbiItem = AbiFunction | AbiInput;

/**
 * Contract ABI Specification following Solidity's external JSON interface format.
 */
export type Abi = AbiItem[];

/**
 * The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side.
 */
export type EvmDataParameterConditionOperator =
  (typeof EvmDataParameterConditionOperator)[keyof typeof EvmDataParameterConditionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmDataParameterConditionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

export interface EvmDataParameterCondition {
  /** The name of the parameter to check against a transaction's calldata. If name is unknown, or is not named, you may supply an array index, e.g., `0` for first parameter. */
  name: string;
  /** The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side. */
  operator: EvmDataParameterConditionOperator;
  /** A single value to compare the value resolved at `name` to. All values are encoded as strings. Refer to the table in the documentation for how values should be encoded, and which operators are supported for each type. */
  value: string;
}

/**
 * The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `values` field will be on the right-hand side.
 */
export type EvmDataParameterConditionListOperator =
  (typeof EvmDataParameterConditionListOperator)[keyof typeof EvmDataParameterConditionListOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmDataParameterConditionListOperator = {
  in: "in",
  not_in: "not in",
} as const;

export interface EvmDataParameterConditionList {
  /** The name of the parameter to check against a transaction's calldata. If name is unknown, or is not named, you may supply an array index, e.g., `0` for first parameter. */
  name: string;
  /** The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `values` field will be on the right-hand side. */
  operator: EvmDataParameterConditionListOperator;
  /** Values to compare against the resolved `name` value. All values are encoded as strings. Refer to the table in the documentation for how values should be encoded, and which operators are supported for each type. */
  values: string[];
}

/**
 * A list of parameter conditions to apply against encoded arguments in the transaction's `data` field.
 */
export type EvmDataConditionParamsItem = EvmDataParameterCondition | EvmDataParameterConditionList;

/**
 * A single condition to apply against the function and encoded arguments in the transaction's `data` field. Each `parameter` configuration must be successfully evaluated against the corresponding function argument in order for a policy to be accepted.
 */
export interface EvmDataCondition {
  /** The name of a smart contract function being called. */
  function: string;
  /** An optional list of parameter conditions to apply against encoded arguments in the transaction's `data` field. */
  params?: EvmDataConditionParamsItem[];
}

/**
 * The type of criterion to use. This should be `evmData`.
 */
export type EvmDataCriterionType = (typeof EvmDataCriterionType)[keyof typeof EvmDataCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmDataCriterionType = {
  evmData: "evmData",
} as const;

/**
 * The ABI of the smart contract being called. This can be a partial structure with only specific functions.
 */
export type EvmDataCriterionAbi = KnownAbiType | Abi;

/**
 * A schema for specifying a criterion for the `data` field of an EVM transaction.
 */
export interface EvmDataCriterion {
  /** The type of criterion to use. This should be `evmData`. */
  type: EvmDataCriterionType;
  /** The ABI of the smart contract being called. This can be a partial structure with only specific functions. */
  abi: EvmDataCriterionAbi;
  /** A list of conditions to apply against the function and encoded arguments in the transaction's `data` field. Each condition must be met in order for this policy to be accepted or rejected. */
  conditions: EvmDataCondition[];
}

/**
 * The type of criterion to use. This should be `netUSDChange`.
 */
export type NetUSDChangeCriterionType =
  (typeof NetUSDChangeCriterionType)[keyof typeof NetUSDChangeCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NetUSDChangeCriterionType = {
  netUSDChange: "netUSDChange",
} as const;

/**
 * The operator to use for the comparison. The total value of a transaction's asset transfer will be on the left-hand side of the operator, and the `changeCents` field will be on the right-hand side.
 */
export type NetUSDChangeCriterionOperator =
  (typeof NetUSDChangeCriterionOperator)[keyof typeof NetUSDChangeCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NetUSDChangeCriterionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * A schema for specifying a criterion for the USD denominated asset transfer or exposure for a transaction. This includes native transfers, as well as token transfers.
 */
export interface NetUSDChangeCriterion {
  /** The type of criterion to use. This should be `netUSDChange`. */
  type: NetUSDChangeCriterionType;
  /** The amount of USD, in cents, that the total value of a transaction's asset transfer should be compared to. */
  changeCents: number;
  /** The operator to use for the comparison. The total value of a transaction's asset transfer will be on the left-hand side of the operator, and the `changeCents` field will be on the right-hand side. */
  operator: NetUSDChangeCriterionOperator;
}

export type SignEvmTransactionCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the SignEvmTransaction operation.
 */
export type SignEvmTransactionCriteria = SignEvmTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEvmTransactionRuleAction =
  (typeof SignEvmTransactionRuleAction)[keyof typeof SignEvmTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEvmTransactionRuleOperation =
  (typeof SignEvmTransactionRuleOperation)[keyof typeof SignEvmTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTransactionRuleOperation = {
  signEvmTransaction: "signEvmTransaction",
} as const;

export interface SignEvmTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEvmTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEvmTransactionRuleOperation;
  criteria: SignEvmTransactionCriteria;
}

/**
 * The type of criterion to use. This should be `evmNetwork`.
 */
export type EvmNetworkCriterionType =
  (typeof EvmNetworkCriterionType)[keyof typeof EvmNetworkCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmNetworkCriterionType = {
  evmNetwork: "evmNetwork",
} as const;

/**
 * The network the transaction is for.
 */
export type EvmNetworkCriterionNetworksItem =
  (typeof EvmNetworkCriterionNetworksItem)[keyof typeof EvmNetworkCriterionNetworksItem];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmNetworkCriterionNetworksItem = {
  "base-sepolia": "base-sepolia",
  base: "base",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
  avalanche: "avalanche",
  polygon: "polygon",
  optimism: "optimism",
  arbitrum: "arbitrum",
  "arbitrum-sepolia": "arbitrum-sepolia",
  zora: "zora",
  bnb: "bnb",
  world: "world",
  "world-sepolia": "world-sepolia",
} as const;

/**
 * The operator to use for the comparison. The transaction's intended `network` will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side.
 */
export type EvmNetworkCriterionOperator =
  (typeof EvmNetworkCriterionOperator)[keyof typeof EvmNetworkCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmNetworkCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * A schema for specifying a criterion for the intended `network` of an EVM transaction.
 */
export interface EvmNetworkCriterion {
  /** The type of criterion to use. This should be `evmNetwork`. */
  type: EvmNetworkCriterionType;
  /** A list of EVM network identifiers that the transaction's intended `network` should be compared to. */
  networks: EvmNetworkCriterionNetworksItem[];
  /** The operator to use for the comparison. The transaction's intended `network` will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side. */
  operator: EvmNetworkCriterionOperator;
}

export type SendEvmTransactionCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the SignEvmTransaction operation.
 */
export type SendEvmTransactionCriteria = SendEvmTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEvmTransactionRuleAction =
  (typeof SendEvmTransactionRuleAction)[keyof typeof SendEvmTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEvmTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEvmTransactionRuleOperation =
  (typeof SendEvmTransactionRuleOperation)[keyof typeof SendEvmTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEvmTransactionRuleOperation = {
  sendEvmTransaction: "sendEvmTransaction",
} as const;

export interface SendEvmTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEvmTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEvmTransactionRuleOperation;
  criteria: SendEvmTransactionCriteria;
}

/**
 * The type of criterion to use. This should be `evmMessage`.
 */
export type EvmMessageCriterionType =
  (typeof EvmMessageCriterionType)[keyof typeof EvmMessageCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmMessageCriterionType = {
  evmMessage: "evmMessage",
} as const;

/**
 * A schema for specifying a criterion for the message being signed.
 */
export interface EvmMessageCriterion {
  /** The type of criterion to use. This should be `evmMessage`. */
  type: EvmMessageCriterionType;
  /** A regular expression the message is matched against. Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax). */
  match: string;
}

/**
 * A schema for specifying the rejection criteria for the SignEvmMessage operation.
 */
export type SignEvmMessageCriteria = EvmMessageCriterion[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEvmMessageRuleAction =
  (typeof SignEvmMessageRuleAction)[keyof typeof SignEvmMessageRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmMessageRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEvmMessageRuleOperation =
  (typeof SignEvmMessageRuleOperation)[keyof typeof SignEvmMessageRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmMessageRuleOperation = {
  signEvmMessage: "signEvmMessage",
} as const;

export interface SignEvmMessageRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEvmMessageRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEvmMessageRuleOperation;
  criteria: SignEvmMessageCriteria;
}

/**
 * The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type EvmTypedAddressConditionOperator =
  (typeof EvmTypedAddressConditionOperator)[keyof typeof EvmTypedAddressConditionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmTypedAddressConditionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * A schema for specifying criterion for an address field of an EVM typed message. The address can be deeply nested within the typed data's message.
 */
export interface EvmTypedAddressCondition {
  /** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of 300 addresses per criterion. */
  addresses: string[];
  /** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: EvmTypedAddressConditionOperator;
  /** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
  path: string;
}

/**
 * The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `value` field will be on the right-hand side.
 */
export type EvmTypedNumericalConditionOperator =
  (typeof EvmTypedNumericalConditionOperator)[keyof typeof EvmTypedNumericalConditionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmTypedNumericalConditionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * A schema for specifying criterion for a numerical field of an EVM typed message. The value can be deeply nested within the typed data's message.
 */
export interface EvmTypedNumericalCondition {
  /**
   * The amount that the value located at the message's path should be compared to.
   * @pattern ^[0-9]+$
   */
  value: string;
  /** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `value` field will be on the right-hand side. */
  operator: EvmTypedNumericalConditionOperator;
  /** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
  path: string;
}

/**
 * A schema for specifying criterion for a string field of an EVM typed message. The value can be deeply nested within the typed data's message.
 */
export interface EvmTypedStringCondition {
  /** A regular expression the field is matched against. */
  match: string;
  /** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
  path: string;
}

/**
 * The type of criterion to use. This should be `evmTypedDataField`.
 */
export type SignEvmTypedDataFieldCriterionType =
  (typeof SignEvmTypedDataFieldCriterionType)[keyof typeof SignEvmTypedDataFieldCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTypedDataFieldCriterionType = {
  evmTypedDataField: "evmTypedDataField",
} as const;

export type SignEvmTypedDataFieldCriterionTypesTypesItem = {
  /** The name of a key within an EIP-712 data structure. */
  name?: string;
  /** The Solidity type of a value within an EIP-712 data structure. */
  type?: string;
};

/**
 * EIP-712 compliant map of model names to model definitions.
 */
export type SignEvmTypedDataFieldCriterionTypesTypes = {
  [key: string]: SignEvmTypedDataFieldCriterionTypesTypesItem[];
};

/**
 * An object containing EIP-712 type definitions, as well as a primary type for the root message object.
 */
export type SignEvmTypedDataFieldCriterionTypes = {
  /** EIP-712 compliant map of model names to model definitions. */
  types: SignEvmTypedDataFieldCriterionTypesTypes;
  /** The name of the root EIP-712 type. This value must be included in the `types` object. */
  primaryType: string;
};

export type SignEvmTypedDataFieldCriterionConditionsItem =
  | EvmTypedAddressCondition
  | EvmTypedNumericalCondition
  | EvmTypedStringCondition;

export interface SignEvmTypedDataFieldCriterion {
  /** The type of criterion to use. This should be `evmTypedDataField`. */
  type: SignEvmTypedDataFieldCriterionType;
  /** An object containing EIP-712 type definitions, as well as a primary type for the root message object. */
  types: SignEvmTypedDataFieldCriterionTypes;
  /** A list of conditions to check against the data being signed. Each condition must be met for the rule to take effect. */
  conditions: SignEvmTypedDataFieldCriterionConditionsItem[];
}

/**
 * The type of criterion to use. This should be `evmTypedDataVerifyingContract`.
 */
export type SignEvmTypedDataVerifyingContractCriterionType =
  (typeof SignEvmTypedDataVerifyingContractCriterionType)[keyof typeof SignEvmTypedDataVerifyingContractCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTypedDataVerifyingContractCriterionType = {
  evmTypedDataVerifyingContract: "evmTypedDataVerifyingContract",
} as const;

/**
 * The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type SignEvmTypedDataVerifyingContractCriterionOperator =
  (typeof SignEvmTypedDataVerifyingContractCriterionOperator)[keyof typeof SignEvmTypedDataVerifyingContractCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTypedDataVerifyingContractCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * A schema for specifying criterion for a domain's verifying contract.
 */
export interface SignEvmTypedDataVerifyingContractCriterion {
  /** The type of criterion to use. This should be `evmTypedDataVerifyingContract`. */
  type: SignEvmTypedDataVerifyingContractCriterionType;
  /** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of 300 addresses per criterion. */
  addresses: string[];
  /** The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: SignEvmTypedDataVerifyingContractCriterionOperator;
}

export type SignEvmTypedDataCriteriaItem =
  | SignEvmTypedDataFieldCriterion
  | SignEvmTypedDataVerifyingContractCriterion;

/**
 * A schema for specifying criteria for the SignEvmTypedData operation.
 */
export type SignEvmTypedDataCriteria = SignEvmTypedDataCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEvmTypedDataRuleAction =
  (typeof SignEvmTypedDataRuleAction)[keyof typeof SignEvmTypedDataRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTypedDataRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEvmTypedDataRuleOperation =
  (typeof SignEvmTypedDataRuleOperation)[keyof typeof SignEvmTypedDataRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmTypedDataRuleOperation = {
  signEvmTypedData: "signEvmTypedData",
} as const;

export interface SignEvmTypedDataRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEvmTypedDataRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEvmTypedDataRuleOperation;
  criteria: SignEvmTypedDataCriteria;
}

/**
 * The type of criterion to use. This should be `solAddress`.
 */
export type SolAddressCriterionType =
  (typeof SolAddressCriterionType)[keyof typeof SolAddressCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolAddressCriterionType = {
  solAddress: "solAddress",
} as const;

/**
 * The operator to use for the comparison. Each of the native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type SolAddressCriterionOperator =
  (typeof SolAddressCriterionOperator)[keyof typeof SolAddressCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolAddressCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * The criterion for the recipient addresses of a Solana transaction's native transfer instruction.
 */
export interface SolAddressCriterion {
  /** The type of criterion to use. This should be `solAddress`. */
  type: SolAddressCriterionType;
  /** The Solana addresses that are compared to the list of native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
  addresses: string[];
  /** The operator to use for the comparison. Each of the native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: SolAddressCriterionOperator;
}

/**
 * The type of criterion to use. This should be `solValue`.
 */
export type SolValueCriterionType =
  (typeof SolValueCriterionType)[keyof typeof SolValueCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolValueCriterionType = {
  solValue: "solValue",
} as const;

/**
 * The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `solValue` field will be on the right-hand side.
 */
export type SolValueCriterionOperator =
  (typeof SolValueCriterionOperator)[keyof typeof SolValueCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolValueCriterionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * The criterion for the SOL value in lamports of a native transfer instruction in a Solana transaction.
 */
export interface SolValueCriterion {
  /** The type of criterion to use. This should be `solValue`. */
  type: SolValueCriterionType;
  /** The amount of SOL in lamports that the transaction instruction's `value` field should be compared to. */
  solValue: string;
  /** The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `solValue` field will be on the right-hand side. */
  operator: SolValueCriterionOperator;
}

/**
 * The type of criterion to use. This should be `splAddress`.
 */
export type SplAddressCriterionType =
  (typeof SplAddressCriterionType)[keyof typeof SplAddressCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SplAddressCriterionType = {
  splAddress: "splAddress",
} as const;

/**
 * The operator to use for the comparison. Each of the SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type SplAddressCriterionOperator =
  (typeof SplAddressCriterionOperator)[keyof typeof SplAddressCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SplAddressCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * The criterion for the recipient addresses of a Solana transaction's SPL token transfer instructions.
 */
export interface SplAddressCriterion {
  /** The type of criterion to use. This should be `splAddress`. */
  type: SplAddressCriterionType;
  /** The Solana addresses that are compared to the list of SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
  addresses: string[];
  /** The operator to use for the comparison. Each of the SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: SplAddressCriterionOperator;
}

/**
 * The type of criterion to use. This should be `splValue`.
 */
export type SplValueCriterionType =
  (typeof SplValueCriterionType)[keyof typeof SplValueCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SplValueCriterionType = {
  splValue: "splValue",
} as const;

/**
 * The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `splValue` field will be on the right-hand side.
 */
export type SplValueCriterionOperator =
  (typeof SplValueCriterionOperator)[keyof typeof SplValueCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SplValueCriterionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * The criterion for the SPL token value of a SPL token transfer instruction in a Solana transaction.
 */
export interface SplValueCriterion {
  /** The type of criterion to use. This should be `splValue`. */
  type: SplValueCriterionType;
  /** The amount of the SPL token that the transaction instruction's `value` field should be compared to. */
  splValue: string;
  /** The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `splValue` field will be on the right-hand side. */
  operator: SplValueCriterionOperator;
}

/**
 * The type of criterion to use. This should be `mintAddress`.
 */
export type MintAddressCriterionType =
  (typeof MintAddressCriterionType)[keyof typeof MintAddressCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const MintAddressCriterionType = {
  mintAddress: "mintAddress",
} as const;

/**
 * The operator to use for the comparison. Each of the token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
 */
export type MintAddressCriterionOperator =
  (typeof MintAddressCriterionOperator)[keyof typeof MintAddressCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const MintAddressCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * The criterion for the token mint addresses of a Solana transaction's SPL token transfer instructions.
 */
export interface MintAddressCriterion {
  /** The type of criterion to use. This should be `mintAddress`. */
  type: MintAddressCriterionType;
  /** The Solana addresses that are compared to the list of token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
  addresses: string[];
  /** The operator to use for the comparison. Each of the token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
  operator: MintAddressCriterionOperator;
}

/**
 * A reference to an established Solana program. When referencing a `KnownIdlType` within a policy rule configuring an `SolDataCriterion`, criteria will decode instruction data as documented in the programs. For more information on supported programs, see the links below.
  - [SystemProgram](https://docs.rs/solana-program/latest/solana_program/system_instruction/enum.SystemInstruction.html).
  - [TokenProgram](https://docs.rs/spl-token/latest/spl_token/instruction/enum.TokenInstruction.html).
  - [AssociatedTokenProgram](https://docs.rs/spl-associated-token-account/latest/spl_associated_token_account/instruction/index.html).
 */
export type KnownIdlType = (typeof KnownIdlType)[keyof typeof KnownIdlType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const KnownIdlType = {
  SystemProgram: "SystemProgram",
  TokenProgram: "TokenProgram",
  AssociatedTokenProgram: "AssociatedTokenProgram",
} as const;

export type IdlInstructionsItemArgsItem = {
  /** The argument name. */
  name: string;
  /** The argument type. */
  type: string;
};

export type IdlInstructionsItemAccountsItem = {
  /** The account name. */
  name: string;
  /** Whether the account is writable. */
  writable?: boolean;
  /** Whether the account must be a signer. */
  signer?: boolean;
};

export type IdlInstructionsItem = {
  /** The instruction name. */
  name: string;
  /**
   * Array of 8 numbers representing the instruction discriminator.
   * @minItems 8
   * @maxItems 8
   */
  discriminator: number[];
  /** List of instruction arguments. */
  args: IdlInstructionsItemArgsItem[];
  /** Optional list of accounts required by the instruction. */
  accounts?: IdlInstructionsItemAccountsItem[];
};

/**
 * Optional metadata about the IDL.
 */
export type IdlMetadata = {
  /** The program name. */
  name?: string;
  /** The program version. */
  version?: string;
  /** The IDL specification version. */
  spec?: string;
};

export type IdlTypesItem = { [key: string]: unknown };

/**
 * IDL Specification following Anchor's IDL format v0.30+.
 */
export interface Idl {
  /** The program address. */
  address: string;
  /** List of program instructions. */
  instructions: IdlInstructionsItem[];
  /** Optional metadata about the IDL. */
  metadata?: IdlMetadata;
  /** Optional type definitions for custom data structures used in the program. */
  types?: IdlTypesItem[];
}

/**
 * The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side.
 */
export type SolDataParameterConditionOperator =
  (typeof SolDataParameterConditionOperator)[keyof typeof SolDataParameterConditionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolDataParameterConditionOperator = {
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "==": "==",
} as const;

/**
 * A single parameter condition to apply against a specific instruction's parameters.
 */
export interface SolDataParameterCondition {
  /** The parameter name. */
  name: string;
  /** The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side. */
  operator: SolDataParameterConditionOperator;
  /** The value to compare against. */
  value: string;
}

/**
 * The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side.
 */
export type SolDataParameterConditionListOperator =
  (typeof SolDataParameterConditionListOperator)[keyof typeof SolDataParameterConditionListOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolDataParameterConditionListOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * A single parameter condition to apply against a specific instruction's parameters.
 */
export interface SolDataParameterConditionList {
  /** The parameter name. */
  name: string;
  /** The operator to use for the comparison. The value resolved at the `name` will be on the left-hand side of the operator, and the `value` field will be on the right-hand side. */
  operator: SolDataParameterConditionListOperator;
  /** The values to compare against. */
  values: string[];
}

/**
 * A list of parameter conditions to apply against a specific instruction's data.
 */
export type SolDataConditionParamsItem = SolDataParameterCondition | SolDataParameterConditionList;

/**
 * A single condition to apply against a specific instruction type and its parameters.
 */
export interface SolDataCondition {
  /** The instruction name. */
  instruction: string;
  /** Parameter conditions for the instruction. */
  params?: SolDataConditionParamsItem[];
}

/**
 * The type of criterion to use. This should be `solData`.
 */
export type SolDataCriterionType = (typeof SolDataCriterionType)[keyof typeof SolDataCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolDataCriterionType = {
  solData: "solData",
} as const;

export type SolDataCriterionIdlsItem = KnownIdlType | Idl;

/**
 * A schema for specifying criterion for instruction data in a Solana transaction.
 */
export interface SolDataCriterion {
  /** The type of criterion to use. This should be `solData`. */
  type: SolDataCriterionType;
  /** List of IDL specifications. Can contain known program names (strings) or custom IDL objects. */
  idls: SolDataCriterionIdlsItem[];
  /** A list of conditions to apply against the transaction instruction. Only one condition must evaluate to true for this criterion to be met. */
  conditions: SolDataCondition[];
}

/**
 * The type of criterion to use. This should be `programId`.
 */
export type ProgramIdCriterionType =
  (typeof ProgramIdCriterionType)[keyof typeof ProgramIdCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProgramIdCriterionType = {
  programId: "programId",
} as const;

/**
 * The operator to use for the comparison. Each of the program IDs in the transaction's instructions will be on the left-hand side of the operator, and the `programIds` field will be on the right-hand side.
 */
export type ProgramIdCriterionOperator =
  (typeof ProgramIdCriterionOperator)[keyof typeof ProgramIdCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProgramIdCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * The criterion for the program IDs of a Solana transaction's instructions.
 */
export interface ProgramIdCriterion {
  /** The type of criterion to use. This should be `programId`. */
  type: ProgramIdCriterionType;
  /** The Solana program IDs that are compared to the list of program IDs in the transaction's instructions. */
  programIds: string[];
  /** The operator to use for the comparison. Each of the program IDs in the transaction's instructions will be on the left-hand side of the operator, and the `programIds` field will be on the right-hand side. */
  operator: ProgramIdCriterionOperator;
}

export type SignSolTransactionCriteriaItem =
  | SolAddressCriterion
  | SolValueCriterion
  | SplAddressCriterion
  | SplValueCriterion
  | MintAddressCriterion
  | SolDataCriterion
  | ProgramIdCriterion;

/**
 * A schema for specifying criteria for the SignSolTransaction operation.
 */
export type SignSolTransactionCriteria = SignSolTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignSolTransactionRuleAction =
  (typeof SignSolTransactionRuleAction)[keyof typeof SignSolTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignSolTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignSolTransactionRuleOperation =
  (typeof SignSolTransactionRuleOperation)[keyof typeof SignSolTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignSolTransactionRuleOperation = {
  signSolTransaction: "signSolTransaction",
} as const;

export interface SignSolTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignSolTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignSolTransactionRuleOperation;
  criteria: SignSolTransactionCriteria;
}

/**
 * The type of criterion to use. This should be `solNetwork`.
 */
export type SolNetworkCriterionType =
  (typeof SolNetworkCriterionType)[keyof typeof SolNetworkCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolNetworkCriterionType = {
  solNetwork: "solNetwork",
} as const;

/**
 * The Solana network the transaction is for.
 */
export type SolNetworkCriterionNetworksItem =
  (typeof SolNetworkCriterionNetworksItem)[keyof typeof SolNetworkCriterionNetworksItem];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolNetworkCriterionNetworksItem = {
  "solana-devnet": "solana-devnet",
  solana: "solana",
} as const;

/**
 * The operator to use for the comparison. The transaction's intended network will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side.
 */
export type SolNetworkCriterionOperator =
  (typeof SolNetworkCriterionOperator)[keyof typeof SolNetworkCriterionOperator];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolNetworkCriterionOperator = {
  in: "in",
  not_in: "not in",
} as const;

/**
 * The criterion for the Solana network of a transaction.
 */
export interface SolNetworkCriterion {
  /** The type of criterion to use. This should be `solNetwork`. */
  type: SolNetworkCriterionType;
  /** The Solana networks that the transaction's intended network should be compared to. */
  networks: SolNetworkCriterionNetworksItem[];
  /** The operator to use for the comparison. The transaction's intended network will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side. */
  operator: SolNetworkCriterionOperator;
}

export type SendSolTransactionCriteriaItem =
  | SolAddressCriterion
  | SolValueCriterion
  | SplAddressCriterion
  | SplValueCriterion
  | MintAddressCriterion
  | SolDataCriterion
  | ProgramIdCriterion
  | SolNetworkCriterion;

/**
 * A schema for specifying criteria for the SendSolTransaction operation.
 */
export type SendSolTransactionCriteria = SendSolTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendSolTransactionRuleAction =
  (typeof SendSolTransactionRuleAction)[keyof typeof SendSolTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendSolTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendSolTransactionRuleOperation =
  (typeof SendSolTransactionRuleOperation)[keyof typeof SendSolTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendSolTransactionRuleOperation = {
  sendSolTransaction: "sendSolTransaction",
} as const;

export interface SendSolTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendSolTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendSolTransactionRuleOperation;
  criteria: SendSolTransactionCriteria;
}

/**
 * The type of criterion to use. This should be `solMessage`.
 */
export type SolMessageCriterionType =
  (typeof SolMessageCriterionType)[keyof typeof SolMessageCriterionType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SolMessageCriterionType = {
  solMessage: "solMessage",
} as const;

/**
 * The criterion for the message of a Solana transaction.
 */
export interface SolMessageCriterion {
  /** The type of criterion to use. This should be `solMessage`. */
  type: SolMessageCriterionType;
  /** A regular expression the field is matched against. */
  match: string;
}

/**
 * A schema for specifying criteria for the SignSolMessage operation.
 */
export type SignSolMessageCriteria = SolMessageCriterion[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignSolMessageRuleAction =
  (typeof SignSolMessageRuleAction)[keyof typeof SignSolMessageRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignSolMessageRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignSolMessageRuleOperation =
  (typeof SignSolMessageRuleOperation)[keyof typeof SignSolMessageRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignSolMessageRuleOperation = {
  signSolMessage: "signSolMessage",
} as const;

export interface SignSolMessageRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignSolMessageRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignSolMessageRuleOperation;
  criteria: SignSolMessageCriteria;
}

/**
 * Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria.
 */
export type SignEvmHashRuleAction =
  (typeof SignEvmHashRuleAction)[keyof typeof SignEvmHashRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmHashRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies.
 */
export type SignEvmHashRuleOperation =
  (typeof SignEvmHashRuleOperation)[keyof typeof SignEvmHashRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEvmHashRuleOperation = {
  signEvmHash: "signEvmHash",
} as const;

export interface SignEvmHashRule {
  /** Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria. */
  action: SignEvmHashRuleAction;
  /** The operation to which the rule applies. */
  operation: SignEvmHashRuleOperation;
}

export type PrepareUserOperationCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the PrepareUserOperation operation.
 */
export type PrepareUserOperationCriteria = PrepareUserOperationCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type PrepareUserOperationRuleAction =
  (typeof PrepareUserOperationRuleAction)[keyof typeof PrepareUserOperationRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PrepareUserOperationRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type PrepareUserOperationRuleOperation =
  (typeof PrepareUserOperationRuleOperation)[keyof typeof PrepareUserOperationRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PrepareUserOperationRuleOperation = {
  prepareUserOperation: "prepareUserOperation",
} as const;

export interface PrepareUserOperationRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: PrepareUserOperationRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: PrepareUserOperationRuleOperation;
  criteria: PrepareUserOperationCriteria;
}

export type SendUserOperationCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the SendUserOperation operation.
 */
export type SendUserOperationCriteria = SendUserOperationCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendUserOperationRuleAction =
  (typeof SendUserOperationRuleAction)[keyof typeof SendUserOperationRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendUserOperationRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendUserOperationRuleOperation =
  (typeof SendUserOperationRuleOperation)[keyof typeof SendUserOperationRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendUserOperationRuleOperation = {
  sendUserOperation: "sendUserOperation",
} as const;

export interface SendUserOperationRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendUserOperationRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendUserOperationRuleOperation;
  criteria: SendUserOperationCriteria;
}

export type SignEndUserEvmTransactionCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the signEndUserEvmTransaction operation.
 */
export type SignEndUserEvmTransactionCriteria = SignEndUserEvmTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEndUserEvmTransactionRuleAction =
  (typeof SignEndUserEvmTransactionRuleAction)[keyof typeof SignEndUserEvmTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEndUserEvmTransactionRuleOperation =
  (typeof SignEndUserEvmTransactionRuleOperation)[keyof typeof SignEndUserEvmTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmTransactionRuleOperation = {
  signEndUserEvmTransaction: "signEndUserEvmTransaction",
} as const;

export interface SignEndUserEvmTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEndUserEvmTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEndUserEvmTransactionRuleOperation;
  criteria: SignEndUserEvmTransactionCriteria;
}

export type SendEndUserEvmTransactionCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the sendEndUserEvmTransaction operation.
 */
export type SendEndUserEvmTransactionCriteria = SendEndUserEvmTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEndUserEvmTransactionRuleAction =
  (typeof SendEndUserEvmTransactionRuleAction)[keyof typeof SendEndUserEvmTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserEvmTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEndUserEvmTransactionRuleOperation =
  (typeof SendEndUserEvmTransactionRuleOperation)[keyof typeof SendEndUserEvmTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserEvmTransactionRuleOperation = {
  sendEndUserEvmTransaction: "sendEndUserEvmTransaction",
} as const;

export interface SendEndUserEvmTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEndUserEvmTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEndUserEvmTransactionRuleOperation;
  criteria: SendEndUserEvmTransactionCriteria;
}

/**
 * A schema for specifying criteria for the signEndUserEvmMessage operation.
 */
export type SignEndUserEvmMessageCriteria = EvmMessageCriterion[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEndUserEvmMessageRuleAction =
  (typeof SignEndUserEvmMessageRuleAction)[keyof typeof SignEndUserEvmMessageRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmMessageRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEndUserEvmMessageRuleOperation =
  (typeof SignEndUserEvmMessageRuleOperation)[keyof typeof SignEndUserEvmMessageRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmMessageRuleOperation = {
  signEndUserEvmMessage: "signEndUserEvmMessage",
} as const;

export interface SignEndUserEvmMessageRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEndUserEvmMessageRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEndUserEvmMessageRuleOperation;
  criteria: SignEndUserEvmMessageCriteria;
}

export type SignEndUserEvmTypedDataCriteriaItem =
  | SignEvmTypedDataFieldCriterion
  | SignEvmTypedDataVerifyingContractCriterion;

/**
 * A schema for specifying criteria for the signEndUserEvmTypedData operation.
 */
export type SignEndUserEvmTypedDataCriteria = SignEndUserEvmTypedDataCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEndUserEvmTypedDataRuleAction =
  (typeof SignEndUserEvmTypedDataRuleAction)[keyof typeof SignEndUserEvmTypedDataRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmTypedDataRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEndUserEvmTypedDataRuleOperation =
  (typeof SignEndUserEvmTypedDataRuleOperation)[keyof typeof SignEndUserEvmTypedDataRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmTypedDataRuleOperation = {
  signEndUserEvmTypedData: "signEndUserEvmTypedData",
} as const;

export interface SignEndUserEvmTypedDataRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEndUserEvmTypedDataRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEndUserEvmTypedDataRuleOperation;
  criteria: SignEndUserEvmTypedDataCriteria;
}

/**
 * Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria.
 */
export type SignEndUserEvmHashRuleAction =
  (typeof SignEndUserEvmHashRuleAction)[keyof typeof SignEndUserEvmHashRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmHashRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies.
 */
export type SignEndUserEvmHashRuleOperation =
  (typeof SignEndUserEvmHashRuleOperation)[keyof typeof SignEndUserEvmHashRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserEvmHashRuleOperation = {
  signEndUserEvmHash: "signEndUserEvmHash",
} as const;

export interface SignEndUserEvmHashRule {
  /** Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria. */
  action: SignEndUserEvmHashRuleAction;
  /** The operation to which the rule applies. */
  operation: SignEndUserEvmHashRuleOperation;
}

export type SignEndUserSolTransactionCriteriaItem =
  | SolAddressCriterion
  | SolValueCriterion
  | SplAddressCriterion
  | SplValueCriterion
  | MintAddressCriterion
  | SolDataCriterion
  | ProgramIdCriterion;

/**
 * A schema for specifying criteria for the signEndUserSolTransaction operation.
 */
export type SignEndUserSolTransactionCriteria = SignEndUserSolTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEndUserSolTransactionRuleAction =
  (typeof SignEndUserSolTransactionRuleAction)[keyof typeof SignEndUserSolTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserSolTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEndUserSolTransactionRuleOperation =
  (typeof SignEndUserSolTransactionRuleOperation)[keyof typeof SignEndUserSolTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserSolTransactionRuleOperation = {
  signEndUserSolTransaction: "signEndUserSolTransaction",
} as const;

export interface SignEndUserSolTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEndUserSolTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEndUserSolTransactionRuleOperation;
  criteria: SignEndUserSolTransactionCriteria;
}

export type SendEndUserSolTransactionCriteriaItem =
  | SolAddressCriterion
  | SolValueCriterion
  | SplAddressCriterion
  | SplValueCriterion
  | MintAddressCriterion
  | SolDataCriterion
  | ProgramIdCriterion
  | SolNetworkCriterion;

/**
 * A schema for specifying criteria for the sendEndUserSolTransaction operation.
 */
export type SendEndUserSolTransactionCriteria = SendEndUserSolTransactionCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEndUserSolTransactionRuleAction =
  (typeof SendEndUserSolTransactionRuleAction)[keyof typeof SendEndUserSolTransactionRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserSolTransactionRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEndUserSolTransactionRuleOperation =
  (typeof SendEndUserSolTransactionRuleOperation)[keyof typeof SendEndUserSolTransactionRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserSolTransactionRuleOperation = {
  sendEndUserSolTransaction: "sendEndUserSolTransaction",
} as const;

export interface SendEndUserSolTransactionRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEndUserSolTransactionRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEndUserSolTransactionRuleOperation;
  criteria: SendEndUserSolTransactionCriteria;
}

/**
 * A schema for specifying criteria for the signEndUserSolMessage operation.
 */
export type SignEndUserSolMessageCriteria = SolMessageCriterion[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SignEndUserSolMessageRuleAction =
  (typeof SignEndUserSolMessageRuleAction)[keyof typeof SignEndUserSolMessageRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserSolMessageRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SignEndUserSolMessageRuleOperation =
  (typeof SignEndUserSolMessageRuleOperation)[keyof typeof SignEndUserSolMessageRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SignEndUserSolMessageRuleOperation = {
  signEndUserSolMessage: "signEndUserSolMessage",
} as const;

export interface SignEndUserSolMessageRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SignEndUserSolMessageRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SignEndUserSolMessageRuleOperation;
  criteria: SignEndUserSolMessageCriteria;
}

export type SendEndUserEvmAssetCriteriaItem =
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the sendEndUserEvmAsset operation.
 */
export type SendEndUserEvmAssetCriteria = SendEndUserEvmAssetCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEndUserEvmAssetRuleAction =
  (typeof SendEndUserEvmAssetRuleAction)[keyof typeof SendEndUserEvmAssetRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserEvmAssetRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEndUserEvmAssetRuleOperation =
  (typeof SendEndUserEvmAssetRuleOperation)[keyof typeof SendEndUserEvmAssetRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserEvmAssetRuleOperation = {
  sendEndUserEvmAsset: "sendEndUserEvmAsset",
} as const;

export interface SendEndUserEvmAssetRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEndUserEvmAssetRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEndUserEvmAssetRuleOperation;
  criteria: SendEndUserEvmAssetCriteria;
}

export type SendEndUserSolAssetCriteriaItem =
  | SplAddressCriterion
  | SplValueCriterion
  | SolDataCriterion
  | SolNetworkCriterion;

/**
 * A schema for specifying criteria for the sendEndUserSolAsset operation.
 */
export type SendEndUserSolAssetCriteria = SendEndUserSolAssetCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEndUserSolAssetRuleAction =
  (typeof SendEndUserSolAssetRuleAction)[keyof typeof SendEndUserSolAssetRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserSolAssetRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEndUserSolAssetRuleOperation =
  (typeof SendEndUserSolAssetRuleOperation)[keyof typeof SendEndUserSolAssetRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserSolAssetRuleOperation = {
  sendEndUserSolAsset: "sendEndUserSolAsset",
} as const;

export interface SendEndUserSolAssetRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEndUserSolAssetRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEndUserSolAssetRuleOperation;
  criteria: SendEndUserSolAssetCriteria;
}

export type SendEndUserOperationCriteriaItem =
  | EthValueCriterion
  | EvmAddressCriterion
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the sendEndUserOperation operation.
 */
export type SendEndUserOperationCriteria = SendEndUserOperationCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type SendEndUserOperationRuleAction =
  (typeof SendEndUserOperationRuleAction)[keyof typeof SendEndUserOperationRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserOperationRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type SendEndUserOperationRuleOperation =
  (typeof SendEndUserOperationRuleOperation)[keyof typeof SendEndUserOperationRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEndUserOperationRuleOperation = {
  sendEndUserOperation: "sendEndUserOperation",
} as const;

export interface SendEndUserOperationRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: SendEndUserOperationRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: SendEndUserOperationRuleOperation;
  criteria: SendEndUserOperationCriteria;
}

export type CreateEndUserEvmSwapCriteriaItem =
  | EvmNetworkCriterion
  | EvmDataCriterion
  | NetUSDChangeCriterion;

/**
 * A schema for specifying criteria for the createEndUserEvmSwap operation.
 */
export type CreateEndUserEvmSwapCriteria = CreateEndUserEvmSwapCriteriaItem[];

/**
 * Whether matching the rule will cause the request to be rejected or accepted.
 */
export type CreateEndUserEvmSwapRuleAction =
  (typeof CreateEndUserEvmSwapRuleAction)[keyof typeof CreateEndUserEvmSwapRuleAction];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreateEndUserEvmSwapRuleAction = {
  reject: "reject",
  accept: "accept",
} as const;

/**
 * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
 */
export type CreateEndUserEvmSwapRuleOperation =
  (typeof CreateEndUserEvmSwapRuleOperation)[keyof typeof CreateEndUserEvmSwapRuleOperation];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreateEndUserEvmSwapRuleOperation = {
  createEndUserEvmSwap: "createEndUserEvmSwap",
} as const;

export interface CreateEndUserEvmSwapRule {
  /** Whether matching the rule will cause the request to be rejected or accepted. */
  action: CreateEndUserEvmSwapRuleAction;
  /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
  operation: CreateEndUserEvmSwapRuleOperation;
  criteria: CreateEndUserEvmSwapCriteria;
}

/**
 * A rule that limits the behavior of an account.
 */
export type Rule =
  | SignEvmTransactionRule
  | SendEvmTransactionRule
  | SignEvmMessageRule
  | SignEvmTypedDataRule
  | SignSolTransactionRule
  | SendSolTransactionRule
  | SignSolMessageRule
  | SignEvmHashRule
  | PrepareUserOperationRule
  | SendUserOperationRule
  | SignEndUserEvmTransactionRule
  | SendEndUserEvmTransactionRule
  | SignEndUserEvmMessageRule
  | SignEndUserEvmTypedDataRule
  | SignEndUserEvmHashRule
  | SignEndUserSolTransactionRule
  | SendEndUserSolTransactionRule
  | SignEndUserSolMessageRule
  | SendEndUserEvmAssetRule
  | SendEndUserSolAssetRule
  | SendEndUserOperationRule
  | CreateEndUserEvmSwapRule;

/**
 * The scope of the policy. Only one project-level policy can exist at any time.
 */
export type PolicyScope = (typeof PolicyScope)[keyof typeof PolicyScope];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PolicyScope = {
  project: "project",
  account: "account",
} as const;

export interface Policy {
  /**
   * The unique identifier for the policy.
   * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
   */
  id: string;
  /**
   * An optional human-readable description of the policy.
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
   * @pattern ^[A-Za-z0-9 ,.]{1,50}$
   */
  description?: string;
  /** The scope of the policy. Only one project-level policy can exist at any time. */
  scope: PolicyScope;
  /** A list of rules that comprise the policy. */
  rules: Rule[];
  /** The ISO 8601 timestamp at which the Policy was created. */
  createdAt: string;
  /** The ISO 8601 timestamp at which the Policy was last updated. */
  updatedAt: string;
}

export interface SolanaAccount {
  /**
   * The base58 encoded Solana address.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names are guaranteed to be unique across all Solana accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /** The list of policy IDs that apply to the account. This will include both the project-level policy and the account-level policy, if one exists. */
  policies?: string[];
  /** The ISO 8601 UTC timestamp at which the account was created. */
  createdAt?: string;
  /** The ISO 8601 UTC timestamp at which the account was last updated. */
  updatedAt?: string;
}

/**
 * The name of the supported Solana networks in human-readable format.
 */
export type ListSolanaTokenBalancesNetwork =
  (typeof ListSolanaTokenBalancesNetwork)[keyof typeof ListSolanaTokenBalancesNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ListSolanaTokenBalancesNetwork = {
  solana: "solana",
  "solana-devnet": "solana-devnet",
} as const;

/**
 * Amount of a given Solana token.
 */
export interface SolanaTokenAmount {
  /**
   * The amount is denominated in the smallest indivisible unit of the token. For SOL, the smallest indivisible unit is lamports (10^-9 SOL). For SPL tokens, the smallest unit is defined by the token's decimals configuration.
   * @pattern ^[0-9]+$
   */
  amount: string;
  /** 'decimals' is the exponential value N that satisfies the equation `amount * 10^-N = standard_denomination`. The standard denomination is the most commonly used denomination for the token.
- For native SOL, `decimals` is 9 (1 SOL = 10^9 lamports). - For SPL tokens, `decimals` is defined in the token's mint configuration. */
  decimals: number;
}

/**
 * General information about a Solana token. Includes the mint address, and other identifying information.
 */
export interface SolanaToken {
  /** The symbol of this token (ex: SOL, USDC, RAY).
The token symbol is not unique. It is possible for two different tokens to have the same symbol.
For the native SOL token, this symbol is "SOL". For SPL tokens, this symbol is defined in the token's metadata.
Not all tokens have a symbol. This field will only be populated when the token has metadata available. */
  symbol?: string;
  /** The name of this token (ex: "Solana", "USD Coin", "Raydium").
The token name is not unique. It is possible for two different tokens to have the same name.
For the native SOL token, this name is "Solana". For SPL tokens, this name is defined in the token's metadata.
Not all tokens have a name. This field will only be populated when the token has metadata available. */
  name?: string;
  /**
   * The mint address of the token.
For native SOL, the mint address is `So11111111111111111111111111111111111111111`. For SPL tokens, this is the mint address where the token is defined.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  mintAddress: string;
}

export interface SolanaTokenBalance {
  amount: SolanaTokenAmount;
  token: SolanaToken;
}

/**
 * Enables control over how often queries need to be fully re-executed on the backing store.
This can be useful in scenarios where API calls might be made frequently, API latency is critical, and some freshness lag (ex: 750ms, 2s, 5s) is tolerable.
By default, each query result is returned from cache so long as the result is from an identical query and less than 500ms old. This freshness tolerance can be modified upwards, to a maximum of 900000ms (i.e. 900s, 15m).

 */
export type OnchainDataQueryCache = {
  /**
   * The maximum tolerable staleness of the query result cache in milliseconds. If a previous execution result of an identical query is older than this age, the query will be re-executed. If the data is less than this age, the result will be returned from cache.
   * @minimum 500
   * @maximum 900000
   */
  maxAgeMs?: number;
};

/**
 * Request to execute a SQL query against indexed blockchain data.
 */
export interface OnchainDataQuery {
  /**
   * SQL query to execute against the indexed blockchain data.
   * @minLength 1
   * @maxLength 100000
   */
  sql: string;
  /** Enables control over how often queries need to be fully re-executed on the backing store.
This can be useful in scenarios where API calls might be made frequently, API latency is critical, and some freshness lag (ex: 750ms, 2s, 5s) is tolerable.
By default, each query result is returned from cache so long as the result is from an identical query and less than 500ms old. This freshness tolerance can be modified upwards, to a maximum of 900000ms (i.e. 900s, 15m).
 */
  cache?: OnchainDataQueryCache;
}

/**
 * Row data with column names as keys.
 */
export type OnchainDataResultResultItem = { [key: string]: unknown };

/**
 * Column data type (ClickHouse types).
 */
export type OnchainDataResultSchemaColumnsItemType =
  (typeof OnchainDataResultSchemaColumnsItemType)[keyof typeof OnchainDataResultSchemaColumnsItemType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnchainDataResultSchemaColumnsItemType = {
  String: "String",
  UInt8: "UInt8",
  UInt16: "UInt16",
  UInt32: "UInt32",
  UInt64: "UInt64",
  UInt128: "UInt128",
  UInt256: "UInt256",
  Int8: "Int8",
  Int16: "Int16",
  Int32: "Int32",
  Int64: "Int64",
  Int128: "Int128",
  Int256: "Int256",
  Float32: "Float32",
  Float64: "Float64",
  Bool: "Bool",
  Date: "Date",
  DateTime: "DateTime",
  DateTime64: "DateTime64",
  UUID: "UUID",
} as const;

export type OnchainDataResultSchemaColumnsItem = {
  /** Column name. */
  name?: string;
  /** Column data type (ClickHouse types). */
  type?: OnchainDataResultSchemaColumnsItemType;
};

/**
 * Schema information for the query result. This is a derived schema from the query result, so types may not match the underlying table.

 */
export type OnchainDataResultSchema = {
  /** Column definitions. */
  columns?: OnchainDataResultSchemaColumnsItem[];
};

/**
 * Metadata about query execution.
 */
export type OnchainDataResultMetadata = {
  /** Whether the result was served from the query result cache. */
  cached?: boolean;
  /** When the query result was executed against the backing store in RFC 3339 format. */
  executionTimestamp?: string;
  /** Query execution time in milliseconds. */
  executionTimeMs?: number;
  /** Number of rows returned. */
  rowCount?: number;
};

/**
 * Result of executing a SQL query.
 */
export interface OnchainDataResult {
  /** Query result as an array of objects representing rows. */
  result?: OnchainDataResultResultItem[];
  /** Schema information for the query result. This is a derived schema from the query result, so types may not match the underlying table.
   */
  schema?: OnchainDataResultSchema;
  /** Metadata about query execution. */
  metadata?: OnchainDataResultMetadata;
}

/**
 * A human-readable description.
 * @minLength 0
 * @maxLength 500
 */
export type Description = string;

/**
 * Schema definition for a table column.
 */
export interface OnchainDataColumnSchema {
  /** Column name. */
  name?: string;
  /** Column data type. */
  type?: string;
  /** Whether this column can contain NULL values. */
  nullable?: boolean;
  /** Human-readable description of the column. */
  description?: Description;
  /** The order of the column in the index. A lower number means the column is more important for the index and should be first in the query. */
  indexOrder?: number;
}

/**
 * Schema definition for a data table.
 */
export interface OnchainDataTableSchema {
  /** The blockchain network database this table belongs to. */
  database?: string;
  /** Table name. */
  table?: string;
  /** Column definitions for this table. */
  columns?: OnchainDataColumnSchema[];
}

/**
 * Schema information for available blockchain data tables.
 */
export interface OnchainDataSchemaResponse {
  /** List of available tables. */
  tables?: OnchainDataTableSchema[];
}

/**
 * Response containing token addresses that an account has received.
 */
export interface AccountTokenAddressesResponse {
  /** The account address that was queried. */
  accountAddress?: string;
  /** List of token contract addresses that the account has received. */
  tokenAddresses?: string[];
  /**
   * Total number of unique token addresses discovered.
   * @minimum 0
   */
  totalCount?: number;
}

/**
 * A webhook event type identifier following dot-separated format:
`<domain>.<entity>.<verb>` (e.g., "onchain.activity.detected").

 */
export type EventType = (typeof EventType)[keyof typeof EventType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EventType = {
  onchainactivitydetected: "onchain.activity.detected",
  walletactivitydetected: "wallet.activity.detected",
  walletactivitymulti: "wallet.activity.multi",
  wallettransactioncreated: "wallet.transaction.created",
  wallettransactionsigned: "wallet.transaction.signed",
  wallettransactionbroadcast: "wallet.transaction.broadcast",
  wallettransactionreplaced: "wallet.transaction.replaced",
  wallettransactionpending: "wallet.transaction.pending",
  wallettransactionconfirmed: "wallet.transaction.confirmed",
  wallettransactionfailed: "wallet.transaction.failed",
  walletdelegationcreated: "wallet.delegation.created",
  walletdelegationrevoked: "wallet.delegation.revoked",
  wallettyped_datasigned: "wallet.typed_data.signed",
  walletmessagesigned: "wallet.message.signed",
  wallethashsigned: "wallet.hash.signed",
  onramptransactioncreated: "onramp.transaction.created",
  onramptransactionupdated: "onramp.transaction.updated",
  onramptransactionsuccess: "onramp.transaction.success",
  onramptransactionfailed: "onramp.transaction.failed",
  offramptransactioncreated: "offramp.transaction.created",
  offramptransactionupdated: "offramp.transaction.updated",
  offramptransactionsuccess: "offramp.transaction.success",
  offramptransactionfailed: "offramp.transaction.failed",
} as const;

/**
 * Additional headers to include in webhook requests.
 */
export type WebhookTargetHeaders = { [key: string]: string };

/**
 * Target configuration for webhook delivery.
Specifies the destination URL and any custom headers to include in webhook requests.

 */
export interface WebhookTarget {
  /** The webhook URL to deliver events to. */
  url: Url;
  /** Additional headers to include in webhook requests. */
  headers?: WebhookTargetHeaders;
}

export type WebhookSubscriptionResponseMetadataAllOf = {
  /**
   * Use the root-level `secret` field instead. Maintained for backward compatibility only.
   * @deprecated
   */
  secret?: string;
};

/**
 * Additional metadata for the subscription.
 */
export type WebhookSubscriptionResponseMetadata = Metadata &
  WebhookSubscriptionResponseMetadataAllOf;

/**
 * Multi-label filters using total overlap logic. Total overlap means the subscription only triggers when events contain ALL these key-value pairs.
Present when subscription uses multi-label format.

 */
export type WebhookSubscriptionResponseLabels = { [key: string]: string };

/**
 * Response containing webhook subscription details.
 */
export interface WebhookSubscriptionResponse {
  /** When the subscription was created. */
  createdAt: string;
  /** When the subscription was last updated. */
  updatedAt?: string;
  /** Description of the webhook subscription. */
  description?: Description;
  /** Types of events to subscribe to. Event types follow a dot-separated format:
service.resource.verb (e.g., "onchain.activity.detected", "wallet.activity.detected", "onramp.transaction.created",
"acceptance.payment_session.authorization_succeeded").
 */
  eventTypes: EventType[];
  /** Whether the subscription is enabled. */
  isEnabled: boolean;
  /** Additional metadata for the subscription. */
  metadata?: WebhookSubscriptionResponseMetadata;
  /** Secret for webhook signature validation. */
  secret: string;
  /** Unique identifier for the subscription. */
  subscriptionId: string;
  target: WebhookTarget;
  /** Multi-label filters using total overlap logic. Total overlap means the subscription only triggers when events contain ALL these key-value pairs.
Present when subscription uses multi-label format.
 */
  labels?: WebhookSubscriptionResponseLabels;
}

/**
 * Response containing a list of webhook subscriptions.
 */
export type WebhookSubscriptionListResponseAllOf = {
  /** The list of webhook subscriptions. */
  subscriptions: WebhookSubscriptionResponse[];
};

export type WebhookSubscriptionListResponse = WebhookSubscriptionListResponseAllOf & ListResponse;

/**
 * Optional. Multi-label filters using total overlap logic. Total overlap means the subscription will only trigger when
an event contains ALL the key-value pairs specified here. Additional labels on
the event are allowed and will not prevent matching. Omit to receive all events for the selected event types.

**Note:** Currently, labels are supported for onchain webhooks only (max 20 labels per subscription).

**Allowed labels for `onchain.activity.detected`** (all in snake_case format):
- `network` (required) — Blockchain network
- `contract_address` — Smart contract address
- `event_name` — Event name (e.g., "Transfer", "Burn")
- `event_signature` — Event signature hash
- `transaction_from` — Transaction sender address
- `transaction_to` — Transaction recipient address
- `params.*` — Any event parameter (e.g., `params.from`, `params.to`, `params.sender`, `params.tokenId`)

 */
export type WebhookSubscriptionRequestLabels = { [key: string]: string };

/**
 * Request to create a new webhook subscription with support for multi-label filtering.

 */
export interface WebhookSubscriptionRequest {
  /** Description of the webhook subscription. */
  description?: Description;
  /** Types of events to subscribe to. Event types follow a dot-separated format:
service.resource.verb (e.g., "onchain.activity.detected", "wallet.activity.detected", "onramp.transaction.created",
"acceptance.payment_session.authorization_succeeded").
The subscription will only receive events matching these types AND the label filter(s).
 */
  eventTypes: EventType[];
  /** Whether the subscription is enabled. */
  isEnabled: boolean;
  target: WebhookTarget;
  metadata?: Metadata;
  /** Optional. Multi-label filters using total overlap logic. Total overlap means the subscription will only trigger when
an event contains ALL the key-value pairs specified here. Additional labels on
the event are allowed and will not prevent matching. Omit to receive all events for the selected event types.

**Note:** Currently, labels are supported for onchain webhooks only (max 20 labels per subscription).

**Allowed labels for `onchain.activity.detected`** (all in snake_case format):
- `network` (required) — Blockchain network
- `contract_address` — Smart contract address
- `event_name` — Event name (e.g., "Transfer", "Burn")
- `event_signature` — Event signature hash
- `transaction_from` — Transaction sender address
- `transaction_to` — Transaction recipient address
- `params.*` — Any event parameter (e.g., `params.from`, `params.to`, `params.sender`, `params.tokenId`)
 */
  labels?: WebhookSubscriptionRequestLabels;
}

/**
 * Optional. Multi-label filters that trigger only when an event contains ALL of these key-value pairs.
Omit to receive all events for the selected event types.

**Note:** Currently, labels are supported for onchain webhooks only (max 20 labels per subscription).

**Allowed labels for `onchain.activity.detected`** (all in snake_case format):
- `network` (required) — Blockchain network
- `contract_address` — Smart contract address
- `event_name` — Event name (e.g., "Transfer", "Burn")
- `event_signature` — Event signature hash
- `transaction_from` — Transaction sender address
- `transaction_to` — Transaction recipient address
- `params.*` — Any event parameter (e.g., `params.from`, `params.to`, `params.sender`, `params.tokenId`)

 */
export type WebhookSubscriptionUpdateRequestLabels = { [key: string]: string };

/**
 * Request to update an existing webhook subscription.

 */
export interface WebhookSubscriptionUpdateRequest {
  /** Description of the webhook subscription. */
  description?: Description;
  /** Types of events to subscribe to. Event types follow a three-part dot-separated format:
service.resource.verb (e.g., "onchain.activity.detected", "wallet.activity.detected", "onramp.transaction.created").
 */
  eventTypes: EventType[];
  /** Whether the subscription is enabled. */
  isEnabled: boolean;
  target: WebhookTarget;
  metadata?: Metadata;
  /** Optional. Multi-label filters that trigger only when an event contains ALL of these key-value pairs.
Omit to receive all events for the selected event types.

**Note:** Currently, labels are supported for onchain webhooks only (max 20 labels per subscription).

**Allowed labels for `onchain.activity.detected`** (all in snake_case format):
- `network` (required) — Blockchain network
- `contract_address` — Smart contract address
- `event_name` — Event name (e.g., "Transfer", "Burn")
- `event_signature` — Event signature hash
- `transaction_from` — Transaction sender address
- `transaction_to` — Transaction recipient address
- `params.*` — Any event parameter (e.g., `params.from`, `params.to`, `params.sender`, `params.tokenId`)
 */
  labels?: WebhookSubscriptionUpdateRequestLabels;
}

/**
 * Details of the HTTP response received from the webhook target.
 */
export interface WebhookEventResponseDetail {
  /** HTTP status code returned by the webhook target. */
  httpCode?: number;
  /** Round-trip time of the webhook delivery in milliseconds. */
  elapsedTimeMs?: number;
  /** Response body returned by the webhook target. */
  body?: string;
  /** Error name if the delivery failed (e.g., timeout, connection_refused). */
  errorName?: string;
}

/**
 * Current delivery status of the event.
 */
export type WebhookEventResponseStatus =
  (typeof WebhookEventResponseStatus)[keyof typeof WebhookEventResponseStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const WebhookEventResponseStatus = {
  pending: "pending",
  processing: "processing",
  succeeded: "succeeded",
  failed: "failed",
  retrying: "retrying",
} as const;

/**
 * Details of a webhook event delivery attempt for a subscription.
 */
export interface WebhookEventResponse {
  /** Unique identifier for the webhook event. */
  eventId: string;
  /** The type of event that was delivered (e.g., "onchain.activity.detected"). */
  eventTypeName: string;
  /** Current delivery status of the event. */
  status: WebhookEventResponseStatus;
  /** Timestamp when the event delivery attempt was created. */
  createdAt: string;
  /** Timestamp when the event was successfully delivered. Only present if status is "succeeded". */
  succeededAt?: string;
  /** Number of delivery retry attempts so far. */
  retryCount: number;
  response?: WebhookEventResponseDetail;
}

/**
 * Response containing a list of webhook event delivery attempts.
 */
export interface WebhookEventListResponse {
  /** The list of webhook event delivery attempts. */
  events: WebhookEventResponse[];
}

/**
 * The version of the x402 protocol.
 */
export type X402Version = (typeof X402Version)[keyof typeof X402Version];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402Version = {
  NUMBER_1: 1,
  NUMBER_2: 2,
} as const;

/**
 * The authorization data for the ERC-3009 authorization message.
 */
export type X402ExactEvmPayloadAuthorization = {
  /**
   * The 0x-prefixed, checksum EVM address of the sender of the payment.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  from: string;
  /**
   * The 0x-prefixed, checksum EVM address of the recipient of the payment.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  to: string;
  /** The value of the payment, in atomic units of the payment asset. */
  value: string;
  /** The unix timestamp after which the payment is valid. */
  validAfter: string;
  /** The unix timestamp before which the payment is valid. */
  validBefore: string;
  /**
   * The hex-encoded nonce of the payment (bytes32).
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  nonce: string;
};

/**
 * The x402 protocol exact scheme payload for EVM networks. The scheme is implemented using ERC-3009. For more details, please see [EVM Exact Scheme Details](https://github.com/coinbase/x402/blob/main/specs/schemes/exact/scheme_exact_evm.md).
 */
export interface X402ExactEvmPayload {
  /**
   * The EIP-712 hex-encoded signature of the ERC-3009 authorization message. Smart account signatures may be longer than 65 bytes.
   * @pattern ^0x[0-9a-fA-F]{130,}$
   */
  signature: string;
  /** The authorization data for the ERC-3009 authorization message. */
  authorization: X402ExactEvmPayloadAuthorization;
}

/**
 * The token permissions for the transfer.
 */
export type X402ExactEvmPermit2PayloadPermit2AuthorizationPermitted = {
  /**
   * The 0x-prefixed, checksum EVM address of the token to transfer.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  token: string;
  /** The amount to transfer in atomic units. */
  amount: string;
};

/**
 * The witness data containing payment details.
 */
export type X402ExactEvmPermit2PayloadPermit2AuthorizationWitness = {
  /**
   * The 0x-prefixed, checksum EVM address of the recipient.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  to: string;
  /** The unix timestamp after which the payment is valid. */
  validAfter: string;
  /**
   * Optional hex-encoded extra data.
   * @pattern ^0x[0-9a-fA-F]*$
   */
  extra?: string;
};

/**
 * The authorization data for the Permit2 PermitWitnessTransferFrom message.
 */
export type X402ExactEvmPermit2PayloadPermit2Authorization = {
  /**
   * The 0x-prefixed, checksum EVM address of the sender of the payment.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  from: string;
  /** The token permissions for the transfer. */
  permitted: X402ExactEvmPermit2PayloadPermit2AuthorizationPermitted;
  /**
   * The 0x-prefixed, checksum EVM address of the spender (x402 Permit2 proxy contract).
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  spender: string;
  /**
   * The Permit2 nonce as a decimal string (uint256).
   * @pattern ^[0-9]+$
   */
  nonce: string;
  /** The unix timestamp before which the permit is valid. */
  deadline: string;
  /** The witness data containing payment details. */
  witness: X402ExactEvmPermit2PayloadPermit2AuthorizationWitness;
};

/**
 * The x402 protocol exact scheme payload for EVM networks using Permit2. Permit2 is a universal token approval mechanism that works with any ERC-20 token, unlike ERC-3009 which requires token-level support.
 */
export interface X402ExactEvmPermit2Payload {
  /**
   * The EIP-712 hex-encoded signature of the Permit2 PermitWitnessTransferFrom message. Smart account signatures may be longer than 65 bytes.
   * @pattern ^0x[0-9a-fA-F]{130,}$
   */
  signature: string;
  /** The authorization data for the Permit2 PermitWitnessTransferFrom message. */
  permit2Authorization: X402ExactEvmPermit2PayloadPermit2Authorization;
}

/**
 * The x402 protocol exact scheme payload for Solana networks. For more details, please see [Solana Exact Scheme Details](https://github.com/coinbase/x402/blob/main/specs/schemes/exact/scheme_exact_svm.md).
 */
export interface X402ExactSolanaPayload {
  /** The base64-encoded Solana transaction. */
  transaction: string;
}

/**
 * The token permissions for the transfer.
 */
export type X402UptoEvmPermit2PayloadPermit2AuthorizationPermitted = {
  /**
   * The 0x-prefixed, checksum EVM address of the token to transfer.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  token: string;
  /** The maximum amount the client authorizes to transfer in atomic units. */
  amount: string;
};

/**
 * The witness data containing payment details. Includes a `facilitator` field to bind the authorization to a specific facilitator address.
 */
export type X402UptoEvmPermit2PayloadPermit2AuthorizationWitness = {
  /**
   * The 0x-prefixed, checksum EVM address of the recipient.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  to: string;
  /**
   * The 0x-prefixed, checksum EVM address of the facilitator authorized to settle this payment. MUST match the `facilitatorAddress` advertised in the payment requirements `extra` field.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  facilitator: string;
  /** The unix timestamp after which the payment is valid. */
  validAfter: string;
};

/**
 * The authorization data for the Permit2 PermitWitnessTransferFrom message. The `permitted.amount` is the maximum the client authorizes; the actual settled amount is decided by the resource server at settle time and MUST be less than or equal to it.
 */
export type X402UptoEvmPermit2PayloadPermit2Authorization = {
  /**
   * The 0x-prefixed, checksum EVM address of the sender of the payment.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  from: string;
  /** The token permissions for the transfer. */
  permitted: X402UptoEvmPermit2PayloadPermit2AuthorizationPermitted;
  /**
   * The 0x-prefixed, checksum EVM address of the spender (the x402 Upto Permit2 proxy contract).
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  spender: string;
  /**
   * The Permit2 nonce as a decimal string (uint256).
   * @pattern ^[0-9]+$
   */
  nonce: string;
  /** The unix timestamp before which the permit is valid. */
  deadline: string;
  /** The witness data containing payment details. Includes a `facilitator` field to bind the authorization to a specific facilitator address. */
  witness: X402UptoEvmPermit2PayloadPermit2AuthorizationWitness;
};

/**
 * The x402 protocol upto scheme payload for EVM networks using Permit2. The `upto` scheme authorizes a maximum amount and lets the facilitator settle for the actual amount used. Structurally identical to `x402ExactEvmPermit2Payload` except `permit2Authorization.witness` carries an additional `facilitator` address that binds the authorization to a specific facilitator (the one announced via `extra.facilitatorAddress` in the payment requirements). For more details, see [EVM Upto Scheme Details](https://github.com/x402-foundation/x402/blob/main/specs/schemes/upto/scheme_upto_evm.md).
 */
export interface X402UptoEvmPermit2Payload {
  /**
   * The EIP-712 hex-encoded signature of the Permit2 PermitWitnessTransferFrom message. Smart account signatures may be longer than 65 bytes.
   * @pattern ^0x[0-9a-fA-F]{130,}$
   */
  signature: string;
  /** The authorization data for the Permit2 PermitWitnessTransferFrom message. The `permitted.amount` is the maximum the client authorizes; the actual settled amount is decided by the resource server at settle time and MUST be less than or equal to it. */
  permit2Authorization: X402UptoEvmPermit2PayloadPermit2Authorization;
}

/**
 * Immutable configuration for an x402 batch-settlement payment channel. The EIP-712 hash of this struct produces the `channelId` used by all batch-settlement payloads.
 */
export interface X402BatchSettlementChannelConfig {
  /**
   * The 0x-prefixed, checksum EVM address of the payer (channel funder).
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  payer: string;
  /**
   * The 0x-prefixed, checksum EVM address authorized to sign vouchers on behalf of the payer.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  payerAuthorizer: string;
  /**
   * The 0x-prefixed, checksum EVM address of the receiver (resource server / merchant).
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  receiver: string;
  /**
   * The 0x-prefixed, checksum EVM address authorized to sign claim batches on behalf of the receiver (typically the facilitator).
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  receiverAuthorizer: string;
  /**
   * The 0x-prefixed, checksum EVM address of the ERC-20 payment token.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  token: string;
  /**
   * The non-cooperative withdraw delay in seconds. Must be between 900 (15 minutes) and 2,592,000 (30 days).
   * @minimum 900
   * @maximum 2592000
   */
  withdrawDelay: number;
  /**
   * A 32-byte salt used to differentiate channels between the same payer/receiver pair.
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  salt: string;
}

/**
 * A signed cumulative-ceiling voucher for an x402 batch-settlement channel. `maxClaimableAmount` is monotonically increasing across requests in the same channel; the receiver may claim any amount up to this ceiling.
 */
export interface X402BatchSettlementVoucher {
  /**
   * The 32-byte EIP-712 hash of the `channelConfig` for this voucher's channel.
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  channelId: string;
  /**
   * The cumulative maximum amount (uint128 as decimal string) the receiver is authorized to claim from this channel as of this voucher.
   * @pattern ^[0-9]+$
   */
  maxClaimableAmount: string;
  /**
   * The EIP-712 hex-encoded signature of the voucher by `payerAuthorizer`.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  signature: string;
}

export type X402BatchSettlementDepositPayloadType =
  (typeof X402BatchSettlementDepositPayloadType)[keyof typeof X402BatchSettlementDepositPayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402BatchSettlementDepositPayloadType = {
  deposit: "deposit",
} as const;

/**
 * An ERC-3009 receiveWithAuthorization message authorizing the channel-funding transfer.
 */
export type X402BatchSettlementDepositPayloadDepositAuthorizationErc3009Authorization = {
  /** The unix timestamp after which the authorization is valid. */
  validAfter: string;
  /** The unix timestamp before which the authorization is valid. */
  validBefore: string;
  /**
   * The 32-byte ERC-3009 nonce/salt for replay protection.
   * @pattern ^0x[0-9a-fA-F]{64}$
   */
  salt: string;
  /**
   * The EIP-712 hex-encoded signature of the ERC-3009 authorization.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  signature: string;
};

/**
 * The asset-transfer authorization for the deposit. Currently only ERC-3009 is supported.
 */
export type X402BatchSettlementDepositPayloadDepositAuthorization = {
  /** An ERC-3009 receiveWithAuthorization message authorizing the channel-funding transfer. */
  erc3009Authorization?: X402BatchSettlementDepositPayloadDepositAuthorizationErc3009Authorization;
};

/**
 * The deposit amount and asset-transfer authorization that funds the channel.
 */
export type X402BatchSettlementDepositPayloadDeposit = {
  /**
   * The deposit amount in atomic units of `channelConfig.token`.
   * @pattern ^[0-9]+$
   */
  amount: string;
  /** The asset-transfer authorization for the deposit. Currently only ERC-3009 is supported. */
  authorization: X402BatchSettlementDepositPayloadDepositAuthorization;
};

/**
 * Sent on the first request to fund a channel via an ERC-3009 receiveWithAuthorization deposit.
 */
export interface X402BatchSettlementDepositPayload {
  type: X402BatchSettlementDepositPayloadType;
  channelConfig: X402BatchSettlementChannelConfig;
  voucher: X402BatchSettlementVoucher;
  /** The deposit amount and asset-transfer authorization that funds the channel. */
  deposit: X402BatchSettlementDepositPayloadDeposit;
}

export type X402BatchSettlementVoucherPayloadType =
  (typeof X402BatchSettlementVoucherPayloadType)[keyof typeof X402BatchSettlementVoucherPayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402BatchSettlementVoucherPayloadType = {
  voucher: "voucher",
} as const;

/**
 * Sent on subsequent requests against an already-funded channel; carries only the latest cumulative voucher.
 */
export interface X402BatchSettlementVoucherPayload {
  type: X402BatchSettlementVoucherPayloadType;
  channelConfig: X402BatchSettlementChannelConfig;
  voucher: X402BatchSettlementVoucher;
}

/**
 * The voucher to claim, identified by the channel config it was signed against and its cumulative ceiling. Field shape mirrors the on-chain claim struct.
 */
export type X402BatchSettlementClaimVoucher = {
  channel: X402BatchSettlementChannelConfig;
  /**
   * The cumulative maximum claimable amount (uint128 as decimal string) signed by the payer authorizer.
   * @pattern ^[0-9]+$
   */
  maxClaimableAmount: string;
};

/**
 * A single voucher claim within a batched on-chain claim transaction. Used by `x402BatchSettlementClaimPayload.claims` and by the server-enriched shape of `x402BatchSettlementRefundPayload.claims`.
NOTE: the nested `voucher` here has a **different shape** from the top-level `x402BatchSettlementVoucher` schema. The top-level voucher is the signed cumulative-ceiling message sent by a client (`{channelId, maxClaimableAmount, signature}`). This nested `voucher` mirrors the on-chain claim struct (`{channel: ChannelConfig, maxClaimableAmount}`) that participates in the EIP-712 hash, with `signature` and `totalClaimed` as siblings rather than nested fields. The field names match the upstream x402 protocol and the on-chain Solidity struct; they cannot be renamed without breaking wire and EIP-712 compatibility.
 */
export interface X402BatchSettlementClaim {
  /** The voucher to claim, identified by the channel config it was signed against and its cumulative ceiling. Field shape mirrors the on-chain claim struct. */
  voucher: X402BatchSettlementClaimVoucher;
  /**
   * The voucher signature from `payerAuthorizer`.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  signature: string;
  /**
   * The cumulative amount already claimed from this channel as of this claim.
   * @pattern ^[0-9]+$
   */
  totalClaimed: string;
}

export type X402BatchSettlementRefundPayloadType =
  (typeof X402BatchSettlementRefundPayloadType)[keyof typeof X402BatchSettlementRefundPayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402BatchSettlementRefundPayloadType = {
  refund: "refund",
} as const;

/**
 * A cooperative refund request. The client emits the minimal shape (just `channelConfig` and `voucher`, with an optional `amount`). A mediating server enriches the payload with `amount`, `refundNonce`, and `claims` before forwarding to the facilitator. Authorizer signatures are optional — the facilitator auto-signs when absent. Field presence determines which shape was sent; the facilitator dispatches accordingly.
 */
export interface X402BatchSettlementRefundPayload {
  type: X402BatchSettlementRefundPayloadType;
  channelConfig: X402BatchSettlementChannelConfig;
  voucher: X402BatchSettlementVoucher;
  /**
   * The refund amount in atomic units of `channelConfig.token`. Optional in the client-emitted shape (defaults to the full remaining channel balance). Required when the payload is enriched by a mediating server.
   * @pattern ^[0-9]+$
   */
  amount?: string;
  /**
   * The on-chain refund nonce for replay protection (uint256 as decimal string). Only present on the server-enriched shape.
   * @pattern ^[0-9]+$
   */
  refundNonce?: string;
  /** Voucher claims to include atomically with the refund. Only present on the server-enriched shape. */
  claims?: X402BatchSettlementClaim[];
  /**
   * Optional EIP-712 signature from the receiver authorizer over the refund. When omitted, the facilitator auto-signs.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  refundAuthorizerSignature?: string;
  /**
   * Optional EIP-712 signature from the receiver authorizer over the included claims. When omitted, the facilitator auto-signs.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  claimAuthorizerSignature?: string;
}

export type X402BatchSettlementClaimPayloadType =
  (typeof X402BatchSettlementClaimPayloadType)[keyof typeof X402BatchSettlementClaimPayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402BatchSettlementClaimPayloadType = {
  claim: "claim",
} as const;

/**
 * Server-to-facilitator request to batch on-chain claims of accumulated vouchers. `claimAuthorizerSignature` is optional; when absent the facilitator auto-signs with its receiver-authorizer key.
 */
export interface X402BatchSettlementClaimPayload {
  type: X402BatchSettlementClaimPayloadType;
  /** The list of voucher claims to batch in a single on-chain `claim` call. */
  claims: X402BatchSettlementClaim[];
  /**
   * Optional EIP-712 signature from the receiver authorizer over the claim batch. When omitted, the facilitator auto-signs.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  claimAuthorizerSignature?: string;
}

export type X402BatchSettlementSettlePayloadType =
  (typeof X402BatchSettlementSettlePayloadType)[keyof typeof X402BatchSettlementSettlePayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402BatchSettlementSettlePayloadType = {
  settle: "settle",
} as const;

/**
 * Server-to-facilitator request to transfer claimed funds for a `(receiver, token)` pair to the receiver wallet.
 */
export interface X402BatchSettlementSettlePayload {
  type: X402BatchSettlementSettlePayloadType;
  /**
   * The 0x-prefixed, checksum EVM address of the receiver to settle to.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  receiver: string;
  /**
   * The 0x-prefixed, checksum EVM address of the token to settle.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  token: string;
}

/**
 * The x402 protocol batch-settlement scheme payload for EVM networks. The `batch-settlement` scheme uses pre-funded payment channels with off-chain cumulative-ceiling vouchers, allowing servers to batch-claim accumulated value in a single on-chain transaction. The payload is a discriminated union on the `type` field with five variants:

  - `deposit`: client-initiated channel funding via ERC-3009.
  - `voucher`: client-side cumulative voucher against an already-funded channel.
  - `refund`: cooperative refund request. The client emits a minimal shape (just channelConfig + voucher, with an optional `amount`); a mediating server enriches it with `amount`, `refundNonce`, and `claims` before forwarding to the facilitator. Authorizer signatures are optional — the facilitator auto-signs when absent.
  - `claim`: server-to-facilitator request to batch on-chain voucher claims.
  - `settle`: server-to-facilitator request to transfer claimed funds to the receiver.

For more details, see [batch-settlement specs](https://github.com/x402-foundation/x402/tree/main/specs/schemes/batch-settlement).
 */
export type X402BatchSettlementEvmPayload =
  | X402BatchSettlementDepositPayload
  | X402BatchSettlementVoucherPayload
  | X402BatchSettlementRefundPayload
  | X402BatchSettlementClaimPayload
  | X402BatchSettlementSettlePayload;

/**
 * The x402 v2 network identifier in CAIP-2 format. x402 v2 identifies networks by their CAIP-2 chain ID (e.g. `eip155:<chainId>` for EVM networks, `solana:<genesisHash>` for Solana). Supported networks: Base, Polygon, Arbitrum One, World Chain (EVM), and Solana.
 */
export type X402V2Network = (typeof X402V2Network)[keyof typeof X402V2Network];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402V2Network = {
  "eip155:8453": "eip155:8453",
  "eip155:84532": "eip155:84532",
  "eip155:137": "eip155:137",
  "eip155:42161": "eip155:42161",
  "eip155:480": "eip155:480",
  "eip155:4801": "eip155:4801",
  "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
  "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
} as const;

/**
 * The scheme of the payment protocol to use. Supported schemes are `exact`, `upto`, and `batch-settlement`.
 */
export type X402V2PaymentRequirementsScheme =
  (typeof X402V2PaymentRequirementsScheme)[keyof typeof X402V2PaymentRequirementsScheme];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402V2PaymentRequirementsScheme = {
  exact: "exact",
  upto: "upto",
  "batch-settlement": "batch-settlement",
} as const;

/**
 * The optional additional scheme-specific payment info.
 */
export type X402V2PaymentRequirementsExtra = { [key: string]: unknown };

/**
 * The x402 v2 payment requirements. Uses CAIP-2 network identifiers and supports `exact`, `upto`, and `batch-settlement` schemes. Carries only the payment fields (no resource metadata — that is in the enclosing `x402V2PaymentPayload.resource`).
 */
export interface X402V2PaymentRequirements {
  /** The scheme of the payment protocol to use. Supported schemes are `exact`, `upto`, and `batch-settlement`. */
  scheme: X402V2PaymentRequirementsScheme;
  /** The network of the blockchain to send payment on in CAIP-2 format. */
  network: X402V2Network;
  /** The asset to pay with.

For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the asset will be a base58-encoded Solana address. */
  asset: BlockchainAddress;
  /** The amount to pay for the resource in atomic units of the payment asset. */
  amount: string;
  /** The destination to pay value to.

For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, payTo will be a base58-encoded Solana address. */
  payTo: BlockchainAddress;
  /** The maximum time in seconds for the resource server to respond. */
  maxTimeoutSeconds: number;
  /** The optional additional scheme-specific payment info. */
  extra?: X402V2PaymentRequirementsExtra;
}

/**
 * Describes the resource being accessed in x402 protocol.
 */
export interface X402ResourceInfo {
  /** The URL of the resource. */
  url?: string;
  /** A human-readable description of the resource. */
  description?: Description;
  /** The MIME type of the resource response. */
  mimeType?: string;
}

/**
 * The payload of the payment depending on the x402Version, scheme, and network. Discriminated by scheme-specific fields: exact-EVM/upto-EVM payloads carry a `signature`; exact-Solana carries a `transaction`; batch-settlement carries a `type` discriminator. See `x402BatchSettlementEvmPayload` for the documented batch-settlement variants.
 */
export type X402V2PaymentPayloadPayload =
  | X402ExactEvmPayload
  | X402ExactEvmPermit2Payload
  | X402ExactSolanaPayload
  | X402UptoEvmPermit2Payload
  | X402BatchSettlementEvmPayload;

/**
 * Optional protocol extensions.
 */
export type X402V2PaymentPayloadExtensions = { [key: string]: unknown };

/**
 * The x402 v2 protocol payment payload. Uses CAIP-2 network identifiers. The `accepted` field carries the full payment requirements; `scheme` and `network` are not top-level fields (they are on the nested `accepted` object).
 */
export interface X402V2PaymentPayload {
  /** The x402 protocol version. Must be `2` for this payload shape. */
  x402Version: X402Version;
  /** The payload of the payment depending on the x402Version, scheme, and network. Discriminated by scheme-specific fields: exact-EVM/upto-EVM payloads carry a `signature`; exact-Solana carries a `transaction`; batch-settlement carries a `type` discriminator. See `x402BatchSettlementEvmPayload` for the documented batch-settlement variants. */
  payload: X402V2PaymentPayloadPayload;
  accepted: X402V2PaymentRequirements;
  resource?: X402ResourceInfo;
  /** Optional protocol extensions. */
  extensions?: X402V2PaymentPayloadExtensions;
}

/**
 * The x402 v1 network identifier. x402 v1 uses human-readable network names. Supported networks: Base mainnet and testnet, Solana mainnet and devnet.
 */
export type X402V1Network = (typeof X402V1Network)[keyof typeof X402V1Network];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402V1Network = {
  base: "base",
  "base-sepolia": "base-sepolia",
  solana: "solana",
  "solana-devnet": "solana-devnet",
} as const;

/**
 * The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
 */
export type X402V1PaymentPayloadScheme =
  (typeof X402V1PaymentPayloadScheme)[keyof typeof X402V1PaymentPayloadScheme];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402V1PaymentPayloadScheme = {
  exact: "exact",
} as const;

/**
 * The payload of the payment depending on the x402Version, scheme, and network.
 */
export type X402V1PaymentPayloadPayload =
  | X402ExactEvmPayload
  | X402ExactEvmPermit2Payload
  | X402ExactSolanaPayload;

/**
 * The x402 v1 protocol payment payload. Uses human-readable network names and requires `scheme` and `network` alongside the inner `payload` object.
 */
export interface X402V1PaymentPayload {
  /** The x402 protocol version. Must be `1` for this payload shape. */
  x402Version: X402Version;
  /** The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`. */
  scheme: X402V1PaymentPayloadScheme;
  /** The network of the blockchain to send payment on. */
  network: X402V1Network;
  /** The payload of the payment depending on the x402Version, scheme, and network. */
  payload: X402V1PaymentPayloadPayload;
}

/**
 * The x402 protocol payment payload that the client attaches to x402-paid API requests to the resource server in the X-PAYMENT header.
For EVM networks, smart account signatures can be longer than 65 bytes.
 */
export type X402PaymentPayload = X402V2PaymentPayload | X402V1PaymentPayload;

/**
 * The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
 */
export type X402V1PaymentRequirementsScheme =
  (typeof X402V1PaymentRequirementsScheme)[keyof typeof X402V1PaymentRequirementsScheme];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402V1PaymentRequirementsScheme = {
  exact: "exact",
} as const;

/**
 * The optional JSON schema describing the resource output.
 */
export type X402V1PaymentRequirementsOutputSchema = { [key: string]: unknown };

/**
 * The optional additional scheme-specific payment info.
 */
export type X402V1PaymentRequirementsExtra = { [key: string]: unknown };

/**
 * The x402 v1 payment requirements. Uses human-readable network names, and carries resource metadata (`resource`, `description`, `mimeType`) alongside the payment fields. The only supported scheme is `exact`.
 */
export interface X402V1PaymentRequirements {
  /** The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`. */
  scheme: X402V1PaymentRequirementsScheme;
  /** The network of the blockchain to send payment on. */
  network: X402V1Network;
  /** The maximum amount required to pay for the resource in atomic units of the payment asset. */
  maxAmountRequired: string;
  /** The URL of the resource to pay for. */
  resource: string;
  /** A human-readable description of the resource. */
  description: Description;
  /** The MIME type of the resource response. */
  mimeType: string;
  /** The optional JSON schema describing the resource output. */
  outputSchema?: X402V1PaymentRequirementsOutputSchema;
  /** The destination to pay value to.

For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, payTo will be a base58-encoded Solana address. */
  payTo: BlockchainAddress;
  /** The maximum time in seconds for the resource server to respond. */
  maxTimeoutSeconds: number;
  /** The asset to pay with.

For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the asset will be a base58-encoded Solana address. */
  asset: BlockchainAddress;
  /** The optional additional scheme-specific payment info. */
  extra?: X402V1PaymentRequirementsExtra;
}

/**
 * The x402 protocol payment requirements that the resource server expects the client's payment payload to meet.
 */
export type X402PaymentRequirements = X402V2PaymentRequirements | X402V1PaymentRequirements;

/**
 * The reason the payment is invalid on the x402 protocol.
 */
export type X402VerifyInvalidReason =
  (typeof X402VerifyInvalidReason)[keyof typeof X402VerifyInvalidReason];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402VerifyInvalidReason = {
  insufficient_funds: "insufficient_funds",
  invalid_scheme: "invalid_scheme",
  invalid_network: "invalid_network",
  invalid_x402_version: "invalid_x402_version",
  invalid_payment_requirements: "invalid_payment_requirements",
  invalid_payload: "invalid_payload",
  invalid_exact_evm_payload_authorization_value: "invalid_exact_evm_payload_authorization_value",
  invalid_exact_evm_payload_authorization_value_too_low:
    "invalid_exact_evm_payload_authorization_value_too_low",
  invalid_exact_evm_payload_authorization_valid_after:
    "invalid_exact_evm_payload_authorization_valid_after",
  invalid_exact_evm_payload_authorization_valid_before:
    "invalid_exact_evm_payload_authorization_valid_before",
  invalid_exact_evm_payload_authorization_typed_data_message:
    "invalid_exact_evm_payload_authorization_typed_data_message",
  invalid_exact_evm_payload_authorization_from_address_kyt:
    "invalid_exact_evm_payload_authorization_from_address_kyt",
  invalid_exact_evm_payload_authorization_to_address_kyt:
    "invalid_exact_evm_payload_authorization_to_address_kyt",
  invalid_exact_evm_payload_signature: "invalid_exact_evm_payload_signature",
  invalid_exact_evm_payload_signature_address: "invalid_exact_evm_payload_signature_address",
  invalid_exact_evm_permit2_payload_allowance_required:
    "invalid_exact_evm_permit2_payload_allowance_required",
  invalid_exact_evm_permit2_payload_signature: "invalid_exact_evm_permit2_payload_signature",
  invalid_exact_evm_permit2_payload_deadline: "invalid_exact_evm_permit2_payload_deadline",
  invalid_exact_evm_permit2_payload_valid_after: "invalid_exact_evm_permit2_payload_valid_after",
  invalid_exact_evm_permit2_payload_spender: "invalid_exact_evm_permit2_payload_spender",
  invalid_exact_evm_permit2_payload_recipient: "invalid_exact_evm_permit2_payload_recipient",
  invalid_exact_evm_permit2_payload_amount: "invalid_exact_evm_permit2_payload_amount",
  invalid_exact_svm_payload_transaction: "invalid_exact_svm_payload_transaction",
  invalid_exact_svm_payload_transaction_amount_mismatch:
    "invalid_exact_svm_payload_transaction_amount_mismatch",
  invalid_exact_svm_payload_transaction_create_ata_instruction:
    "invalid_exact_svm_payload_transaction_create_ata_instruction",
  invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee:
    "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee",
  invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset:
    "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset",
  invalid_exact_svm_payload_transaction_instructions:
    "invalid_exact_svm_payload_transaction_instructions",
  invalid_exact_svm_payload_transaction_instructions_length:
    "invalid_exact_svm_payload_transaction_instructions_length",
  invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction:
    "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction",
  invalid_exact_svm_payload_transaction_instructions_compute_price_instruction:
    "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction",
  invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high:
    "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high",
  invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked:
    "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked",
  invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked:
    "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked",
  invalid_exact_svm_payload_transaction_not_a_transfer_instruction:
    "invalid_exact_svm_payload_transaction_not_a_transfer_instruction",
  invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata:
    "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata",
  invalid_exact_svm_payload_transaction_receiver_ata_not_found:
    "invalid_exact_svm_payload_transaction_receiver_ata_not_found",
  invalid_exact_svm_payload_transaction_sender_ata_not_found:
    "invalid_exact_svm_payload_transaction_sender_ata_not_found",
  invalid_exact_svm_payload_transaction_simulation_failed:
    "invalid_exact_svm_payload_transaction_simulation_failed",
  invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata:
    "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata",
  invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts:
    "invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts",
  invalid_exact_svm_payload_transaction_fee_payer_transferring_funds:
    "invalid_exact_svm_payload_transaction_fee_payer_transferring_funds",
  invalid_batch_settlement_evm_scheme: "invalid_batch_settlement_evm_scheme",
  invalid_batch_settlement_evm_network_mismatch: "invalid_batch_settlement_evm_network_mismatch",
  invalid_batch_settlement_evm_payload_type: "invalid_batch_settlement_evm_payload_type",
  invalid_batch_settlement_evm_channel_not_found: "invalid_batch_settlement_evm_channel_not_found",
  invalid_batch_settlement_evm_deposit_simulation_failed:
    "invalid_batch_settlement_evm_deposit_simulation_failed",
  invalid_batch_settlement_evm_channel_id_mismatch:
    "invalid_batch_settlement_evm_channel_id_mismatch",
  invalid_batch_settlement_evm_channel_state_read_failed:
    "invalid_batch_settlement_evm_channel_state_read_failed",
  invalid_batch_settlement_evm_cumulative_below_claimed:
    "invalid_batch_settlement_evm_cumulative_below_claimed",
  invalid_batch_settlement_evm_cumulative_exceeds_balance:
    "invalid_batch_settlement_evm_cumulative_exceeds_balance",
  invalid_batch_settlement_evm_eip2612_amount_mismatch:
    "invalid_batch_settlement_evm_eip2612_amount_mismatch",
  invalid_batch_settlement_evm_eip2612_asset_mismatch:
    "invalid_batch_settlement_evm_eip2612_asset_mismatch",
  invalid_batch_settlement_evm_eip2612_deadline_expired:
    "invalid_batch_settlement_evm_eip2612_deadline_expired",
  invalid_batch_settlement_evm_eip2612_invalid_format:
    "invalid_batch_settlement_evm_eip2612_invalid_format",
  invalid_batch_settlement_evm_eip2612_invalid_signature:
    "invalid_batch_settlement_evm_eip2612_invalid_signature",
  invalid_batch_settlement_evm_eip2612_owner_mismatch:
    "invalid_batch_settlement_evm_eip2612_owner_mismatch",
  invalid_batch_settlement_evm_eip2612_spender_mismatch:
    "invalid_batch_settlement_evm_eip2612_spender_mismatch",
  invalid_batch_settlement_evm_erc20_approval_asset_mismatch:
    "invalid_batch_settlement_evm_erc20_approval_asset_mismatch",
  invalid_batch_settlement_evm_erc20_approval_from_mismatch:
    "invalid_batch_settlement_evm_erc20_approval_from_mismatch",
  invalid_batch_settlement_evm_erc20_approval_invalid_format:
    "invalid_batch_settlement_evm_erc20_approval_invalid_format",
  invalid_batch_settlement_evm_erc20_approval_unavailable:
    "invalid_batch_settlement_evm_erc20_approval_unavailable",
  invalid_batch_settlement_evm_erc20_approval_wrong_spender:
    "invalid_batch_settlement_evm_erc20_approval_wrong_spender",
  invalid_batch_settlement_evm_erc3009_authorization_required:
    "invalid_batch_settlement_evm_erc3009_authorization_required",
  invalid_batch_settlement_evm_insufficient_balance:
    "invalid_batch_settlement_evm_insufficient_balance",
  invalid_batch_settlement_evm_deposit_payload: "invalid_batch_settlement_evm_deposit_payload",
  invalid_batch_settlement_evm_receive_authorization_signature:
    "invalid_batch_settlement_evm_receive_authorization_signature",
  invalid_batch_settlement_evm_refund_payload: "invalid_batch_settlement_evm_refund_payload",
  invalid_batch_settlement_evm_voucher_payload: "invalid_batch_settlement_evm_voucher_payload",
  invalid_batch_settlement_evm_voucher_signature: "invalid_batch_settlement_evm_voucher_signature",
  invalid_batch_settlement_evm_missing_eip712_domain:
    "invalid_batch_settlement_evm_missing_eip712_domain",
  invalid_batch_settlement_evm_payload_authorization_valid_after:
    "invalid_batch_settlement_evm_payload_authorization_valid_after",
  invalid_batch_settlement_evm_payload_authorization_valid_before:
    "invalid_batch_settlement_evm_payload_authorization_valid_before",
  invalid_batch_settlement_evm_permit2_allowance_required:
    "invalid_batch_settlement_evm_permit2_allowance_required",
  invalid_batch_settlement_evm_permit2_amount_mismatch:
    "invalid_batch_settlement_evm_permit2_amount_mismatch",
  invalid_batch_settlement_evm_permit2_authorization_required:
    "invalid_batch_settlement_evm_permit2_authorization_required",
  invalid_batch_settlement_evm_permit2_deadline_expired:
    "invalid_batch_settlement_evm_permit2_deadline_expired",
  invalid_batch_settlement_evm_permit2_invalid_signature:
    "invalid_batch_settlement_evm_permit2_invalid_signature",
  invalid_batch_settlement_evm_permit2_invalid_spender:
    "invalid_batch_settlement_evm_permit2_invalid_spender",
  invalid_batch_settlement_evm_receiver_authorizer_mismatch:
    "invalid_batch_settlement_evm_receiver_authorizer_mismatch",
  invalid_batch_settlement_evm_receiver_mismatch: "invalid_batch_settlement_evm_receiver_mismatch",
  invalid_batch_settlement_evm_rpc_read_failed: "invalid_batch_settlement_evm_rpc_read_failed",
  invalid_batch_settlement_evm_token_mismatch: "invalid_batch_settlement_evm_token_mismatch",
  invalid_batch_settlement_evm_withdraw_delay_mismatch:
    "invalid_batch_settlement_evm_withdraw_delay_mismatch",
  invalid_batch_settlement_evm_withdraw_delay_out_of_range:
    "invalid_batch_settlement_evm_withdraw_delay_out_of_range",
  invalid_exact_evm_scheme: "invalid_exact_evm_scheme",
  invalid_exact_evm_network_mismatch: "invalid_exact_evm_network_mismatch",
  invalid_exact_evm_payload: "invalid_exact_evm_payload",
  invalid_exact_evm_payload_missing_signature: "invalid_exact_evm_payload_missing_signature",
  invalid_exact_evm_failed_to_get_network_config: "invalid_exact_evm_failed_to_get_network_config",
  invalid_exact_evm_missing_eip712_domain: "invalid_exact_evm_missing_eip712_domain",
  invalid_exact_evm_recipient_mismatch: "invalid_exact_evm_recipient_mismatch",
  invalid_exact_evm_authorization_value: "invalid_exact_evm_authorization_value",
  invalid_exact_evm_required_amount: "invalid_exact_evm_required_amount",
  invalid_exact_evm_payload_authorization_value_mismatch:
    "invalid_exact_evm_payload_authorization_value_mismatch",
  invalid_exact_evm_failed_to_check_nonce: "invalid_exact_evm_failed_to_check_nonce",
  invalid_exact_evm_nonce_already_used: "invalid_exact_evm_nonce_already_used",
  invalid_exact_evm_failed_to_get_balance: "invalid_exact_evm_failed_to_get_balance",
  invalid_exact_evm_insufficient_balance: "invalid_exact_evm_insufficient_balance",
  invalid_exact_evm_signature_format: "invalid_exact_evm_signature_format",
  invalid_exact_evm_failed_to_verify_signature: "invalid_exact_evm_failed_to_verify_signature",
  invalid_exact_evm_signature: "invalid_exact_evm_signature",
  invalid_exact_evm_token_name_mismatch: "invalid_exact_evm_token_name_mismatch",
  invalid_exact_evm_token_version_mismatch: "invalid_exact_evm_token_version_mismatch",
  invalid_exact_evm_eip3009_not_supported: "invalid_exact_evm_eip3009_not_supported",
  invalid_exact_evm_transaction_simulation_failed:
    "invalid_exact_evm_transaction_simulation_failed",
  invalid_exact_evm_verification_failed: "invalid_exact_evm_verification_failed",
  invalid_exact_evm_failed_to_parse_signature: "invalid_exact_evm_failed_to_parse_signature",
  invalid_exact_evm_failed_to_check_deployment: "invalid_exact_evm_failed_to_check_deployment",
  invalid_exact_evm_failed_to_execute_transfer: "invalid_exact_evm_failed_to_execute_transfer",
  invalid_exact_evm_failed_to_get_receipt: "invalid_exact_evm_failed_to_get_receipt",
  invalid_exact_evm_transaction_failed: "invalid_exact_evm_transaction_failed",
  invalid_exact_evm_payload_undeployed_smart_wallet:
    "invalid_exact_evm_payload_undeployed_smart_wallet",
  smart_wallet_deployment_failed: "smart_wallet_deployment_failed",
  unsupported_payload_type: "unsupported_payload_type",
  invalid_erc20_approval_extension_format: "invalid_erc20_approval_extension_format",
  erc20_approval_tx_failed: "erc20_approval_tx_failed",
  erc20_approval_from_mismatch: "erc20_approval_from_mismatch",
  erc20_approval_asset_mismatch: "erc20_approval_asset_mismatch",
  erc20_approval_spender_not_permit2: "erc20_approval_spender_not_permit2",
  erc20_approval_tx_parse_failed: "erc20_approval_tx_parse_failed",
  erc20_approval_tx_wrong_target: "erc20_approval_tx_wrong_target",
  erc20_approval_tx_wrong_selector: "erc20_approval_tx_wrong_selector",
  erc20_approval_tx_wrong_spender: "erc20_approval_tx_wrong_spender",
  erc20_approval_tx_signer_mismatch: "erc20_approval_tx_signer_mismatch",
  erc20_approval_tx_invalid_signature: "erc20_approval_tx_invalid_signature",
  invalid_exact_evm_unsupported_scheme: "invalid_exact_evm_unsupported_scheme",
  invalid_exact_evm_extra_field: "invalid_exact_evm_extra_field",
  invalid_exact_evm_payload_recipient_mismatch: "invalid_exact_evm_payload_recipient_mismatch",
  invalid_exact_evm_insufficient_funds: "invalid_exact_evm_insufficient_funds",
  invalid_exact_evm_transaction_state: "invalid_exact_evm_transaction_state",
  invalid_permit2_spender: "invalid_permit2_spender",
  invalid_permit2_recipient_mismatch: "invalid_permit2_recipient_mismatch",
  permit2_deadline_expired: "permit2_deadline_expired",
  permit2_not_yet_valid: "permit2_not_yet_valid",
  permit2_amount_mismatch: "permit2_amount_mismatch",
  permit2_token_mismatch: "permit2_token_mismatch",
  invalid_permit2_signature: "invalid_permit2_signature",
  permit2_allowance_required: "permit2_allowance_required",
  permit2_invalid_amount: "permit2_invalid_amount",
  permit2_invalid_destination: "permit2_invalid_destination",
  permit2_invalid_owner: "permit2_invalid_owner",
  permit2_payment_too_early: "permit2_payment_too_early",
  permit2_invalid_nonce: "permit2_invalid_nonce",
  permit2_2612_amount_mismatch: "permit2_2612_amount_mismatch",
  permit2_simulation_failed: "permit2_simulation_failed",
  permit2_insufficient_balance: "permit2_insufficient_balance",
  permit2_proxy_not_deployed: "permit2_proxy_not_deployed",
  erc20_approval_insufficient_eth_for_gas: "erc20_approval_insufficient_eth_for_gas",
  erc20_approval_broadcast_failed: "erc20_approval_broadcast_failed",
  invalid_exact_solana_unsupported_scheme: "invalid_exact_solana_unsupported_scheme",
  invalid_exact_solana_network_mismatch: "invalid_exact_solana_network_mismatch",
  invalid_exact_solana_payload_missing_fee_payer: "invalid_exact_solana_payload_missing_fee_payer",
  invalid_exact_solana_fee_payer_not_managed_by_facilitator:
    "invalid_exact_solana_fee_payer_not_managed_by_facilitator",
  invalid_exact_solana_payload_transaction: "invalid_exact_solana_payload_transaction",
  invalid_exact_solana_payload_transaction_could_not_be_decoded:
    "invalid_exact_solana_payload_transaction_could_not_be_decoded",
  invalid_exact_solana_payload_transaction_instructions_length:
    "invalid_exact_solana_payload_transaction_instructions_length",
  invalid_exact_solana_payload_unknown_fourth_instruction:
    "invalid_exact_solana_payload_unknown_fourth_instruction",
  invalid_exact_solana_payload_unknown_fifth_instruction:
    "invalid_exact_solana_payload_unknown_fifth_instruction",
  invalid_exact_solana_payload_unknown_sixth_instruction:
    "invalid_exact_solana_payload_unknown_sixth_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_limit_instruction:
    "invalid_exact_solana_payload_transaction_instructions_compute_limit_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_price_instruction:
    "invalid_exact_solana_payload_transaction_instructions_compute_price_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_price_instruction_too_high:
    "invalid_exact_solana_payload_transaction_instructions_compute_price_instruction_too_high",
  invalid_exact_solana_payload_no_transfer_instruction:
    "invalid_exact_solana_payload_no_transfer_instruction",
  invalid_exact_solana_payload_transaction_fee_payer_transferring_funds:
    "invalid_exact_solana_payload_transaction_fee_payer_transferring_funds",
  invalid_exact_solana_payload_mint_mismatch: "invalid_exact_solana_payload_mint_mismatch",
  invalid_exact_solana_payload_recipient_mismatch:
    "invalid_exact_solana_payload_recipient_mismatch",
  invalid_exact_solana_payload_amount_insufficient:
    "invalid_exact_solana_payload_amount_insufficient",
  invalid_exact_solana_invalid_fee_payer: "invalid_exact_solana_invalid_fee_payer",
  invalid_exact_solana_transaction_signing_failed:
    "invalid_exact_solana_transaction_signing_failed",
  invalid_exact_solana_transaction_simulation_failed:
    "invalid_exact_solana_transaction_simulation_failed",
  invalid_exact_solana_payload_memo_mismatch: "invalid_exact_solana_payload_memo_mismatch",
  invalid_exact_solana_payload_memo_count: "invalid_exact_solana_payload_memo_count",
  invalid_exact_solana_verification_failed: "invalid_exact_solana_verification_failed",
  invalid_exact_solana_fee_payer_mismatch: "invalid_exact_solana_fee_payer_mismatch",
  invalid_exact_solana_transaction_failed: "invalid_exact_solana_transaction_failed",
  invalid_exact_solana_transaction_confirmation_failed:
    "invalid_exact_solana_transaction_confirmation_failed",
  duplicate_settlement: "duplicate_settlement",
  invalid_exact_solana_extra_field: "invalid_exact_solana_extra_field",
  batch_settlement_cumulative_amount_mismatch: "batch_settlement_cumulative_amount_mismatch",
  batch_settlement_channel_busy: "batch_settlement_channel_busy",
  missing_batch_settlement_channel: "missing_batch_settlement_channel",
  batch_settlement_charge_exceeds_signed_cumulative:
    "batch_settlement_charge_exceeds_signed_cumulative",
  batch_settlement_refund_no_balance: "batch_settlement_refund_no_balance",
  batch_settlement_refund_amount_invalid: "batch_settlement_refund_amount_invalid",
  batch_settlement_refund_amount_exceeds_balance: "batch_settlement_refund_amount_exceeds_balance",
  amount_too_low: "amount_too_low",
  invalid_amount: "invalid_amount",
  kyt_risk_detected: "kyt_risk_detected",
  permit2_disabled: "permit2_disabled",
  preflight_validation_failed: "preflight_validation_failed",
  request_blocked_by_location: "request_blocked_by_location",
  self_send_not_allowed: "self_send_not_allowed",
  invalid_bazaar_extension: "invalid_bazaar_extension",
  unknown_error: "unknown_error",
} as const;

/**
 * The result when x402 payment verification fails.
 */
export interface X402VerifyPaymentRejection {
  /** Indicates whether the payment is valid. */
  isValid: boolean;
  invalidReason: X402VerifyInvalidReason;
  /** The message describing the invalid reason. */
  invalidMessage?: string;
  /** The onchain address of the client that is paying for the resource.

For EVM networks, the payer will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the payer will be a base58-encoded Solana address. */
  payer?: BlockchainAddress;
}

/**
 * The reason the payment settlement errored on the x402 protocol.
 */
export type X402SettleErrorReason =
  (typeof X402SettleErrorReason)[keyof typeof X402SettleErrorReason];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402SettleErrorReason = {
  insufficient_funds: "insufficient_funds",
  invalid_scheme: "invalid_scheme",
  invalid_network: "invalid_network",
  invalid_x402_version: "invalid_x402_version",
  invalid_payment_requirements: "invalid_payment_requirements",
  invalid_payload: "invalid_payload",
  invalid_exact_evm_payload_authorization_value: "invalid_exact_evm_payload_authorization_value",
  invalid_exact_evm_payload_authorization_value_too_low:
    "invalid_exact_evm_payload_authorization_value_too_low",
  invalid_exact_evm_payload_authorization_valid_after:
    "invalid_exact_evm_payload_authorization_valid_after",
  invalid_exact_evm_payload_authorization_valid_before:
    "invalid_exact_evm_payload_authorization_valid_before",
  invalid_exact_evm_payload_authorization_typed_data_message:
    "invalid_exact_evm_payload_authorization_typed_data_message",
  invalid_exact_evm_payload_authorization_from_address_kyt:
    "invalid_exact_evm_payload_authorization_from_address_kyt",
  invalid_exact_evm_payload_authorization_to_address_kyt:
    "invalid_exact_evm_payload_authorization_to_address_kyt",
  invalid_exact_evm_payload_signature: "invalid_exact_evm_payload_signature",
  invalid_exact_evm_payload_signature_address: "invalid_exact_evm_payload_signature_address",
  invalid_exact_evm_permit2_payload_allowance_required:
    "invalid_exact_evm_permit2_payload_allowance_required",
  invalid_exact_evm_permit2_payload_signature: "invalid_exact_evm_permit2_payload_signature",
  invalid_exact_evm_permit2_payload_deadline: "invalid_exact_evm_permit2_payload_deadline",
  invalid_exact_evm_permit2_payload_valid_after: "invalid_exact_evm_permit2_payload_valid_after",
  invalid_exact_evm_permit2_payload_spender: "invalid_exact_evm_permit2_payload_spender",
  invalid_exact_evm_permit2_payload_recipient: "invalid_exact_evm_permit2_payload_recipient",
  invalid_exact_evm_permit2_payload_amount: "invalid_exact_evm_permit2_payload_amount",
  invalid_exact_svm_payload_transaction: "invalid_exact_svm_payload_transaction",
  invalid_exact_svm_payload_transaction_amount_mismatch:
    "invalid_exact_svm_payload_transaction_amount_mismatch",
  invalid_exact_svm_payload_transaction_create_ata_instruction:
    "invalid_exact_svm_payload_transaction_create_ata_instruction",
  invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee:
    "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee",
  invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset:
    "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset",
  invalid_exact_svm_payload_transaction_instructions:
    "invalid_exact_svm_payload_transaction_instructions",
  invalid_exact_svm_payload_transaction_instructions_length:
    "invalid_exact_svm_payload_transaction_instructions_length",
  invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction:
    "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction",
  invalid_exact_svm_payload_transaction_instructions_compute_price_instruction:
    "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction",
  invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high:
    "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high",
  invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked:
    "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked",
  invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked:
    "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked",
  invalid_exact_svm_payload_transaction_not_a_transfer_instruction:
    "invalid_exact_svm_payload_transaction_not_a_transfer_instruction",
  invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata:
    "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata",
  invalid_exact_svm_payload_transaction_receiver_ata_not_found:
    "invalid_exact_svm_payload_transaction_receiver_ata_not_found",
  invalid_exact_svm_payload_transaction_sender_ata_not_found:
    "invalid_exact_svm_payload_transaction_sender_ata_not_found",
  invalid_exact_svm_payload_transaction_simulation_failed:
    "invalid_exact_svm_payload_transaction_simulation_failed",
  invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata:
    "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata",
  invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts:
    "invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts",
  invalid_exact_svm_payload_transaction_fee_payer_transferring_funds:
    "invalid_exact_svm_payload_transaction_fee_payer_transferring_funds",
  settle_exact_evm_transaction_confirmation_timed_out:
    "settle_exact_evm_transaction_confirmation_timed_out",
  settle_exact_node_failure: "settle_exact_node_failure",
  settle_exact_failed_onchain: "settle_exact_failed_onchain",
  settle_exact_svm_block_height_exceeded: "settle_exact_svm_block_height_exceeded",
  settle_exact_svm_transaction_confirmation_timed_out:
    "settle_exact_svm_transaction_confirmation_timed_out",
  invalid_batch_settlement_evm_unknown_settle_action:
    "invalid_batch_settlement_evm_unknown_settle_action",
  invalid_batch_settlement_evm_claim_payload: "invalid_batch_settlement_evm_claim_payload",
  invalid_batch_settlement_evm_settle_payload: "invalid_batch_settlement_evm_settle_payload",
  invalid_batch_settlement_evm_authorizer_address_mismatch:
    "invalid_batch_settlement_evm_authorizer_address_mismatch",
  invalid_batch_settlement_evm_claim_simulation_failed:
    "invalid_batch_settlement_evm_claim_simulation_failed",
  invalid_batch_settlement_evm_claim_transaction_failed:
    "invalid_batch_settlement_evm_claim_transaction_failed",
  invalid_batch_settlement_evm_deposit_transaction_failed:
    "invalid_batch_settlement_evm_deposit_transaction_failed",
  invalid_batch_settlement_evm_refund_simulation_failed:
    "invalid_batch_settlement_evm_refund_simulation_failed",
  invalid_batch_settlement_evm_refund_transaction_failed:
    "invalid_batch_settlement_evm_refund_transaction_failed",
  invalid_batch_settlement_evm_settle_simulation_failed:
    "invalid_batch_settlement_evm_settle_simulation_failed",
  invalid_batch_settlement_evm_settle_transaction_failed:
    "invalid_batch_settlement_evm_settle_transaction_failed",
  invalid_batch_settlement_evm_transaction_reverted:
    "invalid_batch_settlement_evm_transaction_reverted",
  invalid_batch_settlement_evm_wait_for_receipt_failed:
    "invalid_batch_settlement_evm_wait_for_receipt_failed",
  invalid_batch_settlement_evm_erc20_approval_broadcast_failed:
    "invalid_batch_settlement_evm_erc20_approval_broadcast_failed",
  invalid_batch_settlement_evm_channel_id_mismatch:
    "invalid_batch_settlement_evm_channel_id_mismatch",
  invalid_batch_settlement_evm_channel_state_read_failed:
    "invalid_batch_settlement_evm_channel_state_read_failed",
  invalid_batch_settlement_evm_cumulative_below_claimed:
    "invalid_batch_settlement_evm_cumulative_below_claimed",
  invalid_batch_settlement_evm_cumulative_exceeds_balance:
    "invalid_batch_settlement_evm_cumulative_exceeds_balance",
  invalid_batch_settlement_evm_eip2612_amount_mismatch:
    "invalid_batch_settlement_evm_eip2612_amount_mismatch",
  invalid_batch_settlement_evm_eip2612_asset_mismatch:
    "invalid_batch_settlement_evm_eip2612_asset_mismatch",
  invalid_batch_settlement_evm_eip2612_deadline_expired:
    "invalid_batch_settlement_evm_eip2612_deadline_expired",
  invalid_batch_settlement_evm_eip2612_invalid_format:
    "invalid_batch_settlement_evm_eip2612_invalid_format",
  invalid_batch_settlement_evm_eip2612_invalid_signature:
    "invalid_batch_settlement_evm_eip2612_invalid_signature",
  invalid_batch_settlement_evm_eip2612_owner_mismatch:
    "invalid_batch_settlement_evm_eip2612_owner_mismatch",
  invalid_batch_settlement_evm_eip2612_spender_mismatch:
    "invalid_batch_settlement_evm_eip2612_spender_mismatch",
  invalid_batch_settlement_evm_erc20_approval_asset_mismatch:
    "invalid_batch_settlement_evm_erc20_approval_asset_mismatch",
  invalid_batch_settlement_evm_erc20_approval_from_mismatch:
    "invalid_batch_settlement_evm_erc20_approval_from_mismatch",
  invalid_batch_settlement_evm_erc20_approval_invalid_format:
    "invalid_batch_settlement_evm_erc20_approval_invalid_format",
  invalid_batch_settlement_evm_erc20_approval_unavailable:
    "invalid_batch_settlement_evm_erc20_approval_unavailable",
  invalid_batch_settlement_evm_erc20_approval_wrong_spender:
    "invalid_batch_settlement_evm_erc20_approval_wrong_spender",
  invalid_batch_settlement_evm_erc3009_authorization_required:
    "invalid_batch_settlement_evm_erc3009_authorization_required",
  invalid_batch_settlement_evm_insufficient_balance:
    "invalid_batch_settlement_evm_insufficient_balance",
  invalid_batch_settlement_evm_deposit_payload: "invalid_batch_settlement_evm_deposit_payload",
  invalid_batch_settlement_evm_receive_authorization_signature:
    "invalid_batch_settlement_evm_receive_authorization_signature",
  invalid_batch_settlement_evm_refund_payload: "invalid_batch_settlement_evm_refund_payload",
  invalid_batch_settlement_evm_voucher_payload: "invalid_batch_settlement_evm_voucher_payload",
  invalid_batch_settlement_evm_voucher_signature: "invalid_batch_settlement_evm_voucher_signature",
  invalid_batch_settlement_evm_missing_eip712_domain:
    "invalid_batch_settlement_evm_missing_eip712_domain",
  invalid_batch_settlement_evm_payload_authorization_valid_after:
    "invalid_batch_settlement_evm_payload_authorization_valid_after",
  invalid_batch_settlement_evm_payload_authorization_valid_before:
    "invalid_batch_settlement_evm_payload_authorization_valid_before",
  invalid_batch_settlement_evm_permit2_allowance_required:
    "invalid_batch_settlement_evm_permit2_allowance_required",
  invalid_batch_settlement_evm_permit2_amount_mismatch:
    "invalid_batch_settlement_evm_permit2_amount_mismatch",
  invalid_batch_settlement_evm_permit2_authorization_required:
    "invalid_batch_settlement_evm_permit2_authorization_required",
  invalid_batch_settlement_evm_permit2_deadline_expired:
    "invalid_batch_settlement_evm_permit2_deadline_expired",
  invalid_batch_settlement_evm_permit2_invalid_signature:
    "invalid_batch_settlement_evm_permit2_invalid_signature",
  invalid_batch_settlement_evm_permit2_invalid_spender:
    "invalid_batch_settlement_evm_permit2_invalid_spender",
  invalid_batch_settlement_evm_receiver_authorizer_mismatch:
    "invalid_batch_settlement_evm_receiver_authorizer_mismatch",
  invalid_batch_settlement_evm_receiver_mismatch: "invalid_batch_settlement_evm_receiver_mismatch",
  invalid_batch_settlement_evm_rpc_read_failed: "invalid_batch_settlement_evm_rpc_read_failed",
  invalid_batch_settlement_evm_token_mismatch: "invalid_batch_settlement_evm_token_mismatch",
  invalid_batch_settlement_evm_withdraw_delay_mismatch:
    "invalid_batch_settlement_evm_withdraw_delay_mismatch",
  invalid_batch_settlement_evm_withdraw_delay_out_of_range:
    "invalid_batch_settlement_evm_withdraw_delay_out_of_range",
  invalid_batch_settlement_evm_scheme: "invalid_batch_settlement_evm_scheme",
  invalid_batch_settlement_evm_network_mismatch: "invalid_batch_settlement_evm_network_mismatch",
  invalid_batch_settlement_evm_payload_type: "invalid_batch_settlement_evm_payload_type",
  invalid_batch_settlement_evm_channel_not_found: "invalid_batch_settlement_evm_channel_not_found",
  invalid_batch_settlement_evm_deposit_simulation_failed:
    "invalid_batch_settlement_evm_deposit_simulation_failed",
  invalid_exact_evm_scheme: "invalid_exact_evm_scheme",
  invalid_exact_evm_network_mismatch: "invalid_exact_evm_network_mismatch",
  invalid_exact_evm_payload: "invalid_exact_evm_payload",
  invalid_exact_evm_payload_missing_signature: "invalid_exact_evm_payload_missing_signature",
  invalid_exact_evm_failed_to_get_network_config: "invalid_exact_evm_failed_to_get_network_config",
  invalid_exact_evm_missing_eip712_domain: "invalid_exact_evm_missing_eip712_domain",
  invalid_exact_evm_recipient_mismatch: "invalid_exact_evm_recipient_mismatch",
  invalid_exact_evm_authorization_value: "invalid_exact_evm_authorization_value",
  invalid_exact_evm_required_amount: "invalid_exact_evm_required_amount",
  invalid_exact_evm_payload_authorization_value_mismatch:
    "invalid_exact_evm_payload_authorization_value_mismatch",
  invalid_exact_evm_failed_to_check_nonce: "invalid_exact_evm_failed_to_check_nonce",
  invalid_exact_evm_nonce_already_used: "invalid_exact_evm_nonce_already_used",
  invalid_exact_evm_failed_to_get_balance: "invalid_exact_evm_failed_to_get_balance",
  invalid_exact_evm_insufficient_balance: "invalid_exact_evm_insufficient_balance",
  invalid_exact_evm_signature_format: "invalid_exact_evm_signature_format",
  invalid_exact_evm_failed_to_verify_signature: "invalid_exact_evm_failed_to_verify_signature",
  invalid_exact_evm_signature: "invalid_exact_evm_signature",
  invalid_exact_evm_token_name_mismatch: "invalid_exact_evm_token_name_mismatch",
  invalid_exact_evm_token_version_mismatch: "invalid_exact_evm_token_version_mismatch",
  invalid_exact_evm_eip3009_not_supported: "invalid_exact_evm_eip3009_not_supported",
  invalid_exact_evm_transaction_simulation_failed:
    "invalid_exact_evm_transaction_simulation_failed",
  invalid_exact_evm_verification_failed: "invalid_exact_evm_verification_failed",
  invalid_exact_evm_failed_to_parse_signature: "invalid_exact_evm_failed_to_parse_signature",
  invalid_exact_evm_failed_to_check_deployment: "invalid_exact_evm_failed_to_check_deployment",
  invalid_exact_evm_failed_to_execute_transfer: "invalid_exact_evm_failed_to_execute_transfer",
  invalid_exact_evm_failed_to_get_receipt: "invalid_exact_evm_failed_to_get_receipt",
  invalid_exact_evm_transaction_failed: "invalid_exact_evm_transaction_failed",
  invalid_exact_evm_payload_undeployed_smart_wallet:
    "invalid_exact_evm_payload_undeployed_smart_wallet",
  smart_wallet_deployment_failed: "smart_wallet_deployment_failed",
  unsupported_payload_type: "unsupported_payload_type",
  invalid_erc20_approval_extension_format: "invalid_erc20_approval_extension_format",
  erc20_approval_tx_failed: "erc20_approval_tx_failed",
  erc20_approval_from_mismatch: "erc20_approval_from_mismatch",
  erc20_approval_asset_mismatch: "erc20_approval_asset_mismatch",
  erc20_approval_spender_not_permit2: "erc20_approval_spender_not_permit2",
  erc20_approval_tx_parse_failed: "erc20_approval_tx_parse_failed",
  erc20_approval_tx_wrong_target: "erc20_approval_tx_wrong_target",
  erc20_approval_tx_wrong_selector: "erc20_approval_tx_wrong_selector",
  erc20_approval_tx_wrong_spender: "erc20_approval_tx_wrong_spender",
  erc20_approval_tx_signer_mismatch: "erc20_approval_tx_signer_mismatch",
  erc20_approval_tx_invalid_signature: "erc20_approval_tx_invalid_signature",
  invalid_exact_evm_unsupported_scheme: "invalid_exact_evm_unsupported_scheme",
  invalid_exact_evm_extra_field: "invalid_exact_evm_extra_field",
  invalid_exact_evm_payload_recipient_mismatch: "invalid_exact_evm_payload_recipient_mismatch",
  invalid_exact_evm_insufficient_funds: "invalid_exact_evm_insufficient_funds",
  invalid_exact_evm_transaction_state: "invalid_exact_evm_transaction_state",
  invalid_permit2_spender: "invalid_permit2_spender",
  invalid_permit2_recipient_mismatch: "invalid_permit2_recipient_mismatch",
  permit2_deadline_expired: "permit2_deadline_expired",
  permit2_not_yet_valid: "permit2_not_yet_valid",
  permit2_amount_mismatch: "permit2_amount_mismatch",
  permit2_token_mismatch: "permit2_token_mismatch",
  invalid_permit2_signature: "invalid_permit2_signature",
  permit2_allowance_required: "permit2_allowance_required",
  permit2_invalid_amount: "permit2_invalid_amount",
  permit2_invalid_destination: "permit2_invalid_destination",
  permit2_invalid_owner: "permit2_invalid_owner",
  permit2_payment_too_early: "permit2_payment_too_early",
  permit2_invalid_nonce: "permit2_invalid_nonce",
  permit2_2612_amount_mismatch: "permit2_2612_amount_mismatch",
  permit2_simulation_failed: "permit2_simulation_failed",
  permit2_insufficient_balance: "permit2_insufficient_balance",
  permit2_proxy_not_deployed: "permit2_proxy_not_deployed",
  erc20_approval_insufficient_eth_for_gas: "erc20_approval_insufficient_eth_for_gas",
  erc20_approval_broadcast_failed: "erc20_approval_broadcast_failed",
  invalid_exact_solana_unsupported_scheme: "invalid_exact_solana_unsupported_scheme",
  invalid_exact_solana_network_mismatch: "invalid_exact_solana_network_mismatch",
  invalid_exact_solana_payload_missing_fee_payer: "invalid_exact_solana_payload_missing_fee_payer",
  invalid_exact_solana_fee_payer_not_managed_by_facilitator:
    "invalid_exact_solana_fee_payer_not_managed_by_facilitator",
  invalid_exact_solana_payload_transaction: "invalid_exact_solana_payload_transaction",
  invalid_exact_solana_payload_transaction_could_not_be_decoded:
    "invalid_exact_solana_payload_transaction_could_not_be_decoded",
  invalid_exact_solana_payload_transaction_instructions_length:
    "invalid_exact_solana_payload_transaction_instructions_length",
  invalid_exact_solana_payload_unknown_fourth_instruction:
    "invalid_exact_solana_payload_unknown_fourth_instruction",
  invalid_exact_solana_payload_unknown_fifth_instruction:
    "invalid_exact_solana_payload_unknown_fifth_instruction",
  invalid_exact_solana_payload_unknown_sixth_instruction:
    "invalid_exact_solana_payload_unknown_sixth_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_limit_instruction:
    "invalid_exact_solana_payload_transaction_instructions_compute_limit_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_price_instruction:
    "invalid_exact_solana_payload_transaction_instructions_compute_price_instruction",
  invalid_exact_solana_payload_transaction_instructions_compute_price_instruction_too_high:
    "invalid_exact_solana_payload_transaction_instructions_compute_price_instruction_too_high",
  invalid_exact_solana_payload_no_transfer_instruction:
    "invalid_exact_solana_payload_no_transfer_instruction",
  invalid_exact_solana_payload_transaction_fee_payer_transferring_funds:
    "invalid_exact_solana_payload_transaction_fee_payer_transferring_funds",
  invalid_exact_solana_payload_mint_mismatch: "invalid_exact_solana_payload_mint_mismatch",
  invalid_exact_solana_payload_recipient_mismatch:
    "invalid_exact_solana_payload_recipient_mismatch",
  invalid_exact_solana_payload_amount_insufficient:
    "invalid_exact_solana_payload_amount_insufficient",
  invalid_exact_solana_invalid_fee_payer: "invalid_exact_solana_invalid_fee_payer",
  invalid_exact_solana_transaction_signing_failed:
    "invalid_exact_solana_transaction_signing_failed",
  invalid_exact_solana_transaction_simulation_failed:
    "invalid_exact_solana_transaction_simulation_failed",
  invalid_exact_solana_payload_memo_mismatch: "invalid_exact_solana_payload_memo_mismatch",
  invalid_exact_solana_payload_memo_count: "invalid_exact_solana_payload_memo_count",
  invalid_exact_solana_verification_failed: "invalid_exact_solana_verification_failed",
  invalid_exact_solana_fee_payer_mismatch: "invalid_exact_solana_fee_payer_mismatch",
  invalid_exact_solana_transaction_failed: "invalid_exact_solana_transaction_failed",
  invalid_exact_solana_transaction_confirmation_failed:
    "invalid_exact_solana_transaction_confirmation_failed",
  duplicate_settlement: "duplicate_settlement",
  invalid_exact_solana_extra_field: "invalid_exact_solana_extra_field",
  batch_settlement_cumulative_amount_mismatch: "batch_settlement_cumulative_amount_mismatch",
  batch_settlement_channel_busy: "batch_settlement_channel_busy",
  missing_batch_settlement_channel: "missing_batch_settlement_channel",
  batch_settlement_charge_exceeds_signed_cumulative:
    "batch_settlement_charge_exceeds_signed_cumulative",
  batch_settlement_refund_no_balance: "batch_settlement_refund_no_balance",
  batch_settlement_refund_amount_invalid: "batch_settlement_refund_amount_invalid",
  batch_settlement_refund_amount_exceeds_balance: "batch_settlement_refund_amount_exceeds_balance",
  amount_too_low: "amount_too_low",
  invalid_amount: "invalid_amount",
  kyt_risk_detected: "kyt_risk_detected",
  permit2_disabled: "permit2_disabled",
  preflight_validation_failed: "preflight_validation_failed",
  request_blocked_by_location: "request_blocked_by_location",
  self_send_not_allowed: "self_send_not_allowed",
  invalid_bazaar_extension: "invalid_bazaar_extension",
  unknown_error: "unknown_error",
} as const;

/**
 * The result when x402 payment settlement fails.
 */
export interface X402SettlePaymentRejection {
  /** Indicates whether the payment settlement is successful. */
  success: boolean;
  errorReason: X402SettleErrorReason;
  /** The message describing the error reason. */
  errorMessage?: string;
  /** The onchain address of the client that is paying for the resource.

For EVM networks, the payer will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the payer will be a base58-encoded Solana address. */
  payer?: BlockchainAddress;
  /**
   * The transaction of the settlement.
For EVM networks, the transaction will be a 0x-prefixed, EVM transaction hash.
For Solana-based networks, the transaction will be a base58-encoded Solana signature.
   * @pattern ^(0x[a-fA-F0-9]{64}|[1-9A-HJ-NP-Za-km-z]{87,88})$
   */
  transaction?: string;
  /** The network where the settlement occurred. */
  network?: string;
}

/**
 * The scheme of the payment protocol.
 */
export type X402SupportedPaymentKindScheme =
  (typeof X402SupportedPaymentKindScheme)[keyof typeof X402SupportedPaymentKindScheme];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402SupportedPaymentKindScheme = {
  exact: "exact",
  upto: "upto",
  "batch-settlement": "batch-settlement",
} as const;

/**
 * The network of the blockchain. The format corresponds to the `x402Version` of the enclosing `x402SupportedPaymentKind`: v1 uses human-readable names (see `X402V1Network`); v2 uses CAIP-2 chain IDs (see `X402V2Network`).
 */
export type X402SupportedPaymentKindNetwork =
  (typeof X402SupportedPaymentKindNetwork)[keyof typeof X402SupportedPaymentKindNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402SupportedPaymentKindNetwork = {
  "base-sepolia": "base-sepolia",
  base: "base",
  "solana-devnet": "solana-devnet",
  solana: "solana",
  "eip155:8453": "eip155:8453",
  "eip155:84532": "eip155:84532",
  "eip155:137": "eip155:137",
  "eip155:42161": "eip155:42161",
  "eip155:480": "eip155:480",
  "eip155:4801": "eip155:4801",
  "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
  "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
} as const;

/**
 * The optional additional scheme-specific payment info.
Common scheme-specific fields:
  - `exact` on Solana: `feePayer` — the base58-encoded Solana address that pays transaction fees.
  - `upto` on EVM: `name`, `version`, and `facilitatorAddress` — the EVM address of the facilitator that the client must bind into the Permit2 witness when constructing the payment payload.
  - `batch-settlement` on EVM: `name`, `version`, `receiverAuthorizer` (the EVM address authorized to sign claim batches), `withdrawDelay` (channel non-cooperative withdraw delay in seconds, 900–2,592,000), and optionally `assetTransferMethod` (e.g., `"eip3009"`).
 */
export type X402SupportedPaymentKindExtra = { [key: string]: unknown };

/**
 * The supported payment kind for the x402 protocol. A kind is comprised of a scheme and a network, which together uniquely identify a way to move money on the x402 protocol. For more details, please see [x402 Schemes](https://github.com/coinbase/x402?tab=readme-ov-file#schemes).
 */
export interface X402SupportedPaymentKind {
  x402Version: X402Version;
  /** The scheme of the payment protocol. */
  scheme: X402SupportedPaymentKindScheme;
  /** The network of the blockchain. The format corresponds to the `x402Version` of the enclosing `x402SupportedPaymentKind`: v1 uses human-readable names (see `X402V1Network`); v2 uses CAIP-2 chain IDs (see `X402V2Network`). */
  network: X402SupportedPaymentKindNetwork;
  /** The optional additional scheme-specific payment info.
Common scheme-specific fields:
  - `exact` on Solana: `feePayer` — the base58-encoded Solana address that pays transaction fees.
  - `upto` on EVM: `name`, `version`, and `facilitatorAddress` — the EVM address of the facilitator that the client must bind into the Permit2 witness when constructing the payment payload.
  - `batch-settlement` on EVM: `name`, `version`, `receiverAuthorizer` (the EVM address authorized to sign claim batches), `withdrawDelay` (channel non-cooperative withdraw delay in seconds, 900–2,592,000), and optionally `assetTransferMethod` (e.g., `"eip3009"`). */
  extra?: X402SupportedPaymentKindExtra;
}

/**
 * Quality metrics for a discovered x402 resource.
 */
export interface X402ResourceQuality {
  /** Total number of paid calls to a resource in the last 30 days. */
  l30DaysTotalCalls?: number;
  /** Number of unique payers to a resource in the last 30 days. */
  l30DaysUniquePayers?: number;
  /** Timestamp of the most recent paid call to a resource. */
  lastCalledAt?: string;
}

/**
 * Communication protocol (e.g., "http", "mcp").
 */
export type X402DiscoveryResourceType =
  (typeof X402DiscoveryResourceType)[keyof typeof X402DiscoveryResourceType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402DiscoveryResourceType = {
  http: "http",
  mcp: "mcp",
} as const;

/**
 * Map of x402 protocol extensions supported by the resource, keyed by extension name.
 */
export type X402DiscoveryResourceExtensions = { [key: string]: unknown };

/**
 * A single discovered x402 resource.
 */
export interface X402DiscoveryResource {
  /** The URL of the resource. */
  resource: string;
  /** A human-readable description of the resource. */
  description?: string;
  /** Communication protocol (e.g., "http", "mcp"). */
  type: X402DiscoveryResourceType;
  x402Version: X402Version;
  /** Timestamp of the last update. */
  lastUpdated?: string;
  /** Payment requirements accepted by the resource. */
  accepts?: X402PaymentRequirements[];
  /** Map of x402 protocol extensions supported by the resource, keyed by extension name. */
  extensions?: X402DiscoveryResourceExtensions;
  quality?: X402ResourceQuality;
  /** Provider-supplied display name of the service this resource belongs to. This is a free-form
label for grouping and presentation only — it is not a stable identifier, and two resources
sharing the same `serviceName` are not guaranteed to belong to the same logical service.
 */
  serviceName?: string;
  /** Provider-supplied, low-cardinality string labels associated with the resource for client-side
filtering and display. Values are free-form (no controlled vocabulary) and case-sensitive.
Order is not significant and duplicates are not expected.
 */
  tags?: string[];
  /** URL of a square icon representing the service this resource belongs to. Distinct from a
brand logo: this is intended for compact, list-view rendering (favicon-style) and is
normalized to a square aspect ratio at ingestion. The image is moderated and re-hosted by
Coinbase, so the URL is stable and safe to render directly in clients. Omitted when the
provider did not supply an icon, when the supplied icon failed moderation, or when image
processing was unavailable at ingestion time.
 */
  iconUrl?: Url;
}

/**
 * Pagination information for the response.
 */
export type X402DiscoveryResourcesResponsePagination = {
  /** The number of discovered x402 resources to return per page. */
  limit?: number;
  /** The offset of the first discovered x402 resource to return. */
  offset?: number;
  /** The total number of discovered x402 resources. */
  total?: number;
};

/**
 * Response containing discovered x402 resources.
 */
export interface X402DiscoveryResourcesResponse {
  x402Version: X402Version;
  /** List of discovered x402 resources. */
  items: X402DiscoveryResource[];
  /** Pagination information for the response. */
  pagination: X402DiscoveryResourcesResponsePagination;
}

/**
 * Pagination information for the response.
 */
export type X402DiscoveryMerchantResponsePagination = {
  /** The number of resources returned per page. */
  limit?: number;
  /** The offset of the first resource returned. */
  offset?: number;
  /** The total number of resources associated with the merchant's payTo address. */
  total?: number;
};

/**
 * Response containing x402 resources associated with a merchant payment address. The resources list is empty when no active resources are found.
 */
export interface X402DiscoveryMerchantResponse {
  x402Version: X402Version;
  payTo: BlockchainAddress;
  /** List of discovered x402 resources associated with the merchant's payTo address. This list is empty when no active resources are found. */
  resources: X402DiscoveryResource[];
  /** Pagination information for the response. */
  pagination: X402DiscoveryMerchantResponsePagination;
}

/**
 * The search method used to retrieve the results (e.g., "text", "vector", "hybrid").
 */
export type X402SearchResourcesResponseSearchMethod =
  (typeof X402SearchResourcesResponseSearchMethod)[keyof typeof X402SearchResourcesResponseSearchMethod];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402SearchResourcesResponseSearchMethod = {
  text: "text",
  vector: "vector",
  hybrid: "hybrid",
} as const;

/**
 * Response from a search for x402 resources.
 */
export interface X402SearchResourcesResponse {
  /** List of x402 resources matching the search query and filters. */
  resources: X402DiscoveryResource[];
  /** Indicates whether the result set was truncated because there were more results than the requested limit. */
  partialResults: boolean;
  /** The search method used to retrieve the results (e.g., "text", "vector", "hybrid"). */
  searchMethod?: X402SearchResourcesResponseSearchMethod;
  x402Version: X402Version;
}

/**
 * JSON-RPC version, must be "2.0".
 */
export type X402McpRequestJsonrpc =
  (typeof X402McpRequestJsonrpc)[keyof typeof X402McpRequestJsonrpc];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402McpRequestJsonrpc = {
  "20": "2.0",
} as const;

/**
 * Request identifier.
 */
export type X402McpRequestId = string | number;

/**
 * Optional parameters for the method.
 */
export type X402McpRequestParams = { [key: string]: unknown };

/**
 * A JSON-RPC 2.0 request for the Model Context Protocol.
 */
export interface X402McpRequest {
  /** JSON-RPC version, must be "2.0". */
  jsonrpc: X402McpRequestJsonrpc;
  /** Request identifier. */
  id?: X402McpRequestId;
  /** The MCP method to invoke. */
  method: string;
  /** Optional parameters for the method. */
  params?: X402McpRequestParams;
}

/**
 * Additional error data.
 */
export type X402McpErrorData = { [key: string]: unknown };

/**
 * JSON-RPC 2.0 error object.
 */
export interface X402McpError {
  /** Error code. */
  code: number;
  /** Error message. */
  message: string;
  /** Additional error data. */
  data?: X402McpErrorData;
}

/**
 * JSON-RPC version.
 */
export type X402McpResponseJsonrpc =
  (typeof X402McpResponseJsonrpc)[keyof typeof X402McpResponseJsonrpc];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402McpResponseJsonrpc = {
  "20": "2.0",
} as const;

/**
 * Request identifier (matches the request ID, null for notifications).
 * @nullable
 */
export type X402McpResponseId = string | number | null;

/**
 * The result of the method call (present on success).
 */
export type X402McpResponseResult = { [key: string]: unknown };

/**
 * A JSON-RPC 2.0 response for the Model Context Protocol.
 */
export interface X402McpResponse {
  /** JSON-RPC version. */
  jsonrpc: X402McpResponseJsonrpc;
  /**
   * Request identifier (matches the request ID, null for notifications).
   * @nullable
   */
  id?: X402McpResponseId;
  /** The result of the method call (present on success). */
  result?: X402McpResponseResult;
  error?: X402McpError;
}

/**
 * A valid HTTPS URL.
 * @minLength 12
 * @maxLength 2048
 * @pattern ^https://.*$
 */
export type HttpsUrl = string;

/**
 * The HTTP method used to probe the endpoint. Only GET and POST are supported; other verbs are intentionally rejected because x402 resources are expected to respond to these methods.
 */
export type X402ValidateRequestMethod =
  (typeof X402ValidateRequestMethod)[keyof typeof X402ValidateRequestMethod];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402ValidateRequestMethod = {
  GET: "GET",
  POST: "POST",
} as const;

/**
 * Request to validate an x402 endpoint's bazaar-discovery configuration.
 */
export interface X402ValidateRequest {
  /** HTTPS URL of the x402 endpoint to validate. Must use the `https://` scheme. */
  resource: HttpsUrl;
  /** The HTTP method used to probe the endpoint. Only GET and POST are supported; other verbs are intentionally rejected because x402 resources are expected to respond to these methods. */
  method?: X402ValidateRequestMethod;
}

/**
 * The name of the preflight check. New values may be added in future versions; clients should handle unknown values gracefully.
 */
export type X402ValidateCheckCheck =
  (typeof X402ValidateCheckCheck)[keyof typeof X402ValidateCheckCheck];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402ValidateCheckCheck = {
  reachable: "reachable",
  returns_402: "returns_402",
  has_bazaar_extension: "has_bazaar_extension",
  parse: "parse",
} as const;

/**
 * Whether this check is a hard indexing requirement or a quality recommendation. A `required` check affects validity when it fails. An `advisory` check (for example, a missing output schema) is a suggestion to improve discoverability and does not make the endpoint invalid.
 */
export type X402ValidateCheckSeverity =
  (typeof X402ValidateCheckSeverity)[keyof typeof X402ValidateCheckSeverity];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402ValidateCheckSeverity = {
  required: "required",
  advisory: "advisory",
} as const;

/**
 * The result of a single preflight check performed against the x402 endpoint.
 */
export interface X402ValidateCheck {
  /** The name of the preflight check. New values may be added in future versions; clients should handle unknown values gracefully. */
  check: X402ValidateCheckCheck;
  /** Whether the check passed. */
  passed: boolean;
  /** A human-readable explanation of the check result. */
  detail: string;
  /** The value the check expected, when applicable. */
  expected?: string;
  /** The value the check observed, when applicable. */
  actual?: string;
  /** Whether this check is a hard indexing requirement or a quality recommendation. A `required` check affects validity when it fails. An `advisory` check (for example, a missing output schema) is a suggestion to improve discoverability and does not make the endpoint invalid. */
  severity: X402ValidateCheckSeverity;
}

/**
 * The simulated facilitator outcome: `accepted` if the facilitator would index the resource, or `rejected` if it would reject it.
 */
export type X402ValidateSimulationOutcome =
  (typeof X402ValidateSimulationOutcome)[keyof typeof X402ValidateSimulationOutcome];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const X402ValidateSimulationOutcome = {
  accepted: "accepted",
  rejected: "rejected",
} as const;

/**
 * The simulated facilitator decision for the x402 endpoint.
 */
export interface X402ValidateSimulation {
  /** The simulated facilitator outcome: `accepted` if the facilitator would index the resource, or `rejected` if it would reject it. */
  outcome: X402ValidateSimulationOutcome;
  /** The reason the resource would be rejected, present only when `outcome` is `rejected`. */
  rejectionReason?: string;
}

/**
 * Bazaar index status for a validated x402 endpoint.
 */
export interface X402ValidateIndex {
  /** Whether the indexed resource is active and served in discovery results. */
  active: boolean;
  /**
   * When the endpoint was last crawled, or `null` if it has been indexed but not yet crawled.
   * @nullable
   */
  lastCrawledAt: string | null;
  /** Quality metrics for the indexed resource, present only when the endpoint has call history. */
  quality?: X402ResourceQuality;
}

/**
 * The raw decoded payment requirements returned by the endpoint, or `null` if the endpoint was not reachable or did not return a parseable 402 payload. Lets sellers inspect exactly what their endpoint is advertising.
 * @nullable
 */
export type X402ValidateResponsePaymentRequirements = X402PaymentRequirements | null;

/**
 * The `extensions.bazaar` block from the endpoint's discovery metadata, or `null` if the bazaar extension was absent or the endpoint was not reachable. Lets sellers verify the discovery configuration their endpoint is advertising.
 * @nullable
 */
export type X402ValidateResponseBazaarExtension = { [key: string]: unknown } | null;

/**
 * Bazaar index status for the endpoint, or `null` if the endpoint is not yet indexed. Present on every response regardless of simulation outcome.
 * @nullable
 */
export type X402ValidateResponseIndex = X402ValidateIndex | null;

/**
 * Response from validating an x402 endpoint's bazaar-discovery configuration.
 */
export interface X402ValidateResponse {
  /** Whether the endpoint is valid: all preflight checks passed and the facilitator would index the resource. */
  valid: boolean;
  /**
   * The HTTP status code returned by the endpoint, or `null` if the endpoint was not reachable.
   * @nullable
   */
  statusCode: number | null;
  /**
   * The x402 protocol version advertised by the endpoint, or `null` if it could not be determined. Intentionally a bare integer rather than the `X402Version` enum so the validator can surface unsupported or malformed version values returned by non-conforming endpoints.
   * @nullable
   */
  x402Version: number | null;
  /** All check results in run order. Well-known check names are `reachable`, `returns_402`, `has_bazaar_extension`, and `parse`. Additional checks may be added in future versions. */
  preflight: X402ValidateCheck[];
  /**
   * The raw decoded payment requirements returned by the endpoint, or `null` if the endpoint was not reachable or did not return a parseable 402 payload. Lets sellers inspect exactly what their endpoint is advertising.
   * @nullable
   */
  paymentRequirements: X402ValidateResponsePaymentRequirements;
  /**
   * The `extensions.bazaar` block from the endpoint's discovery metadata, or `null` if the bazaar extension was absent or the endpoint was not reachable. Lets sellers verify the discovery configuration their endpoint is advertising.
   * @nullable
   */
  bazaarExtension: X402ValidateResponseBazaarExtension;
  simulation: X402ValidateSimulation;
  /**
   * Bazaar index status for the endpoint, or `null` if the endpoint is not yet indexed. Present on every response regardless of simulation outcome.
   * @nullable
   */
  index: X402ValidateResponseIndex;
}

/**
 * The OTP delivery channel.
 */
export type InitiateOnrampVerificationRequestChannel =
  (typeof InitiateOnrampVerificationRequestChannel)[keyof typeof InitiateOnrampVerificationRequestChannel];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const InitiateOnrampVerificationRequestChannel = {
  sms: "sms",
  email: "email",
} as const;

/**
 * The phone number or email address to send the OTP to.
 */
export type InitiateOnrampVerificationRequestDestination = PhoneNumber | Email;

/**
 * Request body for initiating an onramp OTP verification.
 */
export interface InitiateOnrampVerificationRequest {
  /** The OTP delivery channel. */
  channel: InitiateOnrampVerificationRequestChannel;
  /** The phone number or email address to send the OTP to. */
  destination: InitiateOnrampVerificationRequestDestination;
}

/**
 * A unique identifier for an onramp verification record, in the format `onramp_verification_<uuid>`.
 * @pattern ^onramp_verification_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
 */
export type OnrampVerificationId = string;

/**
 * The result of initiating an onramp OTP verification.
 */
export interface OnrampVerificationInitiation {
  /** Identifier returned by this endpoint. Pass to the Submit Onramp Verification endpoint along with the OTP code within 10 minutes. */
  verificationId: OnrampVerificationId;
  /** The deadline for submitting the OTP code (10 minutes from now). */
  otpExpiresAt: string;
}

/**
 * Request body for submitting an OTP code to complete an onramp verification.
 */
export interface SubmitOnrampVerificationRequest {
  /**
   * The 6-digit OTP code the user received.
   * @pattern ^\d{6}$
   */
  otpCode: string;
}

/**
 * The result of successfully submitting an onramp OTP verification.
 */
export interface OnrampVerificationConfirmation {
  /** The same verification ID. Store on the user's device and pass to the Create Onramp Order endpoint. Valid for 60 days. */
  verificationId: OnrampVerificationId;
  /** The date and time when this verification expires for order placement. */
  verificationExpiresAt: string;
}

/**
 * The type of payment method to be used to complete an onramp order.
 */
export type OnrampOrderPaymentMethodTypeId =
  (typeof OnrampOrderPaymentMethodTypeId)[keyof typeof OnrampOrderPaymentMethodTypeId];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampOrderPaymentMethodTypeId = {
  GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
  GUEST_CHECKOUT_GOOGLE_PAY: "GUEST_CHECKOUT_GOOGLE_PAY",
} as const;

/**
 * The type of fee.
 */
export type OnrampOrderFeeType = (typeof OnrampOrderFeeType)[keyof typeof OnrampOrderFeeType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampOrderFeeType = {
  FEE_TYPE_NETWORK: "FEE_TYPE_NETWORK",
  FEE_TYPE_EXCHANGE: "FEE_TYPE_EXCHANGE",
} as const;

/**
 * A fee associated with an order.
 */
export interface OnrampOrderFee {
  /** The type of fee. */
  type: OnrampOrderFeeType;
  /** The amount of the fee. */
  amount: string;
  /** The currency of the fee. */
  currency: string;
}

/**
 * The status of an onramp order.
 */
export type OnrampOrderStatus = (typeof OnrampOrderStatus)[keyof typeof OnrampOrderStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampOrderStatus = {
  ONRAMP_ORDER_STATUS_PENDING_AUTH: "ONRAMP_ORDER_STATUS_PENDING_AUTH",
  ONRAMP_ORDER_STATUS_PENDING_PAYMENT: "ONRAMP_ORDER_STATUS_PENDING_PAYMENT",
  ONRAMP_ORDER_STATUS_PROCESSING: "ONRAMP_ORDER_STATUS_PROCESSING",
  ONRAMP_ORDER_STATUS_COMPLETED: "ONRAMP_ORDER_STATUS_COMPLETED",
  ONRAMP_ORDER_STATUS_FAILED: "ONRAMP_ORDER_STATUS_FAILED",
} as const;

/**
 * An Onramp order.
 */
export interface OnrampOrder {
  /** The ID of the onramp order. */
  orderId: string;
  /** The total amount of fiat to be paid, inclusive of any fees. */
  paymentTotal: string;
  /** The amount of fiat to be converted to crypto. */
  paymentSubtotal: string;
  /** The fiat currency to be converted to crypto. */
  paymentCurrency: string;
  paymentMethod: OnrampOrderPaymentMethodTypeId;
  /** The amount of crypto to be purchased. */
  purchaseAmount: string;
  /** The crypto currency to be purchased. */
  purchaseCurrency: string;
  /** The fees associated with the order. */
  fees: OnrampOrderFee[];
  /** The exchange rate used to convert fiat to crypto i.e. the crypto value of one fiat. */
  exchangeRate: string;
  /** The destination address to send the crypto to. */
  destinationAddress: BlockchainAddress;
  /** The network to send the crypto on. */
  destinationNetwork: string;
  status: OnrampOrderStatus;
  /** The transaction hash of the order (only available once crypto has been sent). */
  txHash?: string;
  /** The date and time the order was created. */
  createdAt: string;
  /** The date and time the order was last updated. */
  updatedAt: string;
  /** The partner user reference ID. */
  partnerUserRef?: string;
}

/**
 * The type of payment link.
 */
export type OnrampPaymentLinkType =
  (typeof OnrampPaymentLinkType)[keyof typeof OnrampPaymentLinkType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampPaymentLinkType = {
  PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON: "PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON",
} as const;

/**
 * A payment link to pay for an order.

Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for details on how to integrate with the different payment link types.
 */
export interface OnrampPaymentLink {
  /** The URL to the hosted widget the user should be redirected to. For certain payment link types you can append your own redirect_url query parameter to this URL to ensure the user is redirected back to your app after the widget completes. */
  url: Url;
  paymentLinkType: OnrampPaymentLinkType;
}

/**
 * The type of payment method used to generate the onramp quote.
 */
export type OnrampQuotePaymentMethodTypeId =
  (typeof OnrampQuotePaymentMethodTypeId)[keyof typeof OnrampQuotePaymentMethodTypeId];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampQuotePaymentMethodTypeId = {
  CARD: "CARD",
  ACH: "ACH",
  APPLE_PAY: "APPLE_PAY",
  PAYPAL: "PAYPAL",
  FIAT_WALLET: "FIAT_WALLET",
  CRYPTO_WALLET: "CRYPTO_WALLET",
} as const;

/**
 * A valid URI.
 * @minLength 5
 * @maxLength 2048
 * @pattern ^.*://.*$
 */
export type Uri = string;

/**
 * Common request parameters shared by [Create Onramp Session](#operation/createOnrampSession) and [Create Onramp Mobile Challenge](#operation/createOnrampMobileChallenge).
 */
export interface OnrampSessionRequest {
  /** The ticker (e.g. `BTC`, `USDC`, `SOL`) or the Coinbase UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`) of the crypto asset to be purchased.

Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported purchase currencies for your user's location. */
  purchaseCurrency: string;
  /** The name of the crypto network the purchased currency will be sent on.

Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported networks for your user's location. */
  destinationNetwork: string;
  /** The address the purchased crypto will be sent to. */
  destinationAddress: BlockchainAddress;
  /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency. */
  paymentAmount?: string;
  /** A string representing the amount of crypto the user wishes to purchase. When using this parameter, the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
  purchaseAmount?: string;
  /** The fiat currency to be converted to crypto. */
  paymentCurrency?: string;
  paymentMethod?: OnrampQuotePaymentMethodTypeId;
  /** The ISO 3166-1 two letter country code (e.g. US). */
  country?: string;
  /** The ISO 3166-2 two letter state code (e.g. NY). Only required for US. */
  subdivision?: string;
  /** URI to redirect the user to after they complete or dismiss the transaction. Embedded in the returned onramp URL as a query parameter. */
  redirectUrl?: Uri;
  /** The IP address of the end user requesting the onramp transaction. */
  clientIp?: string;
  /** A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with "sandbox-" (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.

This value can be used with the [Onramp User Transactions API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-onramp-transactions-by-id) to retrieve all transactions created by the user. */
  partnerUserRef?: string;
}

/**
 * An onramp session containing a ready-to-use onramp URL.
 */
export interface OnrampSession {
  /** Ready-to-use onramp URL. */
  onrampUrl: Url;
}

/**
 * Quote information with pricing details for the crypto purchase.
 */
export interface OnrampQuote {
  /** The total amount of fiat to be paid, inclusive of any fees. */
  paymentTotal: string;
  /** The amount of fiat to be converted to crypto. */
  paymentSubtotal: string;
  /** The fiat currency to be converted to crypto. */
  paymentCurrency: string;
  /** The amount of crypto to be purchased. */
  purchaseAmount: string;
  /** The crypto currency to be purchased. */
  purchaseCurrency: string;
  /** The network to send the crypto on. */
  destinationNetwork: string;
  /** The fees associated with the quote. */
  fees: OnrampOrderFee[];
  /** The exchange rate used to convert fiat to crypto i.e. the crypto value of one fiat. */
  exchangeRate: string;
}

/**
 * The type of user identifier:
- `phone_number`: A phone number in E.164 format associated with an onramp user.

 */
export type OnrampUserIdType = (typeof OnrampUserIdType)[keyof typeof OnrampUserIdType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampUserIdType = {
  phone_number: "phone_number",
} as const;

/**
 * The type of limit:
- `weekly_spending`: Rolling 7-day spending limit. The limit applies to the sum of all completed transactions 
  within a sliding 168-hour (7-day) window. As time passes, older transactions naturally expire from the window. 
  $500 is the default limit.
- `lifetime_transactions`: All-time transaction count limit. Tracks the total number of completed transactions 
  across the user's entire history with no time-based expiration. Once the limit is reached, no further 
  transactions are allowed. 15 is the default limit.

 */
export type OnrampLimitType = (typeof OnrampLimitType)[keyof typeof OnrampLimitType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampLimitType = {
  weekly_spending: "weekly_spending",
  lifetime_transactions: "lifetime_transactions",
} as const;

/**
 * A single limit with remaining capacity.
 */
export interface OnrampUserLimit {
  limitType: OnrampLimitType;
  /** The currency of the limit amounts. Only present for spending limits, not for count-based limits. */
  currency?: string;
  /** The maximum limit value. */
  limit: string;
  /** The remaining amount or count available. */
  remaining: string;
}

/**
 * Populate the properties that correspond to the `fields` array from the user's `OnrampLimitUpgradeOption`.
 */
export interface OnrampLimitUpgradeIdentityFields {
  /** Last 4 digits of the Social Security Number (no dashes or spaces). */
  ssnLast4?: string;
  /** Date of birth. */
  dateOfBirth?: DateOfBirth;
}

/**
 * Request to request a limits upgrade for a user.
 */
export interface OnrampLimitUpgradeRequest {
  /** The user identifier value. For `phone_number` type, this must be in E.164 format. */
  userId: string;
  userIdType: OnrampUserIdType;
  /** Populate the properties that correspond to the `fields` array from the user's `OnrampLimitUpgradeOption`. These fields are required; a request without them is rejected. */
  fields?: OnrampLimitUpgradeIdentityFields;
}

/**
 * The ID of the Payment Method, which is a UUID prefixed by the string `paymentMethod_`.
 * @pattern ^paymentMethod_[a-f0-9\-]{36}$
 */
export type PaymentMethodId = string;

/**
 * Common properties shared by all payment method types.
 */
export interface PaymentMethodBase {
  paymentMethodId: PaymentMethodId;
  /** Whether the payment method is active and can be used in transfers. A payment method may be inactive due to verification requirements or entity-level restrictions. */
  active: boolean;
  /** The timestamp when the payment method was created. */
  createdAt: string;
  /** The timestamp when the payment method was last updated. */
  updatedAt: string;
}

/**
 * Details specific to Fedwire (domestic USD wire) payment methods.
 */
export interface FedwireDetails {
  /** The asset for this payment method. Always `usd` for Fedwire. */
  asset: string;
  /** The name of the bank. */
  bankName: string;
  /**
   * The last 4 digits of the bank account number.
   * @pattern ^[0-9]{4}$
   */
  accountLast4: string;
  /**
   * The ABA routing number of the bank.
   * @pattern ^[0-9]{9}$
   */
  routingNumber: string;
}

/**
 * The payment rail for this payment method.
 */
export type FedwirePaymentMethodAllOfPaymentRail =
  (typeof FedwirePaymentMethodAllOfPaymentRail)[keyof typeof FedwirePaymentMethodAllOfPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const FedwirePaymentMethodAllOfPaymentRail = {
  fedwire: "fedwire",
} as const;

export type FedwirePaymentMethodAllOf = {
  /** The payment rail for this payment method. */
  paymentRail: FedwirePaymentMethodAllOfPaymentRail;
  /** Fedwire (domestic USD wire) details. */
  fedwire: FedwireDetails;
};

export type FedwirePaymentMethodPaymentRail =
  (typeof FedwirePaymentMethodPaymentRail)[keyof typeof FedwirePaymentMethodPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const FedwirePaymentMethodPaymentRail = {
  fedwire: "fedwire",
} as const;

/**
 * A Fedwire (domestic USD wire) payment method linked to your entity.
 */
export type FedwirePaymentMethod = PaymentMethodBase &
  FedwirePaymentMethodAllOf & {
    paymentRail: FedwirePaymentMethodPaymentRail;
  };

/**
 * Details specific to SWIFT (international wire) payment methods.
 */
export interface SwiftDetails {
  /** The asset for this payment method (e.g., `eur`, `gbp`). */
  asset: string;
  /** The name of the bank. */
  bankName: string;
  /**
   * The last 4 characters of the account identifier. For IBAN-based accounts (e.g., EU), this is the last 4 characters of the IBAN. For account number-based accounts (e.g., US), this is the last 4 digits of the account number.
   * @pattern ^[A-Z0-9]{4}$
   */
  accountLast4: string;
  /**
   * Deprecated: use `accountLast4` instead. The last 4 characters of the account identifier.
   * @deprecated
   * @pattern ^[A-Z0-9]{4}$
   */
  ibanLast4?: string;
  /**
   * The Bank Identifier Code (BIC) / SWIFT code.
   * @pattern ^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$
   */
  bic: string;
}

/**
 * The payment rail for this payment method.
 */
export type SwiftPaymentMethodAllOfPaymentRail =
  (typeof SwiftPaymentMethodAllOfPaymentRail)[keyof typeof SwiftPaymentMethodAllOfPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SwiftPaymentMethodAllOfPaymentRail = {
  swift: "swift",
} as const;

export type SwiftPaymentMethodAllOf = {
  /** The payment rail for this payment method. */
  paymentRail: SwiftPaymentMethodAllOfPaymentRail;
  /** SWIFT (international wire) details. */
  swift: SwiftDetails;
};

export type SwiftPaymentMethodPaymentRail =
  (typeof SwiftPaymentMethodPaymentRail)[keyof typeof SwiftPaymentMethodPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SwiftPaymentMethodPaymentRail = {
  swift: "swift",
} as const;

/**
 * A SWIFT (international wire) payment method linked to your entity.
 */
export type SwiftPaymentMethod = PaymentMethodBase &
  SwiftPaymentMethodAllOf & {
    paymentRail: SwiftPaymentMethodPaymentRail;
  };

/**
 * Details specific to SEPA (Single Euro Payments Area) payment methods.
 */
export interface SepaDetails {
  /** The asset for this payment method. Always `eur` for SEPA. */
  asset: string;
  /** The name of the bank. */
  bankName: string;
  /**
   * The last 4 characters of the IBAN.
   * @pattern ^[A-Z0-9]{4}$
   */
  ibanLast4: string;
  /**
   * The Bank Identifier Code (BIC) / SWIFT code.
   * @pattern ^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$
   */
  bic: string;
}

/**
 * The payment rail for this payment method.
 */
export type SepaPaymentMethodAllOfPaymentRail =
  (typeof SepaPaymentMethodAllOfPaymentRail)[keyof typeof SepaPaymentMethodAllOfPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SepaPaymentMethodAllOfPaymentRail = {
  sepa: "sepa",
} as const;

export type SepaPaymentMethodAllOf = {
  /** The payment rail for this payment method. */
  paymentRail: SepaPaymentMethodAllOfPaymentRail;
  /** SEPA (Single Euro Payments Area) details. */
  sepa: SepaDetails;
};

export type SepaPaymentMethodPaymentRail =
  (typeof SepaPaymentMethodPaymentRail)[keyof typeof SepaPaymentMethodPaymentRail];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SepaPaymentMethodPaymentRail = {
  sepa: "sepa",
} as const;

/**
 * A SEPA (Single Euro Payments Area) payment method linked to your entity.
 */
export type SepaPaymentMethod = PaymentMethodBase &
  SepaPaymentMethodAllOf & {
    paymentRail: SepaPaymentMethodPaymentRail;
  };

/**
 * A payment method linked to your entity. Payment methods represent external financial instruments that can be used as a target for transfers.

The `paymentRail` field indicates which type-specific details object is present. Type-specific fields are nested under a key matching the rail name (e.g., `fedwire`, `swift`).
 */
export type PaymentMethodsPaymentMethod =
  | FedwirePaymentMethod
  | SwiftPaymentMethod
  | SepaPaymentMethod;

/**
 * Decoded event parameters from the contract event. Keys correspond to the named arguments in the event signature (e.g., `from`, `to`, `value` for an ERC-20 `Transfer`). Values are returned as strings to preserve precision for large integers and to avoid loss for address types. The exact set of keys depends on the contract event.
 */
export interface OnchainActivityEventParameters {
  [key: string]: string;
}

/**
 * The payload delivered when onchain activity matching your subscription filters is detected. Each event corresponds to a single decoded contract log emitted onchain. The set of keys in `parameters` varies by the contract event being decoded (e.g., `Transfer(address,address,uint256)`).
 */
export interface OnchainActivityDetectedEvent {
  /** The block number containing the transaction that emitted the event. */
  block_number: number;
  /** The contract address that emitted the event. */
  contract_address: string;
  /** The name of the decoded contract event. */
  event_name: string;
  /** The canonical event signature used to decode the log, including parameter types (e.g., `Transfer(address,address,uint256)`). */
  event_signature: string;
  /** The zero-based index of the log within the transaction. */
  log_index: number;
  /** The blockchain network where the activity was detected. */
  network: string;
  parameters: OnchainActivityEventParameters;
  /** The block timestamp of the transaction (ISO 8601 format). */
  timestamp: string;
  /** The address that initiated the transaction (the transaction sender). */
  transaction_from: string;
  /** The hash of the transaction that emitted the event. */
  transaction_hash: string;
  /** The address the transaction was sent to (typically a contract address). */
  transaction_to: string;
}

/**
 * Decoded blockchain event data for the wallet activity webhook. The exact fields depend on the type of onchain activity detected. Common fields include network, block info, and transaction hash. Additional fields are event-specific (e.g., `from`, `to`, `value` for transfers).
 */
export interface OnchainActivityEventData {
  /** The blockchain network where the activity was detected. */
  network: string;
  /** The block number containing the transaction. */
  blockNumber?: string;
  /** The timestamp of the block. */
  blockTimestamp?: string;
  /** The transaction hash of the detected activity. */
  transactionHash: string;
  /** The log index within the transaction. */
  logIndex?: string;
  /** The contract address that emitted the event. */
  contractAddress?: string;
  /** The name of the decoded contract event. */
  eventName?: string;
  [key: string]: unknown;
}

/**
 * Common fields included in every wallet activity webhook event payload.
 */
export interface WalletActivityEventBase {
  /** Unique identifier for this webhook event. Use this for idempotency. */
  eventId: string;
  /** When this event occurred (ISO 8601 format). */
  timestamp: string;
  data: OnchainActivityEventData;
}

/**
 * The type of webhook event.
 */
export type WalletActivityDetectedEventAllOfEventType =
  (typeof WalletActivityDetectedEventAllOfEventType)[keyof typeof WalletActivityDetectedEventAllOfEventType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const WalletActivityDetectedEventAllOfEventType = {
  walletactivitydetected: "wallet.activity.detected",
} as const;

export type WalletActivityDetectedEventAllOf = {
  /** The type of webhook event. */
  eventType: WalletActivityDetectedEventAllOfEventType;
};

export type WalletActivityDetectedEvent = WalletActivityEventBase &
  WalletActivityDetectedEventAllOf;

/**
 * The type of webhook event.
 */
export type WalletActivityMultiEventAllOfEventType =
  (typeof WalletActivityMultiEventAllOfEventType)[keyof typeof WalletActivityMultiEventAllOfEventType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const WalletActivityMultiEventAllOfEventType = {
  walletactivitymulti: "wallet.activity.multi",
} as const;

export type WalletActivityMultiEventAllOf = {
  /** The type of webhook event. */
  eventType: WalletActivityMultiEventAllOfEventType;
};

export type WalletActivityMultiEvent = WalletActivityEventBase & WalletActivityMultiEventAllOf;

/**
 * Payload for `wallet.transaction.created` on EVM networks. Includes the originating `address`.
 */
export interface WalletEvmTransactionCreatedPayload {
  /**
   * The EVM wallet address that created the transaction.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was created (ISO 8601 format). */
  created_at: string;
}

/**
 * Payload for API Key Wallet events. These events carry no end-user payload fields, so neither `user_id` nor `delegation_id` is present.
 */
export interface WalletApiKeyEventPayload {
  [key: string]: unknown;
}

/**
 * Payload for `wallet.transaction.created` on Solana. Solana transaction events do not include an `address`.
 */
export interface WalletSolanaTransactionCreatedPayload {
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was created (ISO 8601 format). */
  created_at: string;
}

/**
 * Payload for User Wallet events. The wallet is owned by an end user, identified by `user_id`. User Wallet actions do not include `delegation_id`.
 */
export interface WalletUserEventPayload {
  /** The user ID that owns the User Wallet. */
  user_id: string;
}

/**
 * Payload for delegated User Wallet events, where a User Wallet action was authorized via a delegation grant. Includes `user_id` and the `delegation_id` of the active grant.
 */
export interface WalletDelegatedEventPayload {
  /** The user ID that owns the User Wallet. */
  user_id: string;
  /** The delegation grant ID used to authorize the action. */
  delegation_id: string;
}

export type WalletTransactionCreatedEventOneOf = WalletEvmTransactionCreatedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionCreatedEventOneOfTwo = WalletSolanaTransactionCreatedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionCreatedEventOneOfThree = WalletEvmTransactionCreatedPayload &
  WalletUserEventPayload;

export type WalletTransactionCreatedEventOneOfFour = WalletSolanaTransactionCreatedPayload &
  WalletUserEventPayload;

export type WalletTransactionCreatedEventOneOfFive = WalletEvmTransactionCreatedPayload &
  WalletDelegatedEventPayload;

export type WalletTransactionCreatedEventOneOfSix = WalletSolanaTransactionCreatedPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction is created. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletTransactionCreatedEvent =
  | WalletTransactionCreatedEventOneOf
  | WalletTransactionCreatedEventOneOfTwo
  | WalletTransactionCreatedEventOneOfThree
  | WalletTransactionCreatedEventOneOfFour
  | WalletTransactionCreatedEventOneOfFive
  | WalletTransactionCreatedEventOneOfSix;

/**
 * Payload for EVM wallet signing events. Carries the EVM signing `address` and timestamp; no network or transaction identifier.
 */
export interface WalletEvmSigningPayload {
  /**
   * The EVM wallet address that performed the signing.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** When the signing occurred (ISO 8601 format). */
  signed_at: string;
}

/**
 * Payload for Solana wallet signing events. Carries the Solana signing `address` and timestamp; no network or transaction identifier.
 */
export interface WalletSolanaSigningPayload {
  /**
   * The Solana wallet address that performed the signing.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: BlockchainAddress;
  /** When the signing occurred (ISO 8601 format). */
  signed_at: string;
}

export type WalletTransactionSignedEventOneOf = WalletEvmSigningPayload & WalletApiKeyEventPayload;

export type WalletTransactionSignedEventOneOfTwo = WalletSolanaSigningPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionSignedEventOneOfThree = WalletEvmSigningPayload &
  WalletUserEventPayload;

export type WalletTransactionSignedEventOneOfFour = WalletSolanaSigningPayload &
  WalletUserEventPayload;

export type WalletTransactionSignedEventOneOfFive = WalletEvmSigningPayload &
  WalletDelegatedEventPayload;

export type WalletTransactionSignedEventOneOfSix = WalletSolanaSigningPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction is signed. Emitted for both EVM and Solana wallets. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletTransactionSignedEvent =
  | WalletTransactionSignedEventOneOf
  | WalletTransactionSignedEventOneOfTwo
  | WalletTransactionSignedEventOneOfThree
  | WalletTransactionSignedEventOneOfFour
  | WalletTransactionSignedEventOneOfFive
  | WalletTransactionSignedEventOneOfSix;

/**
 * Payload for `wallet.transaction.broadcast` on EVM networks. Includes `transaction_hash` and `address`.
 */
export interface WalletEvmTransactionBroadcastPayload {
  /** The onchain transaction hash. */
  transaction_hash: string;
  /**
   * The EVM wallet address that broadcast the transaction.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was broadcast (ISO 8601 format). */
  broadcast_at: string;
}

/**
 * Payload for `wallet.transaction.broadcast` on Solana. Includes `transaction_signature` and omits `address`.
 */
export interface WalletSolanaTransactionBroadcastPayload {
  /** The Solana transaction signature. */
  transaction_signature: string;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was broadcast (ISO 8601 format). */
  broadcast_at: string;
}

export type WalletTransactionBroadcastEventOneOf = WalletEvmTransactionBroadcastPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionBroadcastEventOneOfTwo = WalletSolanaTransactionBroadcastPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionBroadcastEventOneOfThree = WalletEvmTransactionBroadcastPayload &
  WalletUserEventPayload;

export type WalletTransactionBroadcastEventOneOfFour = WalletSolanaTransactionBroadcastPayload &
  WalletUserEventPayload;

export type WalletTransactionBroadcastEventOneOfFive = WalletEvmTransactionBroadcastPayload &
  WalletDelegatedEventPayload;

export type WalletTransactionBroadcastEventOneOfSix = WalletSolanaTransactionBroadcastPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction is broadcast to the network. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletTransactionBroadcastEvent =
  | WalletTransactionBroadcastEventOneOf
  | WalletTransactionBroadcastEventOneOfTwo
  | WalletTransactionBroadcastEventOneOfThree
  | WalletTransactionBroadcastEventOneOfFour
  | WalletTransactionBroadcastEventOneOfFive
  | WalletTransactionBroadcastEventOneOfSix;

/**
 * Payload for `wallet.transaction.replaced`. EVM-only; Solana transactions are not replaceable.
 */
export interface WalletTransactionReplacedPayload {
  /** The onchain transaction hash of the replaced transaction. */
  transaction_hash: string;
  /**
   * The EVM wallet address whose transaction was replaced.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was replaced (ISO 8601 format). */
  replaced_at: string;
}

export type WalletTransactionReplacedEventOneOf = WalletTransactionReplacedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionReplacedEventOneOfTwo = WalletTransactionReplacedPayload &
  WalletUserEventPayload;

export type WalletTransactionReplacedEventOneOfThree = WalletTransactionReplacedPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a pending transaction is replaced (e.g. a fee bump). EVM-only. The payload is one of three EVM wallet-type variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing).
 */
export type WalletTransactionReplacedEvent =
  | WalletTransactionReplacedEventOneOf
  | WalletTransactionReplacedEventOneOfTwo
  | WalletTransactionReplacedEventOneOfThree;

/**
 * Payload for `wallet.transaction.pending`. EVM-only. EIP-1559 fee fields are included.
 */
export interface WalletTransactionPendingPayload {
  /** The onchain transaction hash. */
  transaction_hash: string;
  /**
   * The EVM wallet address whose transaction is pending.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction entered the pending state (ISO 8601 format). */
  pending_since: string;
  /** EIP-1559 max fee per gas in wei. */
  max_fee_per_gas: string;
  /** EIP-1559 max priority fee per gas in wei. */
  max_priority_fee_per_gas: string;
}

export type WalletTransactionPendingEventOneOf = WalletTransactionPendingPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionPendingEventOneOfTwo = WalletTransactionPendingPayload &
  WalletUserEventPayload;

export type WalletTransactionPendingEventOneOfThree = WalletTransactionPendingPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction enters the pending state. EVM-only. The payload is one of three EVM wallet-type variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing).
 */
export type WalletTransactionPendingEvent =
  | WalletTransactionPendingEventOneOf
  | WalletTransactionPendingEventOneOfTwo
  | WalletTransactionPendingEventOneOfThree;

/**
 * Payload for `wallet.transaction.confirmed` on EVM networks. Includes `transaction_hash` and `address`.
 */
export interface WalletEvmTransactionConfirmedPayload {
  /** The onchain transaction hash. */
  transaction_hash: string;
  /**
   * The EVM wallet address that submitted the transaction.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was confirmed (ISO 8601 format). */
  confirmed_at: string;
}

/**
 * Payload for `wallet.transaction.confirmed` on Solana. Includes `transaction_signature` and omits `address`.
 */
export interface WalletSolanaTransactionConfirmedPayload {
  /** The Solana transaction signature. */
  transaction_signature: string;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction was confirmed (ISO 8601 format). */
  confirmed_at: string;
}

export type WalletTransactionConfirmedEventOneOf = WalletEvmTransactionConfirmedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionConfirmedEventOneOfTwo = WalletSolanaTransactionConfirmedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionConfirmedEventOneOfThree = WalletEvmTransactionConfirmedPayload &
  WalletUserEventPayload;

export type WalletTransactionConfirmedEventOneOfFour = WalletSolanaTransactionConfirmedPayload &
  WalletUserEventPayload;

export type WalletTransactionConfirmedEventOneOfFive = WalletEvmTransactionConfirmedPayload &
  WalletDelegatedEventPayload;

export type WalletTransactionConfirmedEventOneOfSix = WalletSolanaTransactionConfirmedPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction is confirmed onchain. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletTransactionConfirmedEvent =
  | WalletTransactionConfirmedEventOneOf
  | WalletTransactionConfirmedEventOneOfTwo
  | WalletTransactionConfirmedEventOneOfThree
  | WalletTransactionConfirmedEventOneOfFour
  | WalletTransactionConfirmedEventOneOfFive
  | WalletTransactionConfirmedEventOneOfSix;

/**
 * Payload for `wallet.transaction.failed` on EVM networks. Includes `transaction_hash` and `address`.
 */
export interface WalletEvmTransactionFailedPayload {
  /** The onchain transaction hash. */
  transaction_hash: string;
  /**
   * The EVM wallet address that submitted the transaction.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: BlockchainAddress;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction failed (ISO 8601 format). */
  failed_at: string;
}

/**
 * Payload for `wallet.transaction.failed` on Solana. Includes `transaction_signature` and omits `address`.
 */
export interface WalletSolanaTransactionFailedPayload {
  /** The Solana transaction signature. */
  transaction_signature: string;
  /** The blockchain network identifier. */
  network: Network;
  /** When the transaction failed (ISO 8601 format). */
  failed_at: string;
}

export type WalletTransactionFailedEventOneOf = WalletEvmTransactionFailedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionFailedEventOneOfTwo = WalletSolanaTransactionFailedPayload &
  WalletApiKeyEventPayload;

export type WalletTransactionFailedEventOneOfThree = WalletEvmTransactionFailedPayload &
  WalletUserEventPayload;

export type WalletTransactionFailedEventOneOfFour = WalletSolanaTransactionFailedPayload &
  WalletUserEventPayload;

export type WalletTransactionFailedEventOneOfFive = WalletEvmTransactionFailedPayload &
  WalletDelegatedEventPayload;

export type WalletTransactionFailedEventOneOfSix = WalletSolanaTransactionFailedPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a transaction fails. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletTransactionFailedEvent =
  | WalletTransactionFailedEventOneOf
  | WalletTransactionFailedEventOneOfTwo
  | WalletTransactionFailedEventOneOfThree
  | WalletTransactionFailedEventOneOfFour
  | WalletTransactionFailedEventOneOfFive
  | WalletTransactionFailedEventOneOfSix;

/**
 * Delivered when a delegation grant is created for a User Wallet.
 */
export interface WalletDelegationCreatedEvent {
  /** The unique identifier for the delegation grant. */
  delegation_id: string;
  /** The user ID that owns the delegation. */
  user_id: string;
  /** When the delegation expires (ISO 8601 format). */
  expires_at: string;
  /** When the delegation was created (ISO 8601 format). */
  created_at: string;
}

/**
 * Delivered when a delegation grant is revoked.
 */
export interface WalletDelegationRevokedEvent {
  /** The unique identifier for the delegation grant. */
  delegation_id: string;
  /** The user ID that owns the delegation. */
  user_id: string;
  /** When the delegation was revoked (ISO 8601 format). */
  revoked_at: string;
}

export type WalletTypedDataSignedEventOneOf = WalletEvmSigningPayload & WalletApiKeyEventPayload;

export type WalletTypedDataSignedEventOneOfTwo = WalletEvmSigningPayload & WalletUserEventPayload;

export type WalletTypedDataSignedEventOneOfThree = WalletEvmSigningPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when EIP-712 typed data is signed. EVM-only. Uses the EVM signing payload. The payload is one of three EVM wallet-type variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing).
 */
export type WalletTypedDataSignedEvent =
  | WalletTypedDataSignedEventOneOf
  | WalletTypedDataSignedEventOneOfTwo
  | WalletTypedDataSignedEventOneOfThree;

export type WalletMessageSignedEventOneOf = WalletEvmSigningPayload & WalletApiKeyEventPayload;

export type WalletMessageSignedEventOneOfTwo = WalletSolanaSigningPayload &
  WalletApiKeyEventPayload;

export type WalletMessageSignedEventOneOfThree = WalletEvmSigningPayload & WalletUserEventPayload;

export type WalletMessageSignedEventOneOfFour = WalletSolanaSigningPayload & WalletUserEventPayload;

export type WalletMessageSignedEventOneOfFive = WalletEvmSigningPayload &
  WalletDelegatedEventPayload;

export type WalletMessageSignedEventOneOfSix = WalletSolanaSigningPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a message is signed. Emitted for both EVM and Solana wallets. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletMessageSignedEvent =
  | WalletMessageSignedEventOneOf
  | WalletMessageSignedEventOneOfTwo
  | WalletMessageSignedEventOneOfThree
  | WalletMessageSignedEventOneOfFour
  | WalletMessageSignedEventOneOfFive
  | WalletMessageSignedEventOneOfSix;

export type WalletHashSignedEventOneOf = WalletEvmSigningPayload & WalletApiKeyEventPayload;

export type WalletHashSignedEventOneOfTwo = WalletSolanaSigningPayload & WalletApiKeyEventPayload;

export type WalletHashSignedEventOneOfThree = WalletEvmSigningPayload & WalletUserEventPayload;

export type WalletHashSignedEventOneOfFour = WalletSolanaSigningPayload & WalletUserEventPayload;

export type WalletHashSignedEventOneOfFive = WalletEvmSigningPayload & WalletDelegatedEventPayload;

export type WalletHashSignedEventOneOfSix = WalletSolanaSigningPayload &
  WalletDelegatedEventPayload;

/**
 * Delivered when a raw hash is signed. Emitted for both EVM and Solana wallets. The payload is one of six variants: API Key Wallet, User Wallet, or User Wallet (Delegated Signing), each delivered as an EVM or Solana variant.
 */
export type WalletHashSignedEvent =
  | WalletHashSignedEventOneOf
  | WalletHashSignedEventOneOfTwo
  | WalletHashSignedEventOneOfThree
  | WalletHashSignedEventOneOfFour
  | WalletHashSignedEventOneOfFive
  | WalletHashSignedEventOneOfSix;

/**
 * A monetary amount with currency.
 */
export interface MoneyAmount {
  /** Currency code (e.g., "USD", "USDC", "ETH"). */
  currency: string;
  /** The amount as a string. */
  value: string;
}

/**
 * Current status of the transaction.
 */
export type OnrampTransactionPayloadStatus =
  (typeof OnrampTransactionPayloadStatus)[keyof typeof OnrampTransactionPayloadStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampTransactionPayloadStatus = {
  ONRAMP_TRANSACTION_STATUS_UNSPECIFIED: "ONRAMP_TRANSACTION_STATUS_UNSPECIFIED",
  ONRAMP_TRANSACTION_STATUS_CREATED: "ONRAMP_TRANSACTION_STATUS_CREATED",
  ONRAMP_TRANSACTION_STATUS_IN_PROGRESS: "ONRAMP_TRANSACTION_STATUS_IN_PROGRESS",
  ONRAMP_TRANSACTION_STATUS_SUCCESS: "ONRAMP_TRANSACTION_STATUS_SUCCESS",
  ONRAMP_TRANSACTION_STATUS_FAILED: "ONRAMP_TRANSACTION_STATUS_FAILED",
  ONRAMP_TRANSACTION_STATUS_AWAITING_AUTH: "ONRAMP_TRANSACTION_STATUS_AWAITING_AUTH",
  ONRAMP_TRANSACTION_STATUS_AWAITING_PAYMENT: "ONRAMP_TRANSACTION_STATUS_AWAITING_PAYMENT",
} as const;

/**
 * The payment method used.
 */
export type OnrampTransactionPayloadPaymentMethod =
  (typeof OnrampTransactionPayloadPaymentMethod)[keyof typeof OnrampTransactionPayloadPaymentMethod];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampTransactionPayloadPaymentMethod = {
  UNSPECIFIED: "UNSPECIFIED",
  CARD: "CARD",
  ACH_BANK_ACCOUNT: "ACH_BANK_ACCOUNT",
  APPLE_PAY: "APPLE_PAY",
  FIAT_WALLET: "FIAT_WALLET",
  CRYPTO_ACCOUNT: "CRYPTO_ACCOUNT",
  GUEST_CHECKOUT_CARD: "GUEST_CHECKOUT_CARD",
  PAYPAL: "PAYPAL",
  RTP: "RTP",
  GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
  GUEST_CHECKOUT_GOOGLE_PAY: "GUEST_CHECKOUT_GOOGLE_PAY",
} as const;

/**
 * The type of onramp transaction.
 */
export type OnrampTransactionPayloadType =
  (typeof OnrampTransactionPayloadType)[keyof typeof OnrampTransactionPayloadType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampTransactionPayloadType = {
  ONRAMP_TRANSACTION_TYPE_UNSPECIFIED: "ONRAMP_TRANSACTION_TYPE_UNSPECIFIED",
  ONRAMP_TRANSACTION_TYPE_BUY_AND_SEND: "ONRAMP_TRANSACTION_TYPE_BUY_AND_SEND",
  ONRAMP_TRANSACTION_TYPE_SEND: "ONRAMP_TRANSACTION_TYPE_SEND",
} as const;

/**
 * Whether the user is authed or guest.
 */
export type OnrampTransactionPayloadUserType =
  (typeof OnrampTransactionPayloadUserType)[keyof typeof OnrampTransactionPayloadUserType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampTransactionPayloadUserType = {
  USER_TYPE_UNSPECIFIED: "USER_TYPE_UNSPECIFIED",
  USER_TYPE_AUTHED: "USER_TYPE_AUTHED",
  USER_TYPE_GUEST: "USER_TYPE_GUEST",
} as const;

/**
 * The reason for failure (if applicable).
 */
export type OnrampTransactionPayloadFailureReason =
  (typeof OnrampTransactionPayloadFailureReason)[keyof typeof OnrampTransactionPayloadFailureReason];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampTransactionPayloadFailureReason = {
  FAILURE_REASON_UNSPECIFIED: "FAILURE_REASON_UNSPECIFIED",
  FAILURE_REASON_BUY_FAILED: "FAILURE_REASON_BUY_FAILED",
  FAILURE_REASON_SEND_FAILED: "FAILURE_REASON_SEND_FAILED",
} as const;

/**
 * Webhook payload for standard onramp transactions (guest checkout and authed flow). Serialized from the OnrampTransaction proto via protojson with eventType appended.
 */
export interface OnrampTransactionPayload {
  /** The webhook event type. */
  eventType: string;
  /** Unique transaction identifier. */
  transactionId: string;
  /** Current status of the transaction. */
  status: OnrampTransactionPayloadStatus;
  /** The crypto currency purchased (e.g., "USDC", "ETH"). */
  purchaseCurrency?: string;
  /** The blockchain network for the purchase (e.g., "ethereum", "base"). */
  purchaseNetwork?: string;
  purchaseAmount?: MoneyAmount;
  paymentTotal?: MoneyAmount;
  paymentTotalUsd?: MoneyAmount;
  paymentSubtotal?: MoneyAmount;
  coinbaseFee?: MoneyAmount;
  networkFee?: MoneyAmount;
  exchangeRate?: MoneyAmount;
  /** The onchain transaction hash of the send (0x-prefixed for EVM). */
  txHash?: string;
  /** When the transaction was created. */
  createdAt?: string;
  /** When the transaction completed (uses send_started_at for early success). */
  completedAt?: string;
  /** The user's country code. */
  country?: string;
  /** Hashed user identifier (entity hash for guest, user ID for authed). */
  userId?: string;
  /** The payment method used. */
  paymentMethod?: OnrampTransactionPayloadPaymentMethod;
  /** The destination wallet address. */
  walletAddress?: string;
  /** The type of onramp transaction. */
  type?: OnrampTransactionPayloadType;
  /** Whether the user is authed or guest. */
  userType?: OnrampTransactionPayloadUserType;
  /** The partnerUserId provided when initializing the onramp session. */
  partnerUserRef?: string;
  /** The token contract address (populated when asset metadata is available). */
  contractAddress?: string;
  /** The reason for failure (if applicable). */
  failureReason?: OnrampTransactionPayloadFailureReason;
  /** The name of the developer app. */
  endPartnerName?: string;
  /** Error code for the transaction failure (if applicable). */
  errorCode?: string;
}

/**
 * The type of fee.
 */
export type OrderFeeFeeType = (typeof OrderFeeFeeType)[keyof typeof OrderFeeFeeType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OrderFeeFeeType = {
  FEE_TYPE_UNSPECIFIED: "FEE_TYPE_UNSPECIFIED",
  FEE_TYPE_NETWORK: "FEE_TYPE_NETWORK",
  FEE_TYPE_EXCHANGE: "FEE_TYPE_EXCHANGE",
} as const;

/**
 * A fee associated with a Headless Onramp API order.
 */
export interface OrderFee {
  /** The type of fee. */
  feeType?: OrderFeeFeeType;
  /** The amount of the fee. */
  feeAmount?: string;
  /** The currency of the fee. */
  feeCurrency?: string;
}

/**
 * The payment method used.
 */
export type OnrampOrderPayloadPaymentMethod =
  (typeof OnrampOrderPayloadPaymentMethod)[keyof typeof OnrampOrderPayloadPaymentMethod];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampOrderPayloadPaymentMethod = {
  UNSPECIFIED: "UNSPECIFIED",
  CARD: "CARD",
  ACH_BANK_ACCOUNT: "ACH_BANK_ACCOUNT",
  APPLE_PAY: "APPLE_PAY",
  FIAT_WALLET: "FIAT_WALLET",
  CRYPTO_ACCOUNT: "CRYPTO_ACCOUNT",
  GUEST_CHECKOUT_CARD: "GUEST_CHECKOUT_CARD",
  PAYPAL: "PAYPAL",
  RTP: "RTP",
  GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
  GUEST_CHECKOUT_GOOGLE_PAY: "GUEST_CHECKOUT_GOOGLE_PAY",
} as const;

/**
 * The status of the order.
 */
export type OnrampOrderPayloadStatus =
  (typeof OnrampOrderPayloadStatus)[keyof typeof OnrampOrderPayloadStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OnrampOrderPayloadStatus = {
  ONRAMP_ORDER_STATUS_UNSPECIFIED: "ONRAMP_ORDER_STATUS_UNSPECIFIED",
  ONRAMP_ORDER_STATUS_PENDING_AUTH: "ONRAMP_ORDER_STATUS_PENDING_AUTH",
  ONRAMP_ORDER_STATUS_PENDING_PAYMENT: "ONRAMP_ORDER_STATUS_PENDING_PAYMENT",
  ONRAMP_ORDER_STATUS_PROCESSING: "ONRAMP_ORDER_STATUS_PROCESSING",
  ONRAMP_ORDER_STATUS_COMPLETED: "ONRAMP_ORDER_STATUS_COMPLETED",
  ONRAMP_ORDER_STATUS_FAILED: "ONRAMP_ORDER_STATUS_FAILED",
} as const;

/**
 * Webhook payload for Headless Onramp API orders (Apple Pay / Google Pay). Serialized from the OnrampOrder proto via protojson with eventType appended.
 */
export interface OnrampOrderPayload {
  /** The webhook event type. */
  eventType: string;
  /** Unique order identifier. */
  orderId: string;
  /** The total fiat amount paid. */
  paymentTotal?: string;
  /** The fiat amount converted to crypto (excluding fees). */
  paymentSubtotal?: string;
  /** The fiat currency used for payment. */
  paymentCurrency?: string;
  /** The payment method used. */
  paymentMethod?: OnrampOrderPayloadPaymentMethod;
  /** The amount of crypto purchased. */
  purchaseAmount?: string;
  /** The crypto currency purchased. */
  purchaseCurrency?: string;
  /** Breakdown of fees for the order. */
  fees?: OrderFee[];
  /** The exchange rate used for conversion. */
  exchangeRate?: string;
  /** The destination wallet address. */
  destinationAddress?: string;
  /** The blockchain network for delivery. */
  destinationNetwork?: string;
  /** The status of the order. */
  status: OnrampOrderPayloadStatus;
  /** The onchain transaction hash (available once crypto is sent). */
  txHash?: string;
  /** When the order was created. */
  createdAt?: string;
  /** When the order was last updated. */
  updatedAt?: string;
  /** The partner user reference ID. */
  partnerUserRef?: string;
}

/**
 * Webhook payload for all onramp transaction events (created, updated, success, failed). Shape depends on transaction type — standard flow (guest checkout / authorized) uses OnrampTransactionPayload, Headless API (Apple Pay / Google Pay) uses OnrampOrderPayload. Distinguish by presence of `orderId` (Headless) vs `transactionId` (standard).
 */
export type OnrampTransactionEvent = OnrampTransactionPayload | OnrampOrderPayload;

export type OnrampTransactionCreatedEvent = OnrampTransactionEvent;

export type OnrampTransactionUpdatedEvent = OnrampTransactionEvent;

export type OnrampTransactionSuccessEvent = OnrampTransactionEvent;

export type OnrampTransactionFailedEvent = OnrampTransactionEvent;

/**
 * Current status of the offramp transaction.
 */
export type OfframpTransactionPayloadStatus =
  (typeof OfframpTransactionPayloadStatus)[keyof typeof OfframpTransactionPayloadStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OfframpTransactionPayloadStatus = {
  TRANSACTION_STATUS_UNSPECIFIED: "TRANSACTION_STATUS_UNSPECIFIED",
  TRANSACTION_STATUS_CREATED: "TRANSACTION_STATUS_CREATED",
  TRANSACTION_STATUS_EXPIRED: "TRANSACTION_STATUS_EXPIRED",
  TRANSACTION_STATUS_STARTED: "TRANSACTION_STATUS_STARTED",
  TRANSACTION_STATUS_SUCCESS: "TRANSACTION_STATUS_SUCCESS",
  TRANSACTION_STATUS_FAILED: "TRANSACTION_STATUS_FAILED",
} as const;

/**
 * The payment method type used for cashout.
 */
export type OfframpTransactionPayloadPaymentMethod =
  (typeof OfframpTransactionPayloadPaymentMethod)[keyof typeof OfframpTransactionPayloadPaymentMethod];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const OfframpTransactionPayloadPaymentMethod = {
  UNSPECIFIED: "UNSPECIFIED",
  CARD: "CARD",
  ACH_BANK_ACCOUNT: "ACH_BANK_ACCOUNT",
  APPLE_PAY: "APPLE_PAY",
  FIAT_WALLET: "FIAT_WALLET",
  CRYPTO_ACCOUNT: "CRYPTO_ACCOUNT",
  GUEST_CHECKOUT_CARD: "GUEST_CHECKOUT_CARD",
  PAYPAL: "PAYPAL",
  RTP: "RTP",
  GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
  GUEST_CHECKOUT_GOOGLE_PAY: "GUEST_CHECKOUT_GOOGLE_PAY",
} as const;

/**
 * Webhook payload for offramp transactions. Serialized from the OfframpTransaction proto via protojson with eventType appended.
 */
export interface OfframpTransactionPayload {
  /** The webhook event type. */
  eventType: string;
  /** Unique transaction identifier. */
  transactionId: string;
  /** Current status of the offramp transaction. */
  status: OfframpTransactionPayloadStatus;
  /** The crypto currency being sold (e.g., "ETH", "USDC"). */
  asset?: string;
  /** The blockchain network (e.g., "ethereum", "base"). */
  network?: string;
  sellAmount?: MoneyAmount;
  total?: MoneyAmount;
  minimumTotal?: MoneyAmount;
  subtotal?: MoneyAmount;
  coinbaseFee?: MoneyAmount;
  exchangeRate?: MoneyAmount;
  unitPrice?: MoneyAmount;
  /** The address crypto was received from. */
  fromAddress?: string;
  /** The address crypto was sent to (Coinbase deposit address). */
  toAddress?: string;
  /** When the transaction was created. */
  createdAt?: string;
  /** When the transaction was last updated. */
  updatedAt?: string;
  /** The onchain transaction hash of the crypto send. */
  txHash?: string;
  /** The URL the user was redirected to after confirming the offramp. */
  redirectUrl?: string;
  /** The payment method type used for cashout. */
  paymentMethod?: OfframpTransactionPayloadPaymentMethod;
}

export type OfframpTransactionCreatedEvent = OfframpTransactionPayload;

export type OfframpTransactionUpdatedEvent = OfframpTransactionPayload;

export type OfframpTransactionSuccessEvent = OfframpTransactionPayload;

export type OfframpTransactionFailedEvent = OfframpTransactionPayload;

/**
 * Idempotency key conflict.
 */
export type IdempotencyErrorResponse = Error;

/**
 * The endpoint cannot serve the request right now, either because the API is in an unintended outage (`service_unavailable` — dependency failure, deploy issue) or because an operator has intentionally disabled this specific endpoint via a kill switch (`endpoint_unavailable`). Clients should dispatch on `errorType`: `service_unavailable` is typically transient and safe to retry, while `endpoint_unavailable` may persist until an operator re-enables the endpoint.
 */
export type EndpointUnavailableErrorResponse = Error;

/**
 * Internal server error.
 */
export type InternalServerErrorResponse = Error;

/**
 * Bad gateway.
 */
export type BadGatewayErrorResponse = Error;

/**
 * Service unavailable.
 */
export type ServiceUnavailableErrorResponse = Error;

/**
 * Unauthorized.
 */
export type UnauthorizedErrorResponse = Error;

/**
 * A payment method is required to complete this operation.
 */
export type PaymentMethodRequiredErrorResponse = Error;

/**
 * The request was rejected due to a delegation issue. The errorType field indicates the specific reason.
 */
export type DelegationForbiddenErrorResponse = Error;

/**
 * The resource already exists.
 */
export type AlreadyExistsErrorResponse = Error;

/**
 * The underlying SQL string is invalid.
 */
export type InvalidSQLQueryErrorResponse = Error;

/**
 * The client closed the connection before the server could send a response.
 */
export type ClientClosedRequestErrorResponse = Error;

/**
 * The request timed out.
 */
export type TimedOutErrorResponse = Error;

/**
 * Optional scheme-specific verify metadata returned by the facilitator.
 */
export type X402VerifyResponseResponseExtra = { [key: string]: unknown };

export type X402VerifyResponseResponse = {
  /** Indicates whether the payment is valid. */
  isValid: boolean;
  invalidReason?: X402VerifyInvalidReason;
  /** The message describing the invalid reason. */
  invalidMessage?: string;
  /** The onchain address of the client that is paying for the resource.

For EVM networks, the payer will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the payer will be a base58-encoded Solana address. */
  payer: BlockchainAddress;
  /** Optional scheme-specific verify metadata returned by the facilitator. */
  extra?: X402VerifyResponseResponseExtra;
};

/**
 * Invalid payment verification on the x402 protocol.
 */
export type X402VerifyInvalidErrorResponse = X402VerifyPaymentRejection;

/**
 * Optional scheme-specific success metadata returned by the facilitator.
 */
export type X402SettleResponseResponseExtra = { [key: string]: unknown };

export type X402SettleResponseResponse = {
  /** Indicates whether the payment settlement is successful. */
  success: boolean;
  errorReason?: X402SettleErrorReason;
  /** The message describing the error reason. */
  errorMessage?: string;
  /** The onchain address of the client that is paying for the resource.

For EVM networks, the payer will be a 0x-prefixed, checksum EVM address.

For Solana-based networks, the payer will be a base58-encoded Solana address. */
  payer: BlockchainAddress;
  /**
   * The transaction of the settlement.
For EVM networks, the transaction will be a 0x-prefixed, EVM transaction hash.
For Solana-based networks, the transaction will be a base58-encoded Solana signature.
   * @pattern ^(0x[a-fA-F0-9]{64}|[1-9A-HJ-NP-Za-km-z]{87,88})$
   */
  transaction: string;
  /** The network where the settlement occurred. */
  network: string;
  /** The amount that was settled, in atomic units. */
  amount?: string;
  /** Optional scheme-specific success metadata returned by the facilitator. */
  extra?: X402SettleResponseResponseExtra;
};

/**
 * Unsuccessful payment settlement on the x402 protocol.
 */
export type X402SettleErrorResponse = X402SettlePaymentRejection;

/**
 * A map of CAIP-2 network or protocol family patterns to their supported signer addresses.
 */
export type X402SupportedPaymentKindsResponseResponseSigners = { [key: string]: string[] };

export type X402SupportedPaymentKindsResponseResponse = {
  /** The list of supported payment kinds. */
  kinds: X402SupportedPaymentKind[];
  /** The list of supported x402 extensions. */
  extensions: string[];
  /** A map of CAIP-2 network or protocol family patterns to their supported signer addresses. */
  signers: X402SupportedPaymentKindsResponseResponseSigners;
};

/**
 * User forbidden from performing the action.
 */
export type ForbiddenErrorResponse = Error;

/**
 * Rate limit exceeded.
 */
export type RateLimitExceededResponse = Error;

/**
 * The number of resources to return per page.
 */
export type PageSizeParameter = number;

/**
 * The token for the next page of resources, if any.
 */
export type PageTokenParameter = string;

/**
 * An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.

 */
export type IdempotencyKeyParameter = string;

/**
 * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.

 */
export type XWalletAuthParameter = string;

/**
 * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.

 */
export type XWalletAuthOptionalParameter = string;

/**
 * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.

 */
export type XDeveloperAuthParameter = string;

/**
 * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
 */
export type ProjectIDOptionalParameter = string;

export type ListFoundationAccountsParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
  /**
   * Filter accounts by account type. When omitted, accounts of any type are returned. Combined with `owner` using AND.
   */
  type?: AccountType;
};

export type ListFoundationAccounts200AllOf = {
  /** The list of accounts. */
  accounts: Account[];
};

export type ListFoundationAccounts200 = ListFoundationAccounts200AllOf & ListResponse;

export type ListBalancesParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListBalances200 = Balances & ListResponse;

export type ListDepositDestinationsParams = {
  /**
   * Filter deposit destinations by account ID.
   */
  accountId?: AccountId;
  /**
   * The cryptocurrency address to filter by. Format depends on the network (e.g., 0x-prefixed for EVM networks, base58 for Solana).
   */
  address?: string;
  /**
   * Filter deposit destinations by type.
   */
  type?: DepositDestinationType;
  /**
   * The blockchain network to filter by (e.g., base, ethereum). Only applies to crypto deposit destinations.
   */
  network?: string;
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListDepositDestinations200AllOf = {
  /** The list of deposit destinations. */
  depositDestinations: DepositDestination[];
};

export type ListDepositDestinations200 = ListDepositDestinations200AllOf & ListResponse;

export type ListTransfersParams = {
  /**
   * Filter transfers by status. Useful for building dashboards, monitoring active transfers, or finding transfers needing action.
   */
  status?: TransferStatus;
  /**
   * Filter transfers by account ID. Returns transfers where the specified account is either the source or target (OR semantics). Cannot be combined with `sourceAccountId` or `targetAccountId`.
   */
  accountId?: AccountId;
  /**
   * Filter transfers by source account ID. Returns only transfers where the specified account is the source. Cannot be combined with `accountId`.
   */
  sourceAccountId?: AccountId;
  /**
   * Filter transfers by target account ID. Returns only transfers where the specified account is the target. Cannot be combined with `accountId`.
   */
  targetAccountId?: AccountId;
  /**
   * Filter transfers to those created at or after this datetime (inclusive). ISO 8601 format.
   */
  createdAfter?: string;
  /**
   * Filter transfers to those created at or before this datetime (inclusive). ISO 8601 format.
   */
  createdBefore?: string;
  /**
   * Filter transfers to those updated at or after this datetime (inclusive). ISO 8601 format. Useful for incremental sync — poll for transfers that changed state since your last check.
   */
  updatedAfter?: string;
  /**
   * Filter transfers to those updated at or before this datetime (inclusive). ISO 8601 format.
   */
  updatedBefore?: string;
  /**
   * Filter transfers by source asset symbol (e.g., `usd`, `usdc`).
   */
  sourceAsset?: string;
  /**
   * Filter transfers by target asset symbol (e.g., `usdc`, `eth`).
   */
  targetAsset?: string;
  /**
   * Filter transfers by the on-chain address of the source.
   */
  sourceAddress?: BlockchainAddress;
  /**
   * Filter transfers by the on-chain destination address of the target.
   */
  targetAddress?: BlockchainAddress;
  /**
   * Filter transfers by the email address of the target recipient.
   */
  targetEmail?: Email;
  /**
   * Filter to a specific transfer by ID. When provided, returns only the matching transfer and bypasses pagination.
   * @pattern ^transfer_[a-f0-9\-]{36}$
   */
  transferId?: string;
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListTransfers200AllOf = {
  /** The list of transfers. */
  transfers: Transfer[];
};

export type ListTransfers200 = ListTransfers200AllOf & ListResponse;

/**
 * Configuration for creating an EVM account for the end user.
 */
export type CreateEndUserBodyEvmAccount = {
  /** If true, creates an EVM smart account and a default EVM EOA account as the owner. If false, only a EVM EOA account is created. */
  createSmartAccount?: boolean;
  /** If true, enables spend permissions for the EVM smart account. */
  enableSpendPermissions?: boolean;
};

/**
 * Configuration for creating a Solana account for the end user.
 */
export type CreateEndUserBodySolanaAccount = {
  /** Only false is a valid option since currently smart accounts on Solana are not supported. */
  createSmartAccount?: boolean;
};

export type CreateEndUserBody = {
  /**
   * A stable, unique identifier for the end user. The `userId` must be unique across all end users in the developer's CDP Project. It must be between 1 and 100 characters long and can only contain alphanumeric characters and hyphens.

If `userId` is not provided in the request, the server will generate a random UUID.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  userId?: string;
  authenticationMethods: AuthenticationMethods;
  /** Configuration for creating an EVM account for the end user. */
  evmAccount?: CreateEndUserBodyEvmAccount;
  /** Configuration for creating a Solana account for the end user. */
  solanaAccount?: CreateEndUserBodySolanaAccount;
};

export type ListEndUsersParams = {
  /**
   * The number of end users to return per page.
   * @minimum 1
   * @maximum 100
   */
  pageSize?: number;
  /**
   * The token for the desired page of end users. Will be empty if there are no more end users to fetch.
   */
  pageToken?: string;
  /**
   * Sort end users. Defaults to ascending order (oldest first).
   */
  sort?: ListEndUsersSortItem[];
};

export type ListEndUsersSortItem = (typeof ListEndUsersSortItem)[keyof typeof ListEndUsersSortItem];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ListEndUsersSortItem = {
  "createdAt=asc": "createdAt=asc",
  "createdAt=desc": "createdAt=desc",
} as const;

export type ListEndUsers200AllOf = {
  /** The list of end users. */
  endUsers: EndUser[];
};

export type ListEndUsers200 = ListEndUsers200AllOf & ListResponse;

/**
 * The request body for a developer to verify an end user's access token.
 */
export type ValidateEndUserAccessTokenBody = {
  /** The access token in JWT format to verify. */
  accessToken: string;
};

export type LookupEndUserParams = {
  /**
   * The email address to search for across all email-based authentication methods.
   */
  email?: Email;
  /**
   * The OAuth provider to search by. Must be provided together with oauthSubject.
   */
  oauthProvider?: OAuth2ProviderType;
  /**
   * The OAuth subject (the `sub` claim from the provider's ID token). Must be provided together with oauthProvider.
   */
  oauthSubject?: string;
  /**
   * The E.164-formatted phone number to search for. Must be URL-encoded when passed as a query parameter (e.g. `+14155552671` → `%2B14155552671`).
   */
  phoneNumber?: PhoneNumber;
  /**
   * The ERC-55 checksummed Ethereum address to search for. Looks up a user by the address they authenticated with via Sign In With Ethereum (EIP-4361).
   */
  siweAddress?: BlockchainAddress;
};

export type LookupEndUser200 = {
  /** The list of end users matching the lookup. */
  endUsers: EndUser[];
};

export type AddEndUserEvmAccountBody = { [key: string]: unknown };

export type AddEndUserEvmAccount201 = {
  evmAccount: EndUserEvmAccount;
};

export type AddEndUserEvmSmartAccountBody = {
  /** If true, enables spend permissions for the EVM smart account. */
  enableSpendPermissions?: boolean;
};

export type AddEndUserEvmSmartAccount201 = {
  evmSmartAccount: EndUserEvmSmartAccount;
};

export type AddEndUserSolanaAccountBody = { [key: string]: unknown };

export type AddEndUserSolanaAccount201 = {
  solanaAccount: EndUserSolanaAccount;
};

/**
 * The type of key being imported. Determines what type of account will be associated for the end user.
 */
export type ImportEndUserBodyKeyType =
  (typeof ImportEndUserBodyKeyType)[keyof typeof ImportEndUserBodyKeyType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ImportEndUserBodyKeyType = {
  evm: "evm",
  solana: "solana",
} as const;

export type ImportEndUserBody = {
  /**
   * A stable, unique identifier for the end user. The `userId` must be unique across all end users in the developer's CDP Project. It must be between 1 and 100 characters long and can only contain alphanumeric characters and hyphens.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  userId: string;
  authenticationMethods: AuthenticationMethods;
  /** The base64-encoded, encrypted private key to import. The private key must be encrypted using the CDP SDK's encryption scheme. This is a 32-byte raw private key. */
  encryptedPrivateKey: string;
  /** The type of key being imported. Determines what type of account will be associated for the end user. */
  keyType: ImportEndUserBodyKeyType;
};

export type SignEvmTransactionWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SignEvmTransactionWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the EVM account belonging to the end user.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The RLP-encoded transaction to sign, as a 0x-prefixed hex string. */
  transaction: string;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SignEvmTransactionWithEndUserAccount200 = {
  /** The RLP-encoded signed transaction, as a 0x-prefixed hex string. */
  signedTransaction: string;
};

export type SendEvmTransactionWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

/**
 * The network to send the transaction to.
 */
export type SendEvmTransactionWithEndUserAccountBodyNetwork =
  (typeof SendEvmTransactionWithEndUserAccountBodyNetwork)[keyof typeof SendEvmTransactionWithEndUserAccountBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEvmTransactionWithEndUserAccountBodyNetwork = {
  base: "base",
  "base-sepolia": "base-sepolia",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
  avalanche: "avalanche",
  polygon: "polygon",
  optimism: "optimism",
  arbitrum: "arbitrum",
  "arbitrum-sepolia": "arbitrum-sepolia",
  world: "world",
  "world-sepolia": "world-sepolia",
} as const;

export type SendEvmTransactionWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the EVM account belonging to the end user.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The network to send the transaction to. */
  network: SendEvmTransactionWithEndUserAccountBodyNetwork;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
  /** The RLP-encoded transaction to sign and send, as a 0x-prefixed hex string. */
  transaction: string;
};

export type SendEvmTransactionWithEndUserAccount200 = {
  /** The hash of the transaction, as a 0x-prefixed hex string. */
  transactionHash: string;
};

export type SendEvmAssetWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

/**
 * The EVM network to send USDC on.
 */
export type SendEvmAssetWithEndUserAccountBodyNetwork =
  (typeof SendEvmAssetWithEndUserAccountBodyNetwork)[keyof typeof SendEvmAssetWithEndUserAccountBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEvmAssetWithEndUserAccountBodyNetwork = {
  base: "base",
  "base-sepolia": "base-sepolia",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
  avalanche: "avalanche",
  polygon: "polygon",
  optimism: "optimism",
  arbitrum: "arbitrum",
  "arbitrum-sepolia": "arbitrum-sepolia",
  world: "world",
  "world-sepolia": "world-sepolia",
} as const;

export type SendEvmAssetWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the recipient.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  to: BlockchainAddress;
  /**
   * The amount of USDC to send as a decimal string (e.g., "1.5" or "25.50").
   * @minLength 1
   * @maxLength 32
   */
  amount: string;
  /** The EVM network to send USDC on. */
  network: SendEvmAssetWithEndUserAccountBodyNetwork;
  /** Whether to use CDP Paymaster to sponsor gas fees. Only applicable for EVM Smart Accounts. When true, the transaction gas will be paid by the Paymaster, allowing users to send USDC without holding native gas tokens. Ignored for EOA accounts. Cannot be used together with `paymasterUrl`. */
  useCdpPaymaster?: boolean;
  /** Optional custom Paymaster URL to use for gas sponsorship. Only applicable for EVM Smart Accounts. This allows you to use your own Paymaster service instead of CDP's Paymaster. Cannot be used together with `useCdpPaymaster`. */
  paymasterUrl?: Url;
  paymasterContext?: PaymasterContext;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SendEvmAssetWithEndUserAccount200 = {
  /**
   * The hash of the transaction, as a 0x-prefixed hex string. Populated for EOA accounts. Null for Smart Accounts (use userOpHash instead).
   * @nullable
   */
  transactionHash?: string | null;
  /**
   * The hash of the user operation, as a 0x-prefixed hex string. Populated for Smart Accounts. Null for EOA accounts (use transactionHash instead).
   * @nullable
   */
  userOpHash?: string | null;
};

export type SignEvmMessageWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SignEvmMessageWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the EVM account belonging to the end user.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The message to sign. */
  message: string;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SignEvmMessageWithEndUserAccount200 = {
  /** The signature of the message, as a 0x-prefixed hex string. */
  signature: string;
};

export type SignEvmTypedDataWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SignEvmTypedDataWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the EVM account belonging to the end user.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  typedData: EIP712Message;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SignEvmTypedDataWithEndUserAccount200 = {
  /** The signature of the typed data, as a 0x-prefixed hex string. */
  signature: string;
};

export type GetDelegationForEndUserParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type GetDelegationForEndUser200 = {
  /** The date until which the delegation is valid. */
  expiresAt: string;
};

export type RevokeDelegationForEndUserParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type RevokeDelegationForEndUserBody = {
  /**
   * When revoking with a wallet authentication scheme, the ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type CreateDelegationForEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type CreateDelegationForEndUserAccountBody = {
  /** The date until which the delegation is valid. */
  expiresAt: string;
  /**
   * The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId: string;
};

export type CreateDelegationForEndUserAccount201 = {
  /** The date until which the delegation is valid. */
  expiresAt: string;
};

export type GetDelegationForEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type GetDelegationForEndUserAccount200 = {
  /** The date until which the delegation is valid. */
  expiresAt: string;
};

export type RevokeDelegationForEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type RevokeDelegationForEndUserAccountBody = {
  /**
   * When revoking with a wallet authentication scheme, the ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type CreateEvmEip7702DelegationWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type CreateEvmEip7702DelegationWithEndUserAccountBody = {
  /**
   * The 0x-prefixed address of the EVM account to delegate.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  network: EvmEip7702DelegationNetwork;
  /** Whether to configure spend permissions for the upgraded, delegated account. When enabled, the account can grant permissions for third parties to spend on its behalf. */
  enableSpendPermissions?: boolean;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type CreateEvmEip7702DelegationWithEndUserAccount201 = {
  /** The unique identifier for the delegation operation. Use this to poll the operation status. */
  delegationOperationId: string;
};

export type SendUserOperationWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SendUserOperationWithEndUserAccountBody = {
  network: EvmUserOperationNetwork;
  /** The list of calls to make from the Smart Account. */
  calls: EvmCall[];
  /** Whether to use the CDP Paymaster for the user operation. */
  useCdpPaymaster: boolean;
  /** The URL of the paymaster to use for the user operation. If using the CDP Paymaster, use the `useCdpPaymaster` option. */
  paymasterUrl?: Url;
  paymasterContext?: PaymasterContext;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
  /**
   * The EIP-8021 data suffix (hex-encoded) that enables transaction attribution for the user operation.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  dataSuffix?: string;
};

export type SignSolanaMessageWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SignSolanaMessageWithEndUserAccountBody = {
  /**
   * The base58 encoded address of the Solana account belonging to the end user.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /** The base64 encoded arbitrary message to sign. */
  message: string;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SignSolanaMessageWithEndUserAccount200 = {
  /** The signature of the message, as a base58 encoded string. */
  signature: string;
};

export type SignSolanaTransactionWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

export type SignSolanaTransactionWithEndUserAccountBody = {
  /**
   * The base58 encoded address of the Solana account belonging to the end user.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /** The base64 encoded transaction to sign. */
  transaction: string;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
};

export type SignSolanaTransactionWithEndUserAccount200 = {
  /** The base64 encoded signed transaction. */
  signedTransaction: string;
};

export type SendSolanaTransactionWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

/**
 * The Solana network to send the transaction to.
 */
export type SendSolanaTransactionWithEndUserAccountBodyNetwork =
  (typeof SendSolanaTransactionWithEndUserAccountBodyNetwork)[keyof typeof SendSolanaTransactionWithEndUserAccountBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendSolanaTransactionWithEndUserAccountBodyNetwork = {
  solana: "solana",
  "solana-devnet": "solana-devnet",
} as const;

export type SendSolanaTransactionWithEndUserAccountBody = {
  /**
   * The base58 encoded address of the Solana account belonging to the end user.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /** The Solana network to send the transaction to. */
  network: SendSolanaTransactionWithEndUserAccountBodyNetwork;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
  /** The base64 encoded transaction to sign and send. This transaction can contain multiple instructions for native Solana batching. */
  transaction: string;
  /** Whether transaction fees should be sponsored by CDP. When true, CDP sponsors the transaction fees on behalf of the end user. When false, the end user is responsible for paying the transaction fees. */
  useCdpSponsor?: boolean;
};

export type SendSolanaTransactionWithEndUserAccount200 = {
  /** The base58 encoded transaction signature. */
  transactionSignature: string;
};

export type SendSolanaAssetWithEndUserAccountParams = {
  /**
   * The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
   * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
   */
  projectID?: ProjectIDOptionalParameter;
};

/**
 * The Solana network to send USDC on.
 */
export type SendSolanaAssetWithEndUserAccountBodyNetwork =
  (typeof SendSolanaAssetWithEndUserAccountBodyNetwork)[keyof typeof SendSolanaAssetWithEndUserAccountBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendSolanaAssetWithEndUserAccountBodyNetwork = {
  solana: "solana",
  "solana-devnet": "solana-devnet",
} as const;

export type SendSolanaAssetWithEndUserAccountBody = {
  /**
   * The base58 encoded address of the recipient.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  to: BlockchainAddress;
  /**
   * The amount of USDC to send as a decimal string (e.g., "1.5" or "25.50").
   * @minLength 1
   * @maxLength 32
   */
  amount: string;
  /** The Solana network to send USDC on. */
  network: SendSolanaAssetWithEndUserAccountBodyNetwork;
  /** Whether to automatically create an Associated Token Account (ATA) for the recipient if it doesn't exist. When true, the sender pays the rent-exempt minimum to create the recipient's USDC ATA. When false, the transaction will fail if the recipient doesn't have a USDC ATA. */
  createRecipientAta?: boolean;
  /**
   * Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
   * @pattern ^[a-zA-Z0-9-]{1,100}$
   */
  walletSecretId?: string;
  /** Whether transaction fees should be sponsored by CDP. When true, CDP sponsors the transaction fees on behalf of the end user. When false, the end user is responsible for paying the transaction fees. */
  useCdpSponsor?: boolean;
};

export type SendSolanaAssetWithEndUserAccount200 = {
  /** The base58 encoded transaction signature. */
  transactionSignature: string;
};

export type ListEvmAccountsParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListEvmAccounts200AllOf = {
  /** The list of EVM accounts. */
  accounts: EvmAccount[];
};

export type ListEvmAccounts200 = ListEvmAccounts200AllOf & ListResponse;

export type CreateEvmAccountBody = {
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /**
   * The ID of the account-level policy to apply to the account.
   * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
   */
  accountPolicy?: string;
};

export type UpdateEvmAccountBody = {
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /**
   * The ID of the account-level policy to apply to the account, or an empty string to unset attached policy.
   * @pattern (^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^$)
   */
  accountPolicy?: string;
};

/**
 * The network to send the transaction to.
 */
export type SendEvmTransactionBodyNetwork =
  (typeof SendEvmTransactionBodyNetwork)[keyof typeof SendEvmTransactionBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendEvmTransactionBodyNetwork = {
  base: "base",
  "base-sepolia": "base-sepolia",
  ethereum: "ethereum",
  "ethereum-sepolia": "ethereum-sepolia",
  avalanche: "avalanche",
  polygon: "polygon",
  optimism: "optimism",
  arbitrum: "arbitrum",
  "arbitrum-sepolia": "arbitrum-sepolia",
  world: "world",
  "world-sepolia": "world-sepolia",
} as const;

export type SendEvmTransactionBody = {
  /** The network to send the transaction to. */
  network: SendEvmTransactionBodyNetwork;
  /** The RLP-encoded transaction to sign and send, as a 0x-prefixed hex string. */
  transaction: string;
};

export type SendEvmTransaction200 = {
  /** The hash of the transaction, as a 0x-prefixed hex string. */
  transactionHash: string;
};

export type SignEvmTransactionBody = {
  /** The RLP-encoded transaction to sign, as a 0x-prefixed hex string. */
  transaction: string;
};

export type SignEvmTransaction200 = {
  /** The RLP-encoded signed transaction, as a 0x-prefixed hex string. */
  signedTransaction: string;
};

export type SignEvmHashBody = {
  /** The arbitrary 32 byte hash to sign. */
  hash: string;
};

export type SignEvmHash200 = {
  /** The signature of the hash, as a 0x-prefixed hex string. */
  signature: string;
};

export type SignEvmMessageBody = {
  /** The message to sign. */
  message: string;
};

export type SignEvmMessage200 = {
  /** The signature of the message, as a 0x-prefixed hex string. */
  signature: string;
};

export type SignEvmTypedData200 = {
  /** The signature of the typed data, as a 0x-prefixed hex string. */
  signature: string;
};

export type CreateEvmEip7702DelegationBody = {
  network: EvmEip7702DelegationNetwork;
  /** Whether to configure spend permissions for the upgraded, delegated account. When enabled, the account can grant permissions for third parties to spend on its behalf. */
  enableSpendPermissions?: boolean;
};

export type CreateEvmEip7702Delegation201 = {
  /** The unique identifier for the delegation operation. Use this to poll the operation status. */
  delegationOperationId: string;
};

export type ListEvmSmartAccountsParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListEvmSmartAccounts200AllOf = {
  /** The list of Smart Accounts. */
  accounts: EvmSmartAccount[];
};

export type ListEvmSmartAccounts200 = ListEvmSmartAccounts200AllOf & ListResponse;

export type CreateEvmSmartAccountBody = {
  /** Today, only a single owner can be set for a Smart Account, but this is an array to allow setting multiple owners in the future. */
  owners: string[];
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
};

export type ImportEvmAccountBody = {
  /** The base64-encoded, encrypted private key of the EVM account. The private key must be encrypted using the CDP SDK's encryption scheme. */
  encryptedPrivateKey: string;
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /**
   * The ID of the account-level policy to apply to the account.
   * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
   */
  accountPolicy?: string;
};

export type ExportEvmAccountBody = {
  /** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
  exportEncryptionKey: string;
};

export type ExportEvmAccount200 = {
  /** The base64-encoded, encrypted private key of the EVM account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
  encryptedPrivateKey: string;
};

export type ExportEvmAccountByNameBody = {
  /** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
  exportEncryptionKey: string;
};

export type ExportEvmAccountByName200 = {
  /** The base64-encoded, encrypted private key of the EVM account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
  encryptedPrivateKey: string;
};

export type UpdateEvmSmartAccountBody = {
  /**
   * An optional name for the smart account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM smart accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
};

export type PrepareUserOperationBody = {
  network: EvmUserOperationNetwork;
  /** The list of calls to make from the Smart Account. */
  calls: EvmCall[];
  /** The URL of the paymaster to use for the user operation. */
  paymasterUrl?: Url;
  paymasterContext?: PaymasterContext;
  /**
   * The EIP-8021 data suffix (hex-encoded) that enables transaction attribution for the user operation.
   * @pattern ^0x[0-9a-fA-F]+$
   */
  dataSuffix?: string;
};

export type PrepareAndSendUserOperationBody = {
  network: EvmUserOperationNetwork;
  /** The list of calls to make from the Smart Account. */
  calls: EvmCall[];
  /** The URL of the paymaster to use for the user operation. */
  paymasterUrl?: Url;
  paymasterContext?: PaymasterContext;
};

export type SendUserOperationBody = {
  /** The hex-encoded signature of the user operation. This should be a 65-byte signature consisting of the `r`, `s`, and `v` values of the ECDSA signature. Note that the `v` value should conform to the `personal_sign` standard, which means it should be 27 or 28. */
  signature: string;
};

export type ListSpendPermissionsParams = {
  /**
   * The number of spend permissions to return per page.
   */
  pageSize?: number;
  /**
   * The token for the next page of spend permissions. Will be empty if there are no more spend permissions to fetch.
   */
  pageToken?: string;
};

export type ListSpendPermissions200AllOf = {
  /** The spend permissions for the smart account. */
  spendPermissions: SpendPermissionResponseObject[];
};

export type ListSpendPermissions200 = ListSpendPermissions200AllOf & ListResponse;

export type GetEvmSwapPriceParams = {
  network: EvmSwapsNetwork;
  toToken: ToToken;
  fromToken: FromToken;
  fromAmount: FromAmount;
  taker: Taker;
  signerAddress?: SignerAddress;
  gasPrice?: GasPrice;
  slippageBps?: SlippageBps;
};

export type CreateEvmSwapQuoteBody = {
  network: EvmSwapsNetwork;
  /**
   * The 0x-prefixed contract address of the token to receive.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  toToken: string;
  /**
   * The 0x-prefixed contract address of the token to send.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  fromToken: string;
  /**
   * The amount of the `fromToken` to send in atomic units of the token. For example, `1000000000000000000` when sending ETH equates to 1 ETH, `1000000` when sending USDC equates to 1 USDC, etc.
   * @pattern ^\d+$
   */
  fromAmount: string;
  /**
   * The 0x-prefixed address that holds the `fromToken` balance and has the `Permit2` allowance set for the swap.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  taker: string;
  /**
   * The 0x-prefixed Externally Owned Account (EOA) address that will sign the `Permit2` EIP-712 permit message. This is only needed if `taker` is a smart contract.
   * @pattern ^0x[a-fA-F0-9]{40}$
   */
  signerAddress?: string;
  /**
   * The target gas price for the swap transaction, in Wei. For EIP-1559 transactions, this value should be seen as the `maxFeePerGas` value. If not provided, the API will use an estimate based on the current network conditions.
   * @pattern ^\d+$
   */
  gasPrice?: string;
  /**
   * The maximum acceptable slippage of the `toToken` in basis points. If this parameter is set to 0, no slippage will be tolerated. If not provided, the default slippage tolerance is 100 bps (i.e., 1%).
   * @minimum 0
   * @maximum 10000
   */
  slippageBps?: number;
};

export type ListEvmTokenBalancesParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListEvmTokenBalances200AllOf = {
  /** The list of EVM token balances. */
  balances: TokenBalance[];
};

export type ListEvmTokenBalances200 = ListEvmTokenBalances200AllOf & ListResponse;

/**
 * The network to request funds from.
 */
export type RequestEvmFaucetBodyNetwork =
  (typeof RequestEvmFaucetBodyNetwork)[keyof typeof RequestEvmFaucetBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const RequestEvmFaucetBodyNetwork = {
  "base-sepolia": "base-sepolia",
  "ethereum-sepolia": "ethereum-sepolia",
  "ethereum-hoodi": "ethereum-hoodi",
} as const;

/**
 * The token to request funds for.
 */
export type RequestEvmFaucetBodyToken =
  (typeof RequestEvmFaucetBodyToken)[keyof typeof RequestEvmFaucetBodyToken];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const RequestEvmFaucetBodyToken = {
  eth: "eth",
  usdc: "usdc",
  eurc: "eurc",
  cbbtc: "cbbtc",
} as const;

export type RequestEvmFaucetBody = {
  /** The network to request funds from. */
  network: RequestEvmFaucetBodyNetwork;
  /**
   * The address to request funds to, which is a 0x-prefixed hexadecimal string.
   * @pattern ^0x[0-9a-fA-F]{40}$
   */
  address: string;
  /** The token to request funds for. */
  token: RequestEvmFaucetBodyToken;
};

export type RequestEvmFaucet200 = {
  /** The hash of the transaction that requested the funds.
   **Note:** In rare cases, when gas conditions are unusually high, the transaction may not confirm, and the system may issue a replacement transaction to complete the faucet request. In these rare cases, the `transactionHash` will be out of sync with the actual faucet transaction that was confirmed onchain. */
  transactionHash: string;
};

export type ListPoliciesParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
  /**
   * The scope of the policies to return. If `project`, the response will include exactly one policy, which is the project-level policy. If `account`, the response will include all account-level policies for the developer's CDP Project.
   */
  scope?: ListPoliciesScope;
};

export type ListPoliciesScope = (typeof ListPoliciesScope)[keyof typeof ListPoliciesScope];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ListPoliciesScope = {
  project: "project",
  account: "account",
} as const;

export type ListPolicies200AllOf = {
  /** The list of policies. */
  policies: Policy[];
};

export type ListPolicies200 = ListPolicies200AllOf & ListResponse;

/**
 * The scope of the policy.
 */
export type CreatePolicyBodyScope =
  (typeof CreatePolicyBodyScope)[keyof typeof CreatePolicyBodyScope];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreatePolicyBodyScope = {
  project: "project",
  account: "account",
} as const;

export type CreatePolicyBody = {
  /** The scope of the policy. */
  scope: CreatePolicyBodyScope;
  /**
   * An optional human-readable description for the policy.
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
   * @pattern ^[A-Za-z0-9 ,.]{1,50}$
   */
  description?: string;
  /** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
  rules: Rule[];
};

export type UpdatePolicyBody = {
  /**
   * An optional human-readable description for the policy.
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
   * @pattern ^[A-Za-z0-9 ,.]{1,50}$
   */
  description?: string;
  /** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
  rules: Rule[];
};

export type ListSolanaAccountsParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListSolanaAccounts200AllOf = {
  /** The list of Solana accounts. */
  accounts: SolanaAccount[];
};

export type ListSolanaAccounts200 = ListSolanaAccounts200AllOf & ListResponse;

export type CreateSolanaAccountBody = {
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all Solana accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /**
   * The ID of the account-level policy to apply to the account.
   * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
   */
  accountPolicy?: string;
};

export type UpdateSolanaAccountBody = {
  /**
   * An optional name for the account. Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all Solana accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
  /**
   * The ID of the account-level policy to apply to the account, or an empty string to unset attached policy.
   * @pattern (^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^$)
   */
  accountPolicy?: string;
};

export type ImportSolanaAccountBody = {
  /** The base64-encoded, encrypted 32-byte private key of the Solana account. The private key must be encrypted using the CDP SDK's encryption scheme. */
  encryptedPrivateKey: string;
  /**
   * An optional name for the account.
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
Account names must be unique across all EVM accounts in the developer's CDP Project.
   * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
   */
  name?: string;
};

export type ExportSolanaAccountBody = {
  /** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
  exportEncryptionKey: string;
};

export type ExportSolanaAccount200 = {
  /** The base64-encoded, encrypted private key of the Solana account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
  encryptedPrivateKey: string;
};

export type ExportSolanaAccountByNameBody = {
  /** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
  exportEncryptionKey: string;
};

export type ExportSolanaAccountByName200 = {
  /** The base64-encoded, encrypted private key of the Solana account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
  encryptedPrivateKey: string;
};

export type SignSolanaTransactionBody = {
  /** The base64 encoded transaction to sign. */
  transaction: string;
};

export type SignSolanaTransaction200 = {
  /** The base64 encoded signed transaction. */
  signedTransaction: string;
};

export type SignSolanaMessageBody = {
  /** The arbitrary message to sign. */
  message: string;
};

export type SignSolanaMessage200 = {
  /** The signature of the message, as a base58 encoded string. */
  signature: string;
};

/**
 * The Solana network to send the transaction to.
 */
export type SendSolanaTransactionBodyNetwork =
  (typeof SendSolanaTransactionBodyNetwork)[keyof typeof SendSolanaTransactionBodyNetwork];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SendSolanaTransactionBodyNetwork = {
  solana: "solana",
  "solana-devnet": "solana-devnet",
} as const;

export type SendSolanaTransactionBody = {
  /** The Solana network to send the transaction to. */
  network: SendSolanaTransactionBodyNetwork;
  /** The base64 encoded transaction to sign and send. This transaction can contain multiple instructions for native Solana batching. */
  transaction: string;
  /** Whether transaction fees should be sponsored by CDP. When true, CDP sponsors the transaction fees on behalf of the server wallet. When false, the server wallet is responsible for paying the transaction fees. */
  useCdpSponsor?: boolean;
};

export type SendSolanaTransaction200 = {
  /** The base58 encoded transaction signature. */
  transactionSignature: string;
};

/**
 * The token to request funds for.
 */
export type RequestSolanaFaucetBodyToken =
  (typeof RequestSolanaFaucetBodyToken)[keyof typeof RequestSolanaFaucetBodyToken];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const RequestSolanaFaucetBodyToken = {
  sol: "sol",
  usdc: "usdc",
  cbtusd: "cbtusd",
} as const;

export type RequestSolanaFaucetBody = {
  /**
   * The address to request funds to, which is a base58-encoded string.
   * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
   */
  address: string;
  /** The token to request funds for. */
  token: RequestSolanaFaucetBodyToken;
};

export type RequestSolanaFaucet200 = {
  /** The signature identifying the transaction that requested the funds. */
  transactionSignature: string;
};

export type ListSolanaTokenBalancesParams = {
  /**
   * The number of balances to return per page.
   */
  pageSize?: number;
  /**
   * The token for the next page of balances. Will be empty if there are no more balances to fetch.
   */
  pageToken?: string;
};

export type ListSolanaTokenBalances200AllOf = {
  /** The list of Solana token balances. */
  balances: SolanaTokenBalance[];
};

export type ListSolanaTokenBalances200 = ListSolanaTokenBalances200AllOf & ListResponse;

export type GetSQLSchemaParams = {
  /**
   * The name of the database to query. Defaults to "base" when not specified.
   */
  database?: GetSQLSchemaDatabase;
  /**
   * Get the schema for a specific table.
   */
  table?: string;
};

export type GetSQLSchemaDatabase = (typeof GetSQLSchemaDatabase)[keyof typeof GetSQLSchemaDatabase];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const GetSQLSchemaDatabase = {
  base: "base",
  base_sepolia: "base_sepolia",
  solana: "solana",
  hyperevm: "hyperevm",
} as const;

export type ListDataTokenBalancesParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListDataTokenBalances200AllOf = {
  /** The list of EVM token balances. */
  balances: TokenBalance[];
};

export type ListDataTokenBalances200 = ListDataTokenBalances200AllOf & ListResponse;

export type ListWebhookSubscriptionsParams = {
  /**
   * The number of subscriptions to return per page.
   * @minimum 1
   * @maximum 100
   */
  pageSize?: number;
  /**
   * The token for the next page of subscriptions, if any.
   */
  pageToken?: string;
};

export type ListWebhookSubscriptionEventsParams = {
  /**
   * Filter by a specific event ID.
   */
  eventId?: string;
  /**
   * Filter events created at or after this timestamp (RFC 3339 format).
   */
  minCreatedAt?: string;
  /**
   * Filter events created at or before this timestamp (RFC 3339 format).
   */
  maxCreatedAt?: string;
  /**
   * Filter by event type names (comma-separated).
   */
  eventTypeNames?: string;
};

export type VerifyX402PaymentBody = {
  x402Version: X402Version;
  paymentPayload: X402PaymentPayload;
  paymentRequirements: X402PaymentRequirements;
};

export type SettleX402PaymentBody = {
  x402Version: X402Version;
  paymentPayload: X402PaymentPayload;
  paymentRequirements: X402PaymentRequirements;
};

export type ListX402DiscoveryResourcesParams = {
  /**
 * Filter by protocol type (e.g., "http", "mcp").
Currently, the only supported protocol type is "http".
 */
  type?: string;
  /**
   * The number of discovered x402 resources to return per page.
   */
  limit?: number;
  /**
   * The offset of the first discovered x402 resource to return.
   */
  offset?: number;
};

export type ListX402DiscoveryMerchantParams = {
  /**
 * The merchant's payment address to look up.
This is the onchain address that payment requirements route funds to.
 */
  payTo: BlockchainAddress;
  /**
   * The number of resources to return per page.
   */
  limit?: number;
  /**
   * The offset of the first resource to return.
   */
  offset?: number;
};

export type SearchX402ResourcesParams = {
  /**
   * Full-text or semantic search query to find matching resources.
   * @maxLength 400
   */
  query?: string;
  /**
 * Filter results by network in CAIP-2 format (e.g., `eip155:8453`) or legacy name (e.g., `base`, `base-sepolia`, `solana`).
Legacy names are normalized to their CAIP-2 equivalents before filtering.
 */
  network?: string;
  /**
 * Filter results by asset address.
For EVM networks, provide a 0x-prefixed EVM address. For Solana networks, provide a base58-encoded address.
Matching is case-insensitive.
 */
  asset?: string;
  /**
   * Filter results by payment scheme (e.g., `exact`).
   */
  scheme?: string;
  /**
 * Filter results by the merchant's payment address.
For EVM networks, provide a 0x-prefixed EVM address. For Solana networks, provide a base58-encoded address.
 */
  payTo?: BlockchainAddress;
  /**
 * Filter results to resources whose URL contains this value (case-insensitive substring match against the resource URL).
Useful for narrowing results to a specific domain, subdomain, or path segment. Combine with `query` to perform semantic search restricted to a URL subset.
Tip: include enough of the URL to disambiguate (e.g. `api.example.com` rather than `example`) — a short substring may also match resources whose path contains the same string.
 * @minLength 3
 * @maxLength 2048
 */
  urlSubstring?: string;
  /**
   * Filter results to resources with a USD price at or below this value.
   */
  maxUsdPrice?: string;
  /**
   * Filter results to resources that support the specified protocol extensions. Can be specified multiple times to filter by multiple extensions.
   */
  extensions?: string[];
  /**
 * Maximum number of resources to return. Must be a positive integer no greater than 20.
Defaults to 20.
 * @minimum 1
 * @maximum 20
 */
  limit?: number;
};

export type CreateOnrampOrderBody = {
  /** The timestamp of when the user acknowledged that by using Coinbase Onramp they are accepting the Coinbase Terms  (https://www.coinbase.com/legal/guest-checkout/us), User Agreement (https://www.coinbase.com/legal/user_agreement),  and Privacy Policy (https://www.coinbase.com/legal/privacy). */
  agreementAcceptedAt: string;
  /** The address the purchased crypto will be sent to. */
  destinationAddress: BlockchainAddress;
  /** The name of the crypto network the purchased currency will be sent on.

Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported networks for your user's location. */
  destinationNetwork: string;
  /** The verified email address of the user requesting the onramp transaction. This email must be verified by your app (via OTP) before being used with the Onramp API. */
  email: string;
  /** If true, this API will return a quote without creating any transaction. */
  isQuote?: boolean;
  /** Optional partner order reference ID. */
  partnerOrderRef?: string;
  /** A unique string that represents the user in your app. This can be used to link individual transactions  together so you can retrieve the transaction history for your users. Prefix this string with “sandbox-”  (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to test your integration  without any real transfer of funds.

This value can be used with with [Onramp User Transactions API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-onramp-transactions-by-id) to retrieve all transactions created by the user. */
  partnerUserRef: string;
  /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using  this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount  of the payment currency. */
  paymentAmount?: string;
  /** The fiat currency to be converted to crypto. */
  paymentCurrency: string;
  paymentMethod: OnrampOrderPaymentMethodTypeId;
  /** The phone number of the user requesting the onramp transaction in E.164 format. This phone number must  be verified by your app (via OTP) before being used with the Onramp API.

Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api) for more details on phone number verification requirements and best practices. */
  phoneNumber: string;
  /** Timestamp of when the user's phone number was verified via OTP. User phone number must be verified  every 60 days. If this timestamp is older than 60 days, an error will be returned. */
  phoneNumberVerifiedAt: string;
  /** The SMS verification ID returned by the Submit Onramp Verification endpoint after verifying the user's phone number. When provided, Onramp validates the server-side verification record instead of trusting `phoneNumberVerifiedAt`. */
  smsVerificationId?: OnrampVerificationId;
  /** The email verification ID returned by the Submit Onramp Verification endpoint after verifying the user's email address. */
  emailVerificationId?: OnrampVerificationId;
  /** A string representing the amount of crypto the user wishes to purchase. When using this parameter the  returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase  currency. */
  purchaseAmount?: string;
  /** The ticker (e.g. `BTC`, `USDC`, `SOL`) or the Coinbase UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`)  of the crypto asset to be purchased.

Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported purchase currencies for your user's location. */
  purchaseCurrency: string;
  /** The IP address of the end user requesting the onramp transaction. */
  clientIp?: string;
  /** The domain that the Apple Pay button will be rendered on. Required when using the `GUEST_CHECKOUT_APPLE_PAY`  payment method and embedding the payment link in an iframe. */
  domain?: string;
};

export type CreateOnrampOrder201 = {
  order: OnrampOrder;
  paymentLink?: OnrampPaymentLink;
};

export type GetOnrampOrderById200 = {
  order: OnrampOrder;
};

export type CreateOnrampSession201 = {
  session: OnrampSession;
  quote?: OnrampQuote;
};

export type GetOnrampUserLimitsBody = {
  paymentMethodType: OnrampOrderPaymentMethodTypeId;
  /** The user identifier value. For `phone_number` type, this must be in E.164 format. */
  userId: string;
  userIdType: OnrampUserIdType;
};

export type GetOnrampUserLimits200 = {
  /** The list of limits applicable to the user. */
  limits: OnrampUserLimit[];
};

export type ListPaymentMethodsParams = {
  /**
   * The number of resources to return per page.
   */
  pageSize?: PageSizeParameter;
  /**
   * The token for the next page of resources, if any.
   */
  pageToken?: PageTokenParameter;
};

export type ListPaymentMethods200AllOf = {
  /** The list of payment methods. */
  paymentMethods: PaymentMethodsPaymentMethod[];
};

export type ListPaymentMethods200 = ListPaymentMethods200AllOf & ListResponse;
