fix(node-operators): replace Moralis holder lookup - #46
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes /node-operators rendering by replacing the failing Moralis-based NFT owner pagination with on-chain pagination via the existing Reader contract, and simplifies build/deploy configuration by removing Moralis-related plumbing.
Changes:
- Replace the
/node-operatorsholder fetch to use Reader pagination and cache results server-side for 5 minutes. - Remove the now-unused
/api/license-holdersAPI route. - Remove Moralis dependency and related Docker/workflow build arguments and secrets wiring.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| package.json | Removes the Moralis dependency from runtime dependencies. |
| package-lock.json | Removes Moralis and its transitive dependencies from the lockfile. |
| lib/api/blockchain.ts | Implements Reader-based pagination to fetch all license holders in bounded pages. |
| app/node-operators/page.tsx | Switches node operators holder retrieval to cached Reader-based holder data. |
| app/api/license-holders/route.ts | Deletes the obsolete Moralis-backed license holders API route. |
| Dockerfile_devnet | Removes MORALIS_API_KEY build arg/env wiring. |
| Dockerfile_testnet | Removes MORALIS_API_KEY build arg/env wiring. |
| Dockerfile_mainnet | Removes MORALIS_API_KEY build arg/env wiring. |
| .github/workflows/release.yml | Removes MORALIS_API_KEY from build env. |
| .github/workflows/build_testnet_mainnet.yml | Removes MORALIS_API_KEY from Docker build args. |
| .github/workflows/build_devnet.yml | Removes MORALIS_API_KEY from Docker build args. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+484
to
+488
| let totalLicenses = 0; | ||
|
|
||
| do { | ||
| const response = await Moralis.EvmApi.nft.getNFTOwners({ | ||
| chain: evmChain, | ||
| format: 'decimal', | ||
| cursor, | ||
| address, | ||
| limit: 100, | ||
| const page = await getLicensesPage(offset, LICENSE_HOLDERS_BATCH_SIZE); | ||
| totalLicenses = Number(page.mndTotalSupply + page.ndTotalSupply); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/node-operatorswith the existing Reader contractRoot cause
Moralis returns the first 100 ND owners on Base mainnet, but rejects the returned cursor on the next request with
400 cursor is not valid. That makes/api/license-holdersfail and prevents/node-operatorsfrom rendering.Validation
npm run lintnpm run build:mainnet/node-operators: HTTP 200 and populated list (49 unique holders)npm ls moralis @moralisweb3/common-core --depth=0: emptyNotes
The existing branding-logo endpoint still returns 400 for operators without a configured logo; this is unrelated and falls back to the existing placeholder UI.