/** * @param string $url * @param ResponseInterface $response * @return array|stdClass * * @throws ApiErrorException */ public static function processResult(string $url, ResponseInterface $response) { $body = $response->getBody()->getContents(); $body = Tools::jsonNumbersToString($body); $result = Json::decode($body); self::checkErrors($result, $url); return $result; }
/** * @see https://info.shapeshift.io/#api-9 * * @param string $amount * @param string $withdrawalAddress * @param string $coin1 * @param string $coin2 * @param string|null $returnAddress * @param string|null $rsAddress * @param string|null $destinationTag * @param string|null $apiKey * @return array|stdClass * * @throws RequestFailedException * @throws ApiErrorException */ public function createFixedAmountTransaction(string $amount, string $withdrawalAddress, string $coin1, string $coin2, string $returnAddress = null, string $rsAddress = null, string $destinationTag = null, string $apiKey = null) { $input = ['withdrawal' => $withdrawalAddress, 'pair' => Tools::buildPair($coin1, $coin2, Tools::LOWERCASE), 'returnAddress' => $returnAddress, 'destTag' => $destinationTag, 'rsAddress' => $rsAddress, 'apiKey' => $apiKey, 'amount' => $amount]; $result = $this->post(Resources::SEND_AMOUNT, $input); if (!isset($result->success)) { throw new NotValidResponseFromApiException('API responded with invalid structure.'); } return $result->success; }