Solana NFT Marketplace program with NFT Trading & Auction
- Prepare anchor development environments
- Prepare aroun 12 SOL in the deploy wallet keypair
- Confirm Network cluster in
Anchor.toml
file : f.e.[programs.devnet]
,cluster = "devnet"
- Confirm deploy authority wallet keypair location : f.e. `wallet = "/home/ubuntu/deploy-keypair.json"
- Configure solana cli with deploy authority keypair and deploying cluster : f.e.
solana config set -h
- Build program with
anchor build
- Copy and paste the result deploy scripts from Build terminal message : f.e.
solana program deploy /home/ubuntu/project/target/deploy/mugs_marketplace.so
- Delete the program keypair in
/target/deploy/mugs_marketplace-keypair.json
- Build project with
anchor build
. This will generate new keypair - Get the address of new keypair with
solana address --keypair ./target/deploy/mugs_marketplace-keypair.json
- Change program addresses in project code.
Anchor.toml
,/program/Mugs_Marketplace/src/lib.rs
- Build program object again with
anchor build
- Deploy newly built so file with
solana program deploy
Able to run all commands in /cli/command.ts
file by running yarn ts-node xxx
.
When you get this error
Error: Provider local is not available on browser.
You can run this command export BROWSER=
once.
- Install
node
andyarn
- Install
ts-node
as global command - Confirm the solana wallet preparation in
package.json
:/root/.config/solana/creator.json
in test case
- Initialize program with
init
command - Should configure the marketplace fee with
update_fee
command - Should add at least one
treasury
wallet withadd_treasury
command for the fee distribution - Should Initialize user PDA with
init_user
command for the first time usage
Initialize Program with creating Global PDA account as Contract Deployer.
Get global PDA info of program. This will show marketplace fee the treasury wallet distributions.
Admin able to update the Marketplace Fee with this command as Admin.
sol_fee
is the fee in permyraid
Admin able to add the team treasury wallet distribution rate for the marketplace fee charge.
address
is the treasury walletrate
is the wallet's distribution rate by permyraid
Admin able to remove the team treasury wallet.
address
is the treasury wallet
Initialize User Data PDA for Escrow Balance & Traded Volume. This command should be executed for the first time usage of each traders.
Get user PDA info for traders. This will show user escrow balance and traded volume info.
address
is the trader wallet address
Transfer NFT from Sender wallet or it's listed Escrow Account to the Recipient.
address
is the NFT mint addressrecipient
is the recipient wallet address
List NFT for sale as Seller.
address
is the NFT mint addressprice_sol
is the listing price of NFT
Cancel Listing of NFT as Seller.
address
is the NFT mint address
Purchase the Listed NFT with Buy Now
price as Buyer.
address
is the NFT mint address
Make offer for a particular Listed NFT as Buyer.
address
is the NFT mint addressprice
is the offering price. Should be in range ofx1 ~ x0.5
of listed price
Cancel maden offer for a particular Listed NFT as Buyer.
address
is the NFT mint address
Accpet proper offer from a certain Buyer as Seller.
address
is the NFT mint addresbuyer
is the Offer provider address
Create Auction for a particular NFT for funny trading as Seller.
address
is the NFT mint addressstart_price
is the bidding start pricemin_increase
is the minimum increasing amount for the higer biddingduration
is the auction period since started time by secondreserve
if this is 1, then the auction is reserve to start from the first bid placed date. Default 0
Participate in auction with higher bidding as Buyer.
address
is the NFT mint addressprice
is the higher bidding price. Should be more than the latest bid + min_increase_amount
Claim NFT for winner as Buyer when auction is ended.
address
is the NFT mint address
Cancel auction as Seller if there is no bid until auction ended.
address
is the NFT mint address
Get nft Sell Data PDA info for a particular listed NFT status.
address
NFT mint address
Get Offer Data PDA info for a particular Offer status.
address
NFT mint addressbuyer
is the offer provider address
Get Auction Data PDA info for a particular auction status.
address
NFT mint address
Get all listed NFTs info which is active for sale now.
Get all offers info for a particular NFT which is active for accept now.
Get all auctions info which is live now or not claimed ended auction.
For the FE side web3 integration, the scripts in lib
directory can be use without no change.
The only thing the FE dev should change is providing web3 connection
& the anchor program
object from idl.
There is the code part for the keypair
wallet based cli
environement case in cli/scripts
.
Should configure properly in BROWSER
environment.
This script will fetch past Txs reacted with Our Marketplace Smartcontract. Then will parse an activity from each Txs so that use the info for DB sync up.
yarn be