/tictactoe

Solana TicTacToe built with the MetaStack

Primary LanguageTypeScript

TicTacToe

A TicTacToe game that runs on the Solana blockchain.

It is built using the IronStack consisting of the following tools:

  • shank which extracts IDL data from the Rust program
  • solita which generates a TypeScript SDK from the extracted IDL
  • amman which allows debugging and testing the program on a local validator

Workshop

This workshop is implemented via pull requests. Each pull request adds a tool or feature and explains how this was done and how you as a developer can experiment with the contract at the current stage.

In most cases this involves building the Rust program, updating the SDK and running some functions against that program after it is deployed on a local validator via amman.

Prerequisites

  • install solana in order to make a local validator available on your machine as well as gain access to commands like cargo build-bpf

Building the Rust Program

cd program && cargo build-bpf

Installing SDK Dependencies

cd ts && yarn install 

Generating SDK

cd ts && yarn api:gen

Running SDK Tests

cd ts && yarn test

Steps

  1. adding solana rust program with processor method stubs
  2. setup SDK package
  3. preparing SDK generation
  4. generating IDL and TypeScript SDK
  5. setup amman and added initialize game test
  6. fix build (you may skip that one)
  7. add init game functionality
  8. amman account providers and renderers
  9. implement join player instruction
  10. resolving errors with cusper
  11. implement and test move instruction

NOTE:

Each step/pull-request is tagged and thus you can check them out via:

git switch <step> -c pr/<step>.

For example to checkout step 2 you'd do: git switch 2 -c pr/2.

Resources

LICENSE

MIT