Skip to content

BSSCommerce/picasarts.io---Near

 
 

Repository files navigation

WARNING

This repository is a sample source code for NFT marketplace on NEAR. It's not ready and need improvements for production.

NFT Market Reference Implementation

A PoC backbone for NFT Marketplaces on NEAR Protocol.

Changelog

Changelog

Progress:

  • NFT & Market smart contracts following NEP-171
  • demo pay out royalties (FTs and NEAR)
  • test and determine standards for markets (best practice?) to buy/sell NFTs (finish standard) with FTs (already standard)
  • demo some basic auction types, secondary markets and
  • frontend with MUI (Material Design - React UI components )
  • first pass / internal audit
  • integrate with Crust dStorage Solution
  • integrate with DiaData - CoinMarketCap endpoint to convert NEAR to USD
  • integrate with Google Analytic to count page views for each NFT item.
  • use MongoDB to store extra profile data such as profile name, collection, banner, logo...
  • implement simple collection feature: each near wallet account has a collection name.
  • show collections & NFTs on home page
  • show related NFTs item on NFT detailed page.
  • switch between chains (NEAR, Aurora, XRP, Ethereum...)
  • connect with bridged tokens e.g. buy and sell with wETH/nDAI (or whatever we call these)

Tech Stack

Installation

Beyond having npm and node (latest versions), you should have Rust installed. I recommend nightly because living on the edge is fun.

https://rustup.rs/

Don't forget to install the wasm32 target:

rustup target add wasm32-unknown-unknown

Also recommend installing near-cli globally

npm i -g near-cli

Everything else can be installed via: yarn cd server && yarn

NEAR Config

There is only one config.js file found in src/config.js, this is also used for running tests.

Using src/config.js you can set up your different environments. Use REACT_APP_ENV to switch environments e.g. in package.json script deploy.

NEAR DEV account

You need create a NEAR wallet account for testing purpose.

Open neardev/dev-account.dev and change your dev account to build smart contracts. There are two accounts for NFT contract and Market contract. NFT contract is built on main account, Market contract is built on sub-account.

Read this document to create a sub-account

Mongo Atlas Config

Open file next.config.js change mongoDB url.

Google Analytic Config

For tracking page views, this app uses Google Analytic Api. Following steps below:

  • Create a Google Analytic Account
  • Create a project in Google Console based on this guide Analytic Api
  • Change .env.example to .env and input information:
    • GOOGGLE_ANALYTICS_TRACKING_ID: Your tracking ID
    • GOOGLE_ANALYTICS_VIEW_ID: view id
    • GOOGLE_CLIENT_EMAIL: IAM user service account
    • GOOGLE_CLIENT_ID: client id
    • GOOGLE_PRIVATE_KEY: private key

Working

Build Smart Contract:

  • source neardev/dev-account.dev
  • npm run build-contract

Run Dev Mode for frontend

  • npm run dev

Run Production Mode for frontend

  • npm run build
  • npm run start

App can be started by PM2

  • pm2 start npm --name "Your app name" -- run start

About

A NFT marketplace on NEAR Protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.5%
  • Rust 30.5%
  • Other 1.0%