pm_sponsorUserOperation
Sponsors a user operation by providing all necessary paymaster-related fields and updated gas parameters. This method uses 4950 credits from your daily balance.
Parameters
- v0.7 and v0.8 user operation
- v0.6 user operation
-
userOperation
: The user operation object containing the following fields:sender
: (string) - The address of the account making the operation.nonce
: (string) - Unique identifier for the request from this sender. This includes the key and sequence number.factory
: (string) [optional] - The factory contract address that will deploy the smart account if it doesn't exist yet.factoryData
: (string) [optional] - The data passed to the factory contract to deploy the smart account.callData
: (string) [optional] - The data to pass to the sender during the main execution call.callGasLimit
: (string) - The amount of gas to allocate the main execution call.verificationGasLimit
: (string) - The amount of gas to allocate for the verification step.preVerificationGas
: (string) - The amount of gas to pay for to compensate the bundler for pre-verification execution andcalldata
.maxFeePerGas
: (string) - Maximum fee per gas, in wei, the sender is willing to pay per gas.maxPriorityFeePerGas
: (string) - Maximum fee, in wei, the sender is willing to pay per gas above the base fee.paymaster
: (string) [optional] - Address of paymaster sponsoring the transaction, ornull
if none.paymasterVerificationGasLimit
: (string) [optional] - The amount of gas to allocate for the verification step of the paymaster, ornull
if no paymaster.paymasterPostOpGasLimit
: (string) [optional] - The amount of gas to allocate for the post-operation step of the paymaster, ornull
if no paymaster.paymasterData
: (string) [optional] - The data to pass to the paymaster during the verification step, ornull
if no paymaster.eip7702Auth
: (object) [optional] - The EIP-7702 authorization data. This can be a dummy authorization:address
: (string) - The contract address for the authorization.chainId
: (string) - The chain ID.nonce
: (string) - The nonce.r
: (string) - The r component of the signature.s
: (string) - The s component of the signature.v
: (string) - The v component of the signature.yParity
: (string) - The y-parity value.
-
entryPoint
: (string) - The EntryPoint contract address (0x0000000071727De22E5E9d8BAf0edAc6f37da032
). -
context
: (object) [optional] - Additional context information. Can be one of:- An object with
token
: (string) - The ERC-20 token address to use for payment. - An object with
sponsorshipPolicyId
: (string) - The ID of the sponsorship policy to use. null
- No additional context.
- An object with
-
userOperation
: The user operation object containing the following fields:sender
: (string) - The address of the account making the operation.nonce
: (string) - Unique identifier for the request from this sender.initCode
: (string) - The initialization code for the smart account if it doesn't exist yet.callData
: (string) [optional] - The data to pass to the sender during the main execution call.callGasLimit
: (string) - The amount of gas to allocate the main execution call.verificationGasLimit
: (string) - The amount of gas to allocate for the verification step.preVerificationGas
: (string) - The amount of gas to pay for to compensate the bundler for pre-verification execution andcalldata
.maxFeePerGas
: (string) - Maximum fee per gas, in wei, the sender is willing to pay per gas.maxPriorityFeePerGas
: (string) - Maximum fee, in wei, the sender is willing to pay per gas above the base fee.paymasterAndData
: (string) - The address of the paymaster contract and the data that will be passed to it.signature
: (string) - The signature data.eip7702Auth
: (object) [optional] - The EIP-7702 authorization data. This can be a dummy authorization:address
: (string) - The contract address for the authorization.chainId
: (string) - The chain ID.nonce
: (string) - The nonce.r
: (string) - The r component of the signature.s
: (string) - The s component of the signature.v
: (string) - The v component of the signature.yParity
: (string) - The y-parity value.
-
entryPoint
: (string) - The EntryPoint contract address (0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
). -
context
: (object) [optional] - Additional context information. Can be one of:- An object with
token
: (string) - The ERC-20 token address to use for payment. - An object with
sponsorshipPolicyId
: (string) - The ID of the sponsorship policy to use. null
- No additional context.
- An object with
Returns
An object containing paymaster-related fields and updated gas parameters.
- v0.7 and v0.8
- v0.6
paymaster
: (string) - The address of the paymaster contract.paymasterData
: (string) - The data to be used in the paymasterData field of the user operation.preVerificationGas
: (string) - The updated preVerificationGas value to use in the user operation.verificationGasLimit
: (string) - The updated verificationGasLimit value to use in the user operation.callGasLimit
: (string) - The updated callGasLimit value to use in the user operation.paymasterVerificationGasLimit
: (string) - The amount of gas to allocate for the verification step of the paymaster.paymasterPostOpGasLimit
: (string) - The amount of gas to allocate for the post-operation step of the paymaster.
paymasterAndData
: (string) - The combined paymaster address and data to be used in the user operation.preVerificationGas
: (string) - The updated preVerificationGas value to use in the user operation.verificationGas
: (string) - The amount of gas to allocate for the verification step.verificationGasLimit
: (string) - The updated verificationGasLimit value to use in the user operation.callGasLimit
: (string) - The updated callGasLimit value to use in the user operation.
Example
Replace <YOUR-API-KEY>
with an API key from your MetaMask Developer dashboard.
Request
- v0.7/v0.8 with token payment
- v0.7/v0.8 with sponsorship policy
- v0.6 with token payment
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "pm_sponsorUserOperation",
"params": [
{
"sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
"nonce": "0x845ADB2C711129D4F3966735ED98A9F09FC4CE5700000000000000000000",
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
"factoryData": "0xc5265d5d000000000000000000000000aac5d4240af87249b3f71bc8e4a2cae074a3e4190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001243c3b752b01845ADb2C711129d4f3966735eD98a9F09fC4cE570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000014375d883Cb4afb913aC35c4B394468C4bC73d77C40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callData": "0xe9ae5c53",
"callGasLimit": "0x13880",
"verificationGasLimit": "0x60B01",
"preVerificationGas": "0xD3E3",
"maxPriorityFeePerGas": "0x3B9ACA00",
"maxFeePerGas": "0x7A5CF70D5",
"paymaster": null,
"paymasterVerificationGasLimit": null,
"paymasterPostOpGasLimit": null,
"paymasterData": null,
"eip7702Auth": {
"address": "0x1234567890123456789012345678901234567890",
"chainId": "0x1",
"nonce": "0x1",
"r": "0x1234567890123456789012345678901234567890123456789012345678901234",
"s": "0x1234567890123456789012345678901234567890123456789012345678901234",
"v": "0x1b",
"yParity": "0x1"
}
},
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
{
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
],
"id": 1
}'
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "pm_sponsorUserOperation",
"params": [
{
"sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
"nonce": "0x845ADB2C711129D4F3966735ED98A9F09FC4CE5700000000000000000000",
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
"factoryData": "0xc5265d5d000000000000000000000000aac5d4240af87249b3f71bc8e4a2cae074a3e4190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001243c3b752b01845ADb2C711129d4f3966735eD98a9F09fC4cE570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000014375d883Cb4afb913aC35c4B394468C4bC73d77C40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callData": "0xe9ae5c53",
"callGasLimit": "0x13880",
"verificationGasLimit": "0x60B01",
"preVerificationGas": "0xD3E3",
"maxPriorityFeePerGas": "0x3B9ACA00",
"maxFeePerGas": "0x7A5CF70D5",
"paymaster": null,
"paymasterVerificationGasLimit": null,
"paymasterPostOpGasLimit": null,
"paymasterData": null
},
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
{
"sponsorshipPolicyId": "policy-123456"
}
],
"id": 1
}'
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "pm_sponsorUserOperation",
"params": [
{
"sender": "0xb341FEAFaF71b09089d03B7D114599f8F491EE45",
"nonce": "0x0",
"initCode": "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3296601cd0000000000000000000000000da6a956b9488ed4dd761e59f52fdc6c8068e6b5000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084d1f57894000000000000000000000000d9ab5096a832b9ce79914329daee236f8eea039000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000014375cd3E53E18f65672E9d0Eb6AD174511b0BF98100000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callData": "0x5194544700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0x0",
"verificationGasLimit": "0x0",
"preVerificationGas": "0x0",
"maxPriorityFeePerGas": "0x3b9aca00",
"maxFeePerGas": "0x7a5cf70d5",
"paymasterAndData": "0x",
"signature": "0x00000000fffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",
"eip7702Auth": {
"address": "0x1234567890123456789012345678901234567890",
"chainId": "0x1",
"nonce": "0x1",
"r": "0x1234567890123456789012345678901234567890123456789012345678901234",
"s": "0x1234567890123456789012345678901234567890123456789012345678901234",
"v": "0x1b",
"yParity": "0x1"
}
},
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
{
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
],
"id": 1
}'
Response
- v0.7 and v0.8
- v0.6
{
"jsonrpc": "2.0",
"result": {
"paymaster": "0x0000000000000039cd5e8aE05257CE51C473ddd1",
"paymasterData": "0x01000066d1a1a4000000000000036cbd53842c5426634e7929541ec2318f3dcf7e0000000000000000000000000000c350000000000000000000000000000000000000000000000000000000009666598f0b846603deb0a8e59b78ba3dce9c3466394ccf07795d38ecf7925dfe12c07a022c27bb199099fa54de2f5e3e87dd9c581df52e9d3d199166a31124cc1227a9921b",
"preVerificationGas": "0x350f7",
"verificationGasLimit": "0x501ab",
"callGasLimit": "0x212df",
"paymasterVerificationGasLimit": "0x6dae",
"paymasterPostOpGasLimit": "0x706e"
},
"id": 1
}
{
"jsonrpc": "2.0",
"result": {
"paymasterAndData": "0x0000000000000039cd5e8aE05257CE51C473ddd101000066d1a1a4000000000000036cbd53842c5426634e7929541ec2318f3dcf7e0000000000000000000000000000c350000000000000000000000000000000000000000000000000000000009666598f0b846603deb0a8e59b78ba3dce9c3466394ccf07795d38ecf7925dfe12c07a022c27bb199099fa54de2f5e3e87dd9c581df52e9d3d199166a31124cc1227a9921b",
"preVerificationGas": "0xdf55",
"verificationGas": "0x52503",
"verificationGasLimit": "0x52503",
"callGasLimit": "0x13880"
},
"id": 1
}