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
string
required
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
object
The paymaster service capability configuration for the specified chain.
Example Usage
Error Handling
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.