This repo contains the Solana Program of Tiny Adventurer 2 developed by Jonas Hahn with accompanying Test Code to verify the functionality of the program.
The game is a simple lootbox game where the creator can store an amount of SOL into the ChestVaultAccount
after the player calls on MoveRight
3 times, they are rewarded with the SOL inside of the lootbox.
initialize_level_one
- Creates the GameDataAccount and the ChestVaultAccount as a PDAreset_level_and_spawn_chest
- Resets the player position back to 0 and loads theChestVaultAccount
with SOL from the signermove_right
- Increments the player position by 1 and checks to see if the player has reached the end of the level, thus releasing the loot
- Clone the repo
- Run
npm install
- Run
anchor build
to build the program - In separate terminal window run
solana-test-validator
to start a local Solana cluster - In primary window run
anchor deploy
to deploy the program to the local cluster - Update your program id in
Anchor.toml
andlib.rs
to match the deployed program id - Run
anchor test
to run the test code