skytale-commons
v1.6.6
Published
Skytale utilities and most common used types
Downloads
29
Readme
Skytale Commons
Skytale utilities and most common used types
Sections
Abi Decoder
Utility for decoding raw input from EVM transactions.
It can be used either as a stand-alone instance or as pool of instances for heavy use.
Implementation based on npm package abi-decoder
environment variables
|Name|Description|Required|default|
|---|---|:---:|---|
|MAX_NUMBER_OF_DECODER_INSTANCES
| max number of instances in pool of ABI Decoder | false
| 10 |
|MIN_NUMBER_OF_DECODER_INSTANCES
| min number of instances in pool of ABI Decoder | fakse
| 2 |
Covalent
Access to the main Covalent API functions.
Implemented:
- Class A Endpoints
environment variables
|Name|Description|Required|default|
|---|---|:---:|---|
|COVALENT_URL
| covalent api url | false
| https://api.covalenthq.com/v1 |
|COVALENT_API_KEY
| covalent api key | true
| |
Coingecko
Utilities' functions to access Coingecko price service and accessories.
It converts the chain ids and symbols in Coingecko internal identifiers.
environment variables
|Name|Description|Required|default|
|---|---|:---:|---|
|COINGECKO_URL
| coingecko api url | false
| https://api.coingecko.com/api/v3 | |
Usage
npm i skytale-commons
A few examples of usage:
- Coingecko Data
import { getSupportedCurrenciesFromCache, getCoinListFromCache, getAssetPlatformsFromCache } from "skytale-commons";
// get the list of supported fiat currencies from 24h cache
const supportedCurrencies = await getSupportedCurrenciesFromCache();
// get the coin list from 24h cache
const coins = await getCoinListFromCache();
// get the asset platforms list from 24h cache
const assets = await getAssetPlatformsFromCache()
import { getCoinBySymbol, getCoinsBySymbols } from "skytale-commons";
// get a single coin from a symbol
const coin = await getCoinBySymbol("ETH");
// get an array of coins from an array of symbols
const coins = await getCoinsBySymbols(["ETH", "BNB"]);
// get a Coingecko Asset Id from a chain id
const id = getChainIdentifier(1);
- Current prices
import { getPriceByTokenSymbol, getPriceByTokenAddress } from "skytale-commons";
const pricesBySymbol = await getPriceByTokenSymbol(
["ETH", "HEX"],
["USD", "EUR", "GBP"],
{
include_last_updated_at: true,
include_24hr_change: true,
include_24hr_vol: true,
include_market_cap: true
});
const pricesByTokenAddress = await getPriceByTokenAddress(
1,
["0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"],
["USD", "EUR", "GBP"],
{
include_last_updated_at: true,
include_24hr_change: true,
include_24hr_vol: true,
include_market_cap: true
});
Contributors
Skytale Commons is developed by the Skytale team.
||| |---|---| |Joris Borsboom | @jorisborsboom | |Patrik Csokas | @patricck | |Avinash Buddana | @avinash.buddana1 | |Martin Mali | @martinheti | |Domnic Fernandes | @fdomnic8| |Rhian Lewis | @rhianlewis | |Enrico Mariotti | @boulder225 | |Massimiliano Gerardi | @massi.gerardi |
Any contribution will be appreciated.