Skip to content

feat(rpc): auto-sync RPCs every 24h & Alchemy Bitcoin endpoints#308

Merged
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:feat/rpc-24h-sync-and-alchemy-btc
Mar 12, 2026
Merged

feat(rpc): auto-sync RPCs every 24h & Alchemy Bitcoin endpoints#308
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:feat/rpc-24h-sync-and-alchemy-btc

Conversation

@AugustoL
Copy link
Collaborator

Description

Two RPC improvements:

  1. Auto-sync every 24 hours — RPCs are re-tested and sorted on app start if 24+ hours have passed since the last sync
  2. Alchemy Bitcoin endpoints — Saving an Alchemy API key now auto-adds Bitcoin mainnet and testnet4 RPCs

Related Issue

Closes #295, Closes #293

Type of Change

  • New feature

Changes Made

Auto-sync RPCs every 24h (#295)

  • Replaced rpcsSynced boolean flag with openScan_lastRpcSyncTime timestamp in localStorage
  • isSyncNeeded() checks if 24+ hours elapsed or no timestamp exists (first-time user)
  • Removed rpcsSynced from UserSettings type — no longer needed
  • Cache clear now removes the timestamp instead of setting a flag
  • Removed useSettings dependency from the hook (simpler, no settings writes)

Alchemy Bitcoin endpoints (#293)

  • Added ALCHEMY_BTC_NETWORKS mapping for Bitcoin mainnet (bip122:000000000019d6689c085ae165831e93) and testnet4 (bip122:00000000da84f2bafbbc53dee25a72ae)
  • Added getAlchemyBtcUrl() helper
  • Auto-add/remove/update logic mirrors existing EVM behavior: replaces old URL on key change, removes on key clear, avoids duplicates

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • My code follows the project's architecture patterns

- Replace rpcsSynced boolean flag with timestamp-based check
  (openScan_lastRpcSyncTime in localStorage)
- On app start, re-sync if 24+ hours have passed or no timestamp exists
- Remove rpcsSynced from UserSettings type (no longer needed)
- Clear cache now removes the sync timestamp instead of setting a flag
- Add Alchemy Bitcoin mainnet and testnet4 RPC auto-add when Alchemy
  key is saved, matching existing EVM auto-add behavior

Closes openscan-explorer#295, Closes openscan-explorer#293
@github-actions
Copy link

🚀 Preview: https://pr-308--openscan.netlify.app
📝 Commit: a676b73d2887a16c063fbfa20c847727e38ef495

Copy link
Collaborator

@josealoha666 josealoha666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The 24h timestamp-based auto-sync is cleaner than persisting a boolean in settings, and the Alchemy Bitcoin endpoint handling mirrors the existing EVM key-update flow cleanly. I checked the diff and npm run typecheck, npm run test:run, and npm run build all passed locally for me.

@AugustoL AugustoL merged commit 40342df into openscan-explorer:dev Mar 12, 2026
4 of 7 checks passed
@AugustoL AugustoL mentioned this pull request Mar 16, 2026
10 tasks
Copy link
Collaborator

@josealoha666 josealoha666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick review: I skimmed the diff and did not find a clear blocker. Leaving a comment-only review for now.

Copy link
Collaborator

@josealoha666 josealoha666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the current head and I do not see an obvious blocking issue from the diff/API view. If CI is green, this looks fine from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants