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

# Wallet integration

> Which EIP-1193 methods are available inside the Startale App, and how the smart account is used as the signer.

When your Mini App runs inside the Startale App, the host narrows the EIP-1193 surface to a curated set. The user's smart account is always the signer. Calls that try to bypass this constraint are rejected.

## Host bridge

Your Mini App runs in a sandboxed iframe. EIP-1193 calls never reach a browser extension or external wallet; they travel through a Comlink RPC channel over `postMessage` to the Startale App host, which routes them through the user's smart account.

```
Mini App (iframe)
  │  wagmi / viem calls eth_sendTransaction
  ▼
startaleConnector  ─── ethProviderRequest(method, params) ──▶  Startale Host
                            postMessage (Comlink)                │
                                                                 │  validates method
                                                                 │  rewrites `from` → smart account
                                                                 │  opens in-app approval modal
                                                                 ▼
                                                           Smart Account
                                                           signs + submits tx
                                                                 │
                                                                 ▼
                                                     result returned to iframe
```

For sensitive methods (`personal_sign`, `eth_signTypedData_v4`, `eth_sendTransaction`, `wallet_sendCalls`) the host opens the Startale approval modal and waits for the user to approve or reject before returning the result. The iframe never touches the private key.

The host also emits provider events back to the iframe (`accountsChanged`, `chainChanged`, `connect`) so wagmi state stays in sync automatically.

## Supported methods

| Method                 | Behavior                                                 |
| ---------------------- | -------------------------------------------------------- |
| `eth_chainId`          | Returns the host's active chain.                         |
| `eth_accounts`         | Returns `[smartAccountAddress]` or `[]`.                 |
| `eth_requestAccounts`  | Same as `eth_accounts`, no popup needed inside the host. |
| `personal_sign`        | `from` rewritten to the smart account.                   |
| `eth_signTypedData_v4` | `from` rewritten to the smart account.                   |
| `eth_sendTransaction`  | `from` rewritten to the smart account.                   |
| `wallet_sendCalls`     | `from` rewritten to the smart account.                   |

Any other method, including `wallet_switchEthereumChain` and `wallet_addEthereumChain`, throws `4200 Unsupported method`.

## The signer is always the smart account

If you submit a transaction with a `from` field set to a linked EOA, the host overrides it. There is no path for a Mini App to sign or send from an EOA, even if that EOA is in `sdk.context.startale.eoaWallets`.

## Capability matrix

| Capability                                                                 | Supported                                              |
| -------------------------------------------------------------------------- | ------------------------------------------------------ |
| Read NFT or ERC-20 balance from a linked EOA                               | Yes, use `eoaWallets` with a read-only RPC call.       |
| Sign a message from the smart account                                      | Yes.                                                   |
| Send a transaction from the smart account                                  | Yes.                                                   |
| Burn or transfer assets held by the smart account                          | Yes.                                                   |
| Sign or send from a linked EOA                                             | No.                                                    |
| Transfer assets from a linked EOA to the smart account inside the Mini App | No, use a standalone web context outside the Mini App. |

## Recommended flow for legacy EOA assets

If a user holds assets in a linked EOA that they want to use inside your Mini App:

1. Detect the balance with `sdk.context.startale.eoaWallets` and a read-only contract call.
2. Show the user a message explaining they need to transfer the asset to their smart account.
3. The transfer happens outside the Mini App, on your project's standalone website where MetaMask connects directly.
4. Once the asset is in the smart account, all standard Mini App flows (`eth_sendTransaction`, `wallet_sendCalls`) work normally.

## Why `wallet_switchEthereumChain` is not supported

The host controls the active chain. A Mini App cannot force a chain switch, the user must change the active chain inside the Startale App itself.

## Why `wallet_addEthereumChain` is not supported

Mini Apps inherit the chains the Startale App supports: Soneium Mainnet (1868) and Soneium Minato (1946). Adding new chains is not delegable from inside a Mini App.
