Skip to content

Enable NFT tab on Rootstock#791

Merged
kvhnuke merged 1 commit intoenkryptcom:devop/release-v2-17from
ahsan-javaiid:feat/nft/rootstock
Apr 6, 2026
Merged

Enable NFT tab on Rootstock#791
kvhnuke merged 1 commit intoenkryptcom:devop/release-v2-17from
ahsan-javaiid:feat/nft/rootstock

Conversation

@ahsan-javaiid
Copy link
Copy Markdown
Contributor

@ahsan-javaiid ahsan-javaiid commented Mar 27, 2026

Description

This pull request enables NFT tab on Rootstock network.

  • Users will be able to view the minted NFT's in enkrypt on Rootstock
  • Users will be able to send / receive NFT's on Rootstock

Demo

rootstock-nft.mp4

How to test

  • Already minted NFT's can be seen by clicking NFT tab keeping Rootstock network selected
  • To mint new NFT on Rootstock visit: https://nfts2me.com

Summary by CodeRabbit

  • New Features
    • Added support for viewing NFT collections on the Rootstock network via Blockscout: collection-level details, per-asset entries, images (IPFS gateway fallback), and links to token instances.
    • Collection descriptions fetched from on-chain metadata when available; unnamed tokens/assets show sensible fallbacks.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8912d93b-584d-4add-8dbb-16e0c817ccc7

📥 Commits

Reviewing files that changed from the base of the PR and between 0c34b2a and 7f1cf13.

📒 Files selected for processing (3)
  • packages/extension/src/libs/nft-handlers/blockscout.ts
  • packages/extension/src/libs/nft-handlers/types/blockscout.ts
  • packages/extension/src/providers/ethereum/networks/rsk.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/extension/src/libs/nft-handlers/types/blockscout.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/extension/src/providers/ethereum/networks/rsk.ts
  • packages/extension/src/libs/nft-handlers/blockscout.ts

Walkthrough

Adds a Blockscout-based NFT handler for Rootstock that fetches ERC-721 collections from Blockscout, maps results to NFTCollection/NFTItem shapes, resolves contractURI metadata via a Rootstock RPC node, and includes new TypeScript types for Blockscout responses; integrates the handler into the Rootstock network config.

Changes

Cohort / File(s) Summary
Blockscout NFT handler & types
packages/extension/src/libs/nft-handlers/blockscout.ts, packages/extension/src/libs/nft-handlers/types/blockscout.ts
New default-exported async NFT handler for Rootstock that queries Blockscout ERC‑721 collections (cached 60s), maps to NFTCollection/NFTItem, converts ipfs:// URIs, and attempts contractURI resolution via a Rootstock RPC node. Adds Blockscout-related TS types (BlockscoutNFTItem, Token, TokenInstance, TokenMetadata, Attribute).
Rootstock network configuration
packages/extension/src/providers/ethereum/networks/rsk.ts
Registers the new Blockscout NFT handler on the Rootstock EvmNetwork options (NFTHandler property).

Sequence Diagram

sequenceDiagram
    participant Client
    participant NFTHandler as NFT Handler<br/>(Blockscout)
    participant BlockscoutAPI as Blockscout API
    participant RootstockRPC as Rootstock RPC

    Client->>NFTHandler: request NFTs(network, address)
    NFTHandler->>NFTHandler: validate network == Rootstock
    NFTHandler->>BlockscoutAPI: fetch ERC-721 collections (cached)
    BlockscoutAPI-->>NFTHandler: return items[]
    alt items present
        loop each collection
            NFTHandler->>RootstockRPC: call contractURI(contract)
            RootstockRPC-->>NFTHandler: return URI (maybe ipfs://)
            NFTHandler->>NFTHandler: convert ipfs to gateway URL
            NFTHandler->>NFTHandler: fetch collection metadata JSON
            NFTHandler->>NFTHandler: extract description -> collection.description
        end
    end
    NFTHandler-->>Client: return NFTCollection[]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • kvhnuke
  • gamalielhere
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: enabling NFT functionality on Rootstock, which is confirmed by the file summaries showing new Blockscout NFT handler implementation and Rootstock network configuration updates.
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 unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/extension/src/libs/nft-handlers/blockscout.ts (1)

7-7: Avoid hardcoding the metadata RPC endpoint.

Using ROOTSTOCK_RPC_NODE directly bypasses network configuration and makes this handler harder to evolve (e.g., environment-specific RPC routing). Prefer passing/deriving the RPC endpoint from network config with an explicit fallback.

Also applies to: 27-27

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/extension/src/libs/nft-handlers/blockscout.ts` at line 7, The
constant ROOTSTOCK_RPC_NODE is hardcoded; change the handler to obtain the RPC
endpoint from the network/config input with a fallback to the current
'https://public-node.rsk.co'. Update the symbol ROOTSTOCK_RPC_NODE usage so the
handler reads an endpoint option from the network config or function parameters
(e.g., a passed-in rpcUrl or network.rpcUrl) and only uses the hardcoded URL as
the default; ensure all places referencing ROOTSTOCK_RPC_NODE (including the
other occurrence around the symbol on line ~27) are switched to use the
derived/configured endpoint.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/extension/src/libs/nft-handlers/blockscout.ts`:
- Around line 29-33: The code awaits contract.contractURI() and fetch(httpUrl)
with no timeouts, which can hang; wrap both calls with bounded timeouts and
return null on timeout. For contract.contractURI(), use a Promise.race that
rejects or resolves to null after X ms (e.g., 5s) and handle that case in the
same way as the existing error path; for fetch(httpUrl) use an AbortController
with the same timeout to abort the request and treat aborted/timeout as null.
Update the block that calls contract.contractURI() and getAssetURL/ fetch to use
these timeout helpers and ensure the catch path still returns null on timeout or
error.
- Around line 41-44: The exported default async NFT handler currently declares
its first parameter as network: NodeType but must match the
EvmNetworkOptions.NFTHandler contract which expects network: BaseNetwork; update
the function signature (the default exported async function that returns
Promise<NFTCollection[]>) to accept network: BaseNetwork instead of NodeType so
the types align with EvmNetworkOptions and downstream callers.

---

Nitpick comments:
In `@packages/extension/src/libs/nft-handlers/blockscout.ts`:
- Line 7: The constant ROOTSTOCK_RPC_NODE is hardcoded; change the handler to
obtain the RPC endpoint from the network/config input with a fallback to the
current 'https://public-node.rsk.co'. Update the symbol ROOTSTOCK_RPC_NODE usage
so the handler reads an endpoint option from the network config or function
parameters (e.g., a passed-in rpcUrl or network.rpcUrl) and only uses the
hardcoded URL as the default; ensure all places referencing ROOTSTOCK_RPC_NODE
(including the other occurrence around the symbol on line ~27) are switched to
use the derived/configured endpoint.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 19ec784f-1891-4405-8013-c1eeec9219e2

📥 Commits

Reviewing files that changed from the base of the PR and between c65a4f7 and 0c34b2a.

📒 Files selected for processing (3)
  • packages/extension/src/libs/nft-handlers/blockscout.ts
  • packages/extension/src/libs/nft-handlers/types/blockscout.ts
  • packages/extension/src/providers/ethereum/networks/rsk.ts

@kvhnuke kvhnuke changed the base branch from develop to devop/release-v2-17 April 6, 2026 21:55
@kvhnuke kvhnuke merged commit 37156e9 into enkryptcom:devop/release-v2-17 Apr 6, 2026
2 of 4 checks passed
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