Skip to content

feat(rosen-service): add Firo chain integration#19

Open
reubenyap wants to merge 4 commits intorosen-bridge:devfrom
reubenyap:feature/firo-rosen-service
Open

feat(rosen-service): add Firo chain integration#19
reubenyap wants to merge 4 commits intorosen-bridge:devfrom
reubenyap:feature/firo-rosen-service

Conversation

@reubenyap
Copy link
Copy Markdown

@reubenyap reubenyap commented Apr 20, 2026

Part of the RCS-003 Bridge Expansion Kit for Firo. Supersedes #18 — this PR carries the full Firo asset-calculator + rosen-service change set, organised as four review-friendly commits against dev:

  1. feat: add Firo chain support to asset-calculator
    Registers firo in NETWORKS (no token support, native token firo), adds FiroCalculator reading locked amounts from the Firo insight-api (/insight-api-zcoin/addr/{address}/balance), adds FiroCalculatorInterface, registers the calculator in AssetCalculator, and updates the existing asset-calculator tests.

  2. feat(utils): add firo URL entries to address/tx/token maps
    Network = keyof typeof NETWORKS now includes 'firo', and the three maps in @rosen-ui/utils are exhaustive { [key in Network]: ... } — without these entries, tsc --noEmit would fail in packages/utils. Uses Firo's native explorer (https://explorer.firo.org) for address and transaction URLs; token URL is empty (Firo has no native token scheme, same as Doge). Per RCS-003 § Utils.

  3. fix(rosen-service2): narrow chain types so firo doesn't break tsc
    Adding firo to NETWORKS_KEYS widens ChainChoices past keyof typeof configs.chains. The Firo backend config hasn't landed in rosen-service2 yet, so the two index sites (assetAggregator, assetDataAdapters) are narrowed to keyof typeof configs.chains as an interim fix — per maintainer guidance on feat: add Firo network support #16. This can be reverted once the rosen-service2 Firo config lands.

  4. feat: add Firo chain support to rosen-service
    Adds FiroRpcScanner, FiroRpcObservationExtractor, event-trigger extractor, and scanner-sync health check. Wires the Firo calculator config (addresses + explorerUrl) into the AssetCalculator constructor. Adds a firo section to apps/rosen-service/src/configs.ts and apps/rosen-service/config/default.yaml, plus calculator.addresses.firo defaults and the firoScannerWarnDiff / firoScannerCriticalDiff health-check keys. Adds @rosen-bridge/firo-scanner and @rosen-bridge/firo-observation-extractor as dependencies.

Why one PR instead of two

Splitting commits 1 and 4 into separate PRs would leave dev non-buildable between merges: adding firoCalculator to the positional AssetCalculator constructor is a breaking change and the only consumer is apps/rosen-service/src/calculator/calculator-service.ts. The Doge reference commit (20fe8df3) bundled the calculator + calculator-service changes for the same reason. The commits above can still be reviewed independently.

What's not here

- Register `firo` in the `NETWORKS` constant (no token support, native
  token `firo`).
- Add `FiroCalculator` that reads locked amounts from the Firo
  insight-api (`/insight-api-zcoin/addr/{address}/balance`).
- Add `FiroCalculatorInterface` and register `FiroCalculator` in
  `AssetCalculator`.

Part of the RCS-003 Bridge Expansion Kit for Firo.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

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

A member of the Team first needs to authorize it.

Reuben Yap and others added 3 commits April 22, 2026 17:22
Required because `Network = keyof typeof NETWORKS` now includes `'firo'`,
and the three maps in @rosen-ui/utils are exhaustive `{ [key in Network]: ... }`
— without these entries, `tsc --noEmit` fails in packages/utils.

- getAddressUrl: https://explorer.firo.org/address
- getTxUrl:      https://explorer.firo.org/tx
- getTokenUrl:   '' (Firo has no native token scheme, same as Doge)

URL paths verified against explorer.firo.org's AngularJS insight-ui
pushState routes.
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.
- Add `@rosen-bridge/firo-scanner` and
  `@rosen-bridge/firo-observation-extractor` as dependencies.
- Wire up a new `FiroRpcScanner` in `scanner-service`, reading from the
  configured Firo RPC node using a failover connector manager.
- Register `FiroRpcObservationExtractor` for the lock address.
- Register the `firo-extractor` event-trigger extractor on the Ergo
  scanner.
- Register a Firo scanner-sync health check
  (`firoScannerWarnDiff` / `firoScannerCriticalDiff`).
- Pass the Firo calculator config (addresses + `explorerUrl`) to
  `AssetCalculator`.
- Add `firo` network section plus health-check thresholds and
  `calculator.addresses.firo` defaults to `config/default.yaml`.
- Add `FIRO_SCANNER_INTERVAL`, `FIRO_SCANNER_LOGGER_NAME`, and
  `FIRO_BLOCK_TIME` constants.

Part of the RCS-003 Bridge Expansion Kit for Firo. Builds on the Firo
asset-calculator integration.
@reubenyap reubenyap force-pushed the feature/firo-rosen-service branch from 4e10d20 to ee6406a Compare April 22, 2026 09:23
@reubenyap reubenyap marked this pull request as ready for review April 22, 2026 09:24
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.

2 participants