contracts
Classes
Eip5792Unsupported
Thrown only when the wallet does not implement the EIP-5792 RPC
surface (method-not-found). Capability-level support — whether the
wallet declares atomicBatch for a given chain — is surfaced via
supportsAtomicBatch() returning false; callers gate on that
boolean BEFORE calling sendCalls, so they should never see this
error for the capability-absent case.
In either case the caller should fall back to sending the steps sequentially.
Extends
Error
Constructors
Constructor
new Eip5792Unsupported(cause): Eip5792Unsupported;Parameters
| Parameter | Type |
|---|---|
cause | unknown |
Returns
Overrides
Error.constructorProperties
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTraceprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTraceisError()
static isError(error): error is Error;Indicates whether the argument provided is a built-in Error instance or not.
Parameters
| Parameter | Type |
|---|---|
error | unknown |
Returns
error is Error
Inherited from
Error.isErrorInterfaces
ClaimCallInputs
Public-input scalars the contract receives alongside the proof.
These MUST match the values the caller passed to
generateClaimProof — passing different scalars and the matching
proof together would fail on-chain verification.
Properties
| Property | Type |
|---|---|
recipient | string |
token | string |
amount | bigint |
releaseTime | bigint |
BatchClaimItem
Properties
| Property | Type |
|---|---|
proof | ClaimProofResult |
inputs | ClaimCallInputs |
SendCallsCall
Shape of wallet_sendCalls call entries (EIP-5792 v1.0).
Properties
| Property | Type | Description |
|---|---|---|
to | string | - |
value? | string | Hex-encoded wei value; omit or "0x0" for non-payable calls. |
data? | string | Hex-encoded calldata. |
SendCallsParams
Properties
| Property | Type | Description |
|---|---|---|
version | "1.0" | Envelope version — EIP-5792 currently defines “1.0” only. |
from | string | - |
chainId | string | Hex-encoded chainId (e.g. "0x1"). |
calls | SendCallsCall[] | - |
capabilities? | Record<string, unknown> | Atomicity / paymaster / auth capabilities. Optional. |
SendCallsResult
The id returned by wallet_sendCalls used to poll for the receipt.
Properties
| Property | Type |
|---|---|
id | string |
CallsStatus
wallet_getCallsStatus response (EIP-5792 v1.0).
Properties
SettleAuthFees
Per-side fee in token units the relayer charges, capped by the
user’s signed maxFee on each side.
Properties
| Property | Type |
|---|---|
feeTokenMaker | bigint |
feeTokenTaker | bigint |
SettleAuthSide
Per-side public material the contract re-checks against the
proof. The proof carries hashes only; these scalars match
the user-signed order.
Properties
| Property | Type | Description |
|---|---|---|
proof | AuthorizeProofResult | - |
sellToken | string | - |
buyToken | string | - |
sellAmount | bigint | - |
buyAmount | bigint | - |
maxFee | bigint | - |
expiry | bigint | - |
relayer | string | - |
tier | 16 | 64 | 128 | Circuit tier this proof was generated against — passed straight through to the verifier-registry dispatch on-chain. Use a CircuitTier’s cap from @zkscatter/sdk/zk rather than a literal so an unsupported tier fails at compile time. |
Variables
MAX_CLAIM_BATCH_SIZE
const MAX_CLAIM_BATCH_SIZE: 20 = 20;Hard cap enforced by PrivateSettlement.claimWithProofBatch.
Mirrors the contract’s MAX_CLAIM_BATCH_SIZE constant; an
oversized batch reverts on-chain after burning gas, so we
catch it client-side. Callers chunk larger sets.
Functions
callCancel()
function callCancel(
signer,
settlementAddress,
proof): Promise<TransactionResponse>;Send PrivateSettlement.cancelPrivate(...). Anyone can submit
on behalf of the user; the cancel proof binds msg.sender (the
relayer) into the signed cancel message, so a different relayer
cannot replay the proof.
After the tx mines:
- The old commitment is permanently dead (escrowNullifier burnt)
- The order is dropped from the orderbook (relayers see the
PrivateCancelevent keyed bynonceNullifier) - The fresh
newCommitmentis inserted into the pool with the same balance, immediately spendable for a new order.
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
settlementAddress | string |
proof | CancelProofResult |
Returns
Promise<TransactionResponse>
callClaimWithProof()
function callClaimWithProof(
signer,
settlementAddress,
proof,
inputs): Promise<TransactionResponse>;Send PrivateSettlement.claimWithProof(...). Anyone can submit
on behalf of the recipient (the address is encoded in the
public signals), so a relayer can dispatch gaslessly.
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
settlementAddress | string |
proof | ClaimProofResult |
inputs | ClaimCallInputs |
Returns
Promise<TransactionResponse>
callClaimWithProofBatch()
function callClaimWithProofBatch(
signer,
settlementAddress,
items): Promise<TransactionResponse>;Batch variant. Reverts atomically if any element is invalid;
caps at MAX_CLAIM_BATCH_SIZE (caller chunks larger sets).
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
settlementAddress | string |
items | BatchClaimItem[] |
Returns
Promise<TransactionResponse>
ensureAllowance()
function ensureAllowance(
signer,
token,
spender,
amount): Promise<TransactionResponse[]>;Approve token for spender to pull amount units.
No-op when the existing allowance already covers the request. When the existing allowance is non-zero but insufficient, we reset to 0 first before raising — some widely-used ERC-20s (notably USDT) revert on non-zero → non-zero allowance changes.
Returns the approval transaction (or [] when nothing was
needed). The reset-to-zero path returns both transactions; both
are pending and can be wait()-ed in order.
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
token | string |
spender | string |
amount | bigint |
Returns
Promise<TransactionResponse[]>
callDeposit()
function callDeposit(
signer,
poolAddress,
result,
token,
amount): Promise<TransactionResponse>;Send CommitmentPool.deposit(...). Caller is responsible for
the ERC-20 approval (see ensureAllowance). Returns the
pending TransactionResponse so callers can show optimistic UI
before wait().
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
poolAddress | string |
result | DepositProofResult |
token | string |
amount | bigint |
Returns
Promise<TransactionResponse>
fetchCapabilities()
function fetchCapabilities(provider, account): Promise<
| Record<string, Record<string, {
supported?: boolean;
}>>
| null>;Returns the capabilities the wallet advertises for the given account.
Shape mirrors EIP-5792:
{ "0x7a69": { atomicBatch: { supported: true }, paymasterService: { ... } } }.
Null when the wallet doesn’t implement wallet_getCapabilities.
Parameters
| Parameter | Type |
|---|---|
provider | BrowserProvider | JsonRpcApiProvider |
account | string |
Returns
Promise<
| Record<string, Record<string, {
supported?: boolean;
}>>
| null>
supportsAtomicBatch()
function supportsAtomicBatch(caps, chainId): boolean;True when the wallet declares atomic-batch support for chainId.
Parameters
| Parameter | Type |
|---|---|
caps | | Record<string, Record<string, { supported?: boolean; }>> | null |
chainId | number | bigint |
Returns
boolean
sendCalls()
function sendCalls(provider, params): Promise<SendCallsResult>;Submit a batch via wallet_sendCalls. Throws Eip5792Unsupported
when the wallet doesn’t implement the RPC; callers should catch
that and drop back to sequential sends.
Parameters
| Parameter | Type |
|---|---|
provider | BrowserProvider | JsonRpcApiProvider |
params | Omit<SendCallsParams, "chainId" | "version"> & { chainId: number | bigint; } |
Returns
Promise<SendCallsResult>
waitForCallsReceipt()
function waitForCallsReceipt(
provider,
id,
__namedParameters?): Promise<CallsStatus>;Poll wallet_getCallsStatus until the batch finalizes.
timeoutMs bounds the wait so a never-confirming batch can’t hang
the UI indefinitely; on timeout the promise rejects and the caller
can decide whether to retry or surface the error. signal lets
the caller cancel the poll early — checked at the top and after
each await so a Cancel during a slow RPC call also breaks out as
soon as the in-flight request settles.
Parameters
| Parameter | Type |
|---|---|
provider | BrowserProvider | JsonRpcApiProvider |
id | string |
__namedParameters | { timeoutMs?: number; pollIntervalMs?: number; signal?: AbortSignal; } |
__namedParameters.timeoutMs? | number |
__namedParameters.pollIntervalMs? | number |
__namedParameters.signal? | AbortSignal |
Returns
Promise<CallsStatus>
callSettleAuth()
function callSettleAuth(
signer,
settlementAddress,
maker,
taker,
fees): Promise<TransactionResponse>;Send PrivateSettlement.settleAuth(...). Relayer-only — the
contract enforces msg.sender ∈ {maker.relayer, taker.relayer}.
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
settlementAddress | string |
maker | SettleAuthSide |
taker | SettleAuthSide |
fees | SettleAuthFees |
Returns
Promise<TransactionResponse>
callScatterDirectAuth()
function callScatterDirectAuth(
signer,
settlementAddress,
side,
fee): Promise<TransactionResponse>;Send PrivateSettlement.scatterDirectAuth(...) — Pay-style same-
token self-pay (no counterparty, no DEX). The contract enforces:
proof.sellToken === proof.buyToken(same-token invariant)msg.sender == proof.relayeris registered (or registry unset)- the authorize proof’s tier has a verifier registered
The single fee is in the same token as the proof — drawn from
the user’s totalLocked, capped against the user-signed maxFee,
and routed to proof.relayer via FeeVault (or directly when
FeeVault is unset). Pass 0n for self-relayer flows.
Parameters
| Parameter | Type |
|---|---|
signer | Signer |
settlementAddress | string |
side | SettleAuthSide |
fee | bigint |
Returns
Promise<TransactionResponse>