Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
"lint": "next lint"
},
"dependencies": {
"@thirdweb-dev/react": "^3",
"@thirdweb-dev/sdk": "^3",
"@thirdweb-dev/chains": "^0.1.10",
"@thirdweb-dev/react": "^3.11.4",
"@thirdweb-dev/sdk": "^3.10.7",
"@thirdweb-dev/storage": "^1.0.6",
"ethers": "^5.6.8",
"next": "^12.1.6",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"eslint": "8.11.0",
Expand Down
4 changes: 2 additions & 2 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import Header from "../components/Header";
import "../styles/globals.css";

// This is the chainId your dApp will work on.
const activeChainId = ChainId.Goerli;
const activeChain = "goerli";

function MyApp({ Component, pageProps }) {
return (
<ThirdwebProvider desiredChainId={activeChainId}>
<ThirdwebProvider activeChain={activeChain}>
<Header />
<Component {...pageProps} />
</ThirdwebProvider>
Expand Down
9 changes: 5 additions & 4 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import {
useContract,
useNetwork,
useSwitchChain,
useNetworkMismatch,
useAddress,
useSDK,
Expand All @@ -12,11 +12,12 @@ import { ChainId, NATIVE_TOKEN_ADDRESS } from "@thirdweb-dev/sdk";
import { useRouter } from "next/router";
import { useRef } from "react";
import styles from "../styles/Theme.module.css";
import { Goerli } from "@thirdweb-dev/chains";

const Create = () => {
const address = useAddress();
const networkMismatch = useNetworkMismatch();
const [, switchNetwork] = useNetwork();
const switchNetwork = useSwitchChain();
const sdk = useSDK();

const [creatingListing, setCreatingListing] = useState(false);
Expand Down Expand Up @@ -59,7 +60,7 @@ const Create = () => {

// Ensure user is on the correct network
if (networkMismatch) {
switchNetwork?.(ChainId.Goerli);
switchNetwork(Goerli.chainId);
return;
}

Expand Down Expand Up @@ -107,7 +108,7 @@ const Create = () => {

// If the transaction succeeds, take the user back to the homepage to view their listing!
if (transactionResult) {
router.push(`/`);
router.push('/');
}
} catch (error) {
console.error(error);
Expand Down
Loading