Skip to content

Raw client

Use the raw client when your account library already constructs and signs EntryPoint v0.7 UserOperations. Most applications should prefer the Viem integration.

ts
import {createInkPublicPaymasterClient} from "@hellomoon/ink-paymaster";

const paymaster = createInkPublicPaymasterClient();
const prepared = await paymaster.prepareUserOperation({
  userOperation: operationWithCorrectlySizedStubSignature,
  maxTokenCost: 100_000n,
  idempotencyKey: "checkout-order-123",
});

// Sign after the quote and estimated gas fields have been applied.
const signed = await account.signUserOperation(prepared.userOperation);
const hash = await paymaster.sendUserOperation(signed);
const receipt = await paymaster.waitForUserOperationReceipt({hash});

Required ordering

  1. Construct a complete v0.7 UserOperation with the correct sender, nonce, account callData, fees, and a stub signature with the same size as the final signature.
  2. Call prepareUserOperation to obtain and attach the signed quote and final gas estimates.
  3. Sign the resulting operation.
  4. Submit that exact signed operation with sendUserOperation.
  5. Wait for its receipt.

Do not change quote-bound fields after preparation. A changed sender, nonce, factory, account call, token, reimbursement ceiling, or validity data invalidates the quote signature.

Public prepaid USDC paymaster for Ink Mainnet