See also the README files of the various subpackages:
foundryup
: 16 May 2023npm install -g pnpm
)
package.json
corepack
to make sure you use the correct version of pnpm.corepack enable
corepack pnpm install
make setup
(cd packages/contracts && make test)
If you're using Visual Studio Code, the contract remappings will only be picked up if you set the
root of the project to the contracts
package. Otherwise, you'll have to manually add the remappings
(from remappings.txt
) to the Solidity plugin configuration.
To deploy and try out the app run the following commands (anvil
and webdev
will keep running and
must be run in their own terminal):
make anvil
make webdev
make deploy
make circuits
This will do the following:
After that, you can visit the app at http://localhost:3000/ (if that port is already occupied, NextJS might affect another one).
Common caveat: Every time you restart Anvil, you might have to perform some kind of reset in your wallet. With Metamask, that's "..." > "Settings" > "Advanced" > "Clear activity and nonce data".
If you access the app via http://localhost:3000/, you can interact with it with your wallet. You'll need to "Claim Airdrop" in order to get a deck to play with.
However, for testing, it's expected you'll use the Anvil ("test ... junk" mnemonic) accounts. These come preloaded with local testnet ETH, and as part of our deploy script, we pre-airdrop a deck to accounts 0 and 1.
You can import those accounts in your wallet, but we recommend instead accessing the app via:
This will load the test private key locally, and avoid the need for you to click your wallet every time a transaction is made!
IMPORTANT: You will need to use two separate browsers (or two separate profiles) to test the game with two different accounts. It may work to some extent with two different tabs, but any reload will reset the address.
If you would like to skip proof generation and verification, you can replace make deploy
and
make dev
with the following commands:
cd packages/contracts && make deploy-noproofs
cd packages/webapp && make dev-noproofs
If you would like to test with deterministic randomness and avoid timeouts when a player takes too
long to perform an action, you can replace make deploy
with:
cd packages/contracts && make deploy-norandom
To both skip proofs and use deterministic randomness, you can replace make deploy
and make dev
with the following commands:
cd packages/contracts && make deploy-noproofs
cd packages/webapp && make dev-noproofs-norandom
See the Makefile for a description of all top-level make commands.