Skip to content

Rename xdai to gnosis, mainnet to ethereum (where possible). - #114

Open
pclaesen wants to merge 1 commit into
RequestNetwork:mainfrom
pclaesen:main
Open

Rename xdai to gnosis, mainnet to ethereum (where possible).#114
pclaesen wants to merge 1 commit into
RequestNetwork:mainfrom
pclaesen:main

Conversation

@pclaesen

@pclaesen pclaesen commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Viem only supports gnosis and mainnet as chain name, 'ethereum' is not a supported chain name. Fixes #34

Summary by CodeRabbit

  • Chores
    • Updated blockchain network configurations to support current chain mappings.
    • Reorganized payment processing network references across data queries.

✏️ Tip: You can customize this high-level summary in your review settings.

Viem only supports gnosis and mainnet as chain name, 'ethereum' is not a supported chain name.
Fixes RequestNetwork#34
@MantisClone

Copy link
Copy Markdown
Contributor

Hello @pclaesen, thank you for submitting your first pull request to the request-scan repository. We value your contribution and encourage you to review our contribution guidelines to ensure your submission meets our standards. Please note that every merged PR is automatically enrolled in our Best PR Initiative, offering a chance to win $500 each quarter. Our team is available via GitHub Discussions or Discord if you have any questions. Welcome aboard!

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Updates blockchain chain identifiers throughout the codebase by replacing XDAI with GNOSIS, removing MAINNET from enums, adding ETHEREUM mappings, and refactoring GraphQL payment network field references across multiple query definitions to reflect new chain source mappings.

Changes

Cohort / File(s) Summary
Chain Configuration
src/lib/consts.ts
Updated public chain enum to replace MAINNET with ETHEREUM, replaced XDAI with GNOSIS, and updated scan URLs and PUBLIC_CLIENTS configuration accordingly.
GraphQL Payment Queries
src/lib/hooks/payments.ts, src/lib/queries/payments.ts, src/lib/queries/address-payments.ts, src/lib/queries/request-payments.ts
Refactored payment network field names in GraphQL queries by systematically remapping: payment_mainnet → payment_arbitrum_one, payment_arbitrum_one → payment_avalanche, payment_avalanche → payment_base, payment_base → payment_bsc, payment_bsc → payment_celo, payment_celo → payment_ethereum, and payment_xdai → payment_gnosis.
Deployment Queries
src/lib/queries/srf-deployments.ts
Updated PROXY_DEPLOYMENTS_QUERY and PROXY_DEPLOYMENTS_BY_REFERENCE_QUERY to apply the same payment network field remapping and removed payment_mainnet while adding payment_ethereum.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main changes: renaming xdai to gnosis and mainnet to ethereum identifiers across the codebase.
Linked Issues check ✅ Passed The PR addresses issue #34 by renaming chain identifiers from 'xdai' to 'gnosis' across configuration, enums, and GraphQL queries, which resolves the UI discrepancy.
Out of Scope Changes check ✅ Passed All changes are consistent with the stated objective of renaming xdai to gnosis and mainnet to ethereum chain identifiers; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MantisClone

Copy link
Copy Markdown
Contributor

Thank you for your submission! As you prepare for the review process, please ensure that your PR title, description, and any linked issues fully comply with our contribution guidelines. A clear explanation of your changes and their context will help expedite the review process. Every merged PR is automatically entered into our Best PR Initiative, offering a chance to win $500 every quarter. We appreciate your attention to detail and look forward to reviewing your contribution!

@greptile-apps

greptile-apps Bot commented Jan 30, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

Renamed chain identifiers from MAINNET to ETHEREUM and XDAI to GNOSIS throughout the codebase to align with Viem's naming requirements.

The changes update:

  • Constants (src/lib/consts.ts): Renamed enum keys in CHAINS, PAYMENT_CHAINS, and corresponding entries in PUBLIC_CLIENTS and CHAIN_SCAN_URLS
  • GraphQL Queries: Updated field names from payment_mainnet to payment_ethereum and payment_xdai to payment_gnosis across all query files

