forked from thirdweb-dev/js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.ts
40 lines (37 loc) · 1.16 KB
/
client.ts
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
import { createThirdwebClient } from "thirdweb";
import { setThirdwebDomains } from "thirdweb/utils";
setThirdwebDomains({
inAppWallet: process.env.NEXT_PUBLIC_IN_APP_WALLET_URL,
rpc: process.env.NEXT_PUBLIC_RPC_URL,
social: process.env.NEXT_PUBLIC_SOCIAL_URL,
storage: process.env.NEXT_PUBLIC_STORAGE_URL,
bundler: process.env.NEXT_PUBLIC_BUNDLER_URL,
pay: process.env.NEXT_PUBLIC_PAY_URL,
analytics: process.env.NEXT_PUBLIC_ANALYTICS_URL,
});
const isDev =
process.env.NODE_ENV === "development" ||
process.env.NEXT_PUBLIC_RPC_URL?.endsWith(".thirdweb-dev.com");
export const THIRDWEB_CLIENT = createThirdwebClient(
process.env.THIRDWEB_SECRET_KEY
? {
secretKey: process.env.THIRDWEB_SECRET_KEY,
config: {
storage: isDev
? {
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
}
: undefined,
},
}
: {
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
config: {
storage: isDev
? {
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
}
: undefined,
},
},
);