/faucet

Alfajores Faucet

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Welcome to Alfajores Faucet app

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.

Setup

Wep app

To set up the web app to run locally:

  1. navigate to the apps/web folder

    $ cd apps/web
  2. 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)
    
  3. 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 run vercel link again. If everything worked, you should see a message like this:

    > Downloading `development` Environment Variables for Project faucet
    ✅  Created .env.local file  [249ms]
  4. 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.

Firebase app

To set up the firebase app to run locally:

  1. navigate to the apps/firebase folder
    $ cd apps/firebase
  2. login to firebase
    $ yarn dlx firebase-tools@latest login
    You'll be asked to authenticate with your Firebase account.
  3. build the firebase app
    $ yarn run preserve
  4. ensure that you are on required node version specified in engines.node in firebase/package.json. Currently this is Node 20 at the time of writing.
    $ nvm use <the-required-node-version>
  5. run the firebase app locally
    $ yarn run serve

Adding chains

Web

  • Add the chain config and token info to config/chains.ts.

  • Add chain name to the networks array, and ChainId and FaucetAddress to enums in types/index.ts.

Firebase

In the apps/firebase project run yarn cli config:set with the relevant params.