diff --git a/sdk/arbiter/ai-integration.mdx b/sdk/arbiter/ai-integration.mdx index 333b400..1976e14 100644 --- a/sdk/arbiter/ai-integration.mdx +++ b/sdk/arbiter/ai-integration.mdx @@ -215,7 +215,7 @@ AI-powered dispute resolution handles financial decisions. Always implement prom Approve/deny individual cases and execute refunds. - - Register your AI arbiter for on-chain discovery. + + How arbiters are discovered by merchants and clients. diff --git a/sdk/arbiter/decision-submission.mdx b/sdk/arbiter/decision-submission.mdx index 696479e..35f2f4c 100644 --- a/sdk/arbiter/decision-submission.mdx +++ b/sdk/arbiter/decision-submission.mdx @@ -245,8 +245,8 @@ flowchart TD Automate decisions with AI evaluation hooks. - - Register as an arbiter for on-chain discovery. + + How arbiters are discovered by merchants and clients. RefundRequest contract and state machine details. diff --git a/sdk/arbiter/quickstart.mdx b/sdk/arbiter/quickstart.mdx index dc24b32..6da45f1 100644 --- a/sdk/arbiter/quickstart.mdx +++ b/sdk/arbiter/quickstart.mdx @@ -23,7 +23,6 @@ const arbiter = new X402rArbiter({ walletClient, operatorAddress: '0x...', refundRequestAddress: config.refundRequest, - arbiterRegistryAddress: config.arbiterRegistry, }); ``` @@ -36,7 +35,6 @@ The Arbiter SDK currently supports: - **`executeRefundInEscrow()`** — Execute an approved refund to transfer funds back - **`getPendingRefundRequests()`** — List refund requests awaiting decision - **`getRefundRequestByKey()`** — Get details of a specific refund request -- **`registerArbiter()`** — Register in the on-chain ArbiterRegistry - **`isArbiterRegistered()`** — Check registration status - **`submitEvidence()`** — Attach evidence (IPFS CID) to a refund request - **`getEvidence()`** — Retrieve a single evidence entry by index diff --git a/sdk/arbiter/registry.mdx b/sdk/arbiter/registry.mdx index 1855c8d..ea7a35b 100644 --- a/sdk/arbiter/registry.mdx +++ b/sdk/arbiter/registry.mdx @@ -1,14 +1,26 @@ --- -title: "Arbiter Registry" -description: "Register, update, and discover arbiters using the on-chain ArbiterRegistry" +title: "Arbiter discovery" +description: "How arbiters are discovered by merchants and clients" icon: "clipboard-list" --- -The ArbiterRegistry is an on-chain contract that allows arbiters to register themselves, publish metadata URIs, and be discovered by merchants and clients. + +The on-chain `ArbiterRegistry` contract has been removed. Arbiter discovery is now handled off-chain. If you were using `arbiterRegistry`, `arbiterRegistryAbi`, or `config.arbiterRegistry`, remove those references from your code. + -## Setup +## What changed -To use registry methods, provide the `arbiterRegistryAddress` when creating the arbiter instance: +The `ArbiterRegistry` contract was deleted from x402r-contracts. ERC-8004 replaces on-chain arbiter discovery with off-chain mechanisms. + +The following exports have been removed from `@x402r/core` and `@x402r/helpers`: + +- `arbiterRegistry` (constant address) +- `arbiterRegistryAbi` +- `X402rChainConfig.arbiterRegistry` field + +## Migrating existing code + +Remove any references to `arbiterRegistryAddress` from your client setup: ```typescript import { X402rArbiter } from '@x402r/arbiter'; @@ -21,151 +33,23 @@ const arbiter = new X402rArbiter({ walletClient, operatorAddress: '0x...', refundRequestAddress: config.refundRequest, - arbiterRegistryAddress: config.arbiterRegistry, + // arbiterRegistryAddress is no longer needed }); ``` -## Register as an Arbiter - -Register your address in the on-chain registry with a URI pointing to your metadata or API endpoint: - -```typescript -const { txHash } = await arbiter.registerArbiter( - 'https://arbiter.example.com/api/disputes' -); -console.log('Registered:', txHash); -``` - -The URI can point to: -- An API endpoint for receiving dispute notifications -- A JSON metadata file describing your arbitration services -- An IPFS hash with your arbiter profile - -## Update Your URI - -Change your registered URI: - -```typescript -const { txHash } = await arbiter.updateArbiterUri( - 'https://new-arbiter.example.com/api' -); -console.log('URI updated:', txHash); -``` - -## Deregister - -Remove yourself from the registry: - -```typescript -const { txHash } = await arbiter.deregisterArbiter(); -console.log('Deregistered:', txHash); -``` - -## Query the Registry - -### Check if an Address is Registered - -```typescript -const isRegistered = await arbiter.isArbiterRegistered('0xArbiterAddress...'); -console.log('Is registered:', isRegistered); -``` - -### Get an Arbiter's URI - -```typescript -const uri = await arbiter.getArbiterUri('0xArbiterAddress...'); -console.log('URI:', uri); // empty string if not registered -``` - -### Get Total Arbiter Count - -```typescript -const count = await arbiter.getArbiterCount(); -console.log('Total arbiters:', count); -``` - -### List Arbiters (Paginated) - -```typescript -const { arbiters, uris, total } = await arbiter.listArbiters(0n, 10n); -console.log(`Showing ${arbiters.length} of ${total} arbiters`); - -for (let i = 0; i < arbiters.length; i++) { - console.log(`${arbiters[i]}: ${uris[i]}`); -} -``` - -## Method Reference - -| Method | Parameters | Returns | Description | -|--------|-----------|---------|-------------| -| `registerArbiter` | `uri: string` | `{ txHash }` | Register with a URI | -| `updateArbiterUri` | `newUri: string` | `{ txHash }` | Update registered URI | -| `deregisterArbiter` | (none) | `{ txHash }` | Remove from registry | -| `getArbiterUri` | `arbiter: Address` | `string` | Get arbiter's URI | -| `isArbiterRegistered` | `arbiter: Address` | `boolean` | Check registration | -| `getArbiterCount` | (none) | `bigint` | Total registered count | -| `listArbiters` | `offset: bigint, count: bigint` | `ArbiterList` | Paginated list | - -## ArbiterList Type - -```typescript -interface ArbiterList { - arbiters: readonly `0x${string}`[]; // Arbiter addresses - uris: readonly string[]; // Corresponding URIs - total: bigint; // Total registered count -} -``` - -## Complete Example - -```typescript -import { X402rArbiter } from '@x402r/arbiter'; -import { getNetworkConfig } from '@x402r/core'; - -async function main() { - const config = getNetworkConfig('eip155:84532')!; - - const arbiter = new X402rArbiter({ - publicClient, - walletClient, - operatorAddress: '0x...', - arbiterRegistryAddress: config.arbiterRegistry, - }); - - // Register - await arbiter.registerArbiter('https://my-arbiter.example.com/api'); - - // Verify - const isRegistered = await arbiter.isArbiterRegistered( - walletClient.account!.address - ); - console.log('Registered:', isRegistered); - - // Browse all arbiters - const { arbiters, uris, total } = await arbiter.listArbiters(0n, 100n); - console.log(`${total} arbiters registered:`); - for (let i = 0; i < arbiters.length; i++) { - console.log(` ${arbiters[i]} → ${uris[i]}`); - } -} - -main().catch(console.error); -``` - -## Next Steps +## Next steps - + Approve and deny refund requests. - + Automate dispute resolution with AI. - + Complete arbiter setup guide. - + Understand arbiter conditions in contracts.