<VersionWarning version="0.1" />

# getPaymasterData

Return values to be used in paymaster-related fields of a signed user operation. This method calls `pm_getPaymasterData` and is part of the experimental [ERC-7677 specification](https://github.com/ethereum/ERCs/pull/360/files).

## Usage

:::code-group
```ts [example.ts]
import { paymasterEip7677Client } from "./client"
import { sepolia } from 'viem/chains'

const paymasterReturnData = paymasterEip7677Client.getPaymasterStubData({
    userOperation: {
        sender: "0x6152348912fb1e78c9037D83f9d4524D4a2988Ed",
        nonce: 20n,
        factory: "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
        factoryData:
            "0xc5265d5d0000000000000000000000006723b44abeec4e71ebe3232bd5b455805badd22f0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e412af322c018104e3ad430ea6d354d013a6789fdfc71e671c4300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000014ec787ae5c34157ce61e751e54dff3612d4117663000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        callData:
            "0xe9ae5c530100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000594bc666500faed35dc741f45a35c571399560d80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e4e688a440000000000000000000000000c67e4838d4e6682e3a5f9ec27f133e76cb3855f30000000000000000000000006152348912fb1e78c9037d83f9d4524d4a2988ed00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000041aebdfb90adba067d9304980a300636506c3c9081b01f64b04f108407a890602377625ef9096946cc028743123646881c7e31a1c8d6698132c188cb4c33a3f9151b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        maxFeePerGas: 99985502n,
        maxPriorityFeePerGas: 1221000n,
        preVerificationGas: 66875n,
        verificationGasLimit: 373705n,
        callGasLimit: 170447n,
        paymasterVerificationGasLimit: 20274n,
        paymasterPostOpGasLimit: 1n,
    },
})
/**
 * {
 *  paymaster: "0x9d0021A869f1Ed3a661Ffe8C9B41Ec6244261d98",
 *  paymasterData: "0x000000000000000000000000000000000000000000000000000000006638ab470000000000000000000000000000000000000000000000000000000000000000e9311d1945317dc6a1c750e8e6d0641a598beb59edc5652ed3807ca57338a7a107123e1a479386b2c91f242d2dff367c18e0ad9d1021acfe47afc890e252644e1c"
 * }
 */
```

```ts [client.ts]
import { createClient, http } from 'viem'
import { sepolia } from 'viem/chains'
import { ENTRYPOINT_ADDRESS_V07 } from 'permissionless'
import { paymasterActionsEip7677 } from 'permissionless/experimental'

export const paymasterEip7677Client = createClient({
  chain: sepolia,
  transport: http("https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_API_KEY_HERE")
}).extend(paymasterActionsEip7677(ENTRYPOINT_ADDRESS_V07))
```
:::

## Returns

* **Type:** `GetPaymasterDataReturnType<entryPoint>`

The paymaster values to be used in the paymaster-related fields of a signed user operation.

For EntryPoint v0.7, the return type is:

```ts
{
    paymaster: Address,
    paymasterData: Hex
}
```

For EntryPoint v0.6, the return type is:

```ts
{
    paymasterAndData: Hex
}
```

## JSON-RPC Method

[`pm_getPaymasterData`](https://github.com/ethereum/ERCs/pull/360/files)
