This repository was archived by the owner on Sep 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/Request/Method/Wallet Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 55use Electrum \Request \AbstractMethod ;
66use Electrum \Request \MethodInterface ;
77use Electrum \Response \Model \Wallet \Transaction ;
8+ use Electrum \Response \Exception \BadResponseException ;
89
910/**
1011 * Wallet history. Returns the transaction history of your wallet.
@@ -23,11 +24,19 @@ class GetHistory extends AbstractMethod implements MethodInterface
2324 *
2425 * @return HistoryResponse
2526 * @throws \Electrum\Request\Exception\BadRequestException
26- * @throws \Electrum\Response\Exception\ElectrumResponseException
27+ * @throws \Electrum\Response\Exception\BadResponseException
2728 */
2829 public function execute (array $ optional = [])
2930 {
3031 $ data = $ this ->getClient ()->execute ($ this ->method , $ optional );
32+ if (!is_array ($ data )) {
33+ $ data = json_decode ($ data , true );
34+ if (isset ($ data ['transactions ' ])) {
35+ $ data = $ data ['transactions ' ];
36+ } else {
37+ throw new BadResponseException ('Cannot get history ' );
38+ }
39+ }
3140 $ transactions = [];
3241 foreach ($ data as $ transaction ) {
3342 $ transactions [] = $ this ->hydrate (new Transaction (), $ transaction );
You can’t perform that action at this time.
0 commit comments