This project is now part of the @safe-global/safe-wallet monorepo! The monorepo setup allows centralized management
of multiple
applications and shared libraries. This workspace (apps/web
) is the frontend of the Safe{Wallet} web app.
Safe{Wallet} is a smart contract wallet for Ethereum and other EVM chains. Based on Gnosis Safe multisig contracts.
You can run commands for this workspace in two ways:
- From the root of the monorepo using
yarn workspace
commands - From within the
apps/web
directory
Except for the main monorepo prerequisites, no additional prerequisites are required for this workspace.
- Install all dependencies from the root of the monorepo:
yarn install
Contributions, be it a bug report or a pull request, are very welcome. Please check our contribution guidelines beforehand.
Create a .env
file with environment variables. You can use the .env.example
file as a reference.
Here's the list of all the environment variables:
Env variable | Description |
---|---|
NEXT_PUBLIC_BRAND_NAME |
The name of the app, defaults to "Wallet fork" |
NEXT_PUBLIC_BRAND_LOGO |
The URL of the app logo displayed in the header |
NEXT_PUBLIC_INFURA_TOKEN |
Infura RPC API token |
NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN |
Infura token for Safe Apps, falls back to NEXT_PUBLIC_INFURA_TOKEN |
NEXT_PUBLIC_IS_PRODUCTION |
Set to true to build a minified production app |
NEXT_PUBLIC_GATEWAY_URL_PRODUCTION |
The base URL for the Safe Client Gateway |
NEXT_PUBLIC_GATEWAY_URL_STAGING |
The base CGW URL on staging |
NEXT_PUBLIC_SAFE_VERSION |
The latest version of the Safe contract, defaults to 1.4.1 |
NEXT_PUBLIC_WC_PROJECT_ID |
WalletConnect v2 project ID |
NEXT_PUBLIC_TENDERLY_ORG_NAME |
Tenderly org name for Transaction Simulation |
NEXT_PUBLIC_TENDERLY_PROJECT_NAME |
Tenderly project name |
NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL |
Tenderly simulation URL |
NEXT_PUBLIC_BEAMER_ID |
Beamer is a news feed for in-app announcements |
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID |
GTM project id |
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_DEVELOPMENT_AUTH |
Dev GTM key |
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LATEST_AUTH |
Preview GTM key |
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LIVE_AUTH |
Production GTM key |
NEXT_PUBLIC_SENTRY_DSN |
Sentry id for tracking runtime errors |
NEXT_PUBLIC_IS_OFFICIAL_HOST |
Whether it's the official distribution of the app, or a fork; has legal implications. Set to true only if you also update the legal pages like Imprint and Terms of use |
NEXT_PUBLIC_REDEFINE_API |
Redefine API base URL |
NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION |
Firebase Cloud Messaging (FCM) initializeApp options on production |
NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION |
FCM vapid key on production |
NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING |
FCM initializeApp options on staging |
NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING |
FCM vapid key on staging |
NEXT_PUBLIC_SPINDL_SDK_KEY |
Spindl SDK key |
If you don't provide some of the variables, the corresponding features will be disabled in the UI.
From the root of the monorepo:
yarn workspace @safe-global/web start
Or directly from the apps/web
directory:
yarn start
Open http://localhost:3000 with your browser to see the app.
Note
From now on for brevity we will only show the command to run from the root of the monorepo. You can always run the command from the apps/web
directory you just need to omit the workspace @safe-global/web
.
ESLint:
yarn workspace @safe-global/web lint --fix
Prettier:
yarn workspace @safe-global/web prettier
Unit tests:
yarn workspace @safe-global/web test --watch
Build a static site:
yarn workspace @safe-global/web build
Serve the static files:
yarn workspace @safe-global/web serve
Launch the Cypress UI:
yarn workspace @safe-global/web cypress:open
You can then choose which e2e tests to run. Some tests will require signer private keys, please include them in your .env file
To create a new component from a template:
yarn workspace @safe-global/web cmp MyNewComponent
This repo has a pre-push hook that runs the linter (always) and the tests (if the RUN_TESTS_ON_PUSH
env variable is
set to true)
before pushing. If you want to skip the hooks, you can use the --no-verify
flag.
This app is built using the following frameworks:
- Safe Core SDK
- Safe Gateway SDK
- Next.js
- React
- Redux
- MUI
- ethers.js
- web3-onboard