Skip to main content
POST
/
rpc
/
Trails
/
YieldCreateEnterAction
YieldCreateEnterAction generates unsigned deposit transaction calldata for a yield market.
curl --request POST \
  --url https://trails-api.sequence.app/rpc/Trails/YieldCreateEnterAction \
  --header 'Content-Type: application/json' \
  --data '
{
  "earnMarketId": "<string>",
  "userWalletAddress": "<string>",
  "args": {}
}
'
{
  "payload": {}
}

Documentation Index

Fetch the complete documentation index at: https://docs.trails.build/llms.txt

Use this file to discover all available pages before exploring further.

Overview

YieldCreateEnterAction returns the unsigned transaction payload needed to deposit into a DeFi yield market. This is the low-level endpoint that backs the lend and deposit composable actions in the SDK. Use this endpoint when building custom DeFi UIs outside React, or when you need to construct the calldata manually before passing it to Trails via the to.calldata param on QuoteIntent. For React apps, use the lend() or deposit() action builders with useTrailsSendTransaction — they call this endpoint internally.

Request Parameters

FieldTypeRequiredDescription
earnMarketIdstringYesMarket ID from YieldGetMarkets
userWalletAddressstringYesAddress of the depositing wallet
argsobjectNoMarket-specific arguments (varies by protocol)

Response

Returns payload containing unsigned transaction data:
FieldDescription
transactionsArray of transaction objects to execute
transactions[].toContract address
transactions[].dataABI-encoded calldata
transactions[].valueETH value (for native token deposits)

Examples

Build a deposit calldata for Aave

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateEnterAction', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY',
  },
  body: JSON.stringify({
    earnMarketId: 'base-usdc-aave-v3-lending',
    userWalletAddress: '0xYourWalletAddress',
  }),
})

const { payload } = await response.json()
const action = JSON.parse(payload)

// Pass action.transactions[0].data to QuoteIntent as to.calldata

With protocol-specific arguments

Some markets accept additional arguments (e.g. slippage, referral codes):
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateEnterAction', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY',
  },
  body: JSON.stringify({
    earnMarketId: 'ethereum-usdc-morpho-0x...',
    userWalletAddress: '0xYourWalletAddress',
    args: {
      referralCode: 0,
    },
  }),
})

SDK alternative

For React, use the lend or deposit builders with useTrailsSendTransaction:
import { useTrailsSendTransaction, lend, deposit } from '0xtrails'

const { sendTransaction } = useTrailsSendTransaction({
  actions: [
    lend({ marketId: 'base-usdc-aave-v3-lending', amount: '100' }),
  ],
})
See Composable Actions for the full SDK approach.

See also

Body

application/json
earnMarketId
string
required

Market ID from YieldGetMarkets

userWalletAddress
string
required

Wallet address of the user performing the action

args
object

Optional market-specific arguments (e.g. referral codes, slippage)

Response

OK

payload
object
required

JSON object containing unsigned transaction payloads