UNPKG

@coinbase/cdp-sdk

Version:

SDK for interacting with the Coinbase Developer Platform Wallet API

1,309 lines (1,169 loc) 112 kB
/** * Generated by orval v7.6.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 */ 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; } 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", bad_gateway: "bad_gateway", 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", rate_limit_exceeded: "rate_limit_exceeded", request_canceled: "request_canceled", service_unavailable: "service_unavailable", timed_out: "timed_out", unauthorized: "unauthorized", 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", } 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?: string; } /** * 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; } 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 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 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 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; 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?: string; } /** * 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; } export interface RevokeSpendPermissionRequest { network: SpendPermissionNetwork; /** The hash of the spend permission to revoke. */ permissionHash: string; /** The paymaster URL of the spend permission. */ paymasterUrl?: string; } /** * 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", } 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. * @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", zora: "zora", bnb: "bnb", } 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 c