-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththirdweb.ts
More file actions
44 lines (37 loc) · 1.33 KB
/
thirdweb.ts
File metadata and controls
44 lines (37 loc) · 1.33 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { createThirdwebClient, getContract } from "thirdweb";
import { etherlinkTestnet } from "thirdweb/chains";
import { USDT_CONTRACT_ADDRESS } from "./addresses";
export const chain = etherlinkTestnet;
// Use environment variables with fallbacks for development
// In production builds, these should be set via EAS build configuration
const clientId = "e815b7bc8066484753033e49b5f637f8";
const secretKey =
"TLTWULf6K5QRGeh9Oh3nmeoqXRBJmCBMUy9B_RCid_NfmRSjV85xIYXmRmBwQKZ0ApGZAPOdfw0psbKEUm5mcA";
// Log the environment for debugging (remove in production)
console.log("Thirdweb Environment Check:", {
hasClientId: !!clientId,
hasSecretKey: !!secretKey,
nodeEnv: process.env.NODE_ENV,
isProduction: process.env.NODE_ENV === "production",
});
// Validate that we have the required credentials
if (!clientId) {
console.error(
"Missing EXPO_PUBLIC_THIRDWEB_CLIENT_ID - make sure to set it in your .env file or EAS build configuration"
);
}
if (!secretKey) {
console.error(
"Missing EXPO_PUBLIC_THIRDWEB_SECRET_KEY - make sure to set it in your .env file or EAS build configuration"
);
}
// Create client with better error handling
export const client = createThirdwebClient({
clientId: clientId,
secretKey: secretKey,
});
export const usdcContract = getContract({
client,
address: USDT_CONTRACT_ADDRESS,
chain: chain,
});