Code Monkey home page Code Monkey logo

nft-sales-adapters's Introduction

DappRadar NFT Sales Adapters

This repository hosts the adapters for integrating NFT collections or marketplaces on dappradar.com/nft and other products.

Repository is maintained through community support, to add your collection or marketplace please read contribution guidelines.

Guidelines

  1. Integrations are done for marketplaces, not for separate collections (unless a collection also has a native marketplace, like CryptoPunks).
  2. Integration must be done in a way that it tracks all the sale events on the marketplace (sale, auction, etc.)
  3. Only sales on that specific marketplace should be counted. For example, if one smart contract is used by 3 NFT marketplaces, your integration needs to differentiate those and only include sales done on that specific marketplace.

API key

Apply for API key by filling out form https://forms.gle/5E8hsZhyd94X9a3M7.

API keys necessary to simplify testing of the adapters and even if we will review untested adapters, process will be a lot faster if developers tests adapters using API key before submitting a pull request.

Contribution

  • Fork the GitHub repository
  • Get the API key by filling up the form
  • Build an adapter inside adapters/ directory
  • Test adapter code using provided testing tool
  • Create a pull request to the main repository

Repository Structure

All adapters should have separated from other and have its own directory, for example:

  • adapters/ens
  • adapters/axie-infinity

Inside adapter directory there should be at least 2 files

  • abi.json - ABI of the contract used by collection or marketplace
  • index.js - adapter code

Technical Documentation

Supported blockchain protocols

  • Ethereum
  • BNB Chain (Binance Smart Chain)
  • Polygon
  • Avalanche

Environment Configuration

Create a copy of environment configuration

cp .env.dist .env

How to run services

First update your .env file to contain your key, after that create you adapter inside adapters/my-adapter, the naming should be lowercase with multiple words divided by -, for example: my-adapter

To run & test your adapter simply while being in root write:

node ./tester/test.js ../adapters/my-adapter/index.js

It should run a validator and your adapter if you pass make a pull request!

How to build adapters

Each adapter is expected to have certain methods, those can be found in tester/util.js named ENTITY_KEYS please try to follow the example ENS adapter as close as possible in terms of functionality

Each adapter should import and use EVMC SDK, feel free to extend this SDK with different parameters.

this.name = "ens";
this.symbol = null;
this.token = "0x0000000000000000000000000000000000000000";
this.protocol = "ethereum";
this.block = 12855192;
this.contract = "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"

Regarding adapters constructor values, the name should be the same as the adapters/ location name, the block should be the starting block when the contract was released and the contract is self-explanatory.

The websocket for web3 is defined in /sdk/util.js, inside the headers please choose your supported blockchain, this file should not be committed, but feel free to change it while working on the adapter.

/sdk/metadata.js is our inner file and should not be updated in any way also as it's used by out internal tracking.

Metadata and Symbols

Metadata like price of token at that certain point is handled via axios call to process.env.DAPPRADAR_META_URL, each call is requested towards APIs limit, if the limit is hit you will get a faulty response.

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.