Skip to content

Commit 987259a

Browse files
Glory MatthewGlory Matthew
authored andcommitted
M2: Wire frontend to mainnet — env-driven network and contract address
- CONTRACT_ADDRESS reads from NEXT_PUBLIC_CONTRACT_ADDRESS env var - Default network switches to mainnet (was hardcoded testnet) - Explorer links no longer hardcode chain=testnet - .env.local (testnet) and .env.production (mainnet) templates added - Both files gitignored to protect future secrets - Frontend builds clean (verified)
1 parent f1611d5 commit 987259a

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

web/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
.vercel
2+
.next/
3+
node_modules/
4+
.env.local
5+
.env.production
6+
.env.*.local

web/src/components/flash-loan/FlashLoanForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useState, useEffect } from "react";
3+
import { useState } from "react";
44
import { useStacks } from "@/lib/hooks/useStacks";
55
import { useFlashLoan } from "@/lib/hooks/useFlashLoan";
66
import { useProtocolStats } from "@/lib/hooks/useProtocolStats";
@@ -158,7 +158,7 @@ export function FlashLoanForm() {
158158
<p className="text-green-400 text-sm font-medium">Transaction submitted</p>
159159
{txId && (
160160
<a
161-
href={`https://explorer.hiro.so/txid/${txId}?chain=testnet`}
161+
href={`https://explorer.hiro.so/txid/${txId}`}
162162
target="_blank"
163163
rel="noopener noreferrer"
164164
className="text-green-400/80 text-xs underline mt-1 block"

web/src/lib/providers/StacksProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const StacksContext = createContext<StacksContextValue | null>(null);
2323
export function StacksProvider({ children }: { children: React.ReactNode }) {
2424
const [isWalletConnected, setIsWalletConnected] = useState(false);
2525
const [stxAddress, setStxAddress] = useState<string | null>(null);
26-
const [network, setNetwork] = useState<NetworkType>("testnet");
26+
const [network, setNetwork] = useState<NetworkType>(
27+
(process.env.NEXT_PUBLIC_NETWORK as NetworkType) ?? "mainnet"
28+
);
2729

2830
const hydrateFromStorage = useCallback(() => {
2931
if (typeof window === "undefined") return;

web/src/lib/stacks/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { STACKS_TESTNET, STACKS_MAINNET, StacksNetwork } from "@stacks/network";
22

33
export type NetworkType = "testnet" | "mainnet";
44

5-
export const CONTRACT_ADDRESS = "ST3JAZD8CJ9XX3WNN2G61C7HD4RY333MRKPR5JGW7";
5+
// Mainnet deployer address — update after mainnet deployment
6+
export const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS ?? "SP3JAZD8CJ9XX3WNN2G61C7HD4RY333MRKPR5JGW7";
67
export const CONTRACT_NAME = "flashstack-core";
78

89
export const RECEIVER_CONTRACTS = [

0 commit comments

Comments
 (0)