hector-rubic-sdk
Version:
Simplify dApp creation
32 lines (31 loc) • 1.11 kB
TypeScript
import { HttpClient } from '../models/http-client';
import { BlockchainName } from '../../core/blockchain/models/blockchain-name';
import BigNumber from 'bignumber.js';
export declare class CoingeckoApi {
private readonly httpClient;
private static isSupportedBlockchain;
private readonly nativeCoinsCoingeckoIds;
private readonly tokenBlockchainId;
constructor(httpClient: HttpClient);
/**
* Gets price of native coin in usd from coingecko.
* @param blockchain Supported by {@link supportedBlockchains} blockchain.
*/
getNativeCoinPrice(blockchain: BlockchainName): Promise<BigNumber>;
/**
* Gets price of token in usd from coingecko.
* @param token Token to get price for.
*/
getErc20TokenPrice(token: {
address: string;
blockchain: BlockchainName;
}): Promise<BigNumber>;
/**
* Gets price of common token or native coin in usd from coingecko.
* @param token Token to get price for.
*/
getTokenPrice(token: {
address: string;
blockchain: BlockchainName;
}): Promise<BigNumber>;
}