<?php /** * Discovered account currencies. */ if (!$exchange) { throw new JobException("No exchange defined"); } $factory = new \Core\DiscoveredCurrencyFactory(); $instance = \DiscoveredComponents\Accounts::getInstance($exchange); $currencies = $instance->fetchSupportedCurrencies($factory, $logger); $logger->info("Found " . count($currencies) . " currencies: " . implode(", ", $currencies)); $persistent = new \Core\PersistentAccountType($instance, db()); $persistent->storeSupportedCurrencies($currencies, $logger);
/** * Does not include disabled accounts or exchanges */ function get_supported_wallets() { $wallets = array("796" => array('btc', 'ltc', 'usd'), "cryptostocks" => array('btc', 'ltc'), "havelock" => array('btc'), "litecoininvest" => array('ltc'), "generic" => get_all_currencies()); // add all discovered pairs foreach (Accounts::getAllInstances() as $key => $exchange) { if (in_array($key, Accounts::getDisabled())) { // do not list disabled accounts continue; } $persistent = new \Core\PersistentAccountType($exchange, db()); $result = array(); foreach ($persistent->getSupportedCurrencies() as $currency) { if (in_array($currency, get_all_currencies())) { $result[] = $currency; } } $wallets[$key] = $result; } // and add in hash currencies (temporary; eventually we want to remove 'hash' from this return result) foreach (Accounts::getMiners() as $key) { if (in_array($key, Accounts::getDisabled())) { // do not list disabled accounts continue; } $wallets[$key][] = 'hash'; } return $wallets; }