#15 - A Complete Guide to Mint Solana NFTs through a Mobile App (Android)
Author: @rockluckycat
See the example repo here
Overview
Creat candy machine through Metaplex js
Creat a Pixel 4 Android virtual device
Run react-native app on Android Emulator
Connect wallet through @solana/mobile-wallet-adapter
Upload image and metadata to Arweave
Mint Solana NFT through candy machine
The demo procedure is running on solana devnet
Setup
Structure
This Tutorial Only Works on Android OS
Since Solana Mobile SDK hasn't support iOS yet. You can't connect wallet with @solana/mobile-wallet-adapter on iOS devices. As a result, this tutorial only works on Android right now.
Setting up the development environment
There are two ways to develop React Native App.
Expo Go
React Native CLI
We don't talk about which one is better here. The point is I have tried to run this code with Expo Go. However it still has some issues when using @solana/mobile-wallet-adapter, but it works fine with React Native CLI.
So I suggest you to use React Native CLI method to setting up your development environment.
Follow this doc to setup.
Creat a Pixel 4 Android virtual device
Follow this doc to create a virtual device.
And remeber select Pixel 4 which is the newest verison has Play Store inside.
System Image please select "S API Level 31"
After you run up your virtual Pixel 4, remember to install Phantom or Solflare.
Install metaplex-candy-machine-example
metaplex-candy-machine-example
https://github.com/BoxInThePARK/metaplex-candy-machine-example
Install mobile-nft-mint-example
mobile-nft-mint-example
https://github.com/BoxInThePARK/mobile-nft-mint-example
Set Arweave Package to Local Patch
Right now,
arweave-js
hasn't completely supported react-native yet. Therefore, if you want to upload image or metadata to Arweave network througharweave-js
package. You will address some issues occured by some needed packages are unable to resolve on react-native. Because react-native doesn't have them.To solve these problems, not only you should install other packages, you also need to do small modification on the package's sourcecode. This is the reason why we set
arweave-js
as a local patch,Here are the steps:
Install
Modify source code
Setup Arweave Wallet
Follow this doc to setup your Arweave wallet and claim free AR token by completing assigned task. You should have a downloaded key file after the setup. We will need the keyfile in the rest of the tutorial.
Part 1: Create Candy Machine
Create .env
File
.env
FilePaste this to .env
Create A New Candy Machine
Then you can get a new candy machine address.
Part 2: Run The App on Android Emulator/Device
Setup Arweave Wallet
Follow this doc to setup your Arweave wallet and claim free AR token by completing assigned task.
Create .env
File
.env
FilePaste this to .env
Install App to Emulator
Recommend to have two terminal windows here.
Run the Metro
Install App
Connect Wallet
Set Wallet to devnet
Add uri in APP_IDENTITY
Refresh app or rebuild. Then start testing!
Upload Image and Metadata
The procedure comes from SolMeet #3. You can take a detail look at here
Find Candy Machine
Mint NFT
Find NFT in Your Wallet
Reference
General
https://reactnative.dev/docs
SMS
https://github.com/solana-mobile/mobile-wallet-adapter
https://github.com/solana-mobile/mobile-wallet-adapter/tree/main/examples/example-react-native-app
Metaplex
https://github.com/metaplex-foundation/js-examples/tree/main/mint-ui-example
https://docs.metaplex.com/programs/token-metadata/overview
Arweave
https://github.com/thuglabs/arweave-image-uploader
Last updated