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.
StartaleAccountClient exposes a small set of actions that cover almost every contract interaction you will write. This page shows how to encode calldata, send a single call, batch multiple calls atomically, and handle the most common errors.
Source:
StartaleGroup/scs-aa-sdk.Encode the calldata
UseencodeFunctionData from viem to turn a function call into ABI-encoded 0x bytes. The result becomes the data field of a Call object.
| Symbol | Source | Role |
|---|---|---|
encodeFunctionData | viem | ABI-encodes a function name + args into hex calldata. |
getContract or writeContract, you can reuse those ABI fragments directly here.
Send a single call
| Symbol | Source | Role |
|---|---|---|
smartAccountClient.sendUserOperation | @startale-scs/aa-sdk | Builds, signs, and submits a UserOperation through the SCS bundler. Returns the UserOperation hash. |
smartAccountClient.waitForUserOperationReceipt | @startale-scs/aa-sdk | Polls the bundler until the UserOperation is mined, then returns { success, receipt, ... }. |
calls[].value is in wei. The smart account itself does not need to hold ETH unless you set a non-zero value and your paymaster does not cover it.
Batch multiple calls atomically
A single UserOperation can carry many calls. They are executed in order inside the same EVM transaction; if any one reverts, the whole UserOperation reverts and nothing is settled. This is built in tosendUserOperation: just append more entries to the calls array.
calls is a { to, value, data } object; ordering is preserved and execution is atomic. A working multi-call example using this exact pattern lives in scs-aa-quickstart/src/startale-minato/demo_install_modules.ts.
Read state from the same publicClient
The smart account does not change how you read onchain data. Reuse the publicClient you passed to createSmartAccountClient:
Handle errors
sendUserOperation throws when the bundler rejects the UserOperation, when the paymaster declines to sponsor it, or when validation reverts. A small triage helper goes a long way:
AA** codes come from the EntryPoint contract; their full meaning is documented in the ERC-4337 spec.
Send a transaction-style call
If your code expects the viemsendTransaction shape, the smart account client supports it too. It compiles the call into a single-call UserOperation under the hood:
waitForUserOperationReceipt.
Next steps
Sponsored paymaster
Send the same calls with gas paid by your paymaster.
ERC-20 paymaster
Quote a token, approve it once, and pay gas in tokens.
Parallel transactions
Run independent UserOperations on different nonce lanes.
Smart sessions
Drop the signature prompt for repeated, scoped calls.