The actual chain values remain correct ("mainnet" and "gnosis") as required by Viem. The refactoring ensures the codebase uses semantically clearer naming (ETHEREUM instead of MAINNET) while maintaining compatibility with Viem's chain definitions.

A minor style inconsistency exists in request-payments.ts where the payment_ethereum block has parameters in a different order than other blocks, though this doesn't affect functionality in GraphQL.

Confidence Score: 4.5/5

  • This PR is safe to merge with very low risk
  • Systematic renaming changes that are well-contained and verified. The only minor issue is a parameter ordering inconsistency that doesn't affect functionality. All usages have been updated consistently, and the Viem compatibility requirement is correctly satisfied.
  • src/lib/queries/request-payments.ts has a minor parameter ordering inconsistency that should be standardized for consistency

Important Files Changed

Filename Overview
src/lib/consts.ts Renamed MAINNET to ETHEREUM and XDAI to GNOSIS in CHAINS, PAYMENT_CHAINS, PUBLIC_CLIENTS, and CHAIN_SCAN_URLS
src/lib/queries/payments.ts Updated GraphQL query field names from payment_mainnet to payment_ethereum and payment_xdai to payment_gnosis
src/lib/queries/request-payments.ts Updated GraphQL query field names and fixed parameter ordering inconsistency in payment_ethereum block

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant Consts as consts.ts
    participant Queries as GraphQL Queries
    participant GQL as GraphQL Client
    participant Subgraph as The Graph Subgraph
    participant Viem as Viem Public Clients
    
    Note over Consts: CHAINS.ETHEREUM = "mainnet"<br/>CHAINS.GNOSIS = "gnosis"
    Note over Consts: PAYMENT_CHAINS.ETHEREUM = "payment_ethereum"<br/>PAYMENT_CHAINS.GNOSIS = "payment_gnosis"
    
    App->>Queries: fetchPayments()
    Queries->>GQL: Execute PAYMENTS_QUERY
    Note over Queries: Query uses payment_ethereum<br/>instead of payment_mainnet
    GQL->>Subgraph: payment_ethereum { payments(...) }
    GQL->>Subgraph: payment_gnosis { payments(...) }
    Subgraph-->>GQL: Payment data
    GQL-->>Queries: Formatted results
    Queries-->>App: Payment[]
    
    App->>Consts: Access PUBLIC_CLIENTS[CHAINS.ETHEREUM]
    Consts->>Viem: createPublicClient({ chain: mainnet })
    Note over Viem: Viem expects "mainnet" and "gnosis"<br/>as valid chain identifiers
    Viem-->>Consts: Public client instance
    Consts-->>App: Configured client
    
    App->>Consts: Access CHAIN_SCAN_URLS[CHAINS.ETHEREUM]
    Consts-->>App: "https://etherscan.io"
