This is the react / next.js frontend for CasinoJAM SAGE playground. If you are looking for the node implementation, go here.
This repo uses papi to connect to substrate nodes. In order to generate the typescript types with papi, you must first run the following commands, see
pnpm papi add casinojam -w wss://rpc-paseo.ajuna.network
or if you are running a substrate node locally
pnpm papi add casinojam -w ws://127.0.0.1:9944
This will generate the types for connecting papi to ajuna with the key
casinojam
[!IMPORTANT] If your node specifications change, you will have to rerun the command.
pnpm install
pnpm dev
Open http://localhost:3000 with your browser to see the result.
If you are running your node with the --dev
flag, you will have access to demo
accounts. You can add alices, bobs, ... accounts to your wallets with the
following mnemonics
# alice
bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice
# bob
bottom drive obey lake curtain smoke basket hold race lonely fit walk//Bob
All commands the cli accepts are in the /commands
folder. Add a new command by
- Creating a new file, e.g.
/commands/new-command.ts
. - Returning a function that exends the
Command
type - Add the exported
Command
to thecommands
array in/commands/index.ts
it is used to tell the terminal what commands are available and what to do when called.
In the command's execute
function you will have access to CommandContext
which includes the active api, client, signer, selected account. Take a look at
existing commands to see how to use the context variables.
- You can also use the Substrate Portal (Polkadot JS APPs) frontend to connect to your local node via https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/extrinsics. This will help you understand SAGE transitions better.
- This frontend is build on Next.js and react, make sure you understand what it is and how to use it