In this lesson, you will:
This lesson covers the process of building the upgraded spl-token-minter program. After successfully building the program, it guides you through the steps of connecting your wallet to the devnet, airdropping testnet tokens, and deploying the program. Subsequently, we test the deployed program to ensure its functionality.
Start by opening your project's root directory in the terminal and enter:
anchor build
This command generates a target folder in the project root and compiles idl and types of our Solana program for client-side interaction using RPC methods. Next, verify your configuration:
solana config get
The expected output should be:
Config File: ~/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: ~/.config/solana/id.json
Commitment: confirmed
Set your cluster to devnet:
solana config set --url https://api.devnet.solana.com
Generate a new wallet keypair:
solana-keygen new
Check your wallet address and balance:
solana address
solana balance
If necessary, airdrop Devnet SOL:
solana airdrop 4
Begin the deployment process:
solana-test-validator
Deploy your program:
anchor deploy
You should see a deployment confirmation:
Deploying cluster: https://api.devnet.solana.com
Upgrade authority: ~/.config/solana/id.json
Deploying program "spl_token_minter"...
Program path: /path/to/your/project/target/deploy/spl_token_minter.so...
Program Id: <Your Program ID>
Deploy success
Update the program IDs in both your Solidity file and anchor.toml
file with the new IDs. Rebuild the program:
anchor build
Ensure all dependencies are installed:
yarn install
npm install
Run the tests:
anchor test
The output should indicate the success of the tests:
spl-token-minter
Your transaction signature 5eMMtzhkGq8sZFNkLir3i7KFCua6b9itjym7mn1Gm2KBTPDjUL6p27qMba8GynZwVfvEBynF2rc57qBrtR3XZdiJ
✔ Is initialized! (2311ms)
Your transaction signature 38opFwF4DgQyXmtUwKgx2NDoTGsCTaWJzLqcRk49BS4x1a3hj8MyHSAn89cRvEaf6p62DVKX1u9tBzXtxSK861u9
✔ Create an SPL Token! (1540ms)
tokenAmount 199000000000n
✔ Mint some tokens to your wallet! (1794ms)
Your transaction signature 36aRV86YKuSab4iMcrBJbgcF2QskVshnFC5fQGDdoXoJm7qnpwAKJ7coXTM9ia2JNDPnr15FTvALtHT9DzvhCksQ
recipienttokenAmount 54000000000n
✔ Transfer some tokens to another wallet! (2814ms)
4 passing (8s)
✨ Done in 12.26s.
This completes the process of building, deploying, and testing the upgraded spl-token-minter program. The successful tests confirm the program's ability to transfer tokens effectively within the Solana ecosystem.
In the next lesson, we will explore additional aspects of Solana's development, further enhancing our understanding and skills.