Skip to content

feat: add Firo network support#16

Open
reubenyap wants to merge 13 commits intorosen-bridge:devfrom
reubenyap:cursor/-bc-2b025ca2-9368-47a2-ac62-6845cce1b479-2154
Open

feat: add Firo network support#16
reubenyap wants to merge 13 commits intorosen-bridge:devfrom
reubenyap:cursor/-bc-2b025ca2-9368-47a2-ac62-6845cce1b479-2154

Conversation

@reubenyap
Copy link
Copy Markdown

@reubenyap reubenyap commented Apr 4, 2026

Summary

This PR adds complete Firo chain integration to the Rosen Bridge UI, following the established UTXO chain pattern used by Doge and Bitcoin.

Note: This PR supersedes #15 and incorporates all of its changes along with fixes for the review feedback raised there.

Commits

The PR is structured as focused commits for easy review:

  1. feat: add Firo network support - The full Firo integration (equivalent to the changes in add firo support #15)
  2. fix: address review feedback on Firo integration - Fixes for the issues identified in the add firo support #15 review
  3. Use Firo RPC for wallet utilities - Replaces unavailable BlockCypher/explorer wallet calls with Firo node RPC

Changes

Firo Integration

  • networks/firo/: Network package with client class, constants, types, UTXO selection, transaction generation, and Firo RPC utilities
  • wallets/firo-wallet/: Wallet package with browser extension integration (connect, sign, broadcast)
  • apps/rosen/: App wiring with server actions, lock address config, and wallet registration
  • packages/constants: Add Firo to NETWORKS (index 7, native token: firo)
  • packages/icons: Add Firo network SVG icon
  • packages/utils: Add Firo explorer URLs (address, token, tx)
  • apps/rosen-service: Gracefully skip unconfigured chains in commitment extractor registration
  • apps/rosen/.env.example: Add FIRO_RPC_API variable

Review Fixes

Addresses the feedback from #15 and #16:

  • build.sh: Add networks/firo and wallets/firo-wallet workspaces to the build script
  • firo.svg: Remove XML declaration and unnecessary attributes; keep only viewBox and xmlns consistent with other network SVGs
  • getMaxTransfer.ts: Fix typo opRetrunDataLength -> opReturnDataLength
  • utils.ts: Fix incorrect JSDoc @param references
  • Replace FIRO_BLOCKCYPHER_API / FIRO_EXPLORER_API with FIRO_RPC_API
  • Use Firo node RPC for UTXOs, balance, raw tx lookup, fee estimates, chain height, and tx broadcast
  • Expect the configured node to enable address and transaction indexes for getaddressutxos, getaddressbalance, and getrawtransaction
  • Strip Firo special-transaction extra payloads from getrawtransaction results only for PSBT nonWitnessUtxo compatibility with bitcoinjs-lib

cursoragent and others added 2 commits April 4, 2026 16:23
Add complete Firo chain integration following the established UTXO chain
pattern (Doge/Bitcoin):

- networks/firo: Network package with client, constants, types, UTXO
  selection, transaction generation, and BlockCypher API utilities
- wallets/firo-wallet: Wallet package with browser extension integration
  (connect, sign, broadcast)
- apps/rosen: App wiring with server actions, lock address config, and
  wallet registration
- packages/constants: Add Firo to NETWORKS (index 7, native token: firo)
- packages/icons: Add Firo network SVG icon
- packages/utils: Add Firo explorer URLs (address, token, tx)
- apps/rosen-service: Gracefully skip unconfigured chains in commitment
  extractor registration

Co-authored-by: Reuben Yap <reuben@firo.org>
- Add networks/firo and wallets/firo-wallet to build.sh (BEK requirement)
- Clean up firo.svg: remove XML declaration and unnecessary attributes,
  keep only viewBox and xmlns (consistent with other network SVGs)
- Fix typo: opRetrunDataLength -> opReturnDataLength in getMaxTransfer.ts
- Fix incorrect JSDoc @param references in utils.ts

Co-authored-by: Reuben Yap <reuben@firo.org>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 4, 2026

@cursoragent is attempting to deploy a commit to the rosen-bridge Team on Vercel.

A member of the Team first needs to authorize it.

@reubenyap reubenyap mentioned this pull request Apr 4, 2026
vorujack
vorujack previously approved these changes Apr 16, 2026
RaaCT0R
RaaCT0R previously approved these changes Apr 16, 2026
Co-authored-by: Reuben Yap <reuben@firo.org>
@cursor cursor Bot dismissed stale reviews from RaaCT0R and vorujack via ed5812b April 16, 2026 07:13
vorujack
vorujack previously approved these changes Apr 16, 2026
ChainChoices (derived from NETWORKS_KEYS) includes chains like firo
that have no entry in the Chains config type nor a data adapter. Using
the broader ChainChoices type to index configs.chains / drive the adapter
switch made the switch non-exhaustive and caused type-check failures.

Narrow the index cast in assetAggregator and the parameter of
createChainSpecificDataAdapter to keyof Chains so indexing is valid and
the switch is exhaustive, eliminating the inferred undefined in the
return type.

https://claude.ai/code/session_01MJPsWRuNaJm3GSREcoMDJ5
reubenyap and others added 2 commits April 17, 2026 18:02
- Align FiroWallet.performConnect with MyDogeWallet and other sibling
  wallets by calling this.isConnected() (base-class wrapper that
  asserts availability and swallows connection-check errors) instead
  of the raw hasConnection() vendor probe.
- Add a changeset covering the full Firo integration plus the
  rosen-service2 type-narrowing fix so the changeset CI check passes.

https://claude.ai/code/session_01MJPsWRuNaJm3GSREcoMDJ5
vorujack
vorujack previously approved these changes Apr 18, 2026
RaaCT0R
RaaCT0R previously approved these changes Apr 18, 2026
Comment thread apps/rosen-service2/src/services/assetAggregator.ts
Comment thread .changeset/firo-network-support.md Outdated
@reubenyap reubenyap dismissed stale reviews from RaaCT0R and vorujack via 5c28730 April 19, 2026 10:38
vorujack
vorujack previously approved these changes Apr 19, 2026
`path.posix.relative` cannot produce a correct relative path from two
Windows-absolute paths, so `getKnipCommand` was emitting garbage like
`knip --dependencies --workspace ../E:\Github\rosen-ui\packages\X`,
which knip rejects as "Workspace is not a directory". This blocked
pre-commit hooks on Windows for any commit touching package sources.

Use the cross-platform `path.relative` and normalize separators to
forward slashes (matching the existing type-check line that already
uses `path.relative`).
With firo in NETWORKS_KEYS but not yet in configs.chains, ChainChoices
is wider than keyof typeof configs.chains. Adjust the two spots that
index configs.chains[chain] so tsc stays green until the backend Firo
config lands:

- assetAggregator: cast chain to keyof typeof configs.chains at the
  index site.
- assetDataAdapters: narrow createChainSpecificDataAdapter's chain
  parameter from ChainChoices to keyof typeof configs.chains (the
  switch never handled firo anyway), removing the now-unused
  ChainChoices import.
vorujack
vorujack previously approved these changes Apr 25, 2026
Comment thread networks/firo/src/utils.ts Outdated
@reubenyap reubenyap force-pushed the cursor/-bc-2b025ca2-9368-47a2-ac62-6845cce1b479-2154 branch from cdd7b09 to 0f0cf6c Compare April 29, 2026 12:22
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.

6 participants