-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
61 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
PORT=string | ||
NETWORK=string # See 'SupportedNetwork' type. | ||
PUBLIC_API_KEYS=string # comma-separated list of strings | ||
DRIPS_API_KEY=string | ||
INFURA_API_KEY=string | ||
POSTGRES_CONNECTION_STRING=string | ||
REPO_DRIVER_ADDRESS=string # optional, defaults to mainnet address of latest deployment | ||
DRIPS_ADDRESS=string # optional, defaults to mainnet address of latest deployment | ||
RPC_URL=string # optional, defaults to infura mainnet | ||
PRETEND_ALL_REPOS_EXIST=boolean # true or false. If true, app will always assume all GitHub repos exist. Used in E2E tests. Defaults to false. | ||
NODE_ENV=string # 'development' or 'production'. | ||
RATE_LIMIT_WINDOW_IN_MINUTES=number # optional, defaults to 2. | ||
RATE_LIMIT_MAX_REQUESTS_PER_WINDOW=number # optional, defaults to 1000. | ||
MAX_QUERY_DEPTH=number # optional, defaults to 4. | ||
TIMEOUT_IN_SECONDS=number # optional, defaults to 20. | ||
ADDRESS_DRIVER_ADDRESS=string # required, address of the `AddressDriver` contract. | ||
IPFS_GATEWAY_URL=string # required, URL of the IPFS gateway. | ||
PORT=string # Optional. The port the server will listen on. Defaults to 8080. | ||
NETWORK=string # Required. The network to connect to. See `SupportedNetworks` in `types.ts` for supported networks. | ||
PUBLIC_API_KEYS=string # Required. A comma-separated list of API keys that are allowed to access the server. | ||
INFURA_API_KEY=string # Required only if RPC_URL is not specified. The Infura API key to use for connecting to the Ethereum network. | ||
POSTGRES_CONNECTION_STRING=string # Required. The connection string for the database. | ||
REPO_DRIVER_ADDRESS=string # Optional. Defaults to mainnet address of latest deployment | ||
DRIPS_ADDRESS=string # Optional. Defaults to mainnet address of latest deployment | ||
RPC_URL=string # Optional. The RPC URL to connect to for retrieving blockchain events. If not specified, the server will use Infura. In this case, INFURA_API_KEY must be specified. | ||
PRETEND_ALL_REPOS_EXIST=boolean # Optional. If true, app will always assume all GitHub repos exist. Used in E2E tests. Defaults to false. | ||
RATE_LIMIT_WINDOW_IN_MINUTES=number # Optional. Defaults to 2. | ||
RATE_LIMIT_MAX_REQUESTS_PER_WINDOW=number # Optional. Defaults to 1000. | ||
MAX_QUERY_DEPTH=number # Optional. Defaults to 4. | ||
TIMEOUT_IN_SECONDS=number # Optional. Defaults to 20. | ||
ADDRESS_DRIVER_ADDRESS=string # Required. the address of the `AddressDriver` contract. | ||
IPFS_GATEWAY_URL=string # Required. The URL of the IPFS gateway. |
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 |
---|---|---|
|
@@ -79,6 +79,7 @@ web_modules/ | |
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.* | ||
!.env.template | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Provider } from 'ethers'; | ||
import { FetchRequest, JsonRpcProvider, WebSocketProvider } from 'ethers'; | ||
import shouldNeverHappen from '../utils/shouldNeverHappen'; | ||
import appSettings from './appSettings'; | ||
|
||
let providerInstance: Provider | null = null; | ||
|
||
export default function getProvider(): Provider { | ||
if (!providerInstance) { | ||
const { rpcUrl, glifToken } = appSettings; | ||
|
||
if (rpcUrl.includes('node.glif.io')) { | ||
const fetchRequest = new FetchRequest(rpcUrl); | ||
|
||
fetchRequest.method = 'POST'; | ||
fetchRequest.setHeader('Content-Type', 'application/json'); | ||
fetchRequest.setHeader('Authorization', `Bearer ${glifToken}`); | ||
|
||
providerInstance = new JsonRpcProvider(fetchRequest, undefined, {}); | ||
} else if (rpcUrl.startsWith('http')) { | ||
providerInstance = new JsonRpcProvider(rpcUrl, undefined, {}); | ||
} else if (rpcUrl.startsWith('wss')) { | ||
providerInstance = new WebSocketProvider(rpcUrl); | ||
} else { | ||
shouldNeverHappen(`Invalid RPC URL: ${rpcUrl}`); | ||
} | ||
} | ||
|
||
return providerInstance; | ||
} |
This file was deleted.
Oops, something went wrong.
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