StarknetCC - Full dApp workshop by AVNU team
You'll find the PDF presentation here
This workshop will show you how to dev a full Starknet dApp with NextJS & Starknet-react, including multi-wallets support(Argent web wallet | Argent-x | Braavos) and multi-call transactions.
You'll also use an ERC-721 contract, with a 'mint' function (see ABI).
This workshop currently run on the Starknet Goerli Testnet
Explore the contract interactions in NextJS by using an existing ERC-721 contract & ERC-20 contracts deployed on Starknet.
- Contract interactions
- Start with existing contracts
- Deploy & connect your own
- Display current information
- Last block
- Transactions
- ERC-721
- mint
- balanceOf
- Minting & send (multicalls)
To follow this workshop you should at least:
- Have a Starknet compatible wallet installed (with some Starknet Goerli ETH in wallet to do TX's)
- Have basic knowledge in ReactJS / NextJS framework
- Have basic knowledge in Cairo smart contracts development
- Have basic knowledge on how Starknet works(BC in general, Account abstraction, ...)
About the tooling:
- IDE
- Yarn or NPM
Clone the repository
git clone [email protected]:avnu-labs/avnu-dapp-workshop.git
cd avnu-dapp-workshop
Install Dependencies
yarn | npm install
Run in dev
yarn dev | npm run dev
Here are the interesting files tree you'll have to update/use during this workshop
- app
- layout.tsx
- page.tsx
- assets
- abis
- ERC20.json
- AVNUNft.json
- abis
- lib
- shared
- components
- layout
- nft
- transactions
- models
- nft-metadata.tsx
- services
- components
- wallet
- components
- connect-button.tsx
- connect-wallet-modal.tsx
- components
- shared
- Familiarize a little with the project
- See the file tree
- Contract addresses are located in environment
- (use of ChakraUI components library)
- Uncomment part by part the workshop
- Fetching block infos
- Update the starknet providers to connect to the default Starknet Goerli provider by using Starknet-react
- Update the footer component to fetch & display the current block infos
- (The UI part is already done here)
- Wallet connect
- Look at the Connect button component & Connect wallet modal component
- Update it to ask user wallet connection by using Starknet-react or Get starknet by argent if you want to use argent web wallet.
- You should be able to connect with Braavos or ArgentX, and see your current address on the UI
- Managing ERC-721
- Start by taking a look at the NFT component & Mint button component
- You can now update the NFT component to
- Fetch & display the name, description and image of the NFT by fetching metadata
- Fetch the balance of the connected account
- Mint the NFT by using the mint button
- Simple call, only mint
- Multi-call, mint and donate
- Managing transactions ---------------------------
- Look at the Current transaction component & the Transactions list component
- Here you'll have to
- Watch the last transaction registered by the app & display the current status in real time
- Display all registered transactions by the app
- Deploy your own ERC-721 contract
- You can put aside IDE for the time & open your terminal
- You can use the OpenZeppelin ERC-721 contract
- Use Starkli to compile, declare & deploy the contracts
- Wait until the contract is deployed
- Once it's ok, you can test it by calling mint on the deployed contract to verify
- With the CLI
- With the voyager
- Declare & upload your metadata.json to IPFS (or other if you prefer)
- Set the tokenURI of your contract to the IPFS link
- You can now replace the nftAddress in the environment file to use your own
0x039eb1299cbb259edabb45376ec742497c67150b9adc2d9c3c026a8cc58c634a
There some improvements you can make to improve this workshop, here is a non-exhaustive list:
- Use other starknet-reacts hooks
- UseStarkName()
- Save transactions in local storage
- Display current transaction information on the UI (toast, history panel, ...)
- Auto reload of balance after mint
- Implement a button to be able to add a specific token to your wallet
- ...
Here is all the docs you'll need to complete the workshop
https://github.com/apibara/starknet-react
https://www.npmjs.com/package/@argent/get-starknet
https://github.com/OpenZeppelin/cairo-contracts
https://github.com/xJonathanLEI/starkli
This workshop is released under the AGPL-3.0-only.