Wrapper for API methods that return possible cached data

Hierarchy (view full)

Constructors

  • Create class instance

    Parameters

    • apiKey: string

      Crypto Bot API key, looks like '1234:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'

    • endpoint: string = 'mainnet'

      API endpoint url or 'mainnet' or 'testnet' for hardcoded in library endpoint urls

    Returns Store

    Error - If passed invalid API key or endpoint

Properties

_CURRENCIES_UPDATE_PERIOD: number = 3600

Update period for fetching currencies from backend API in seconds

_EXCHANGE_RATES_UPDATE_PERIOD: number = 60

Update period for fetching exhange rates from backend API in seconds

_ME_UPDATE_PERIOD: number = 3600

Update period for fetching app infomation from backend API in seconds

_transport: Transport

Transport class instance

_currenciesFetchHandler: ((isForce?: boolean) => Promise<Currencies>)

Store.getCurrencies method fetch data handler, see createFetchHandler for more

_exchangeRatesFetchHandler: ((isForce?: boolean) => Promise<ExchangeRates>)

Store.getExchangeRates method fetch data handler, see createFetchHandler for more

_meFetchHandler: ((isForce?: boolean) => Promise<Me>)

Store.getMe method fetch data handler, see createFetchHandler for more

Methods

  • Get API supported currencies infomation

    Use toCurrencies backend API result convert function

    Parameters

    • OptionalisForce: boolean

      If true, return fresh data from backend API, not from cache

    Returns Promise<Currencies>

    Promise, what resolved to API supported currencies infomation object

    Error - If there is an error sending request to backend API or parsing response

  • Get API supported currencies exchange rate infomation

    Use toExchangeRates backend API result convert function

    Parameters

    • OptionalisForce: boolean

      If true, return fresh data from backend API, not from cache

    Returns Promise<ExchangeRates>

    Promise, what resolved to API supported currencies exchange rate infomation object

    Error - If there is an error sending request to backend API or parsing response

  • Get associated with passed API key app infomation

    Use toMe backend API result convert function

    Parameters

    • isForce: boolean = false

      If true, return fresh data from backend API, not from cache

    Returns Promise<Me>

    Promise, what resolved to associated with passed API key app infomation object

    Error - If there is an error sending request to backend API or parsing response