Skip to content

CallsStatus

The status of a batch of calls, as wallet_getCallsStatus returns it (EIP-5792): a status code, whether the batch ran atomically, and the receipts of its transactions.

import { Effect } from "effect";
import { Wallet } from "@ethect/core/rpc";
const hashes = (id: string) =>
Effect.gen(function* () {
const status = yield* Wallet.getCallsStatus(id);
// status: CallsStatus.CallsStatus
return status.receipts.map((receipt) => receipt.transactionHash);
});
Schema Type Describes Returned by
CallsStatus.schema CallsStatus.CallsStatus where a batch stands Wallet.getCallsStatus
CallsStatus.receiptSchema CallsStatus.Receipt the receipt of a transaction that carried calls of the batch the receipts of a status

CallsStatus.CallsStatus.

Field Type Notes
version string (optional) as the wallet sends it, such as "2.0.0"
id string (optional) the id of the batch, when the wallet sends it as a string
chainId number (optional) the chain the batch was sent on, when the wallet sends it
status number a code, in the table below
atomic boolean (optional) whether the wallet ran the calls atomically
receipts ReadonlyArray<CallsStatus.Receipt> in the order the transactions were included. Empty while pending, and when the wallet sends none
capabilities WalletCapabilities (optional) what the wallet attached to its answer
Code Meaning
100 pending
200 confirmed
400 failed off chain
500 reverted
600 partly reverted

EIP-5792 v1 said it in words: "PENDING" is read as 100 and "CONFIRMED" as 200, as viem reads them.

CallsStatus.Receipt, a subset of a Receipt.

Field Type Notes
logs ReadonlyArray<{ address: Address, data: Hex, topics: ReadonlyArray<Hash> }> only the logs of the batch’s own calls
status "success" | "reverted"
blockHash Hash
blockNumber bigint from hex, or from a JSON number
gasUsed bigint from hex, or from a JSON number
transactionHash Hash
  • Codes come in hundreds. A more specific code stays in the hundred of its kind. Test the range, such as status >= 200 && status < 300, not one value.

  • status twice. The status of the batch is a number. The status of a receipt is a name, decoded from "0x1" and "0x0".

  • No receipts is an empty list. A wallet that leaves receipts out, as most do while the batch is pending, answers [].

  • version and atomic are optional. A wallet that leaves one out still says where its batch stands: the status is read all the same.

  • What a wallet means is read. Wallets do not all answer as EIP-5792 writes it, and an answer is read whenever its meaning is unambiguous:

    The wallet sends Read as
    a status "PENDING" or "CONFIRMED" (EIP-5792 v1) 100, 200
    a receipt’s blockNumber or gasUsed as a JSON number the same bigint
    no receipts []
    an id that is not a string, such as Ambire’s { type, identifier, bundler } no id
    no chainId no chainId
    a key set to undefined, which only a provider in the page can send an absent key

    id and chainId are never needed to read an answer: whoever asked knows both.

  • What it cannot read fails. An answer without a status, or a receipt without a 32-byte transactionHash, fails the call with a CodecError on the result. Its value is the answer as the wallet sent it.

  • Encoded as EIP-5792 writes it. A status encodes to a number, the numbers of a receipt to hex, and id and chainId when they are there. A key is never written as undefined.

  • One receipt or several. When atomic is true, all the calls may be in one receipt.

  • A log has three fields. address, data and topics. The other fields of a Log are dropped when a wallet sends them.