From fdd17327be33110dfdae3298484603dbc6692a68 Mon Sep 17 00:00:00 2001 From: Ekliptor Date: Sun, 20 Sep 2020 22:49:00 +0700 Subject: [PATCH] fixed empty response on new SLP address --- src/BlockchainApi/BchdProtoGatewayApi.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BlockchainApi/BchdProtoGatewayApi.php b/src/BlockchainApi/BchdProtoGatewayApi.php index 29f04e3..e4411d1 100644 --- a/src/BlockchainApi/BchdProtoGatewayApi.php +++ b/src/BlockchainApi/BchdProtoGatewayApi.php @@ -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); @@ -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;