Skip to content

Native sponsorship ​

Use authenticated sponsorship when Hello Moon should pay the UserOperation's native gas without charging the smart account USDC. The SDK exposes a standard Viem PaymasterClient backed by the ERC-7677 /sponsor/rpc endpoint.

Compatibility ​

SurfaceSupported value
NetworkInk Mainnet, chain ID 57073 (0xdef1)
EntryPointv0.7 at 0x0000000071727De22E5E9d8BAf0edAc6f37da032
Sponsored paymaster0x23a6D980208EC2D409ae7E3acEec52a33B7d0970
Paymaster serviceERC-7677 pm_getPaymasterStubData and pm_getPaymasterData
Viem>=2.55.18 <3
BundlerAlto through /public/rpc

Alto receives, validates, bundles, and submits UserOperations. The separate sponsored paymaster contract deposits native gas currency into EntryPoint and sponsors operations allowed by the API key's policy.

Backend integration ​

ts
import {createPublicClient, defineChain, http} from "viem";
import {createBundlerClient} from "viem/account-abstraction";
import {
  createInkSponsoredPaymasterClient,
  INK_SPONSORED_PAYMASTER,
} from "@hellomoon/ink-paymaster";

const inkRpcUrl = process.env.INK_RPC_URL!;
const ink = defineChain({
  id: INK_SPONSORED_PAYMASTER.chainId,
  name: INK_SPONSORED_PAYMASTER.chainName,
  nativeCurrency: {name: "Ether", symbol: "ETH", decimals: 18},
  rpcUrls: {default: {http: [inkRpcUrl]}},
});

const publicClient = createPublicClient({chain: ink, transport: http(inkRpcUrl)});
const paymaster = createInkSponsoredPaymasterClient({
  apiKey: process.env.INK_SPONSOR_API_KEY!,
});
const bundlerClient = createBundlerClient({
  account,
  chain: ink,
  client: publicClient,
  transport: http(
    `${INK_SPONSORED_PAYMASTER.serviceUrl}${INK_SPONSORED_PAYMASTER.bundlerPath}`,
  ),
  paymaster,
  paymasterContext: {idempotencyKey: `checkout-${orderId}`},
});

const hash = await bundlerClient.sendUserOperation({
  calls: [{to: destination, data: "0x", value: 0n}],
});
const receipt = await bundlerClient.waitForUserOperationReceipt({hash});

The complete type-checked version is sdk/examples/sponsored.ts.

Security boundary ​

The bearer key authorizes a request against server-side sponsorship policy. It does not sign for the smart account: the account owner still signs the final UserOperation. Keep the key in backend secret storage and never embed it in browser bundles, mobile applications, public repositories, analytics events, or logs. Browser code should call your backend, which applies application-level authorization before using this SDK client.

Stub and final data ​

Viem calls pm_getPaymasterStubData while preparing and estimating the operation, then pm_getPaymasterData before submission. The service currently returns a real signed authorization from the stub method with isFinal: true, allowing Viem to use it as final paymaster data. Both methods remain available for standard ERC-7677 client compatibility.

Keep the account, UserOperation encoding, SDK, paymaster, bundler, and EntryPoint aligned on v0.7. The service rejects other chains and EntryPoint versions. A compatible client does not by itself grant sponsorship: the API key, server policy, funded EntryPoint deposit, and deployed contract must also be active.

ERC-4337 paymaster clients for Ink Mainnet