Skip to content

Commit

Permalink
fixed empty response on new SLP address
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekliptor authored and Ekliptor committed Sep 20, 2020
1 parent f6f6517 commit fdd1732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/BlockchainApi/BchdProtoGatewayApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getAddressDetails(string $address): ?BchAddress {
if ($response === false)
return null;
$jsonRes = json_decode($response);
if ($jsonRes === null) // empty object if address is unknown = valid response
if ($jsonRes === null || $response === '{}') // empty object if address is unknown = valid response
return null;
else if (isset($jsonRes->error) && $jsonRes->error) {
$this->logError("Error on receiving BCH address details", $jsonRes->error);
Expand Down Expand Up @@ -124,8 +124,8 @@ public function getSlpAddressDetails(string $address, string $tokenID): ?SlpToke
if ($response === false)
return null;
$jsonRes = json_decode($response);
if ($jsonRes === null) // empty object if address is unknown = valid response
return null;
if ($jsonRes === null || $response === '{}')
return null; // empty object if address is unknown = valid response, check again later once a TX with this token happened
else if (isset($jsonRes->error) && $jsonRes->error) {
$this->logError("Error on receiving SLP address details", $jsonRes->error);
return null;
Expand Down

0 comments on commit fdd1732

Please sign in to comment.