# Paymaster V2 RPC Methods

JSON-RPC API reference for Candide's Paymaster service

info

Visit [dashboard](https://dashboard.candide.dev) to get an API key for Candide's Paymaster.

## pm\_supportedERC20Tokens[​](#pm_supportederc20tokens "Direct link to pm_supportedERC20Tokens")

Gets supported ERC-20 Tokens for gas payments, along side the paymaster metadata

#### Invocation[​](#invocation "Direct link to Invocation")

```
{ "method": "pm_supportedERC20Tokens", "params": [] }
```

#### Return[​](#return "Direct link to Return")

```
{ "result": { paymasterMetadata, tokens } }
```

* Example Request
* Example Response
* Response Types

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "pm_supportedERC20Tokens",
  "params": []
}
```

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "paymasterMetadata": {
      "name": "Candide Paymaster",
      "description": "Candide Paymaster a fast, secure and feature-rich 4337 Paymaster",
      "icons": [],
      "address": "0x7e3393ebA62DA6f555a5341E079e0F6585CE8c56",
      "sponsoredEventTopic": "0x13..fa1",
      "dummyPaymasterAndData": "0x69...135",
    },
    "tokens": [
      {
        "symbol": "DAI",
        "address": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
        "decimal": "0x12",
        "fee": "0x0",
        "exchangeRate": "0x0ddeb609310c89b1"
      }
    ]
  }
}
```

| Parameter         | Type                                                                                                                                                                                                                                                                                                                                                                                                       |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| paymasterMetadata | Objectkey	type	descriptionname	string	Paymaster Name&#xA;description	string	A short description for the paymaster service&#xA;icons	string\[]	icons associated with the paymaster service&#xA;address	string	Paymaster Contract Address&#xA;sponsoredEventTopic	string	Emmited topic event if a paymaster is being used&#xA;dummyPaymasterAndData	string	Dummy value to use for estimating userop gas before sponsorship |
| tokens            | Object\[]key	type	descriptionsymbol	string	Token Symbol&#xA;address	string	Token contract address&#xA;decimal	number	Decimals of token&#xA;exchangeRate	string	Exchange rate of token&#xA;fee	bigint	Gas fee in unit of of the token                                                                                                                                                                                   |

## pm\_sponsorUserOperation[​](#pm_sponsoruseroperation "Direct link to pm_sponsorUserOperation")

Sends a UserOperation to a paymaster for off-chain verification. If approved, it will return the `paymasterData`. It will also return gas overrides when the mode for gas sponsorship is FREE for the user.

* **Pay Gas in ERC-20s**: No gas overrides are returned
* **Gas Policy**: Mandatory `preVerificationGas`, `maxFeePerGas`, and `maxPriorityFeePerGas` fields are returned.

If the paymaster rejects the UserOperation, it should not return a result but a standard JSON-RPC error with the reason.

#### Invocation[​](#invocation-1 "Direct link to Invocation")

```
{ "method": "pm_sponsorUserOperation", "params": [userOperation, entrypoint, context] }
```

#### Return[​](#return-1 "Direct link to Return")

```
{
  "result": {
    paymasterAndData,
    preVerificationGas,
    maxFeePerGas,
    maxPriorityFeePerGas
  } 
}
```

* Example Request
* Example Response
* Request Types
* Response Type

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "pm_sponsorUserOperation",
    "params": [
    {
      sender: "0x2c298CcaFF..c236fCC66dB2"
      nonce: "0x17",
      initCode: "0x",
      callData: "0xf3....0000",
      callGasLimit: "0x12a87",
      verificationGasLimit: "0x1a332",
      preVerificationGas: "0xe95c",
      maxFeePerGas: "0x5f4ecdc0",
      maxPriorityFeePerGas: "0x59682f00",
      paymasterAndData: "0x",
      signature: "0x",
    },
    "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
    { "token": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1" },
  ]
}
```

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "paymasterAndData": "0x....",
    "preVerificationGas": "0x..",
    "maxFeePerGas": "0x..",
    "maxPriorityFeePerGas": "0x.."
  }
}
```

| Parameter     | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| :------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userOperation | Objectkey	type	descriptionsender	string	The account making the operation&#xA;nonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )&#xA;initCode	string	The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created)&#xA;callData	string	The data to pass to the sender during the main execution call&#xA;callGasLimit	bigint	The amount of gas to allocate the main execution call&#xA;verificationGasLimit	bigint	The amount of gas to allocate for the verification step&#xA;preVerificationGas	bigint	The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata&#xA;maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)&#xA;maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)&#xA;paymasterAndData	string	Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas&#xA;signature	string	The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
| entrypoint    | Type	Descriptionstring	Entrypoint address                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| context       | Object: This argument contains information about the specific paymaster implementation you are using. If use paying gas in ERC-20 Tokens, pass the token key and value.key	type	descriptiontoken	string?	ERC20 token address, if paying gas in erc-20 tokens (optional)&#xA;sponsorshipPolicyId	string?	Sponsorship Policy ID if using a private gas policy (optional)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

| key                    | type                                                                                                                                                                                                                                              | description                                                                                        |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------- |
| `paymasterAndData`     | `string`                                                                                                                                                                                                                                          | Paymaster address and data required to pass paymaster contract validation                          |
| `preVerificationGas`   | `string`                                                                                                                                                                                                                                          | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata |
| `maxFeePerGas`         | `string`                                                                                                                                                                                                                                          | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                       |
| `maxPriorityFeePerGas` | `string`                                                                                                                                                                                                                                          | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                    |
| `sponsorMetadata`      | `key	type	descriptionname	string	Name of Sponsor who is sponsoring the Gas Policy
description	string	A short description of the sponsor
url	string	Website of the Sponsor
icons	string[]	Logos or Icons that the Sponsor is using to promote their Gas Policy` | Information about the Gas Policy Sponsor                                                           |

## pm\_supportedEntryPoint[​](#pm_supportedentrypoint "Direct link to pm_supportedEntryPoint")

Get supported EntryPoint returns the entryPoint address supported by the paymaster

#### Invocation[​](#invocation-2 "Direct link to Invocation")

```
{ "method": "pm_supportedEntryPoint", "params": [] }
```

#### Return[​](#return-2 "Direct link to Return")

```
{ "result": entrypoint }
```

* Example Request
* Example Response
* Response Type

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "pm_supportedEntryPoint",
  "params": []
}
```

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" // Entrypoint address
}
```

| key          | type     | description                                         |
| :----------- | :------- | :-------------------------------------------------- |
| `entrypoint` | `string` | EntryPoint Address that the paymaster is supporting |

## pm\_chainId[​](#pm_chainid "Direct link to pm_chainId")

Get Chain ID asks the paymaster service to return the chain\_id it currently supports

#### Invocation[​](#invocation-3 "Direct link to Invocation")

```
{ "method": "pm_chainId", "params": [] }
```

#### Return[​](#return-3 "Direct link to Return")

```
{ "result": chainId }
```

* Example Request
* Example Response
* Response Type

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "pm_chainId",
  "params": []
}
```

```
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": "0x5"
}
```

| Parameter | Type     | Description                          |
| :-------- | :------- | :----------------------------------- |
| chainId   | `string` | Chain ID that the paymaster supports |
