Sub-Adapters 1
Preview and test each sub adapter.
Arweave (arweave)
Metadata
- ID
- arweave
- name
"Arweave"
- icon
- category
"Network Protocol"
- subcategory
"Storage"
- description
"Arweave enables you to store documents and applications forever."
- feeDescription
"Transaction fees paid to miners to store data in the permaweb."
- blockchain
"Arweave"
- source
"Arweave API"
- website
"https://www.arweave.org/"
- protocolLaunch
"2020-12-17"
- tokenTicker
"AR"
- tokenCoingecko
"arweave"
- events
[]
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1export const name = 'Arweave';
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: "arweave"
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: 'arweave',
32 queries: {
33 oneDayTotalFees: getOneDayFees,
34 dateRangeTotalFees: getFees,
35 },
36 metadata: {
37 name: 'Arweave',
38 icon: sdk.ipfs.getDataURILoader('QmUzfCv6GNKE6Curdb2Va6kkg2tTiLPGt8vWp9Lsa1CQcB', 'image/png'),
39 category: 'Network Protocol',
40 subcategory: 'Storage',
41 description: 'Arweave enables you to store documents and applications forever.',
42 feeDescription: 'Transaction fees paid to miners to store data in the permaweb.',
43 blockchain: 'Arweave',
44 source: 'Arweave API',
45 website: 'https://www.arweave.org/',
46 protocolLaunch: '2020-12-17',
47 tokenTicker: 'AR',
48 tokenCoingecko: 'arweave',
49 events: [
50 ],
51 },
52 })
53}
54
It's something off?
Report it to the discussion board on Discord, we will take care of it.