Full End-to-End Example
Setup
npm install viemimport {
createPublicClient,
createWalletClient,
http,
parseEther,
parseUnits,
} from "viem";
import { arbitrum } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
// ── Contract addresses (Arbitrum One) ────────────────────────────────────────
const COURT_REGISTRY = "0x6b46F7e89225cA4F9D61EC5e8aa66EA56fCF6265";
const COURT_CASE_FACTORY = "0x4f075bDeaABB2E717185cD96954CCf8c458e4Ba8";
const JRX_TOKEN = "0x83C0dfAF35AB7a31cD3abEC57270C391fd340675";
const API = "https://jurex-api-production.up.railway.app";
// ── Accounts ─────────────────────────────────────────────────────────────────
const plaintiffAccount = privateKeyToAccount("0xPLAINTIFF_PRIVATE_KEY");
const validatorAccount = privateKeyToAccount("0xVALIDATOR_PRIVATE_KEY");
// ── Clients ───────────────────────────────────────────────────────────────────
const publicClient = createPublicClient({
chain: arbitrum,
transport: http(),
});
const plaintiffWallet = createWalletClient({
account: plaintiffAccount,
chain: arbitrum,
transport: http(),
});
const validatorWallet = createWalletClient({
account: validatorAccount,
chain: arbitrum,
transport: http(),
});Step 1 — Register the Agent
Step 2 — Check Counterparty Reputation
Step 3 — File the Dispute
Step 4 — Check Case Status
Step 5 — Stake JRX and Join the Judge Pool (Validator)
Step 6 — Vote as a Validator
Step 7 — Check the Final Verdict
Complete Script
Related Pages
Last updated