A tutorial on how to build this project can be found here.
If you are following along, run git checkout start-here
and continue to the below steps.
Full working version is live at decentralized-dice.vercel.app.
- run
npm install
oryarn install
to install dependencies - copy
.env.sample
and rename to.env.local
(add your own contract address and subgraph URL, follow along here on how to do that) - run
npm run dev
oryarn dev
to start the development server - open up
localhost:3000
in your browser, you should see an input field, and a button to connect your wallet - connect your wallet, paste in another ETH address, and you should be enabled to roll the dice
- if following the tutorial, hop back to follow along deploying the smart contract and subgraph.
- You can find the majority of the app code in
pages/index.tsx
- The UI uses ConnectKit + wagmi to web3 enable the app and interact with the smart contract
- There are additional components in
src/components
folder, which are used to query and display data from subgraph (the walkthrough will cover using these)
- install graph-cli globally, open project in subgraph studio,
graph-auth
with your project token cd subgraph
graph codegen
-> createsgenerated
folder with generated AssemblyScript typesgraph build
-> createsbuild
folder with compiled subgraph in WebAssemblygraph deploy decentalized-dice(or your proj here)
+ specify version -> check it reflects in subgraph studio