-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
import { graphql } from '@quest-chains/sdk'; | ||
|
||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
export const INFURA_ID = process.env.NEXT_PUBLIC_INFURA_ID!; | ||
import { EnvironmentError } from './errors'; | ||
|
||
export const SUPPORTED_NETWORKS = process.env | ||
.NEXT_PUBLIC_SUPPORTED_NETWORKS!.split(' ') | ||
.filter(n => !!n && !Number.isNaN(Number(n))) | ||
.map(n => `0x${Number(n).toString(16)}`) | ||
.filter(n => graphql.SUPPORTED_NETWORKS.includes(n)); | ||
if (!process.env.NEXT_PUBLIC_INFURA_ID) | ||
throw new EnvironmentError('NEXT_PUBLIC_INFURA_ID'); | ||
|
||
export const INFURA_ID = process.env.NEXT_PUBLIC_INFURA_ID; | ||
|
||
if (!process.env.NEXT_PUBLIC_SUPPORTED_NETWORKS) | ||
throw new EnvironmentError('NEXT_PUBLIC_SUPPORTED_NETWORKS'); | ||
|
||
export const SUPPORTED_NETWORKS = | ||
process.env.NEXT_PUBLIC_SUPPORTED_NETWORKS.split(' ') | ||
.filter(n => !!n && !Number.isNaN(Number(n))) | ||
.map(n => `0x${Number(n).toString(16)}`) | ||
.filter(n => graphql.SUPPORTED_NETWORKS.includes(n)); | ||
|
||
export const API_URL = | ||
process.env.NEXT_PUBLIC_API_URL || 'https://api.questchains.xyz'; | ||
|
||
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; | ||
|
||
export const QUESTCHAINS_URL = | ||
process.env.NEXT_PUBLIC_QUESTCHAINS_URL || 'https://questchains.xyz'; | ||
process.env.NEXT_PUBLIC_QUESTCHAINS_URL || 'https://app.questchains.xyz'; | ||
|
||
export const PLAUSIBLE_DATA_DOMAIN = | ||
process.env.NEXT_PUBLIC_PLAUSIBLE_DATA_DOMAIN || 'app.questchains.xyz'; | ||
|
||
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export class EnvironmentError extends Error { | ||
public errorType = 'EnvironmentError'; | ||
|
||
constructor(envVar: string) { | ||
super(`Invalid/Missing environment variable: "${envVar}"`); | ||
} | ||
} |