> ## 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 your Mini App'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. |
| `wallet_switchEthereumChain` | Switches to a chain your Mini App is enabled for. See [Chains](#chains). |
| `wallet_addEthereumChain` | Same as `wallet_switchEthereumChain`. It switches to an enabled chain and adds nothing. |

Any other method throws `4200 Unsupported method`.

## Errors

Rejected requests carry an EIP-1193 error `code`. Check the `code`, not the message. Messages can change, and some are translated into the user's app language.

| Code | When |
| - | - |
| `4001` | The user rejected the request, or closed the Mini App while the request was pending. |
| `-32603` | The host could not complete the request. For example, the network fee could not be estimated, the transaction failed to send, or the request timed out. |

A fee estimate that takes longer than 45 seconds counts as failed. A request that is still pending after 5 minutes times out. If the user has already confirmed a transaction and it is still being sent, the host waits one more 5 minutes before timing out.

For other error codes, see [Errors](https://docs.startale.com/api-reference/errors.md).

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

## Gas

Gas for Mini App transactions is paid by the Startale App. Both `eth_sendTransaction` and `wallet_sendCalls` are sponsored, and there is nothing to configure. Signing methods cost no gas at all.

**Do not set `paymasterOptions` in a Mini App.** The host sponsors with its own paymaster and ignores any paymaster your Mini App supplies. `paymasterOptions` exists for applications that run on their own origin, outside the Startale App. See [Gas in a standalone application](https://docs.startale.com/app-sdk/gasless.md).

Two limits apply. Neither produces a distinct error: when sponsorship does not apply, the user pays, and a user without ETH sees the transaction fail.

* **Ethereum Mainnet is capped per user.** If your Mini App is enabled for Ethereum Mainnet, the first three Ethereum Mainnet transactions per user are sponsored. The count is per user across the Startale App, not per Mini App, so a user may have used it up before opening yours. After that the user pays gas from their smart account's ETH balance, and a user without ETH cannot complete the transaction. Soneium transactions are not capped, and Mini Apps run on Soneium only unless enabled for another chain.
* **Sponsorship can be withdrawn for an app.** It is an operated service rather than a guarantee. Startale can withdraw sponsorship for a specific app, for example when its transactions generate abnormal gas cost, after which its users pay.

Design for both. Treat a failed transaction as a state your interface explains rather than one it retries, because retrying an operation the user cannot fund produces the same failure and a worse experience. Keep the gas cost of your onchain calls proportionate to what they do: sponsorship covers normal product usage, not unbounded onchain work.

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

## Chains

A Mini App can only use the chains it is enabled for. By default that is Soneium Mainnet (1868) only. The Startale team can enable another chain for a specific Mini App, and Ethereum Mainnet (1) is the only other chain enabled today.

In the [developer preview](https://docs.startale.com/miniapps/testing.md#preview), every Mini App is also enabled for Ethereum Mainnet, Soneium Minato (1946), and Ethereum Sepolia (11155111), so you can test on them before launch.

Your Mini App starts on its default chain. Read it with `eth_chainId` rather than assuming Soneium, and track changes with the `chainChanged` event.

To change chain, call `wallet_switchEthereumChain` with an enabled chain. The host switches, emits `chainChanged`, and returns `null`, and later requests use the new chain. `wallet_addEthereumChain` does the same and cannot add a chain. A request for any chain your Mini App is not enabled for throws `4200`.

A `wallet_sendCalls` request whose `chainId` differs from the active chain is rejected with `-32602`. `eth_sendTransaction` takes no chain and always uses the active chain.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.