Skip to content

Husten150/risein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stellar NFT Minter

A Soroban smart contract + React frontend for minting NFTs on the Stellar testnet.

Requirements

  • Rust 1.74+ (rustup target add wasm32v1-none)
  • Node.js 18+
  • Stellar CLI (cargo install stellar-cli)
  • Freighter browser extension
  • Visual Studio 2022 Build Tools (Windows) with VC++ workload + Windows SDK
    • Or: brew install gcc (macOS) / apt install build-essential (Linux)

Project Structure

stellar-nft-minter/
├── nft-contract/          # Soroban smart contract
│   ├── contracts/
│   │   └── nft-minter/    # NFT minter contract source
│   │       ├── src/lib.rs # Contract logic
│   │       └── src/test.rs# Tests
│   └── build.bat          # Windows build script
├── frontend/              # React + Vite + TypeScript
│   ├── src/
│   │   ├── App.tsx        # Main UI
│   │   ├── contract.ts    # Contract client
│   │   └── types.ts       # TypeScript types
│   └── .env.example       # Environment config
└── deploy.ps1             # Deployment automation

Deployed Contract

The NFT Minter contract is deployed on Stellar Testnet.

Detail Value
Contract ID CC7WQJXRNQBMCIFO3V6ZDWRVBM23RB4FK5QWH7UPBEETFH23TL7MPRZC
Network Stellar Testnet (https://horizon-testnet.stellar.org)
Admin Address GCIRI6IR6PPQSO7PJN2DS5C3RU55ZGWCTYV24GN3STOTKAR5UMHMQH3Y
Collection Name StellarNFT
Collection Symbol SNFT
Explorer View on Stellar Expert

Quick Start

1. Build the contract

cd nft-contract
# Windows (requires VS Build Tools + Windows SDK):
build.bat
# Or:
stellar contract build

2. Run tests

cd nft-contract
cargo test

3. Deploy to testnet

# The deploy script creates an account, deploys, and initializes:
.\deploy.ps1

Or manually:

# Create and fund a testnet account
stellar keys generate nft-admin
stellar keys fund nft-admin --network testnet

# Deploy
stellar contract deploy \
  --wasm target/wasm32v1-none/release/nft_minter.wasm \
  --source nft-admin \
  --network testnet

# Initialize
stellar contract invoke \
  --id <CONTRACT_ID> \
  --source nft-admin \
  --network testnet \
  -- \
  initialize \
  --admin <ADMIN_ADDRESS> \
  --name 'StellarNFT' \
  --symbol 'SNFT'

4. Run the frontend

cd frontend

# Copy and configure
cp .env.example .env
# Edit .env and set VITE_CONTRACT_ID=<your-deployed-contract-id>

# Install & start
npm install
npm run dev

5. Use the app

  1. Open http://localhost:5173 in your browser
  2. Install Freighter wallet if you haven't
  3. Switch Freighter to Stellar Testnet
  4. Fund your account from Stellar Lab
  5. Click Connect Freighter
  6. Fill in NFT metadata and mint!

Contract Functions

Function Description
initialize(admin, name, symbol) Initialize collection
mint(to, name, description, uri) Mint a new NFT
transfer(from, to, token_id) Transfer NFT ownership
owner_of(token_id) Get token owner
balance_of(owner) Get NFT count
token_metadata(token_id) Get token metadata
name() / symbol() Collection info
total_supply() Total minted count

Events

The contract emits events on:

  • mint — when an NFT is minted
  • transfer — when ownership changes
  • initialize — when contract is initialized

Error Handling (3 types)

  1. Wallet errors — Freighter not installed / not connected
  2. Network errors — Wrong network / testnet unreachable
  3. Transaction errors — Simulation failure / submission failure
  4. Input errors — Missing required fields
  5. Contract errors — Not initialized / token not found

Tech Stack

  • Smart Contract: Rust + Soroban SDK 26
  • Frontend: React 19 + TypeScript + Vite
  • Wallet: Freighter API
  • Network: Stellar Testnet

About

stellar wallet for transaction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors