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 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.1.3';
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  sdk.register({
28    id: 'solana',
29    queries: {
30      oneDayTotalFees: getSolanaFee,
31    },
32    metadata: {
33      name: 'Solana',
34      icon: sdk.ipfs.getDataURILoader('QmXcXaQ5GGBBQb7cgrn6SySZVWoiniwYkc3DrjgUKVt5ky', 'image/svg+xml'),
35      category: 'l1',
36      description: 'Solana is a high-throughput smart-contract blockchain',
37      feeDescription: 'Transaction fees are paid to validators',
38      source: 'Solana.FM',
39      tokenTicker: 'SOL',
40      tokenCoingecko: 'solana',
41      website: 'https://solana.com',
42      protocolLaunch: '2020-12-15',
43    },
44  });
45}
46

It's something off?

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

Adapter Info

Version

0.1.3

License

MIT

IPFS CID

QmdVbfVLVRXi4LErkvtsNHpqgAUsVi5nw2paPxgNShpQjX

CID (source)

QmRbYTSupqz7qTzSn7ZkLcDv28dPVz4AVaFDu4uUkjMcZx

Author

mihal.eth