Appearance
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
- 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. - Call
prepareUserOperationto obtain and attach the signed quote and final gas estimates. - Sign the resulting operation.
- Submit that exact signed operation with
sendUserOperation. - 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.