@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
1,397 lines (1,241 loc) • 369 kB
text/typescript
/**
* 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 has