Vite React Starter for a DAO app scoped to a single DAO.
npx degit HausDAO/dao-app-starter-vite my-daohaus-app
cd my-daohaus-app
git init
yarn
git clone git@github.com:HausDAO/moloch-v3-vite-starter.git
git remote remove origin
cd dh-moloch-v3-vite-starter
yarn
git clone https://github.com/HausDAO/dh-v3-vite-starter.git
git remote remove origin
cd dh-moloch-v3-vite-starter
yarn
.env
Setupcp .env.sample .env
VITE_RIVET_KEY
Get a free Rivet key here
VITE_EXPLORER_KEY
Get an Etherscan API key here
VITE_GRAPH_API_KEY_MAINNET
If developing for Mainnet or Gnosis Chain you can get an API key here. Ignore this one if not worried about mainnet or gnosis chain yet.
VITE_TARGET_KEY
This is the target address for the DAO you are developing the app for. You will get this value in the next step if you do not have an existing DAO.
Summon a DAO
src/targetDao.ts
Add your DAO's data to the property and values of the object
.env
Add the DAO address in the VITE_TARGET_KEY
variable
targetDao.ts
and toggle with this env
variabletargetDao.ts
as neededyarn dev
main.tsx
react-query
provider @daohaus/moloch-v3-hooks
will useDHConnectProvider
- that handles the Wallet Connect functionalityHausThemeProvider
- that provides the styling theme to the appHomeContainer.tsx
DHLayout
which adds the connect button and navigation to the app
navLinks
TXBuilder
which enables easy transaction creationFormTest.tsx
FormBuilder
to the applegos/forms.ts
, legos/fields.ts
, and legos/tx.ts
moloch-v3-fields
package
daoid
and daochain
These values are used in most hooks and components and you have some options:
Get them from targetDao.ts
const daoChain = TARGET_DAO[import.meta.env.VITE_TARGET_KEY].CHAIN_ID;
const daoId = TARGET_DAO[import.meta.env.VITE_TARGET_KEY].ADDRESS;
or load them into a context from the @daohaus/moloch-v3-hooks
library and then there is a hook you can use.
Wrap your tree in this context:
import { CurrentDaoProvider } from "@daohaus/moloch-v3-hooks";
...
<CurrentDaoProvider
targetDao={{
daoChain: TARGET_DAO[import.meta.env.VITE_TARGET_KEY].CHAIN_ID,
daoId: TARGET_DAO[import.meta.env.VITE_TARGET_KEY].ADDRESS,
}}
>
{children}
</CurrentDaoProvider>;
Then access this hook:
import { useCurrentDao } from "@daohaus/moloch-v3-hooks";
...
const { daoChain, daoId } = useCurrentDao();
urlParams
in a multi DAO apptbd
tbd
tbd