Skip to content

@hellomoon/ink-paymaster


@hellomoon/ink-paymaster / InkPublicPaymasterClient

Class: InkPublicPaymasterClient

Low-level client for quotes and EntryPoint v0.7 UserOperation RPC methods.

Remarks

Prefer createInkViemPaymaster with a Viem Bundler Client for normal application use. Use this client directly when another account library constructs and signs raw UserOperations.

Constructors

Constructor

new InkPublicPaymasterClient(options?): InkPublicPaymasterClient

Parameters

options?

InkPublicPaymasterClientOptions = {}

Returns

InkPublicPaymasterClient

Properties

bundlerUrl

readonly bundlerUrl: string

Fully resolved public Alto JSON-RPC endpoint.


deployment

readonly deployment: object = INK_PUBLIC_PAYMASTER

Pinned chain, EntryPoint, paymaster, token, and route metadata.

bundlerPath

readonly bundlerPath: "/public/rpc" = "/public/rpc"

chainId

readonly chainId: 57073 = 57_073

chainName

readonly chainName: "Ink Mainnet" = "Ink Mainnet"

entryPoint

readonly entryPoint: `0x${string}`

entryPointVersion

readonly entryPointVersion: "0.7" = "0.7"

healthPath

readonly healthPath: "/healthz" = "/healthz"

paymaster

readonly paymaster: `0x${string}`

quotePath

readonly quotePath: "/public/quote" = "/public/quote"

quoteVersion

readonly quoteVersion: 2 = 2

serviceUrl

readonly serviceUrl: "https://ink-paymaster.hellomoon.io" = "https://ink-paymaster.hellomoon.io"

token

readonly token: object

token.address

readonly address: `0x${string}`

token.decimals

readonly decimals: 6 = 6

token.symbol

readonly symbol: "USDC" = "USDC"


healthUrl

readonly healthUrl: string

Fully resolved service health endpoint.


quoteUrl

readonly quoteUrl: string

Fully resolved public quote endpoint.


serviceUrl

readonly serviceUrl: string

Normalized service origin without a trailing slash.

Methods

estimateUserOperationGas()

estimateUserOperationGas(userOperation): Promise<Partial<Pick<RpcUserOperationV07, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">>>

Requests eth_estimateUserOperationGas from the public Alto endpoint.

Parameters

userOperation

RpcUserOperationV07

Returns

Promise<Partial<Pick<RpcUserOperationV07, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">>>


getChainId()

getChainId(): Promise<number>

Returns the chain ID reported by the public Alto endpoint.

Returns

Promise<number>


getHealth()

getHealth(): Promise<PublicPaymasterHealth>

Fetches and validates the public service health response.

Returns

Promise<PublicPaymasterHealth>


getSupportedEntryPoints()

getSupportedEntryPoints(): Promise<readonly `0x${string}`[]>

Returns the EntryPoint deployments supported by the public Alto endpoint.

Returns

Promise<readonly `0x${string}`[]>


getUserOperationReceipt()

getUserOperationReceipt(hash): Promise<UserOperationReceipt | null>

Fetches a UserOperation receipt, returning null while the operation is pending or unknown.

Parameters

hash

`0x${string}`

Returns

Promise<UserOperationReceipt | null>


prepareUserOperation()

prepareUserOperation(parameters): Promise<PreparedUserOperation>

Obtains a quote, attaches its paymaster fields, and applies the bundler gas estimate.

Parameters

parameters

QuoteUserOperationParameters

Returns

Promise<PreparedUserOperation>

Remarks

Sign only the returned userOperation; quote and gas fields are not final before this call.


quoteUserOperation()

quoteUserOperation(parameters): Promise<QuoteUserOperationResult>

Requests and validates a signed prepaid-USDC quote for a v0.7 UserOperation.

Parameters

parameters

QuoteUserOperationParameters

Returns

Promise<QuoteUserOperationResult>

Remarks

This method does not estimate gas, attach the quote, or sign the operation.


sendUserOperation()

sendUserOperation(userOperation): Promise<`0x${string}`>

Submits a signed v0.7 UserOperation through eth_sendUserOperation.

Parameters

userOperation

RpcUserOperationV07

Returns

Promise<`0x${string}`>


waitForUserOperationReceipt()

waitForUserOperationReceipt(parameters): Promise<UserOperationReceipt>

Polls until a UserOperation receipt is available or the configured timeout expires.

Parameters

parameters

WaitForUserOperationReceiptParameters

Returns

Promise<UserOperationReceipt>

Public prepaid USDC paymaster for Ink Mainnet