Skip to main content

Enter Position

Generate the transactions needed to enter (deposit into) a yield position using the Yield.xyz Actions API. This skill covers the complete workflow: validating the yield, constructing the enter action, iterating through unsigned transactions, and submitting transaction hashes.

When to Use

Activate this skill when the user asks to:
  • Stake tokens (e.g., “Stake 1 ETH with Lido”)
  • Deposit into a lending protocol (e.g., “Deposit 1000 USDC into Aave on Ethereum”)
  • Enter a vault (e.g., “Deposit into Morpho vault”)
  • Provide liquidity
  • Start earning yield on any token

Authentication

Base URL

Step-by-Step Instructions

Step 1: Verify the Yield Exists and Accepts Deposits

Confirm status.enter is true. If false, the yield is not accepting new deposits.

Step 2: Check Argument Requirements

From the yield metadata response, inspect the args.enter field to determine required arguments:

Step 3: Select a Validator (if Required)

For staking yields that require a validator:
Choose a validator from the response. Prefer validators with preferred: true.

Step 4: Create the Enter Action

Endpoint: POST /v1/actions/enter Request Body (CreateActionDto):
Example with validator (Cosmos staking):
Example with provider (Ethereum native staking):
cURL Example:
Response (ActionDto):

Step 5: Sign and Submit Each Transaction

For each transaction in the transactions array, in order:
  1. Sign the unsignedTransaction using the user’s wallet or signing mechanism
  2. Broadcast the signed transaction to the blockchain
  3. Submit the hash to Yield.xyz for tracking:
Endpoint: PUT /v1/transactions/{transactionId}/submit-hash
Alternatively, submit the signed transaction for Yield.xyz to broadcast: Endpoint: POST /v1/transactions/{transactionId}/submit

Step 6: Verify Action Completion

Endpoint: GET /v1/actions/{actionId}
Poll until status is SUCCESS or FAILED.

Amount Formatting

Amounts must be in the token’s smallest unit (base units): Formula: baseUnits = amount * 10^decimals

Transaction Types

An enter action may produce multiple transactions that must be executed in order:

Error Handling

Edge Cases

  • Approval transactions: EVM DeFi yields (lending, vaults) often require a token approval transaction before the deposit. Always execute transactions in the order returned.
  • Minimum amounts: Some yields have minimum deposit amounts. If the amount is too low, you’ll receive a 400 error.
  • Geoblocking: Enter actions enforce geolocation restrictions. A 403 error means the user’s region is blocked.
  • Transaction ordering: Transactions MUST be executed sequentially in the order they appear in the response. Do not parallelize.
  • Gas estimation: The unsigned transaction includes gas parameters, but the signer may need to re-estimate gas on some networks.
  • ETH native staking minimum: Ethereum native staking requires exactly 32 ETH per validator.
  • skipPrechecks: Pass "skipPrechecks": true in arguments to bypass pre-execution balance checks if you know the balance is sufficient.