Giter Club home page Giter Club logo

express-protocol-sdk's Introduction

Express-Protocol-SDK

Express Protocol SDK is used to build applications for minting, trading, auctioning NFTs on multiple blockchains.

Currently, the following blockchains are supported:

Mainnet :-

  • Binance Smart Chain
  • Polygon Matic

Testnets :-

  • Rinkeby Testnet
  • Ropsten Testnet
  • BSC Testnet
  • Polygon Testnet

Installation

npm install pandora-express

Development

For running the SDK code in a local environment -

→Clone the repository.

→Install the dependencies.

npm install

→Install parcel-bundler globally(if not already installed).

npm install -g parcel-bundler

→To initiate a sample application, run

parcel erc721/example/index.html

Structure

The erc721 and erc1155 directory follows a similar directory structure for two different token standards ERC721 and ERC1155 respectively. Inside both the directories -

-> The abi directory contains the abi of the smart contracts through which the Tokens are issued and traded within a blockchain network.

  • pndc.js contains the abi of PNDC_ERC721 contract through which NFTs can be minted singly or in batch.
  • tokenfactory.js contains the abi of TokenFactory contract through which NFTs can be put on direct sale, auction sale and can be bought, bid as well.
  • tokenerc721.js contains the abi of TokenERC721 contract through which collections can be created.
  • Similarly, pndc1155.js, tokenfactory1155.js and tokenerc1155.js inside erc1155/abi contains the abis for the ERC1155 token standard.

-> The example directory contains code for a basic application that uses all the functionality of Protocol SDK.

-> The src directory contains the main source code of the SDK.

  • src/nft/mint.js contains code for minting NFTs.
  • src/order/sell.js contains code for putting NFTs on direct sale, auction sale, and for canceling the sale.
  • src/order/buy.js contains code for buying NFTs on direct sale.
  • src/order/Bid.js contains code for bidding on NFTs, accepting bids, and withdrawing bids.
  • src/collection/collection.js contains code for creating collections and minting, trading, auctioning NFTs inside the collection.
  • src/common/utils.js contains utility functions and variables that are used by other functions.

index.js contains the code for the initialization of the SDK

Usage

Import createPandoraExpressSDK function from pandora-express and initialize SDK.

import {createPandoraExpressSDK} from "pandora-express";
const ExpressSDK = createPandoraExpressSDK();

Mint: NFTs can be mint using the mint function.

ExpressSDK.erc721.nft.mint(web3, chainId, minterAddress, tokenURI, royalties);

Sell: NFTs can be put on sale using the sellNFT function.

ExpressSDK.erc721.order.sellNFT(
  web3,
  chainId,
  tokenId,
  tokenPrice,
  ownerAddress
);

Buy: NFTs can be bought using the buyNFT function.

ExpressSDK.erc721.order.buyNFT(web3, chainId, saleId, buyerAddress, price);

Cancel Sale: NFTs on sale can be removed from sale using the cancelSale function.

ExpressSDK.erc721.order.cancelSale(web3, chainId, sellerAddress, saleId);

Auction: NFTs can be put on auction sale using sellNFTByBid function.

ExpressSDK.erc721.order.sellNFTByBid(
  web3,
  chainId,
  tokenId,
  initialPrice,
  ownerAddress,
  auctionTime
);

Bid: NFTs on auction sale can be bid using bid function.

ExpressSDK.erc721.order.bid(web3, chainId, saleId, buyerAddress, bidPrice);

Bid Execution: Bids on NFTs can be executed using acceptBid function.

ExpressSDK.erc721.order.acceptBid(web3, chainId, saleId, bidId, sellerAddress);

Bid Withdraw: Other bids except executed bid can be withdrawn using withdrawBid function.

ExpressSDK.erc721.order.withdrawBid(web3, chainId, saleId, bidId, buyerAddress);

TokenURI: Fetch token URI of the NFT using fetchTokenURI function.

ExpressSDK.erc721.nft.fetchTokenURI(
  web3,
  chainId,
  tokenId,
);

