@@ -692,9 +692,6 @@ public function exchangeInfo($symbols = null)
692
692
{
693
693
if (!$ this ->exchangeInfo ) {
694
694
$ arr = array ();
695
- $ arr ['symbols ' ] = array ();
696
- $ parameters = [];
697
-
698
695
if ($ symbols ) {
699
696
if (gettype ($ symbols ) == "string " ) {
700
697
$ parameters ["symbol " ] = $ symbols ;
@@ -706,7 +703,11 @@ public function exchangeInfo($symbols = null)
706
703
} else {
707
704
$ arr = $ this ->httpRequest ("v3/exchangeInfo " );
708
705
}
709
-
706
+ if ((is_array ($ arr ) === false ) || empty ($ arr )) {
707
+ echo "Error: unable to fetch spot exchange info " . PHP_EOL ;
708
+ $ arr = array ();
709
+ $ arr ['symbols ' ] = array ();
710
+ }
710
711
$ this ->exchangeInfo = $ arr ;
711
712
$ this ->exchangeInfo ['symbols ' ] = null ;
712
713
@@ -921,13 +922,16 @@ public function depositAddress(string $asset, $network = null)
921
922
$ return = $ this ->httpRequest ("v1/capital/deposit/address " , "GET " , $ params , true );
922
923
923
924
// Adding for backwards compatibility with wapi
924
- $ return ['asset ' ] = $ return ['coin ' ];
925
- $ return ['addressTag ' ] = $ return ['tag ' ];
926
-
927
- if (!empty ($ return ['address ' ])) {
928
- $ return ['success ' ] = 1 ;
925
+ if (is_array ($ return ) && !empty ($ return )) {
926
+ $ return ['asset ' ] = $ return ['coin ' ];
927
+ $ return ['addressTag ' ] = $ return ['tag ' ];
928
+ if (!empty ($ return ['address ' ])) {
929
+ $ return ['success ' ] = 1 ;
930
+ } else {
931
+ $ return ['success ' ] = 0 ;
932
+ }
929
933
} else {
930
- $ return [ ' success ' ] = 0 ;
934
+ echo " Error: no deposit address found " . PHP_EOL ;
931
935
}
932
936
933
937
return $ return ;
@@ -955,8 +959,12 @@ public function depositHistory(string $asset = null, array $params = [])
955
959
$ return = $ this ->httpRequest ("v1/capital/deposit/hisrec " , "GET " , $ params , true );
956
960
957
961
// Adding for backwards compatibility with wapi
958
- foreach ($ return as $ key =>$ item ) {
959
- $ return [$ key ]['asset ' ] = $ item ['coin ' ];
962
+ if (is_array ($ return ) && !empty ($ return )) {
963
+ foreach ($ return as $ key =>$ item ) {
964
+ $ return [$ key ]['asset ' ] = $ item ['coin ' ];
965
+ }
966
+ } else {
967
+ echo "Error: no deposit history found " . PHP_EOL ;
960
968
}
961
969
962
970
return $ return ;
0 commit comments