Lightweight boilerplate for Solana dapps. Allows quick building and prototyping.
If this repo helps you building your dapps on Solana - please ensure you leave us a star! This motivates and helps us a lot to bring more free code, templates and boilerplates to you.
If you need help with setting up the boilerplate or have other questions - don't hesitate to write in our community forum and we will check asap. Forum link. The best thing about this boilerplate is the super active community ready to help at any time! We help each other.
📄 Clone or fork solana-boilerplate
:
git clone https://github.com/solana-boilerplate/solana-boilerplate.git
💿 Install all dependencies:
cd solana-boilerplate
yarn install
✏ Rename .env.example
to .env
in the main folder and provide your appId
and serverUrl
from Moralis (How to start Moralis Server)
Example:
REACT_APP_MORALIS_APPLICATION_ID=xxxxxxxxxxxx
REACT_APP_MORALIS_SERVER_URL=https://xxxxxx.grandmoralis.com:2053/server
🚴♂️ Run your App:
yarn start
Gets basic Solana information such as user's address.
Example
const { account } = useSolana();
Gets Solana SOL token balance of an address.
Example
const { getSolanaNativeBalance, data, error, isLoading } = useSolanaNativeTokenBalance({
network: "mainnet",
address: "xxx"
});
Gets Solana SPL token balance of an address.
Example
const { getSPLTokenBalance, data, error, isLoading } = useSPLTokenBalance({
network: "mainnet",
address: "xxx"
});
Gets Solana NFT balance of an address.
Example
const { getSPLNFTBalance, data, error, isLoading } = useSPLNFTBalance({
network: "mainnet",
address: "xxx"
});
Gets Solana portfolio (SOL, SPL token, SPL NFT) of an address.
Example
const { getSolanaPortfolio, data, error, isLoading } = useSolanaPortfolio({
network: "mainnet",
address: "xxx"
});