The Workflow
-
- Server: Fetch the contract spec and build the transaction.
-
- Server: Run the simulation to calculate fees.
-
- Client: Receive the “ready-to-sign” transaction from the server.
-
- Client: Sign with the user’s wallet and broadcast.
The Server Action
The Client Component
Performance Gains
- Reduced Client Latency: The browser doesn’t need to fetch the WASM spec or run heavy simulations.
- Security: You can validate the user’s input on the server before the transaction is even sent to the wallet.
- Shared Logic: If you are already fetching data for SEO (SSR), you can reuse that contract state for the subsequent user actions.

