Skip to Content
SDK ReferenceTypeScript APIcontracts
SDK reference (auto)

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
ParameterType
causeunknown
Returns

Eip5792Unsupported

Overrides
Error.constructor

Properties

PropertyModifierTypeDescriptionInherited from
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.Error.stackTraceLimit
cause?publicunknown-Error.cause
namepublicstring-Error.name
messagepublicstring-Error.message
stack?publicstring-Error.stack

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
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces 

Inherited from
Error.prepareStackTrace
isError()
static isError(error): error is Error;

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
ParameterType
errorunknown
Returns

error is Error

Inherited from
Error.isError

Interfaces

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

PropertyType
recipientstring
tokenstring
amountbigint
releaseTimebigint

BatchClaimItem

Properties

PropertyType
proofClaimProofResult
inputsClaimCallInputs

SendCallsCall

Shape of wallet_sendCalls call entries (EIP-5792 v1.0).

Properties

PropertyTypeDescription
tostring-
value?stringHex-encoded wei value; omit or "0x0" for non-payable calls.
data?stringHex-encoded calldata.

SendCallsParams

Properties

PropertyTypeDescription
version"1.0"Envelope version — EIP-5792 currently defines “1.0” only.
fromstring-
chainIdstringHex-encoded chainId (e.g. "0x1").
callsSendCallsCall[]-
capabilities?Record<string, unknown>Atomicity / paymaster / auth capabilities. Optional.

SendCallsResult

The id returned by wallet_sendCalls used to poll for the receipt.

Properties

PropertyType
idstring

CallsStatus

wallet_getCallsStatus response (EIP-5792 v1.0).

Properties

PropertyTypeDescription
statusstringBatch state per EIP-5792: “pending” — still in flight “completed” — all included txs mined (individual receipts[i].status still has to be checked for on-chain revert) Typed as string (not the closed union) so the runtime guard for future / wallet-specific states still type-checks under strict TS — narrowing on the closed union after the === "completed" branch would mark the rejected-state guard as unreachable.
receipts?{ logs: { address: string; data: string; topics: string[]; }[]; status: string; blockHash: string; blockNumber: string; gasUsed: string; transactionHash: string; }[]-

SettleAuthFees

Per-side fee in token units the relayer charges, capped by the user’s signed maxFee on each side.

Properties

PropertyType
feeTokenMakerbigint
feeTokenTakerbigint

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

PropertyTypeDescription
proofAuthorizeProofResult-
sellTokenstring-
buyTokenstring-
sellAmountbigint-
buyAmountbigint-
maxFeebigint-
expirybigint-
relayerstring-
tier16 | 64 | 128Circuit 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 PrivateCancel event keyed by nonceNullifier)
  • The fresh newCommitment is inserted into the pool with the same balance, immediately spendable for a new order.

Parameters

ParameterType
signerSigner
settlementAddressstring
proofCancelProofResult

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

ParameterType
signerSigner
settlementAddressstring
proofClaimProofResult
inputsClaimCallInputs

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

ParameterType
signerSigner
settlementAddressstring
itemsBatchClaimItem[]

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

ParameterType
signerSigner
tokenstring
spenderstring
amountbigint

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

ParameterType
signerSigner
poolAddressstring
resultDepositProofResult
tokenstring
amountbigint

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

ParameterType
providerBrowserProvider | JsonRpcApiProvider
accountstring

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

ParameterType
caps| Record<string, Record<string, { supported?: boolean; }>> | null
chainIdnumber | 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

ParameterType
providerBrowserProvider | JsonRpcApiProvider
paramsOmit<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

ParameterType
providerBrowserProvider | JsonRpcApiProvider
idstring
__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

ParameterType
signerSigner
settlementAddressstring
makerSettleAuthSide
takerSettleAuthSide
feesSettleAuthFees

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.relayer is 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

ParameterType
signerSigner
settlementAddressstring
sideSettleAuthSide
feebigint

Returns

Promise<TransactionResponse>

Last updated on