This guide integrates the Startale App SDK into a React project. By the end you will have an application that: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.
- Connects to a user’s Startale smart account through wagmi.
- Produces an ERC-1271 signature and verifies it offchain with viem.
- Sends a transaction packaged as an ERC-4337 UserOperation on Soneium Mainnet.
The reference stack is Vite + React 18 with wagmi 2, viem 2, and TanStack Query. The same code paths apply in Next.js. See SDK installation for framework variants.
Prerequisites
| Requirement | Version |
|---|---|
| Node.js | 20 or later |
| Package manager | pnpm 9, npm, yarn, or bun |
| React project | Scaffold one below if you do not already have one |
Install the SDK
Install Each package has a specific role in the integration:
@startale/app-sdk with its peer dependencies.@startale/app-sdkexposes the Startale connector and the underlying EIP-1193 provider.wagmiprovides the React hooks,useAccount,useConnect,useSendTransaction, that drive the integration.viemis the typed RPC client wagmi uses for read and write operations.@tanstack/react-querycaches asynchronous state, including the connector’s readiness and the smart-account address resolution.
Configure the wagmi client
Create
src/wagmi.ts. This file declares the supported chain, registers the Startale connector, and configures an HTTP transport.src/wagmi.ts
createConfig returns a typed wagmi configuration. The chains field declares which chains the application supports, and the connector derives its appChainIds from this list automatically.startaleConnector accepts a preference object. appName and appLogoUrl appear inside the Startale App popup so the user can identify the requesting application. Use a short name and a square HTTPS image URL.http() with no argument routes to the default public RPC for the chain. Production traffic should use a dedicated endpoint. See Networks for the current options.The declare module 'wagmi' block registers this configuration as the active one for type inference. Without it, hooks like useAccount cannot infer chain-aware return types in your application code.Wrap the application
Wrap the application in
WagmiProvider and QueryClientProvider in src/main.tsx. Both providers are required. WagmiProvider exposes the config and connection state to wagmi hooks. QueryClientProvider backs the React Query cache that wagmi uses internally for asynchronous state.src/main.tsx
Connect a wallet
Add a button that triggers the Startale connector. The example uses three wagmi hooks: Click the button. A popup opens to
useAccount reads the current connection state, useConnect exposes the registered connectors and a connect action, and useDisconnect clears the local connection.src/App.tsx
connectors[0] returns the Startale connector because it is the only one registered in wagmi.ts. When multiple connectors are configured, identify Startale by connector.id === 'startaleApp' rather than relying on array position.Run the dev server:app.startale.com. The user signs in with Google, LINE, Apple, or MetaMask, approves the connection, and the popup closes. The application receives the user’s smart-account address in address.The address returned is a smart account, not an externally owned account. The same address resolves on every application that integrates the Startale App SDK.
Sign a message
Produce an ERC-1271 signature with Verify the signature offchain with viem’s
useSignMessage. Smart accounts do not sign with a private key in the standard ECDSA path. Signatures are produced through the account contract and verified by calling isValidSignature on the same contract.verifyMessage:verifyMessage calls isValidSignature on the smart-account contract. The same code path verifies signatures whether the account is deployed or counterfactual. See Smart accounts for the ERC-6492 wrapping behavior.ERC-1271 verification is a contract call and requires a
publicClient configured against the same chain as the signing account. When the verifier runs on different infrastructure, use the same chain identifier on both sides.Send a transaction
The application calls A popup opens with the transaction details. The user reviews and approves; the application receives a transaction hash that resolves to a confirmed UserOperation onchain.
useSendTransaction exactly as it would with any wagmi-compatible wallet. The SDK transforms the request into an ERC-4337 UserOperation, attaches a paymaster signature if one is configured, and submits the operation through the bundler. The user signs in the popup.Who pays the gas? Inside the Startale App (Mini Apps), the host paymaster sponsors gas automatically. Standalone dapps configure a paymaster through
paymasterOptions; without one, the user pays gas from their smart account’s ETH balance. See Gas sponsorship for the full model.The integration is complete: connect, sign, send. Every signature verifies through ERC-1271, and the same code runs on Soneium Minato.
Next steps
Configure a paymaster
Wire an SCS paymaster or your own ERC-7677 service into the SDK.
Charge in USDSC
Standard ERC-20 transfers in the Startale stablecoin.
Sign typed data
EIP-712 for orders, permits, and consent flows.
Build a Mini App
Run the project inside the Startale App with access to host context.
Handle errors
User rejections, chain mismatches, wrong calls and popup blockers.