The paymasterService capability enables apps to sponsor user transactions using ERC-4337 paymaster web services. This allows users to execute transactions without paying gas fees directly.
Parameters
The URL of the ERC-7677-compliant paymaster service that will sponsor the transactions.Format: Must be a valid HTTPS URL pointing to a paymaster service endpoint.
Returns
The paymaster service capability configuration for the specified chain.
Example Usage
Error Handling
| Code | Message | Description |
|---|---|---|
| 4100 | Paymaster service not supported | Wallet does not support paymaster service integration |
| 4200 | Invalid paymaster URL | The provided paymaster service URL is invalid or unreachable |
| 4300 | Paymaster service error | The paymaster service returned an error or is unavailable |
| 5700 | Paymaster capability required | Transaction requires paymaster service but wallet doesn’t support it |
Paymaster Service Implementation
The paymaster service must implement ERC-7677 compliance with these endpoints:1. Gas Estimation Endpoint
2. Paymaster Data Endpoint
Complete Example
Here’s a complete example of implementing sponsored transactions:Error Handling
Handle paymaster-related errors appropriately:Use Cases
Gaming Applications
DeFi Onboarding
Best Practices
- Validate Paymaster URLs: Ensure paymaster service URLs are trustworthy and ERC-7677 compliant
- Handle Failures Gracefully: Implement fallbacks for when paymaster services are unavailable
- Monitor Costs: Track paymaster usage to manage sponsorship costs
- User Communication: Clearly communicate when transactions are sponsored
The paymaster service capability enables seamless user experiences by removing the need for users to hold native tokens for gas fees.