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
1 change: 1 addition & 0 deletions frontend/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
return (
<QueryClientProvider client={queryClient}>
<SuiClientProvider networks={networkConfig} defaultNetwork="mainnet">
<RegisterEnokiWallets />
<WalletProvider>
<WalletPersistenceManager>
{children}
Expand Down
22 changes: 12 additions & 10 deletions frontend/src/components/RegisterEnokiWallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

import { useSuiClientContext } from "@mysten/dapp-kit";
import { isEnokiNetwork, registerEnokiWallets } from "@mysten/enoki";
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { useEffect } from "react";

export function RegisterEnokiWallets() {
const { client, network } = useSuiClientContext();
// We force Testnet for Enoki as per requirement, even if app is on Mainnet
const enokiNetwork = "testnet";

// Create a dedicated client for Enoki on Testnet
const enokiClient = new SuiClient({ url: getFullnodeUrl(enokiNetwork) });

useEffect(() => {
if (!isEnokiNetwork(network)) {
console.log("Enoki: Current network is not supported", network);
return;
}

// We skip the isEnokiNetwork check since we are forcing a supported network (testnet)

const apiKey = process.env.NEXT_PUBLIC_ENOKI_API_KEY;
if (!apiKey || apiKey.startsWith("YOUR_")) {
console.error("Enoki: Invalid API Key configuration. Please check your .env.local file.");
}

console.log("Enoki: Registering wallets for network", network);
console.log("Enoki: Registering wallets for network", enokiNetwork);

const { unregister } = registerEnokiWallets({
apiKey: process.env.NEXT_PUBLIC_ENOKI_API_KEY || "YOUR_PUBLIC_ENOKI_API_KEY",
Expand All @@ -33,12 +35,12 @@ export function RegisterEnokiWallets() {
clientId: process.env.NEXT_PUBLIC_TWITCH_CLIENT_ID || "YOUR_TWITCH_CLIENT_ID",
},
},
client,
network,
client: enokiClient,
network: enokiNetwork,
});

return unregister;
}, [client, network]);
}, []);

return null;
}
5 changes: 4 additions & 1 deletion frontend/src/components/WalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ export function WalletModal({ isOpen }: WalletModalProps) {
</div>

{/* Connect Button */}
<div className="pt-4">
<div className="pt-4 space-y-3">
<div className="font-pixel text-base flex justify-center">
<ConnectButton />
</div>
<p className="text-center text-xs text-yellow-500/80 font-mono">
⚠ Social Logins (Google, etc.) available on Testnet only
</p>
</div>

{/* Bottom Info */}
Expand Down