Skip to content

Commit

Permalink
fix marketplace (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus authored Feb 16, 2024
1 parent a3bb1dd commit bafca17
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions marketplace/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@ import "./globals.css";
import { MintbaseWalletContextProvider } from "@mintbase-js/react";
import { QueryClient, QueryClientProvider } from "react-query";
import Header from "@/components/header";
import { mbjs } from "@mintbase-js/sdk";

const inter = Inter({ subsets: ["latin"] });

const MintbaseWalletSetup = {
contractAddress: "hellovirtualworld.mintspace2.testnet",
network: "testnet",
callbackUrl: "http://localhost:3000",
};
export const isDev = process.env.NEXT_PUBLIC_ENV === 'dev'

export const getCallbackUrl = () => {
let callbackUrl = ''

if (typeof window !== 'undefined') {
callbackUrl =
isDev || window?.location?.host.includes('localhost')
? `http://${window?.location.host}`
: `}`
}

return callbackUrl
}


export default function RootLayout({
children,
Expand All @@ -24,6 +35,16 @@ export default function RootLayout({
}) {
const queryClient = new QueryClient();

mbjs.config({
network: process.env.NEXT_PUBLIC_NETWORK || 'testnet'
})

const MintbaseWalletSetup = {
contractAddress: "hellovirtualworld.mintspace2.testnet",
network: "testnet",
callbackUrl: getCallbackUrl(),
};

return (
<QueryClientProvider client={queryClient}>
<MintbaseWalletContextProvider {...MintbaseWalletSetup}>
Expand Down

0 comments on commit bafca17

Please sign in to comment.