Lend

Deposit into a vault with an EVM Smart Account

Changed on

Deposits the vault's underlying asset (e.g. USDC) from an EVM Smart Account into a vault. The Smart Account's owner must be a CDP EVM account. The token approval and deposit are batched into a single user operation, whose hash is returned in userOpHash. Because the approval and deposit execute atomically in a single user operation, no share-price guard is required. Poll getUserOperation until the user operation reaches a terminal status. For deposits from EVM accounts, use depositToVaultWithEvmAccount instead. The amount field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50") in the standard unit denomination of the vault's underlying asset.

post/v2/evm/smart-accounts/{address}/lend/deposit

Request

  • Base URL
    https://api.cdp.coinbase.com/platform
  • Auth
    HTTP bearer

Path parameters

address, string required

The 0x-prefixed address of the EVM Smart Account to deposit from.

Headers

X-Wallet-Auth, string required

A JWT signed using your Wallet Secret, encoded in base64. Refer to the Generate Wallet Token section of our Authentication docs for more details on how to generate your Wallet Token.

X-Idempotency-Key, string

An optional string request header for making requests safely retryable. When included, duplicate requests with the same key will return identical responses. Refer to our Idempotency docs for more information on using idempotency keys.

Request body

DepositToVaultWithEvmSmartAccountRequest required
object

A request to deposit the vault's underlying asset (e.g. USDC) into a vault from an EVM Smart Account. The token approval and deposit are batched into a single user operation.

useCdpPaymaster, boolean

Whether to use CDP Paymaster to sponsor gas fees. When true, the user operation gas will be paid by the Paymaster, allowing the account to deposit without holding native gas tokens. Cannot be used together with paymasterUrl.

paymasterUrl, string uri

Optional custom Paymaster URL to use for gas sponsorship. This allows you to use your own Paymaster service instead of CDP's Paymaster. Cannot be used together with useCdpPaymaster.

paymasterContext, PaymasterContext

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.

Example request

{
  "vaultId": "vault_019f5f10-096a-7a23-86df-f479650d813f",
  "amount": "25.50",
  "receiver": "0x1234567890123456789012345678901234567890",
  "useCdpPaymaster": true
}

Response

Successfully broadcast the deposit user operation. Poll getUserOperation for its status.

SmartAccountVaultDepositResponse required

The result of a vault deposit from an EVM Smart Account after broadcast.

userOpHash, string required

The hash of the user operation executing the deposit, as a 0x-prefixed hex string.

Example response

{
  "userOpHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}

Changes

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    7 more changes in this revision