> ## Documentation Index
> Fetch the complete documentation index at: https://anypay-docs-update-resources-2026-06-29.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# YieldCreateEnterAction

> Generate unsigned deposit transaction calldata for a DeFi yield market

## 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

| Field               | Type   | Required | Description                                    |
| ------------------- | ------ | -------- | ---------------------------------------------- |
| `earnMarketId`      | string | Yes      | Market ID from `YieldGetMarkets`               |
| `userWalletAddress` | string | Yes      | Address of the depositing wallet               |
| `args`              | object | No       | Market-specific arguments (varies by protocol) |

## Response

Returns `payload` containing unsigned transaction data:

| Field                  | Description                             |
| ---------------------- | --------------------------------------- |
| `transactions`         | Array of transaction objects to execute |
| `transactions[].to`    | Contract address                        |
| `transactions[].data`  | ABI-encoded calldata                    |
| `transactions[].value` | ETH value (for native token deposits)   |

## Examples

### Build a deposit calldata for Aave

```typescript theme={null}
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):

```typescript theme={null}
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`:

```tsx theme={null}
import { useTrailsSendTransaction, lend, deposit } from '0xtrails'

const { sendTransaction } = useTrailsSendTransaction({
  actions: [
    lend({ marketId: 'base-usdc-aave-v3-lending', amount: '100' }),
  ],
})
```

See [Composable Actions](/use-cases/composable-actions) for the full SDK approach.

## See also

* [YieldCreateExitAction](/api-reference/endpoints/yield-create-exit-action) — Withdraw from a position
* [YieldGetMarkets](/api-reference/endpoints/yield-get-markets) — Discover market IDs
* [Composable Actions](/use-cases/composable-actions) — SDK builders for DeFi deposits


## OpenAPI

````yaml trails-api.gen.json post /rpc/Trails/YieldCreateEnterAction
openapi: 3.0.0
info:
  title: Trails API
  version: 0.0.1
servers:
  - url: https://trails-api.sequence.app
    description: Trails API
security: []
paths:
  /rpc/Trails/YieldCreateEnterAction:
    post:
      tags:
        - Trails
      summary: >-
        YieldCreateEnterAction generates unsigned deposit transaction calldata
        for a yield market.
      description: >
        Returns the unsigned transaction payload needed to deposit into a DeFi
        yield market.

        This backs the lend() and deposit() composable action builders in the
        SDK.
      operationId: Trails-YieldCreateEnterAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateYieldActionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateYieldActionResponse'
        4XX:
          description: Client error
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorWebrpcEndpoint'
                  - $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
                  - $ref: '#/components/schemas/ErrorWebrpcBadRoute'
                  - $ref: '#/components/schemas/ErrorWebrpcBadMethod'
                  - $ref: '#/components/schemas/ErrorWebrpcBadRequest'
                  - $ref: '#/components/schemas/ErrorInvalidArgument'
                  - $ref: '#/components/schemas/ErrorUnavailable'
                  - $ref: '#/components/schemas/ErrorNotFound'
        5XX:
          description: Server error
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorWebrpcBadResponse'
                  - $ref: '#/components/schemas/ErrorWebrpcServerPanic'
                  - $ref: '#/components/schemas/ErrorWebrpcInternalError'
                  - $ref: '#/components/schemas/ErrorUnexpected'
components:
  schemas:
    CreateYieldActionRequest:
      type: object
      required:
        - earnMarketId
        - userWalletAddress
      properties:
        earnMarketId:
          type: string
          description: Market ID from YieldGetMarkets
        userWalletAddress:
          type: string
          description: Wallet address of the user performing the action
        args:
          type: object
          description: Optional market-specific arguments (e.g. referral codes, slippage)
          additionalProperties: true
    CreateYieldActionResponse:
      type: object
      required:
        - payload
      properties:
        payload:
          type: object
          description: JSON object containing unsigned transaction payloads
          additionalProperties: true
    ErrorWebrpcEndpoint:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcEndpoint
        code:
          type: number
          example: 0
        msg:
          type: string
          example: endpoint error
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorWebrpcRequestFailed:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcRequestFailed
        code:
          type: number
          example: -1
        msg:
          type: string
          example: request failed
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorWebrpcBadRoute:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcBadRoute
        code:
          type: number
          example: -2
        msg:
          type: string
          example: bad route
        cause:
          type: string
        status:
          type: number
          example: 404
    ErrorWebrpcBadMethod:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcBadMethod
        code:
          type: number
          example: -3
        msg:
          type: string
          example: bad method
        cause:
          type: string
        status:
          type: number
          example: 405
    ErrorWebrpcBadRequest:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcBadRequest
        code:
          type: number
          example: -4
        msg:
          type: string
          example: bad request
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorInvalidArgument:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: InvalidArgument
        code:
          type: number
          example: 2000
        msg:
          type: string
          example: Invalid argument
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorUnavailable:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: Unavailable
        code:
          type: number
          example: 2002
        msg:
          type: string
          example: Unavailable resource
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorNotFound:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: NotFound
        code:
          type: number
          example: 8000
        msg:
          type: string
          example: Resource not found
        cause:
          type: string
        status:
          type: number
          example: 400
    ErrorWebrpcBadResponse:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcBadResponse
        code:
          type: number
          example: -5
        msg:
          type: string
          example: bad response
        cause:
          type: string
        status:
          type: number
          example: 500
    ErrorWebrpcServerPanic:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcServerPanic
        code:
          type: number
          example: -6
        msg:
          type: string
          example: server panic
        cause:
          type: string
        status:
          type: number
          example: 500
    ErrorWebrpcInternalError:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: WebrpcInternalError
        code:
          type: number
          example: -7
        msg:
          type: string
          example: internal error
        cause:
          type: string
        status:
          type: number
          example: 500
    ErrorUnexpected:
      type: object
      required:
        - error
        - code
        - msg
        - status
      properties:
        error:
          type: string
          example: Unexpected
        code:
          type: number
          example: 2001
        msg:
          type: string
          example: Unexpected server error
        cause:
          type: string
        status:
          type: number
          example: 500

````