Uh oh!
There was an error while loading. Please reload this page.
feat(swift-example-app): debounced live validation of faucet RPC password - #3590
Conversation
…word The "Faucet RPC Password" field on OptionsView (regtest + Use Docker Setup branch) used to silently persist whatever was typed and surface auth failures only later, when the user tapped "Request from faucet" on `ReceiveAddressView`. With dashmate randomizing every Core RPC user's password at `setup local` time, users would routinely paste the wrong value (the documented `rpcpassword` template default never matches a real cluster), notice nothing on the OptionsView, then hit a 401 from the faucet without an obvious reason. Wire the field up to a `@State faucetPassword` and a debounced `.task(id: faucetPassword)` that: - Sleeps 500ms; cancels-and-restarts on every keystroke (the auto-cancel of `.task(id:)` makes this a single-line debouncer). - On a stable value, runs a `getblockcount` JSON-RPC against `http://127.0.0.1:<faucetRPCPort>/` with HTTP basic auth and a 3-second timeout. - Maps the response into a `FaucetValidationStatus` enum (`.checking` / `.valid` / `.invalid` / `.unreachable(detail)`) rendered as an inline label below the field with an SF Symbol + color (green check / red xmark / orange exclamation). - Empty field short-circuits to `.idle` so the status row stays hidden until the user types. - On view appear, the `.task(id:)` fires once with the stored password so the badge reflects persisted state without retyping. The `UserDefaults` write-through is preserved via `.onChange`, so other consumers (`ReceiveAddressView.requestFromFaucet`) keep reading the canonical value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review GateCommit:
|
✅ DashSDKFFI.xcframework built for this PR.
SwiftPM (host the zip at a stable URL, then use): .binaryTarget(
name:"DashSDKFFI",
url:"https://your.cdn.example/DashSDKFFI.xcframework.zip",
checksum:"d0a27292127db0d5e64d42da6469bb00ee2304245db7c4d75b3dc73b1538fb76")Xcode manual integration:
|
Uh oh!
There was an error while loading. Please reload this page.
Issue being fixed or feature implemented
The "Faucet RPC Password" field on OptionsView (regtest + Use Docker Setup branch) silently persisted whatever was typed. Auth failures surfaced only later, when the user tapped "Request from faucet" on `ReceiveAddressView` and got a 401 with no obvious reason.
Compounding factor: dashmate randomizes every Core RPC user's password at `setup local` time (`setupLocalPresetTaskFactory.js`: `options.password = generateRandomString(12)`). The base config template's `rpcpassword` literal never matches a real local cluster, so anyone copy-pasting from the dashmate base config docs hits 401 with no inline signal.
What was done?
`packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift`:
How Has This Been Tested?
Breaking Changes
None. The `UserDefaults` storage key, format, and write-through behavior are unchanged. The only addition is the inline status indicator and the background probe.
Checklist:
🤖 Generated with Claude Code