Sub-Adapters 1
Preview and test each sub adapter.
Filecoin (filecoin)
Metadata
- ID
- filecoin
- name
"Filecoin"
- icon
- category
"l1"
- description
"Filecoin is a blockchain used for data storage and retreival"
- feeDescription
"Base fees are burned and tips are paid to miners."
- blockchain
"Filecoin"
- source
"BitQuery"
- website
"https://filecoin.io"
- protocolLaunch
"2020-10-16"
- tokenTicker
"FIL"
- tokenCoingecko
"filecoin"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Filecoin Fees';
2export const version = '0.0.1';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getFees = async (date: string): Promise<number> => {
7 const query = `{
8 filecoin {
9 messages(options: {asc: "date.date"}
10 date: {is: "${date}"}) {
11 date: date {
12 date
13 }
14 minerTip(calculate: sum)
15 baseFeeBurn(calculate: sum)
16 overEstimationBurn(calculate: sum)
17 }
18 }
19 }`;
20
21 const [data, price] = await Promise.all([
22 sdk.graph.query('https://cryptostats-api-proxy.vercel.app/api/v1/bitquery/query', query),
23 sdk.coinGecko.getCurrentPrice('filecoin'),
24 ]);
25
26 const { minerTip, baseFeeBurn, overEstimationBurn } = data.filecoin.messages[0];
27
28 const totalFees = minerTip + baseFeeBurn + overEstimationBurn;
29
30 return totalFees * price;
31 }
32
33 sdk.register({
34 id: 'filecoin',
35 queries: {
36 oneDayTotalFees: getFees,
37 },
38 metadata: {
39 name: 'Filecoin',
40 icon: sdk.ipfs.getDataURILoader('QmSi57thGKY9X9cjVPvgWoYg8pVBeZsecW1v6NmmkY6RNa', 'image/svg+xml'),
41 category: 'l1',
42 description: 'Filecoin is a blockchain used for data storage and retreival',
43 feeDescription: 'Base fees are burned and tips are paid to miners.',
44 blockchain: 'Filecoin',
45 source: 'BitQuery',
46 website: 'https://filecoin.io',
47 protocolLaunch: '2020-10-16',
48 tokenTicker: 'FIL',
49 tokenCoingecko: 'filecoin',
50 },
51 })
52}
53
It's something off?
Report it to the discussion board on Discord, we will take care of it.