Adapter

Solana Fees

Pull fee data from Solana.FM via the CryptoStats proxy

Sub-Adapters 1

Preview and test each sub adapter.

Solana (solana)

Metadata

ID
solana
name

"Solana"

icon
category

"l1"

description

"Solana is a high-throughput smart-contract blockchain"

feeDescription

"Transaction fees are 50% burned, with the remainder paid to validators."

source

"Solana.FM"

tokenTicker

"SOL"

tokenCoingecko

"solana"

website

"https://solana.com"

protocolLaunch

"2020-12-15"

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'Solana Fees';
2export const version = '0.2.0';
3export const license = 'MIT';
4export const description = 'Pull fee data from Solana.FM via the CryptoStats proxy';
5
6export function setup(sdk: Context) {
7  const getSolanaFee = async (date: string): Promise<number> => {
8    const nextDay = sdk.date.getNextDay(date);
9
10    const [data, nextDayData] = await Promise.all([
11      sdk.http.get(`https://cryptostats-api-proxy.vercel.app/api/v1/solana-daily-fees/${date}`),
12      sdk.http.get(`https://cryptostats-api-proxy.vercel.app/api/v1/solana-daily-fees/${nextDay}`),
13    ]);
14
15    if (!data.success) {
16      throw new Error('Data not found');
17    }
18    if (!nextDayData.success) {
19      throw new Error('Day incomplete');
20    }
21
22    const solPrice = await sdk.coinGecko.getHistoricalPrice('solana', date);
23
24    return (data.value / 1e9) * solPrice;
25  }
26
27  const getFeesBurned = async (date: string) => {
28    const fee = await getSolanaFee(date);
29    return fee * 0.5;
30  }
31
32  sdk.register({
33    id: 'solana',
34    queries: {
35      oneDayTotalFees: getSolanaFee,
36      oneDayProtocolFees: getFeesBurned,
37    },
38    metadata: {
39      name: 'Solana',
40      icon: sdk.ipfs.getDataURILoader('QmXcXaQ5GGBBQb7cgrn6SySZVWoiniwYkc3DrjgUKVt5ky', 'image/svg+xml'),
41      category: 'l1',
42      description: 'Solana is a high-throughput smart-contract blockchain',
43      feeDescription: 'Transaction fees are 50% burned, with the remainder paid to validators.',
44      source: 'Solana.FM',
45      tokenTicker: 'SOL',
46      tokenCoingecko: 'solana',
47      website: 'https://solana.com',
48      protocolLaunch: '2020-12-15',
49    },
50  });
51}
52

It's something off?

Report it to the discussion board on Discord, we will take care of it.

Adapter Info

Version

0.2.0

License

MIT

IPFS CID

QmbxmDEkxBbn6foBRTVMEidxTzcw1Num7jwtoq3o17SzM9

CID (source)

QmZJpDNKsfMNWbK57vgPeBQ2RZj23PC1KwMKSkZHxN6uqB

Collections

Author

mihal.eth