# PTF-339 — CERTIFIED WALLETS XRPL-FIRST LOOKUP FIX
## Program Temporary Fix

**PTF:** PTF-339  
**Status:** APPLIED (production patched by Codex, second attempt)  
**APAR:** APAR-339  
**WO:** WO-2026-CERTIFIED-WALLETS-001  
**VIRA:** VIRA-339  
**Applied:** 2026-05-17 ~15:20 UTC  
**Applied By:** Codex (Claude Code) — after AR escalation and SGPT independent build  
**Governing Law:** AG-001  

---

## 1. What Was Fixed

### Bug 1 — XRPScan Button URL
- **Before:** `href="#"` or XRPScan homepage URL
- **After:** `https://xrpscan.com/account/${walletAddress}` assigned via `document.getElementById('btn-xrpscan').href = xrpscanUrl`

### Bug 2 — Hardcoded Wallet
- **Before:** `const wallet = 'rKZtUe8bSbczVFViwmLiWpR1gk7KTqaN76'` (static)
- **After:** Dynamic reading from URL params (`?wallet=`, `?address=`, `?account=`, `?r=`), hash params, or logged-in session (`datacert_session`)

### Bug 3 — Domain Not Hotlinked
- **Before:** `'bitvision.ai'` (plain text)
- **After:** `<a href="https://${domain}" target="_blank" rel="noopener" style="color:#2b6cb0; text-decoration:underline;">${domain}</a>`

### Architecture Change — XRPL-First
- **Before:** Relied solely on DataCert API for domain data (broke for wallets not in DB)
- **After:** Reads XRPL ledger directly via `xrplcluster.com` JSON-RPC, hex-decodes `AccountRoot.Domain`, then overlays DataCert trust/certification status

## 2. Files Changed

| File | Location | Change |
|---|---|---|
| `certified-wallets.html` | `/home/datacert/public_html/` on svr01 | Full rewrite with XRPL-first logic |

## 3. Verification

Confirmed working for:
- `rfGJnfUaGpJw7vtiT6TCG6S6ywxeLAkeN8` → domain: madeinusanews.com (hotlinked)
- `rKZtUe8bSbczVFViwmLiWpR1gk7KTqaN76` → domain: bitvision.ai (hotlinked)
- XRPScan button opens `/account/{address}` in new tab for both wallets

## 4. Outstanding

- [ ] Production file not yet synced back to deploy dir (`/opt/veritize-docker/ops/deploy/datacert/`)
- [ ] Deploy dir still contains SGPT v2 version (stale — do not deploy over production)
- [ ] Browser screenshot evidence needed from Michelle's machine to confirm cache-busted load

## 5. Backup

Production backup: `certified-wallets.html.bak-v2-{timestamp}` on svr01
