Sub-Adapters 1
Preview and test each sub adapter.
Filecoin (filecoin)
Metadata
- ID
- filecoin
- name
"Filecoin"
- icon
- category
"Network Protocol"
- subcategory
"Storage"
- description
"Filecoin is a decentralized storage network designed to store humanity's most important information."
- feeDescription
"Transaction fees are partially burnt and partially paid to miners."
- blockchain
"Filecoin"
- source
"Starboard Ventures"
- 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
1export const name = 'Filecoin';
2export const version = '0.0.2';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getFees = async (startDate: string, endDate: string): Promise<number> => {
7
8 const startTime = (new Date(startDate).getTime() / 1000);
9 const endTime = (new Date(endDate).getTime() / 1000);
10
11 const query = `query {
12 dateRangeTotalUsdFees(
13 name: "filecoin"
14 startTime: ${startTime}
15 endTime: ${endTime}
16 )
17 }`;
18
19 const data = await sdk.graph.query('https://api.d4.xyz/graphql', query);
20 const fees = parseFloat(data.dateRangeTotalUsdFees);
21
22 return fees;
23 }
24
25 const getOneDayFees = (date: string) => {
26 const nextDay = sdk.date.offsetDaysFormatted(date, 1);
27 return getFees(date, nextDay);
28 }
29
30 sdk.register({
31 id: 'filecoin',
32 queries: {
33 oneDayTotalFees: getOneDayFees,
34 dateRangeTotalFees: getFees,
35 },
36 metadata: {
37 name: 'Filecoin',
38 icon: sdk.ipfs.getDataURILoader('QmSi57thGKY9X9cjVPvgWoYg8pVBeZsecW1v6NmmkY6RNa', 'image/svg+xml'),
39 category: 'Network Protocol',
40 subcategory: "Storage",
41 description: 'Filecoin is a decentralized storage network designed to store humanity\'s most important information.',
42 feeDescription: 'Transaction fees are partially burnt and partially paid to miners.',
43 blockchain: 'Filecoin',
44 source: 'Starboard Ventures',
45 website: 'https://filecoin.io',
46 protocolLaunch: '2020-10-16',
47 tokenTicker: 'FIL',
48 tokenCoingecko: 'filecoin',
49 },
50 })
51}
52
It's something off?
Report it to the discussion board on Discord, we will take care of it.