Coin tracking integration

This page aims to provide all necessary info to display on coin tracking sites such as Coingecko, shardmarketcap and coinmarketcap.

Currently NIFTEX v2 is running on mainnet at www.niftex.org. In the future NIFTEX v2 will expand to other L1bis chains such as 0xPolygon. When this happens, we will share new graphql endpoints for further integration. All the endpoints below are using graphql (For NIFTEX v2 ethereum mainnet)

NIFTEX-v2 backend: https://backend-v2.niftex.com/graphql

NIFTEX-v2 subgraph: https://api.thegraph.com/subgraphs/name/jmahhh/niftex-v2-main-subgraph-mainnet

1. Get all pairs

Endpoint: https://api.thegraph.com/subgraphs/name/jmahhh/niftex-v2-main-subgraph-mainnet

query {
bondingCurves(orderBy: tradedEthersExact, orderDirection: desc) {
id
wallet {
asToken {
symbol
name
}
id
}
tradedEthersExact
tradedShardsExact
}
}

This will only show assets that are using NIFTEX v2 bonding curves.

  • bondingCurves[i].id: the contract address of bonding curve

  • bondingCurves[i].wallet.asToken.symbol: The symbol of v2 asset paired with ETH. We currently only supports ETH - <niftex v2 asset> pair

  • bondingCurves[i].wallet.id: the contract address custodying all NFTs. This is one very important data as this will be used widely across all niftex v2 pages, and used to query metadata (name, symbol, description)

  • tradedEthersExact, tradedShardsExact shows the all-time trading volume in ETH and fractions respectively.

2. Metadata. (Name, symbol, description, images)

On smart contract we only store name and symbol as those are required data for ERC20s. The description of the fractionalized asset(s) can be retrieved via niftex v2 backend as follows

. Endpoint: https://backend-v2.niftex.com/graphql

To get description and nft details:

query {
shardedWalletDetails_getDescription(shardedWalletAddress: "0xf3110b27f481f9ac3c1ba3c54de542accb2d913c", chainId: 1)
nftMetahouse_getNftDataByShardedWallet(
shardedWallet: "0xf3110b27f481f9ac3c1ba3c54de542accb2d913c",
chainId: 1
) {
id
usableImageUrl
}
}

Note: 0xf3110b27f481f9ac3c1ba3c54de542accb2d913c is the custody address of R64X. You can dynamically get this address via bondingCurves[0].wallet.id as mentioned in point 1.

shardedWalletDetails_getDescription and nftMetahouse_getNftDataByShardedWallet are 2 distinct queries.

Supported chainId:

  • 1: Ethereum mainnet

(we will add more supported chain ids when expanding to other L1bis chains)

3. Get trades per bonding curve.

Endpoint: https://api.thegraph.com/subgraphs/name/jmahhh/niftex-v2-main-subgraph-mainnet

query {
bondingCurve(id: "0xe5b43f7d633c18ae5b8eed3a39ba11657843f91e") {
prices(orderBy: timestamp, orderDirection: desc) {
timestamp
priceExact
}
}
}

Note: 0xe5b43f7d633c18ae5b8eed3a39ba11657843f91e is the bonding curve address for R64X-ETH. You can dynamically get this address via bondingCurves[i].id as mentioned in point 1.

  • timestamp is in seconds.

To get 24h trading volume, we need to compute following details before putting into the query:

  • now timestamp: Math.round(new Date().valueOf() / 1000) (to get timestamp in seconds)

  • 24h before now timestamp: now - 24*60*60

For example:

now: 1618988420 - 24h before now: 1618902020

query:

query {
bondingCurve(id: "0xe5b43f7d633c18ae5b8eed3a39ba11657843f91e") {
shardsbought(where: {timestamp_gte: 1618902020, timestamp_lte: 1618988420}) {
timestamp
amountExact
costExact
}
shardssold(where: {timestamp_gte: 1618902020, timestamp_lte: 1618988420}) {
timestamp
amountExact
payoutExact
}
}
}

After getting all the trades within the last 24 hours, you can sum shardsbought.costExact and shardsSold.payoutExact then times 2 to get trading volume in the last 24 hours.