import { getByNameOrSymbol, getAll } from "./currencies" import { Options } from "./types"; var DEFAULT_CURRENCY_NAME = 'bitcoin'; const validate = ({address, currencyNameOrSymbol, opts}: {address: string, currencyNameOrSymbol?: string, opts: Options}) => { var currency = getByNameOrSymbol(currencyNameOrSymbol || DEFAULT_CURRENCY_NAME); if (currency && currency.validator) { return currency.validator(address, currency, opts); } throw new Error('Missing validator for currency: ' + currencyNameOrSymbol); } const getCurrencies = () => { return getAll(); } const findCurrency = (symbol: string) => { return getByNameOrSymbol(symbol) || null; } export { validate, getCurrencies, findCurrency } export default validate;