Sub-Adapters 1
Preview and test each sub adapter.
Solana (solana)
Metadata
- ID
- solana
- name
"Solana"
- category
"l1"
- icon
- description
"Solana is a high-throughput smart-contract blockchain"
- issuanceDescription
"SOL is issued to validators"
- source
"Solana.FM"
- tokenTicker
"SOL"
- tokenCoingecko
"solana"
- website
"https://solana.com"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Solana Issuance';
2export const version = '0.3.0';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getSolanaIssuance = async () => {
7 const [supplyResult, inflationResult, solPrice] = await Promise.all([
8 sdk.http.post('https://api.mainnet-beta.solana.com', { jsonrpc: "2.0", id: 1, method: "getSupply" }),
9 sdk.http.post('https://api.mainnet-beta.solana.com', { jsonrpc: "2.0", id: 1, method: "getInflationRate" }),
10 sdk.coinGecko.getCurrentPrice('solana'),
11 ])
12
13 return inflationResult.result.total * supplyResult.result.value.total / 1e9 / 365 * solPrice;
14 }
15
16 const getIssuanceRate = async () => {
17 const inflationRate = await sdk.http.post('https://api.mainnet-beta.solana.com', { jsonrpc: "2.0", id: 1, method: "getInflationRate" });
18 return inflationRate.result.total;
19 }
20
21 sdk.register({
22 id: 'solana',
23 queries: {
24 issuance7DayAvgUSD: getSolanaIssuance,
25 issuanceRateCurrent: getIssuanceRate,
26 },
27 metadata: {
28 name: 'Solana',
29 category: 'l1',
30 icon: sdk.ipfs.getDataURILoader('QmXcXaQ5GGBBQb7cgrn6SySZVWoiniwYkc3DrjgUKVt5ky', 'image/svg+xml'),
31 description: 'Solana is a high-throughput smart-contract blockchain',
32 issuanceDescription: 'SOL is issued to validators',
33 source: 'Solana.FM',
34 tokenTicker: 'SOL',
35 tokenCoingecko: 'solana',
36 website: 'https://solana.com',
37 },
38 })
39}
40
It's something off?
Report it to the discussion board on Discord, we will take care of it.