> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spiralstake.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# build_equity_deposit_tx

> Build the unsigned atomic batch to enter a stock + yield equity vault.

Returns the **unsigned** call batch to deposit into a vault, for the given wallet to sign. Non-custodial — the server never signs, sends, or holds keys. The batch is exactly what the Spiral app submits.

## Input

Same as [`simulate_equity_deposit`](/agents/tools/simulate-equity-deposit), plus:

<ParamField path="userAddress" type="string" required>
  The wallet that will sign. The stock leg and the yield loop are opened for it.
</ParamField>

## Output

```json theme={null}
{
  "chainId": 4663,
  "action": "equity_deposit",
  "strategyId": "equity-0x50bc…",
  "atomic": true,
  "calls": [
    { "to": "0x…USDG",   "data": "0x095ea7b3…" },   // 1. approve USDG → equity router
    { "to": "0x…Morpho", "data": "0xeecea000…" },   // 2. morpho.setAuthorization(router, true)
    { "to": "0x…Router", "data": "0x4183fb79…" },   // 3. router.equityEntry(...)
    { "to": "0x…Morpho", "data": "0xeecea000…" }    // 4. morpho.setAuthorization(router, false)
  ],
  "meta": {
    "preview": { "…": "same as simulate_equity_deposit" },
    "stockBorrowAmount": "494960000",
    "amountFlashLoan": "4711990000",
    "expiresAt": "2026-01-01T00:01:00.000Z",
    "signingUrl": "https://app.spiralstake.xyz/4663/strategies/equity-0x50bc…?leverage=50.00&amount=1000&payToken=0x…",
    "instructions": "…"
  }
}
```

## Executing

Unlike a loop bundle there is no `approvals` / `tx` split: the Morpho manager authorization the router needs is granted and revoked **inside** the batch, so nothing persists after it.

<Steps>
  <Step title="Submit as one atomic batch">
    Send `calls` in order as a single batch — EIP-5792 `wallet_sendCalls`, or a Safe MultiSend. This is how the app submits it (`atomic: true`).
  </Step>

  <Step title="If the wallet cannot batch">
    Send the calls one by one, in order, and **always send the final call** — it revokes the authorization granted in step 2, even if step 3 failed.
  </Step>

  <Step title="Or hand off the link">
    Give the user `meta.signingUrl` to review and sign in the Spiral app.
  </Step>
</Steps>

<Warning>
  Rebuild if `meta.expiresAt` passes before signing — the swap calldata is only valid for \~60 seconds.
</Warning>

## What the router does on-chain

`equityEntry` pulls the USDG, swaps it to the stock, supplies the stock as **your** collateral on the partner Morpho market, borrows `stockBorrowAmount` USDG against it (bounded on-chain to `LLTV − 0.25%` of the collateral actually received), zaps that USDG into the yield collateral and opens the yield loop on Spiral's core for you. Any residual is refunded to you in the same call.
