Legacy RPC Methods
JSON-RPC API reference for Stackup's Legacy PAYG Paymaster service.
Legacy
This page references the methods for the legacy PAYG Paymaster API. This legacy API has been replaced in v0.6 and will be deprecated soon.
Endpoint
The v0.4 PAYG paymaster endpoint is https://app.stackup.sh/api/v2/paymaster/payg/API_KEY
pm
namespace
pm
namespaceThese endpoints relate to a paymaster's off-chain component.
Sponsor UserOperation
This method sends a UserOperation
to a paymaster for off-chain verification. If approved, it will return the paymasterAndData
field as the result which can be appended to the UserOperation
before signing.
If the paymaster rejects the UserOperation
it does not return a result but a standard JSON-RPC error with the reason.
{
"jsonrpc": "2.0",
"id": 1,
"method": "pm_sponsorUserOperation",
"params": [
// A partial UserOperation object.
// This is essentially the UserOperation without the signature field.
// The final signature for the UserOperation must include the returned paymasterAndData.
{
sender, // address
nonce, // uint256
initCode, // bytes
callData, // bytes
callGasLimit, // uint256
verificationGasLimit, // uint256
preVerificationGas, // uint256
maxFeePerGas, // uint256
maxPriorityFeePerGas, // uint256
paymasterAndData, // bytes
},
// The EntryPoint address the UserOperation is intended for
entryPoint
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1234...5678" // valid paymasterAndData value
}
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"message": "Error reason here.",
"code": -32601
}
}
Supported EntryPoints
This method is almost identical to what is specified in the ERC-4337 standard for eth_supportedEntryPoints
except with the inclusion of a chainId
param. It returns an array of the entryPoint
addresses supported by the paymaster for the specified Network.
Ideally, apps can use this method to check if a Paymaster is currently online and ready to accept sponsorship requests.
{
"jsonrpc": "2.0",
"id": 1,
"method": "pm_supportedEntryPoints",
"params": [
chainId // string
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": ["0x0576a174D229E3cFA37253523E645A78A0C91B57"]
}
Client SDK integration
The eth-infinitism client SDK has a class component for integrating a generic PaymasterAPI. However, we recommend creating a new VerifyingPaymasterAPI
class that extends PaymasterAPI to support the pm_sponsorUserOperation
method. Please see this example VerifyingPaymasterAPI.
Updated about 1 month ago