Collection Functions.

Collection: New collection can be deployed using createCollection function.

ExpressSDK.erc721.collection.createCollection(
  web3,
  chainId,
  ownerAddress,
  collectionName,
  collectionSymbol,
  collectionDescription,
  collectionRoyalties
);

Mint in Collection: NFTs can be minted inside collection using mint function.

ExpressSDK.erc721.collection.mint(
  web3,
  collectionAddress,
  tokenURI,
  minterAddress,
  royalties
);

Sell in Collection: NFTs can be put on direct sale inside collection using sellNFT function.

ExpressSDK.erc721.collection.sellNFT(
  web3,
  chainId,
  sellCollectionAddress,
  sellTokenId,
  sellPrice,
  ownerAddress
);

Buy in Collection: NFTs on sale can be bought in a collection using buyNFT function.

ExpressSDK.erc721.collection.buyNFT(
  web3,
  chainId,
  buyTokenId,
  buyerAddress,
  buyPrice
);

Auction in Collection : NFTs can be put on auction sale in a collection using sellNFTByBid function.

ExpressSDK.erc721.collection.sellNFTByBid(
  web3,
  chainId,
  sellByBidCollectionAddress,
  sellByBidTokenId,
  sellByBidPrice,
  ownerAddress,
  sellByBidTime
);

Bid Collection NFTs: NFTs on auction sale can be bid by other users in a collection using bid function.

ExpressSDK.erc721.collection.bid(
  web3,
  chainId,
  bidCollectionSaleId,
  bidderAddress,
  bidCollectionPrice
);

Bid Execution on Collection NFTs: Bids on NFTs can be executed in a collection using acceptBid function.

ExpressSDK.erc721.collection.acceptBid(
  web3,
  chainId,
  acceptBidSaleId,
  acceptBidId,
  sellerAddress
);

Bid Withdraw in Collection: Other bids except executed bid can be withdrawn in a collection using withdrawBid function.

ExpressSDK.erc721.collection.withdrawBid(
  web3,
  chainId,
  saleId,
  bidId,
  buyerAddress
);

Cancel Sale in Collection NFTs: NFTs on sale in a collection can be removed from sale using the cancelSale function.

ExpressSDK.erc721.collection.cancelSale(web3, chainId, sellerAddress, saleId);

Token URI of NFT in Collection: Fetch TokenURI of the NFT in a collection using fetchTokenURI function.

ExpressSDK.erc721.collection.fetchTokenURI(
  web3,
  collectionAddress
  tokenId
);

Pinata Upload Functions.

Upload NFTs to Pinata Cloud service :

ExpressSDK.pinata.upload(
  nftImage,
  nftDescription,
  pinataApiKey,
  pinataSecretApiKey
);

Upload JSON data to Pinata Cloud:

ExpressSDK.pinata.pinJSON(
  pinataAPIKeyJSON,
  pinataSecretApiKeyJSON,
  pinataJSONData
);

express-protocol-sdk's People

Contributors

kishan79 avatar nitishnaidu368 avatar parva-jain avatar sanskarkhare avatar techpandora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

express-protocol-sdk's Issues

API integration with SDK.

The user can query the respective chain for information such as:

  • currency rates
  • get items using id / get items by owner,creator,collection / get all items
  • get ownership details using tokenID
  • get info about sell/bid orders by id
  • get auction info
  • get collection info

Can we implement our own servers with access using these API's where the user can query directly through our SDK?

Include the readme

@parv we can add a basic step by step guide here as well to use the SDK and run the dapp

Missing pieces :shared by Tushar

List:

  1. API Integration with SDK:
    Rarible sdk has api integration where the user can query the respective chain for information such as:
    - currency rates
    - get items using id / get items by owner,creator,collection / get all items
    - get ownership details using tokenID
    - get info about sell/bid orders by id
    - get auction info
    - get collection info
  2. Burn functionality
  3. Transfer token to other addresses
  4. Support for different chains
  5. Support for different wallets

cc @TusharTapadia @vishaldantuluri @parva-jain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.