Loading

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +59 to +63
payment_ethereum {
payments(
where: { reference: $reference }
orderBy: timestamp
orderDirection: desc
where: { reference: $reference }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent parameter ordering: where comes after orderBy in payment_ethereum block, while all other blocks have where first.

Suggested change
payment_ethereum {
payments(
where: { reference: $reference }
orderBy: timestamp
orderDirection: desc
where: { reference: $reference }
payment_ethereum {
payments(
where: { reference: $reference }
orderBy: timestamp
orderDirection: desc
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/queries/request-payments.ts
Line: 59:63

Comment:
Inconsistent parameter ordering: `where` comes after `orderBy` in `payment_ethereum` block, while all other blocks have `where` first.

```suggestion
    payment_ethereum {
      payments(
        where: { reference: $reference }
        orderBy: timestamp
        orderDirection: desc
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +14 to +16
payment_arbitrum_one {
payments(
where: { reference: $reference }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent parameter ordering: where comes before orderBy in payment_arbitrum_one block, while the old payment_mainnet had it after. Consider keeping same order as other blocks.

Suggested change
payment_arbitrum_one {
payments(
where: { reference: $reference }
payment_arbitrum_one {
payments(
where: { reference: $reference }

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/queries/request-payments.ts
Line: 14:16

Comment:
Inconsistent parameter ordering: `where` comes before `orderBy` in `payment_arbitrum_one` block, while the old `payment_mainnet` had it after. Consider keeping same order as other blocks.

```suggestion
    payment_arbitrum_one {
      payments(
        where: { reference: $reference }
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@rodrigopavezi

Copy link
Copy Markdown
Contributor

Heads-up before this merges — I think it would break all payment data in production, and I'd rather flag it than let it land quietly. CI passing doesn't cover this, because nothing here actually queries Hasura.

The problem

The diff doesn't just rename TypeScript identifiers, it renames the Hasura remote-schema names inside the GraphQL documents, in five files:

-    payment_mainnet {          -    payment_xdai {
+    payment_ethereum {         +    payment_gnosis {

Those are wire names, not labels. If Hasura still exposes the remotes as payment_mainnet and payment_xdai, these documents ask for top-level fields that don't exist, Hasura fails validation for the whole document and returns data: null — so every payment query returns nothing on every chain, not just the renamed two.

Evidence that the remotes have not been renamed

From the production console on scan.request.network today, the SRF query fails with:

field 'singleRequestProxyDeployments' not found in type: 'payment_zksynceraQuery'

The query text in that same error contains payment_mainnet { … } and payment_xdai { … }. Hasura validates the entire document before executing, so if payment_xdai were an unknown field it would have been reported too. It wasn't — only zksyncera's inner field was. So payment_mainnet and payment_xdai are the names Hasura accepts right now.

An inconsistency that suggests the same conclusion

CHAINS keeps the wire value while renaming the key, which is exactly right:

ETHEREUM: "mainnet",   // key renamed, value preserved ✅

But PAYMENT_CHAINS changes the values, and CHAINS.GNOSIS changes "xdai""gnosis":

ETHEREUM = "payment_ethereum",   // ⚠️ was "payment_mainnet"
GNOSIS   = "payment_gnosis",     // ⚠️ was "payment_xdai"

CHAINS values are also matched against the network field coming back from the subgraphs and used to key CHAIN_SCAN_URLS and PUBLIC_CLIENTS. If the data still says xdai, those lookups miss and you lose the scan links and public client for Gnosis.

Suggested shape

The readability win is real and worth having — it just needs to stop at the identifiers:

  • Rename the keys freely: XDAIGNOSIS, MAINNETETHEREUM.
  • Keep every value exactly as the backend spells it: "xdai", "payment_xdai", "mainnet", "payment_mainnet".

That gives you CHAINS.GNOSIS / PAYMENT_CHAINS.ETHEREUM in the code with zero wire-format change. If the Hasura remotes are going to be renamed, then this PR is correct — but it has to land in lockstep with that change, not before it.

Context on overlap

#117 restructures these same five query files (one request per chain via Promise.allSettled, so one dead subgraph stops zeroing the other thirteen). I originally suggested merging this PR first to avoid conflicts, assuming it was a benign rename — I withdraw that, since it isn't. Happy to fold the identifier-only rename into #117 with credit to @pclaesen if that's easier than reworking this one; whichever you prefer.

@pclaesen

Copy link
Copy Markdown
Contributor Author

Fine for me, thanks @rodrigopavezi !

rodrigopavezi added a commit that referenced this pull request Jul 29, 2026
One unavailable subgraph currently destroys **all** payment data. Stacked on #116.

## On #114 — do not merge it first

This touches the same six files as #114 (`xdai → gnosis`, `mainnet → ethereum`). I originally suggested merging #114 first to avoid conflicts. **Having read it, I withdraw that.**

#114 renames the Hasura remote-schema names *inside the GraphQL documents* (`payment_xdai` → `payment_gnosis`, `payment_mainnet` → `payment_ethereum`). Production evidence says those remotes are still `payment_xdai`/`payment_mainnet`: the SRF validation error in the console today lists both in the query text and Hasura rejects only `payment_zksyncera`'s inner field — and Hasura validates the whole document, so an unknown top-level field would have been reported too.

So merging #114 as-is would take payment data from "broken on one chain" to "broken on every chain". Details and a suggested identifier-only fix are in a comment on #114. This PR does not need to wait for it.

## The problem, live in production right now

The payment and SRF queries were single GraphQL documents aliasing 11-14 chain remotes at once. Hasura returns `data: null` when any one remote errors, so a single unavailable chain destroyed the entire result:

```
fetchRequestPayments Error: subgraph not found: no allocations
field 'singleRequestProxyDeployments' not found in type: 'payment_zksynceraQuery'
```

Confirmed by loading the site: **`/payments` renders completely empty**, "Recent payments" shows "No data", and **every request page reports `Balance: 0`** no matter what was actually paid. Thirteen healthy chains were being discarded because of one.

For actual users this is worse than the 500 in #116 — an explorer that reports every request as unpaid.

## The fix

Each fan-out is now one request per chain via `Promise.allSettled`, merged through the existing unchanged formatters. A rejected chain is skipped and logged with its name; healthy chains still return data. Only a **total** failure of every chain throws — a full outage must not be indistinguishable from "no results", and #116's error states surface it.

Output is byte-identical when all chains are healthy.

**One thing worth knowing, preserved rather than "fixed":** today's behaviour is already per-chain top-N, not global top-N — `first: 10` across 14 chains can return 140 rows, because the formatters merge and sort but never apply a global slice. Changing that would alter visible row counts and pagination, so it deserves its own decision rather than riding along here.

## Also here

- **Dropped `payment_zksyncera` from the SRF queries only** — that subgraph genuinely lacks the `singleRequestProxyDeployments` entity, so querying it could only ever error. Expressed as data in `consts.ts` via the pre-existing but unused `PAYMENT_CHAINS` enum. Note `SRF_CHAIN_REMOTES` is *not* "all chains minus zksyncera": the SRF queries never covered fantom, fuse or moonbeam, so an explicit list was the only way to preserve today's coverage exactly.
- **`hooks/payments.ts` was a byte-for-byte duplicate** of `queries/payments.ts` whose `fetchPayments` swallowed errors and returned `[]`, making failure indistinguishable from empty at the query layer. Nothing imports it; it is now a thin re-export rather than a second copy of the same bug.
- **A CI smoke check** that actually serves the app and requests `/request/<id>`, failing on 5xx. This is the signal that was missing for #116's bug: `next build` only compiles that route, `npm run check` is formatting only, and there are no tests. Dummy env, no secrets, polls for readiness rather than sleeping.

## Trade-off, accepted deliberately

Up to **14 parallel HTTP round-trips** per logical query instead of 1. `revalidate: 60` and Hasura's `@cached` blunt it, and no batching layer or dependency was added. Worth watching Hasura rate limits.

## Not addressed

- **`queries/transactions.ts` and `address-transactions.ts` have the identical fragility** against the two *storage* remotes — if `storage_sepolia` is down, mainnet requests vanish too. Left alone to keep this diff scoped; they need the same treatment.
- **Restoring the missing subgraph is upstream indexer work**, not a change in this repo (likely `payments-subgraph` / indexer allocations). This PR stops one dead chain from zeroing the UI; it does **not** bring the data back. `Balance: 0` will persist until the subgraph is served again.

## Verification

`npm run build` ✅, `tsc --noEmit` clean, biome clean, built query documents validated through `graphql.parse`. **Not verified:** happy-path merge against live data — the local Hasura URL is a stand-in, so this is verified by construction and by its degradation behaviour, not against production data.
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.

On the payments table, Blockchain column, for payments on gnosis, display "gnosis", not "xdai"

3 participants