Mochi APIs
API using for ticker
Query for a token or a list of tokens (in case of duplicated symbols) https://api.mochi.pod.town/api/v1/defi/coins?query=sol
The response will look something like this
{
"data": [
{
"id": "solana",
"symbol": "sol",
"name": "Solana"
},
{
"id": "sol-wormhole",
"symbol": "sol",
"name": "SOL (Wormhole)"
},
{
"id": "wrapped-solana",
"symbol": "sol",
"name": "Wrapped Solana"
}
]
}
data
will be an empty list if the token is not found After that, you can grab the token's id
and call the next api https://api.mochi.pod.town/api/v1/defi/coins/{id}
, response will be something like this
{
"data": {
"id": "ethereum",
"name": "Ethereum",
"symbol": "eth",
"market_cap_rank": 2,
"asset_platform_id": "",
"image": {
"thumb": "https://assets.coingecko.com/coins/images/279/thumb/ethereum.png?1595348880",
"small": "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
"large": "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880"
},
"market_data": {
"current_price": {
"usd": 1983.03,
"vnd": 46626651,
...
},
"market_cap": {
"usd": 236866834921,
"vnd": 5569405946919549,
...
},
// these are quite self-explanatory
"price_change_percentage_1h_in_currency": {
"usd": 4.7594,
"bnb": 3.59761,
...
},
"price_change_percentage_24h_in_currency": {
"usd": 4.7594,
"bnb": 3.59761,
...
},
"price_change_percentage_7d_in_currency": {
"usd": 4.7594,
"bnb": 3.59761,
...
}
},
// ignore this for now
"tickers": [],
// the token's description
"description": {
"en": "Ethereum is a global, open-source platform..."
}
}
}
Additionally, you can also query chart data for a pair of tokens https://api.mochi.pod.town/api/v1/defi/coins/compare?base=ethereum&target=tether&interval=30
base
and target
is the token's id as mentioned above interval
is measured in days all query params are required
{
"data": {
"base_coin": {
"id": "ethereum",
"name": "Ethereum",
"symbol": "eth",
"market_cap_rank": 2,
"asset_platform_id": "",
"image": {
"thumb": "https://assets.coingecko.com/coins/images/279/thumb/ethereum.png?1595348880",
"small": "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
"large": "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880"
},
"market_data": {},
"market_cap": {},
"price_change_percentage_1h_in_currency": {},
"price_change_percentage_24h_in_currency": {},
"price_change_percentage_7d_in_currency": {}
},
"tickers": [],
"description": {
"en": "..."
}
},
"target_coin": {
"id": "tether",
"name": "Tether",
"symbol": "usdt",
"market_cap_rank": 3,
"asset_platform_id": "ethereum",
"image": {
"thumb": "https://assets.coingecko.com/coins/images/325/thumb/Tether.png?1668148663",
"small": "https://assets.coingecko.com/coins/images/325/small/Tether.png?1668148663",
"large": "https://assets.coingecko.com/coins/images/325/large/Tether.png?1668148663"
},
"market_data": {},
"market_cap": {},
"price_change_percentage_1h_in_currency": {},
"price_change_percentage_24h_in_currency": {},
"price_change_percentage_7d_in_currency": {},
"tickers": [],
"description": {
"en": "..."
}
},
// ticks for y axis
"ratios": [
1747.3762376237623,
1748.950495049505,
1729.7227722772277,
1739.4554455445543,
1727.2673267326732,
....
],
// ticks for x axis
"times": [
"03-20",
"03-21",
"03-21",
"03-21",
"03-21",
"03-21",
"03-21",
"03-22",
"03-22",
"03-22",
"03-22",
"03-22",
"03-22",
...
],
"base_coin_suggestions": null,
"target_coin_suggestions": null,
"from": "March 20, 2023",
"to": "April 19, 2023"
}
}
API using for watchlist
GET view a user's watchlist data https://api.mochi.pod.town/api/v1/defi/watchlist?user_id={id}
user_id
is the discord's user id POST add a token to user's watchlist https://api.mochi.pod.town/api/v1/defi/watchlist
{
user_id: '...',
symbol: 'ETH'
}
DELETE remove a token from user's watchlist https://api.mochi.pod.town/api/v1/defi/watchlist?symbol=ETH&user_id=...
APIs for NFT checking
https://api.mochi.pod.town/api/v1/nfts/{symbol_or_address}/{token_id}
query string:
query_address
: boolean - use when you want to query using the collection's address instead of the symbol
the above endpoint will return either
empty - no record found
response with data (in case there is only one matching symbol of a collection in database)
empty but
suggestions
field are populated (in case there are multiple collections that match the symbol)
response will have the following shape (some properties are omitted for the sake of brevity) https://api.mochi.pod.town/api/v1/nfts/NEKO/1
{
"data": {
"image_content_type": "",
"rarity_rank": 0,
"rarity_tier": "",
"attributes": null,
"rarity": null,
"metadata_id": "",
"owner": {
"owner_address": "",
"collection_address": "",
"token_id": ""
},
"marketplace": null
},
// where there are mutliple collections with the same symbol (NEKO in this case)
"suggestions": [
{
"name": "Cyber Neko",
"symbol": "NEKO",
"address": "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73",
"chain": "ftm",
"chain_id": 0
},
{
"name": "Sipher NEKO",
"symbol": "NEKO",
"address": "0x09E0dF4aE51111CA27d6B85708CFB3f1F7cAE982",
"chain": "eth",
"chain_id": 0
},
...
]
}
When you receive this type of response, generally we recommend that you show the selection to user and let them choose, after which you will obtain the collection's address. Let's say they chose the first one (0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73
)
You can then proceed to call the above api again, this time substituting the symbol with address and add the query_address=true
to query string, response will look like following:
{
"data": {
"token_id": "1",
"collection_address": "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73",
"name": "Cyber Neko 1",
"description": "Cyber Neko NFT",
"image": "https://storage.googleapis.com/cyber-neko/genesis-collection/full/1",
"image_cdn": "https://storage.googleapis.com/cyber-neko/genesis-collection/thumb/1",
"image_content_type": "",
"rarity_rank": 0,
"rarity_tier": "",
"attributes": [
{
"collection_address": "",
"token_id": "",
"trait_type": "Mask",
"value": "None",
"count": 6556,
"rarity": "Common",
"frequency": "99.36%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Earring",
"value": "None",
"count": 4965,
"rarity": "Common",
"frequency": "82.36%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Eyewear",
"value": "None",
"count": 4629,
"rarity": "Common",
"frequency": "81.13%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Fur",
"value": "None",
"count": 4041,
"rarity": "Common",
"frequency": "71.12%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Necklace",
"value": "None",
"count": 4024,
"rarity": "Common",
"frequency": "72.29%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Body",
"value": "White",
"count": 894,
"rarity": "Common",
"frequency": "15.49%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Eyes",
"value": "Tired Eyes",
"count": 390,
"rarity": "Uncommon",
"frequency": "5.61%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Mouth",
"value": "Bearded",
"count": 118,
"rarity": "Mythic",
"frequency": "0.59%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Background",
"value": "Paw Pattern",
"count": 92,
"rarity": "Uncommon",
"frequency": "1.07%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Hat",
"value": "Playboy",
"count": 68,
"rarity": "Rare",
"frequency": "0.48%"
},
{
"collection_address": "",
"token_id": "",
"trait_type": "Clothe",
"value": "Japanese Uniform",
"count": 67,
"rarity": "Rare",
"frequency": "0.47%"
}
],
"rarity": {
"rank": 914,
"score": "3.658723",
"total": 6666,
"rarity": "Epic"
},
"metadata_id": "",
"owner": {
"owner_address": "0xD28Cf82b9B8ee25E3C82923aDF6aA6CC2f220932",
"collection_address": "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73",
"token_id": "1"
},
"marketplace": []
},
"suggestions": null,
}
Last updated