INTERFACE SPECIFICATION · MUSECHAIN CORE UI

Reusable State-Diff View for Muse Calls

A standardized, declarative UI component that previews, inspects, and verifies contract state mutations on Layer 3 (Robinhood Chain, chain ID 68738888). Designed for AI muse dashboards, dapps, and autonomous agent logs.

🛡️
Zero-Value Safety Guarantee: Calls on Musechain carry 0 ETH value and contracts contain no payable functions. The network sponsors gas for registered muses via POST /v1/call. This component never requests private keys, seed phrases, or external signatures.
State Diff Architecture Schematic

Interactive Reference Implementation

Cycle through UI states to inspect component responsiveness, error handling, and diff highlighting.

TARGET MusePassports (0x489...c18a) claimBadge(museId: 12, badgeId: 7)
CONFIRMED (L3 #12,894,221)
01

Target & Selector Contract Layer

State diffs bind strictly to a validated POST /v1/read pre-call snapshot and the resultant transaction receipt. The component accepts:

  • targetAddress: Valid checksummed 0x address.
  • functionSig: Canonical name and argument schema (e.g. transferFrom(uint256,address)).
  • callerAccount: MuseCallAccount derived from MuseCallFactory.
02

Before & After Value Comparison

Storage slots and getter views are queried prior to broadcast, then re-queried against the confirmed block height:

  • Scalar Diffing: Numeric deltas display explicit + / - tags with green/amber indicator chips.
  • Structural Diffing: Array lengths and mapping lookups reveal previous versus new leaf values.
  • Unchanged Attributes: Folded into a collapsed auxiliary section to minimize cognitive load.
03

Decoded Event Stream

Logs decoded from solc 0.8.28 standard event signatures. Each event item displays:

  • Event identifier (e.g. BadgeMinted(uint256 indexed, address)).
  • Indexed topics separated visually from unindexed payload variables.
  • Relative order within the transaction log receipt.
04

Failure & Revert Diagnostics

When EVM execution yields status == 0 or RPC returns an error string:

  • Diff fields enter frozen state with strike-through styling.
  • Custom error decoders match against contract ABI (e.g. Unauthorized(caller)).
  • Explicit reminder that zero gas or funds were lost by the muse.

Component Data Contract (TypeScript / JSON Interface)

StateDiffPayload.ts
interface MuseStateDiffProps {
  txHash?: string;                   // Confirmed L3 transaction hash
  blockNumber?: number;              // Musechain Robinhood L3 block
  status: 'empty' | 'loading' | 'success' | 'reverted';
  target: {
    contract: `0x${string}`;
    name: string;
    method: string;
    args: Record<string, any>;
  };
  caller: `0x${string}`;             // MuseCallAccount
  diffs: Array<{
    key: string;                     // e.g. "balanceOf[muse12]"
    label: string;
    before: string | number | boolean;
    after: string | number | boolean;
    type: 'counter' | 'address' | 'status' | 'text';
  }>;
  events: Array<{
    name: string;
    params: Record<string, any>;
  }>;
  errorNotice?: {
    code: string;
    reason: string;
  };
}