1.6.6 • Published 1 year ago

skytale-commons v1.6.6

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
1 year ago

Skytale Commons

Skytale utilities and most common used types

Wiki Documentation

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

NameDescriptionRequireddefault
MAX_NUMBER_OF_DECODER_INSTANCESmax number of instances in pool of ABI Decoderfalse10
MIN_NUMBER_OF_DECODER_INSTANCESmin number of instances in pool of ABI Decoderfakse2

Covalent

Access to the main Covalent API functions.

Covalent API Documetation

Implemented:

environment variables

NameDescriptionRequireddefault
COVALENT_URLcovalent api urlfalsehttps://api.covalenthq.com/v1
COVALENT_API_KEYcovalent api keytrue

Coingecko

Utilities' functions to access Coingecko price service and accessories.

It converts the chain ids and symbols in Coingecko internal identifiers.

Coingecko API Documetation

environment variables

NameDescriptionRequireddefault
COINGECKO_URLcoingecko api urlfalsehttps://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.

1.6.4

1 year ago

1.6.3

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.6

1 year ago

1.6.5

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.5.0

1 year ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago