public function getCurrencies()
{
$this->request = $this->createNewRequest();
$this->request->setMethod(Request::METHOD_GET);
$this->request->setPath('currencies');
$this->response = $this->sendRequest($this->request);
$body = json_decode($this->response->getBody(), true);
if (empty($body['data'])) {
throw new \Exception('Error with request: no data returned');
}
$currencies = $body['data'];
array_walk($currencies, function (&$value, $key) {
$currency = new \Bitpay\Currency();
$currency->setCode($value['code'])->setSymbol($value['symbol'])->setPrecision($value['precision'])->setExchangePctFee($value['exchangePctFee'])->setPayoutEnabled($value['payoutEnabled'])->setName($value['name'])->setPluralName($value['plural'])->setAlts($value['alts'])->setPayoutFields($value['payoutFields']);
$value = $currency;
});
return $currencies;
}