Code Monkey home page Code Monkey logo

subgraph's Introduction

Protocol subgraph

The subgraph provides information on purchases at Rarible, including commission amounts.

Contracts support status in the current version:

  • TokenSale
  • ERC721SaleV1
  • ERC721SaleV2
  • ERC1155SaleV1
  • ERC1155SaleV2
  • ExchangeV1

The graphql schema is still under heavy development and will likely have major changes and improvements.

Installation/Development

Please follow the official documentation.

Entities

Deal - represents the Buy event

  • type - deal initiation method (Order or Bid)
  • seller - seller's address
  • buyer - buyer's address
  • sellTokenId - token to sell id
  • sellToken - token to sell address
  • buyToken - token to buy address
  • sellAmount - amount of sellToken
  • buyAmount - amount of buyToken
  • price - price in a buyToken currency
  • fee - fee in a buyToken currency
  • txHash - transaction hash
  • blockNumber - number of the block
  • blockTime - timestamp of the block
  • contract - ContractType

Block - represents the ethereum block

  • blockNumber - number of the block
  • blockTime - timestamp of the block

Counter - counter for each ContractType

  • count - number of events under the specified contract
  • firstBlock - Block of the first event
  • lastBlock - Block of the last event
  • contract - ContractType

Enumerations

DealType - enumerates deal initiation methods

  • Order
  • Bid

ContractType - enumeration for contracts

  • TokenSale
  • ERC721SaleV1
  • ERC721SaleV2
  • ERC1155SaleV1
  • ERC1155SaleV2
  • ExchangeV1

Queries

HTTP queries can be accessed at: https://api.thegraph.com/subgraphs/name/rarible/protocol.

List of deals

{
    deals (first: 10) {
        seller
        buyer
        sellTokenId
        sellToken
        buyToken
        sellAmount
        buyAmount
        price
        fee
        txHash
        blockNumber
        blockTime
        contract
    }
}

The number of entities can be limited with first flag

List of deals specified by a contract

{
    deals (where: { contract: ExchangeV1 }) {
        seller
        buyer
        sellTokenId
        sellToken
        buyToken
        sellAmount
        buyAmount
        price
        fee
        txHash
        blockNumber
        blockTime
        contract
    }
}

see ContractType enumeration for possible contract values

List of counters for contracts

{
    counters {
        count
        firstBlock {
            blockNumber
            blockTime
        }
        lastBlock {
            blockNumber
            blockTime
        }
        contract
    }
}

Suggestions

You are welcome to suggest features and report bugs found!

License

Protocol subgraph is available under MIT License.

subgraph's People

Contributors

mazinden avatar

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.