Let's run the test once to see what happens.
First, make sure that anchor
is installed:
Install avm
:
$ cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
...
Install latest anchor
version:
$ avm install 0.27.0
...
$ avm use 0.27.0
...
If you haven't installed
cargo
, please refer to this doc for installation steps.
You may have to install some extra dependencies on Linux (ex. Ubuntu):
$ sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev
...
Check if Anchor is successfully installed:
$ anchor --version
anchor-cli 0.27.0
Next, install dependencies:
$ yarn
Get the public key of the deploy key. This keypair is generated automatically so a different key is exptected:
$ anchor keys list
barocasino: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
Replace the default value of program_id
with this new value:
# Anchor.toml
[programs.localnet]
barocasino = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
...
// lib.rs
...
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
...
Build the program:
$ anchor build
Let's deploy the program. Notice that barocasino
will be deployed on a mainnet-fork test validator run by Dappio:
$ solana config set --url localhost
...
$ anchor deploy
...
Program Id: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
Deploy success
Finally, run the test:
$ anchor test --skip-deploy --skip-build --skip-local-validator