@@ -797,84 +797,121 @@ public function withdraw(string $asset, string $address, $amount, $addressTag =
797797 }
798798
799799 /**
800- * depositAddress get the deposit address for an asset
801- *
802- * $depositAddress = $api->depositAddress("VEN");
803- *
804- * @param $asset string the currency such as BTC
805- * @return array with error message or array deposit address information
800+ * depositAddress - Get the deposit address for an asset
801+ *
802+ * @link https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
803+ *
804+ * @property int $weight 1
805+ *
806+ * @param string $asset (mandatory) An asset, e.g. BTC
807+ * @param string $network (optional) You can get network in networkList from /sapi/v1/capital/config/getall
808+ *
809+ * @return array containing the response
806810 * @throws \Exception
807811 */
808- public function depositAddress (string $ asset )
812+ public function depositAddress (string $ asset, $ network = null )
809813 {
810814 $ params = [
811- "wapi " => true ,
812- "asset " => $ asset ,
815+ "sapi " => true ,
816+ "coin " => $ asset ,
813817 ];
814- return $ this ->httpRequest ("v3/depositAddress.html " , "GET " , $ params , true );
818+ if (is_null ($ network ) === false && empty ($ network ) === false ) {
819+ $ params ['network ' ] = $ network ;
820+ }
821+
822+ $ return = $ this ->httpRequest ("v1/capital/deposit/address " , "GET " , $ params , true );
823+
824+ // Adding for backwards compatibility with wapi
825+ $ return ['asset ' ] = $ return ['coin ' ];
826+ $ return ['addressTag ' ] = $ return ['tag ' ];
827+
828+ if (!empty ($ return ['address ' ])) {
829+ $ return ['success ' ] = 1 ;
830+ } else {
831+ $ return ['success ' ] = 0 ;
832+ }
833+
834+ return $ return ;
815835 }
816836
817837 /**
818- * depositAddress get the deposit history for an asset
819- *
820- * $depositHistory = $api->depositHistory();
821- *
822- * $depositHistory = $api->depositHistory( "BTC" );
823- *
824- * @param $asset string empty or the currency such as BTC
825- * @param $params array optional startTime, endTime, status parameters
826- * @return array with error message or array deposit history information
838+ * depositHistory - Get the deposit history for one or all assets
839+ *
840+ * @link https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
841+ *
842+ * @property int $weight 1
843+ *
844+ * @param string $asset (optional) An asset, e.g. BTC - or leave empty for all
845+ * @param array $params (optional) An array of additional parameters that the API endpoint allows
846+ *
847+ * @return array containing the response
827848 * @throws \Exception
828849 */
829850 public function depositHistory (string $ asset = null , array $ params = [])
830851 {
831- $ params ["wapi " ] = true ;
852+ $ params ["sapi " ] = true ;
832853 if (is_null ($ asset ) === false ) {
833- $ params ['asset ' ] = $ asset ;
854+ $ params ['coin ' ] = $ asset ;
834855 }
835- return $ this ->httpRequest ("v3/depositHistory.html " , "GET " , $ params , true );
856+ $ return = $ this ->httpRequest ("v1/capital/deposit/hisrec " , "GET " , $ params , true );
857+
858+ // Adding for backwards compatibility with wapi
859+ foreach ($ return as $ key ->$ item ) {
860+ $ return [$ key ]['asset ' ] = $ item ['coin ' ];
861+ }
862+
863+ return $ return ;
864+
836865 }
837866
838867 /**
839- * withdrawHistory get the withdrawal history for an asset
840- *
841- * $withdrawHistory = $api->withdrawHistory();
842- *
843- * $withdrawHistory = $api->withdrawHistory( "BTC" );
844- *
845- * @param $asset string empty or the currency such as BTC
846- * @param $params array optional startTime, endTime, status parameters
847- * @return array with error message or array deposit history information
868+ * withdrawHistory - Get the withdraw history for one or all assets
869+ *
870+ * @link https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
871+ *
872+ * @property int $weight 1
873+ *
874+ * @param string $asset (optional) An asset, e.g. BTC - or leave empty for all
875+ * @param array $params (optional) An array of additional parameters that the API endpoint allows: status, offset, limit, startTime, endTime
876+ *
877+ * @return array containing the response
848878 * @throws \Exception
849879 */
850880 public function withdrawHistory (string $ asset = null , array $ params = [])
851881 {
852- $ params ["wapi " ] = true ;
882+ $ params ["sapi " ] = true ;
853883 if (is_null ($ asset ) === false ) {
854- $ params ['asset ' ] = $ asset ;
884+ $ params ['coin ' ] = $ asset ;
855885 }
856- return $ this ->httpRequest ("v3/withdrawHistory.html " , "GET " , $ params , true );
886+ // Wrapping in array for backwards compatibility with wapi
887+ $ return = array (
888+ 'withdrawList ' => $ this ->httpRequest ("v1/capital/withdraw/history " , "GET " , $ params , true )
889+ );
890+
891+ // Adding for backwards compatibility with wapi
892+ $ return ['success ' ] = 1 ;
893+
894+ return $ return ;
857895 }
858896
859897 /**
860- * withdrawFee get the withdrawal fee for an asset
861- *
862- * $withdrawFee = $api->withdrawFee( "BTC" );
863- *
864- * @param $asset string currency such as BTC
865- * @return array with error message or array containing withdrawFee
898+ * withdrawFee - Get the withdrawal fee for an asset
899+ *
900+ * @property int $weight 1
901+ *
902+ * @param string $asset (mandatory) An asset, e.g. BTC
903+ *
904+ * @return array containing the response
866905 * @throws \Exception
867906 */
868907 public function withdrawFee (string $ asset )
869908 {
870- $ params = [
871- "wapi " => true ,
872- ];
873-
874- $ response = $ this ->httpRequest ("v3/assetDetail.html " , "GET " , $ params , true );
909+ $ return = $ this ->assetDetail ();
875910
876- if (isset ($ response ['success ' ], $ response ['assetDetail ' ], $ response ['assetDetail ' ][$ asset ]) && $ response ['success ' ]) {
877- return $ response ['assetDetail ' ][$ asset ];
911+ if (isset ($ return ['success ' ], $ return ['assetDetail ' ], $ return ['assetDetail ' ][$ asset ]) && $ return ['success ' ]) {
912+ return $ return ['assetDetail ' ][$ asset ];
913+ } else {
914+ return array ();
878915 }
879916 }
880917
0 commit comments