Sub-Adapters 1
Preview and test each sub adapter.
Cosmos Hub (cosmos-hub)
Metadata
- ID
- cosmos-hub
- name
"Cosmos Hub"
- icon
- protocolLaunch
"2019-12-11"
- category
"blockchain"
- description
"The Cosmos network consists of many independent, parallel blockchains, each powered by classical Byzantine fault-tolerant (BFT) consensus protocols. This adapter shows fees of teh Cosmos Hub chain."
- feeDescription
"Transaction fees are paid by users to miners of the cosmos hub."
- blockchain
"Cosmos"
- source
"Cosmos API"
- website
"http://cosmos.network/"
- tokenTicker
"ATOM"
- tokenCoingecko
"cosmos"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1export const name = 'Cosmos Hub';
2export const version = '0.0.3';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getOneDayFees = async (date: string) => {
7 // const url = `https://api.cosmoscan.net/transactions/fee/agg?by=day&from=${from_timestamp}&to=${to_timestamp}`
8 const url = `https://cryptostats-api-proxy.vercel.app/api/v1/cosmos-daily-fees/${date}`
9 const daylyFees = (await sdk.http.get(url)).value
10 const atomPrice = await sdk.coinGecko.getHistoricalPrice('cosmos', date)
11 const totalFees = daylyFees * atomPrice
12 sdk.log('fees | atom Price', daylyFees, atomPrice)
13 return totalFees;
14 }
15
16 sdk.register({
17 id: 'cosmos-hub',
18 queries: {
19 oneDayTotalFees: getOneDayFees,
20 oneDayProtocolFees: getOneDayFees,
21 },
22 metadata: {
23 name: 'Cosmos Hub',
24 icon: sdk.ipfs.getDataURILoader('QmRPHkVuUWdkmFXEJwP6qUYK6qiRizAiMNQb99J7F8qH6p', 'image/webp'),
25 protocolLaunch: '2019-12-11',
26 category: 'blockchain',
27 description: 'The Cosmos network consists of many independent, parallel blockchains, each powered by classical Byzantine fault-tolerant (BFT) consensus protocols. This adapter shows fees of teh Cosmos Hub chain.',
28 feeDescription: 'Transaction fees are paid by users to miners of the cosmos hub.',
29 blockchain: 'Cosmos',
30 source: 'Cosmos API',
31 website: 'http://cosmos.network/',
32 tokenTicker: 'ATOM',
33 tokenCoingecko: 'cosmos',
34 },
35 })
36}
It's something off?
Report it to the discussion board on Discord, we will take care of it.