Last active
January 7, 2022 13:18
-
-
Save mwrites/bd2f079bf49850ef941c5358de04ec67 to your computer and use it in GitHub Desktop.
Solana Workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anchor init myproj; cd myproj; anchor build | |
# Open a new tab and run a local ledger | |
solana-test-validator --no-bpf-jit | |
# Go back to main tab | |
anchor deploy `solana address -k target/deploy/bouteilles-keypair.json` | |
# After our first deploy we now have a keypair and we can use the public address as the programID. | |
sed -i '' "s/Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS/$(solana address -k target/deploy/bouteilles-keypair.json)/g" Anchor.toml | |
sed -i '' "s/Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS/$(solana address -k target/deploy/bouteilles-keypair.json)/g" programs/bouteilles/src/lib.rs | |
# Let's build and deploy once again with our new identifier | |
anchor build && anchor deploy | |
--- | |
# Tests | |
# If you have previousply built and deploy to a running ledger | |
# On a separate terminal session, start the local ledger. | |
solana-test-validator --no-bpf-jit | |
# Then, back on the main terminal session. | |
anchor build && anchor deploy && anchor run test | |
# It means if you are just tweaking test, you can just | |
anchor run test | |
# But if you need to do the whole cycle + run a fresh local ledger (solana-test-validator --reset) | |
# You can do the whole thing in one shot with, make sure that you don't have any local ledger running tho! | |
anchor test | |
--- | |
# "Serving your backend" | |
# This command is quite useful when you focusing on your frontend and just need the latest version of your solana program running | |
anchor localnet | |
# It is the same as | |
solana-test-validator --reset | |
anchor build | |
anchor deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment