File size: 787 Bytes
78d0e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// This is a placeholder until we fetch the real config
export const config = {
  tokenContract: "",
  healthRegistry: "",
  donationRouter: "",
  chainId: "56", // Default to BNB Chain
}

// Function to fetch contract addresses from server
export async function fetchContractConfig() {
  try {
    const response = await fetch("/api/contracts")
    if (!response.ok) {
      throw new Error("Failed to fetch contract configuration")
    }
    const data = await response.json()
    return {
      tokenContract: data.flbToken,
      healthRegistry: data.healthRegistry,
      donationRouter: data.donationRouter,
      chainId: data.chainId,
    }
  } catch (error) {
    console.error("Error fetching contract config:", error)
    return config // Return default config on error
  }
}