Skip to content

Commit

Permalink
change to frontend specific RPC env
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Jul 16, 2024
1 parent a5cb288 commit f95b772
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { configureChains, createConfig, WagmiConfig } from "wagmi";
import { InjectedConnector } from "wagmi/connectors/injected";
import { Chain, Wallet, connectorsForWallets } from "@rainbow-me/rainbowkit";
import { ChainSetting } from "./main";
import { rpcUrl } from "./constants/urls";

function App() {
const chainSetting = useLoaderData() as ChainSetting
Expand All @@ -31,8 +32,9 @@ function App() {
symbol: chainSetting.denom,
},
rpcUrls: {
public: { http: [chainSetting.rpcUrl] },
default: { http: [chainSetting.rpcUrl] },
public: { http: [rpcUrl] },
default: { http: [rpcUrl] },
private: { http: [chainSetting.rpcUrl] }
},
} as const satisfies Chain;

Expand Down Expand Up @@ -65,7 +67,7 @@ function App() {
[
jsonRpcProvider({
rpc: (chain) => ({
http: chainSetting.rpcUrl
http: rpcUrl
}),
}),
]
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/constants/urls.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const baseUrl = `${import.meta.env.VITE_SUBNET_URL}`;
export const baseUrl = `${import.meta.env.VITE_SUBNET_URL}`;
export const rpcUrl = `${import.meta.env.FRONTEND_SUBNET_RPC}`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import InfoList from "@/components/info-list/InfoList";
import Loader from "@/components/loader/Loader";
import { formatHash } from "@/utils/formatter";
import { useAccount, useBalance, useNetwork } from "wagmi";
import { rpcUrl } from "@/constants/urls";
export default function ManagementLoggedInPage() {

const [isLoading, setIsLoading] = useState(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ErrorTypes } from "@/pages/errors";

import type { InfoListInfo } from "@/types/info";
import { ChainSetting } from "@/main";
import { rpcUrl } from "@/constants/urls";
interface LoginErrorProps {
errorType: ErrorTypes;
chainSetting: ChainSetting;
Expand Down Expand Up @@ -44,7 +45,7 @@ export default function LoginError({ errorType, chainSetting }: LoginErrorProps)
<br></br>
<b>Network name:</b> {chainSetting.networkName}
<br></br>
<b>New RPC URL:</b> {chainSetting.rpcUrl}
<b>New RPC URL:</b> {rpcUrl}
<br></br>
<b>Chain ID:</b> {chainSetting.networkId}
<br></br>
Expand Down

0 comments on commit f95b772

Please sign in to comment.