diff --git a/gatsby-node.js b/gatsby-node.js index 12a825855..83424c2e4 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,5 +1,3 @@ -const path = require("path"); -const webpack = require("webpack"); const { createRemoteFileNode } = require("gatsby-source-filesystem"); const fetch = require("node-fetch"); @@ -42,21 +40,23 @@ exports.sourceNodes = async ({ return acc; }, Promise.resolve({})); - chains.forEach((chain) => { - const icon = chain.icon; - const iconCid = iconFiles[icon]?.name; - const node = { - ...chain, - icon: iconCid, - parent: null, - children: [], - id: createNodeId(`chain__${chain.chainId}`), - internal: { - type: "Chain", - content: JSON.stringify(chain), - contentDigest: createContentDigest(chain), - }, - }; - createNode(node); - }); + chains + .filter((chain) => chain.rpc.length > 0) + .forEach((chain) => { + const icon = chain.icon; + const iconCid = iconFiles[icon]?.name; + const node = { + ...chain, + icon: iconCid, + parent: null, + children: [], + id: createNodeId(`chain__${chain.chainId}`), + internal: { + type: "Chain", + content: JSON.stringify(chain), + contentDigest: createContentDigest(chain), + }, + }; + createNode(node); + }); }; diff --git a/src/context/Web3Context.tsx b/src/context/Web3Context.tsx index b804600d6..be7b4ad7f 100644 --- a/src/context/Web3Context.tsx +++ b/src/context/Web3Context.tsx @@ -66,13 +66,16 @@ export const Web3Provider = ({ children }) => { if (!provider) { return; } + const { nativeCurrency, explorers } = chain; + const blockExplorerUrls = + explorers && explorers.length > 0 ? explorers.map((e) => e.url) : null; provider.send("wallet_addEthereumChain", [ { chainId: `0x${chain.chainId.toString(16)}`, chainName: chain.name, - nativeCurrency: chain.nativeCurrency, + nativeCurrency, rpcUrls: chain.rpc, - blockExplorerUrls: chain.explorers?.map((e) => e.url), + blockExplorerUrls, }, ]); };