POST
/
#pm_sponsorUserOperation
curl --request POST \
  --url 'https://paymaster.particle.network/#pm_sponsorUserOperation' \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "pm_sponsorUserOperation",
  "params": [
    {
      "sender": "0xSenderAddress",
      "nonce": "0x1",
      "initCode": "0xInitCode",
      "callData": "0xCallData",
      "maxFeePerGas": "0x3B9ACA00",
      "maxPriorityFeePerGas": "0x3B9ACA00",
      "paymasterAndData": "0xPaymasterData",
      "signature": "0xSignature",
      "preVerificationGas": "0x5208",
      "verificationGasLimit": "0x5208",
      "callGasLimit": "0x5208"
    }
  ]
}'
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "paymasterAndData": "0xPaymasterData"
  }
}

Contextualizing sponsorUserOperation

  • sponsorUserOperation returns a Paymaster signature to sponsor a given UserOperation, pulling from the USDT balance of the Paymaster. It takes:
  • UserOperation object.
  • entrypointAddress - string.

Query example

JavaScript
import Axios from "axios";

const chainId = 11155111;
const projectUuid = "Your project uuid";
const projectKey = "Your project client key or server key";
const entryPoint = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const userOp = {
    sender: "0xfE71795B01d2c36FD5a001fe9D47EAec0da77e59",
    nonce: "0x00",
    initCode:
        "0x9406cc6185a346906296840746125a0e449764545fbfb9cf0000000000000000000000009a8c05c7ac9acecc1185d5a624eb185e63dde9c20000000000000000000000000000000000000000000000000000000000000000",
    callData:
        "0xb61d27f6000000000000000000000000aae0de40f94469761b797920a46f223d0fffd013000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
    maxFeePerGas: "0x5e18a0d2",
    maxPriorityFeePerGas: "0x5de29812",
    paymasterAndData: "0x",
    signature: "0x",
    preVerificationGas: "0xc954",
    verificationGasLimit: "0x066c12",
    callGasLimit: "0xf2a0",
};

const paymasterUrl = "https://paymaster.particle.network";
(async () => {
    const response = await Axios.post(
        paymasterUrl,
        {
            method: "pm_sponsorUserOperation",
            params: [userOp, entryPoint],
        },
        {
            params: {
                chainId,
                projectUuid,
                projectKey,
            },
        }
    );

    console.log(response.data);
})();

Body

application/json
Request to sponsor a user operation.
jsonrpc
string
default:
2.0
required

Version of the JSON-RPC protocol, should be 2.0.

id
integer
default:
0
required

The request identifier.

method
enum<string>
required

API method being called.

Available options:
pm_sponsorUserOperation
params
object[]
required

Parameters for sponsoring a user operation.

Response

200 - application/json
Successful response with sponsorship details.
jsonrpc
string
default:
2.0
required

Version of the JSON-RPC protocol, should be 2.0.

id
integer
default:
0
required

The request identifier.

result
object
required