The ERC-20 paymaster flow lets users pay gas in tokens like ASTR or USDC instead of holding native ETH. The Startale Token Paymaster quotes the cost in tokens, the user (or your dapp) approves the spend once, and every subsequent UserOperation charges the token directly.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.
Source:
StartaleGroup/scs-aa-sdk. Token addresses for each network are listed in Supported networks.How it works
1. Build the token-paymaster client
The client looks like the sponsored client, exceptpaymasterContext.token replaces paymasterContext.paymasterId.
| Field | Type | Notes |
|---|---|---|
paymasterContext.token | Address | The ERC-20 used to pay gas. Must be one of the supported tokens on the target network. |
2. Quote the cost in tokens
Before sending a UserOperation, ask the paymaster for the cost across the tokens you support.getTokenPaymasterQuotes returns one entry per token plus a list of unsupported addresses you passed in.
Field on each feeQuote | What it means |
|---|---|
symbol, decimal, tokenAddress, logoUrl | Display metadata for the token. |
maxGasFee | Maximum cost in token base units (already factoring decimal). |
maxGasFeeUSD | The same maximum, denominated in USD for display. |
exchangeRate | Token-to-native rate the paymaster used for the quote. |
premiumPercentage | Spread the paymaster adds on top of the raw conversion. |
validUntil | Unix timestamp; quote expires after this point. |
3. Send the UserOperation
Once the user picks a token, send the UserOperation with the token-paymaster client. The SDK takes care of the approval flow and packing the token intopaymasterAndData.
| Symbol | Source | Role |
|---|---|---|
sendTokenPaymasterUserOp | @startale-scs/aa-sdk | One-shot helper that approves the token (if needed), prepares the UserOperation with the token paymaster, and submits it. |
prepareTokenPaymasterUserOp | @startale-scs/aa-sdk | Lower-level helper that returns the unsigned UserOperation if you need to inspect it before signing. |
Common errors
| Error | Likely cause | Fix |
|---|---|---|
unsupported token | The token is not listed for the network. | Use one of the addresses in Supported networks. |
insufficient allowance | The smart account has not approved the paymaster to spend the token. | Use sendTokenPaymasterUserOp, which inserts the approval automatically. |
quote expired | The user took longer than validUntil to sign. | Re-quote and re-prompt. |
Next steps
Sponsored paymaster
Compare token gas to a fully sponsored flow.
Supported tokens
Look up the exact token address for the network you target.
Contract interactions
Combine token gas with batched calls.
Smart sessions
Pair token gas with scoped sessions for high-frequency UX.