-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
138 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# QucikStart | ||
|
||
To set up your environment, please see [here](./setup.md). To contribute PixeLAW, please check it out [contribution guide](./contributing.md) | ||
Play PixeLAW first optimally. Currently, the playtest is closed. So please contact us on [Discord](https://t.co/jKDjNbFdZ5). | ||
|
||
But you can set up your local environment and play. Please check out [here](./setup.md). | ||
|
||
To deep dive into PixeLAW, please try [tutorial](../tutorial/readme.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Set up local environment | ||
|
||
## Prerequisites | ||
- Rust - install [here](https://www.rust-lang.org/tools/install) | ||
- Cairo language server - install [here](https://book.dojoengine.org/development/setup.html#3-setup-cairo-vscode-extension) | ||
- Dojo - install [here](https://book.dojoengine.org/getting-started/quick-start.html) | ||
- Scarb - install [here](https://docs.swmansion.com/scarb/download) | ||
- NodeJS - install [here](https://nodejs.org/en/download) | ||
- Docker - install [here](https://docs.docker.com/engine/install/) | ||
- Docker compose plugin - install [here](https://docs.docker.com/compose/install/) | ||
|
||
## Developing Locally | ||
|
||
### Step1: Build the contracts | ||
|
||
```shell | ||
make build | ||
``` | ||
|
||
This command compiles your project and prepares it for execution. | ||
|
||
### Step 2: Start Dojo Forkserver | ||
The Dojo Forkserver is a container that has the [Katana RPC](https://book.dojoengine.org/framework/katana/overview.html), | ||
the [Torii World Indexer](https://book.dojoengine.org/framework/torii/overview.html), and a Forkserver | ||
Dashboard. Once the container starts, it starts running Katana, deploys the World Container from the repo | ||
via the contracts volume (See the docker-compose.yml for more details), runs the post_deploy script from | ||
the repo's Scarb.toml, and starts up Torii. The Dojo Forkserver Dashboard is accesible via http://localhost:3000/fork. | ||
|
||
```shell | ||
make start_keiko | ||
``` | ||
|
||
### Step 3: Get the React frontend ready | ||
|
||
```shell | ||
make prep_web | ||
cd web | ||
yarn | ||
``` | ||
|
||
### Step 4: Run the frontend locally | ||
|
||
```shell | ||
cd web | ||
yarn dev | ||
``` | ||
|
||
### Step 5: Run the queue bot | ||
````shell | ||
cd bots | ||
yarn install | ||
yarn dev | ||
```` | ||
- to run here, you can check this page: https://www.npmjs.com/package/canvas | ||
- the following command might fix your issue. | ||
````shell | ||
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman | ||
```` | ||
|
||
|
||
#### NOTE | ||
To change accounts, add an account query to the frontend url. For example: http://localhost:3000/?account=1. Add | ||
as many accounts as desired by following the pattern set in the env.example. | ||
|
||
The following would be example players: | ||
````console | ||
# for player 1 | ||
http://localhost:5173/?account=1 | ||
# for player 2 | ||
http://localhost:5173/?account=2 | ||
```` | ||
|
||
|
||
## Project Structure | ||
This is an overview of the most important folders/files: | ||
- `Makefile` : A collection of helpful commands, mainly for Dojo | ||
- `contracts` : The Dojo Cairo smart contract code | ||
- `src/components.cairo` : Dojo component definitions | ||
- `src/systems.cairo` : Dojo component definitions | ||
- `src/Scarb.toml` : The scarb config file used for katana | ||
- `web` : A [Vite](https://vitejs.dev/) React project | ||
- `.env` : (copied from env.example) Contains the hardcoded developer addresses used for Dojo | ||
- `src/dojo/contractComponents.ts` : Client-side definitions of the components | ||
- `src/dojo/createClientComponents.ts` : Client-side setup of the components | ||
- `src/dojo/createSystemCalls.ts` : Client-side definitions of the systems | ||
|
||
|
||
## Typical development activities | ||
### Add a DOJO system | ||
- Edit `src/systems.cairo` | ||
- Edit `src/dojo/createSystemCalls.ts` | ||
### Add a DOJO component | ||
- Edit `src/components.cairo` | ||
- Edit `src/dojo/contractComponents.ts` | ||
- Edit `src/dojo/createClientComponents.ts` | ||
### Redeploy to Katana | ||
- Restart Katana | ||
- Redeploy the contracts with `cd contracts && scarb run deploy` | ||
|
||
## Troubleshooting / Tricks | ||
### When using vscode, the cairo language server panics with `thread 'main' panicked at 'internal error: entered unreachable code: ` | ||
Resolution: None, this is a know issue, can ignore | ||
|
||
### When deploying/migrating, consistent exceptions even though the contract compiles. | ||
Resolution: Delete the `contracts/target` dir | ||
|
||
### How do I use different accounts while testing? | ||
Register 2 accounts (example from https://github.com/coostendorp/dojo-rps): | ||
```rust,ignore | ||
let player1 = starknet::contract_address_const::<0x1337>(); | ||
let player2 = starknet::contract_address_const::<0x1338>(); | ||
``` | ||
And then switch accounts like this: | ||
```rust,ignore | ||
starknet::testing::set_contract_address(player1); | ||
``` |