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

# Open a position

> From a chosen strategy to a signed, on-chain leveraged position.

<Steps>
  <Step title="Simulate">
    ```ts theme={null}
    const sim = await call("simulate_leverage", {
      strategyId, payToken, amount: "50000", leverage: 8,
    });
    ```

    Confirm `positionPreview` — leverage, `effectiveLtv`, `expectedLeverageApy`, `priceImpactPct`.
  </Step>

  <Step title="Build the unsigned tx">
    ```ts theme={null}
    const bundle = await call("build_leverage_tx", {
      strategyId, payToken, amount: "50000", leverage: 8, userAddress: "0x…",
    });
    ```
  </Step>

  <Step title="Verify (optional but recommended)">
    * `bundle.tx.to` is the Spiral contract for that chain.
    * `bundle.approvals[].to` is the pay token.
    * `bundle.tx.value` is `0` for an ERC-20 pay (non-reallocate).
  </Step>

  <Step title="Sign & send">
    Send `approvals[]` first (if any), then `tx`, from `userAddress`. Or hand the user `bundle.meta.signingUrl`.
  </Step>

  <Step title="Confirm">
    ```ts theme={null}
    const { positions } = await call("get_positions", { userAddress: "0x…" });
    ```
  </Step>
</Steps>

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