Skip to content

Commit

Permalink
chore: removed hardcoded network
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 committed Dec 31, 2024
1 parent 8390b7b commit 2ce732f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
7 changes: 2 additions & 5 deletions templates/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { FuelProvider } from "@fuels/react";
import React, { ReactNode, useEffect, useState } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ToastContainer } from "react-toastify";
import { FuelConnector, Network, Provider } from "fuels";
import { FuelConnector, Provider } from "fuels";
import { defaultConnectors } from "@fuels/connectors";

import { chainId, providerUrl } from "../lib";
import { providerUrl } from "../lib";

import "react-toastify/dist/ReactToastify.css";
import "@/styles/globals.css";
Expand All @@ -19,8 +19,6 @@ const connectors: FuelConnector[] = defaultConnectors({
fuelProvider: Provider.create(providerUrl),
});

const networks: Network[] = [{ url: providerUrl, chainId }];

interface RootLayoutProps {
children: ReactNode;
}
Expand Down Expand Up @@ -48,7 +46,6 @@ export default function RootLayout({ children }: RootLayoutProps) {
theme="dark"
fuelConfig={{ connectors }}
uiConfig={{ suggestBridge: false }}
networks={networks}
>
{" "}
<ToastContainer theme="dark" />
Expand Down
1 change: 0 additions & 1 deletion templates/nextjs/src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const isTestnet = environment === environments.TESTNET;
export const localProviderUrl = `http://127.0.0.1:${process.env.VITE_FUEL_NODE_PORT || 4000}/v1/graphql`;
export const testnetProviderUrl = "https://testnet.fuel.network/v1/graphql";
export const providerUrl = isLocal ? localProviderUrl : testnetProviderUrl;
export const chainId = 0; // Local and testnet are both on chain 0
export const playgroundUrl = providerUrl.replace("v1/graphql", "v1/playground");

export const localContractId = contractIds.testContract;
Expand Down
1 change: 0 additions & 1 deletion templates/vite/src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const isTestnet = environment === environments.TESTNET;
export const localProviderUrl = `http://127.0.0.1:${process.env.VITE_FUEL_NODE_PORT || 4000}/v1/graphql`;
export const testnetProviderUrl = "https://testnet.fuel.network/v1/graphql";
export const providerUrl = isLocal ? localProviderUrl : testnetProviderUrl;
export const chainId = 0; // Local and testnet are both on chain 0
export const playgroundUrl = providerUrl.replace("v1/graphql", "v1/playground");

export const localContractId = contractIds.testContract;
Expand Down
7 changes: 2 additions & 5 deletions templates/vite/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { FuelProvider } from "@fuels/react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ToastContainer } from "react-toastify";
import { FuelConnector, Network, Provider } from "fuels";
import { FuelConnector, Provider } from "fuels";

import App from "./App.tsx";
import { chainId, providerUrl } from "./lib.tsx";
import { providerUrl } from "./lib.tsx";

import "react-toastify/dist/ReactToastify.css";
import "./index.css";
Expand All @@ -19,16 +19,13 @@ const connectors: FuelConnector[] = defaultConnectors({
fuelProvider: Provider.create(providerUrl),
});

const networks: Network[] = [{ url: providerUrl, chainId }];

createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<FuelProvider
theme="dark"
fuelConfig={{ connectors }}
uiConfig={{ suggestBridge: false }}
networks={networks}
>
<App />
<ToastContainer theme="dark" />
Expand Down

0 comments on commit 2ce732f

Please sign in to comment.