This Repo contains the code for the alfajores faucet. This is contained in 2 apps.
-
The firebase app contains functions which do the actual fauceting.
-
The web app contains a UI for making requests.
The web app deploys automatically to vercel.
To set up the web app to run locally:
-
navigate to the
apps/web
folder$ cd apps/web
-
link your local repository to the
faucet
project on Vercel$ yarn dlx vercel@latest link
You'll be asked to authenticate with your Vercel account. Once you've done that, you'll be guided through a series of prompts to link your local project to the
faucet
Vercel project.? Set up “~/Documents/celo-org/faucet/apps/web”? [Y/n] y ? Which scope should contain your project? Celo Ecosystem Project Hosting ? Link to existing project? [y/N] y ? What’s the name of your existing project? faucet ✅ Linked to c-labs/faucet (created .vercel)
-
fetch environment variables from Vercel
$ yarn dlx vercel@latest env pull
If you get an error like
Error! No project found
, you may need to runvercel link
again. If everything worked, you should see a message like this:> Downloading `development` Environment Variables for Project faucet ✅ Created .env.local file [249ms]
-
run the app locally
$ yarn dev
You should see a message like this:
ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Loaded env from /Users/arthur/Documents/celo-org/faucet/apps/web/.env.local
You can now view the app in your browser at http://localhost:3000.
To set up the firebase app to run locally:
- navigate to the
apps/firebase
folder$ cd apps/firebase
- login to firebase
You'll be asked to authenticate with your Firebase account.
$ yarn dlx firebase-tools@latest login
- build the firebase app
$ yarn run preserve
- ensure that you are on required node version specified in
engines.node
infirebase/package.json
. Currently this is Node 20 at the time of writing.$ nvm use <the-required-node-version>
- run the firebase app locally
$ yarn run serve
-
Add the chain config and token info to
config/chains.ts
. -
Add chain name to the networks array, and
ChainId
andFaucetAddress
to enums intypes/index.ts
.
In the apps/firebase
project run yarn cli config:set
with the relevant params.