Skip to content

Commit

Permalink
Merge pull request #105 from subquery/fix/rpc
Browse files Browse the repository at this point in the history
Fix/rpc
  • Loading branch information
HuberTRoy authored Apr 19, 2024
2 parents b275718 + 1cc6589 commit 8e2c463
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions src/conf/rainbowConf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,49 @@ import { publicProvider } from 'wagmi/providers/public';

import '@rainbow-me/rainbowkit/styles.css';

// goerli and mainnet just for get data actually not supported
const supportedChains =
process.env.REACT_APP_NETWORK === 'testnet'
? [baseSepolia, sepolia]
: [
{
...base,
rpcUrls: {
default: {
http: [base.rpcUrls.default.http]
},
public: {
http: [base.rpcUrls.default.http]
},
fallback: {
http: base.rpcUrls.default.http
}
}
},
{
...mainnet,
rpcUrls: {
default: {
http: [mainnet.rpcUrls.default.http]
},
public: {
http: [mainnet.rpcUrls.default.http]
},
fallback: {
http: mainnet.rpcUrls.default.http
}
}
}
];
const testnetSupportedChains = [baseSepolia, sepolia];
const prodSupportedChains = [
{
...base,
rpcUrls: {
default: {
http: [...base.rpcUrls.default.http]
},
public: {
http: [...base.rpcUrls.default.http]
},
fallback: {
http: base.rpcUrls.default.http
}
}
},
{
...mainnet,
rpcUrls: {
default: {
http: [...mainnet.rpcUrls.default.http]
},
public: {
http: [...mainnet.rpcUrls.default.http]
},
fallback: {
http: mainnet.rpcUrls.default.http
}
}
}
];

const supportedChains = process.env.REACT_APP_NETWORK === 'testnet' ? testnetSupportedChains : prodSupportedChains;

// This should ok. It seems is a bug of Ts.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { chains, publicClient } = configureChains(supportedChains, [publicProvider()]);

// add two check, these two only be used for ts check, not elegant, but works
configureChains(testnetSupportedChains, [publicProvider()]);
configureChains(prodSupportedChains, [publicProvider()]);

const connectors = connectorsForWallets([
{
groupName: 'Recommended',
Expand Down

0 comments on commit 8e2c463

Please sign in to comment.