Discover Solana Dapp dev using Anchor, Solana (rust) and Svelte (Typescript).
Thanks to https://dev.to/0xmuse/accelerated-guide-to-fullstack-web3-with-ass-anchor-solana-and-svelte-1mg
First, you will need to install the Rust toolchain.
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup component add rustfmt
To install Solana Tool Suite, you can simply run the installation script. I’m specifying to install v1.9.4:
sh -c "$(curl -sSfL https://release.solana.com/v1.9.4/install)"
Note that if you are using zsh, you need to update your PATH.
Check:
solana --version
Now, you can run the test validator (a local testnet) to see if everything works correctly with command:
solana-test-validator
Let’s stop the test validator for now and install Anchor, the recommended framework for Solana programs.
Make sure you have Yarn v1
installed. Then let's build using Rust package manager:
cargo install --git https://github.com/project-serum/anchor --tag v0.20.1 anchor-cli --locked
Check:
anchor --version
It a browser extension, like Metamask, but for Solana. Install it and create a wallet.
Look at ~/.config/solana/id.json
or generate new using solana-keygen new
.
Then configure Solana to use localhost
solana config set --url localhost
solana config get
Clone the repo, go in it, and install the JS deps
yarn
Then you can run these dev commands:
anchor build # Install the needed Rust deps and compile the programs (aka: Smart-contract)
anchor test # Exec contract tests using JS test framework