/// <summary> /// Request withdrawal cancelation /// </summary> /// <param name="currency_name">base coin or quote coin name</param> /// <param name="transferId">The unique id of the withdrawal request specified</param> /// <param name="args">Add additional attributes for each exchange</param> /// <returns></returns> public override async ValueTask <Transfer> CancelCoinWithdrawAsync(string currency_name, string transferId, Dictionary <string, object> args = null) { var _result = new Transfer(); var _currency_id = await publicApi.LoadCurrencyIdAsync(currency_name); if (_currency_id.success == true) { privateClient.ExchangeInfo.ApiCallWait(TradeType.Private); var _params = privateClient.MergeParamsAndArgs(args); var _json_value = await privateClient.CallApiPost1Async($"/v1/dw/withdraw-virtual/{transferId}/cancel", _params); #if DEBUG _result.rawJson = _json_value.Content; #endif var _json_result = privateClient.GetResponseMessage(_json_value.Response); if (_json_result.success == true) { var _json_data = privateClient.DeserializeObject <HWithdraw>(_json_value.Content); if (_json_data.success == true) { var _transfer = new HTransferItem { transferId = transferId, timestamp = CUnixTime.NowMilli, transactionType = TransactionType.Withdraw, currency = currency_name, toAddress = "", toTag = "", amount = 0.0m, isCompleted = _json_data.success }; _result.result = _transfer; } else { _json_result.SetFailure("Unknown reference id"); } } _result.SetResult(_json_result); } else { _result.SetResult(_currency_id); } return(_result); }
/// <summary> /// Withdraw funds /// </summary> /// <param name="currency_name">base coin or quote coin name</param> /// <param name="address">coin address for send</param> /// <param name="tag">Secondary address identifier for coins like XRP,XMR etc.</param> /// <param name="quantity">amount of coin</param> /// <param name="args">Add additional attributes for each exchange</param> /// <returns></returns> public override async ValueTask <Transfer> CoinWithdrawAsync(string currency_name, string address, string tag, decimal quantity, Dictionary <string, object> args = null) { var _result = new Transfer(); var _currency_id = await publicApi.LoadCurrencyIdAsync(currency_name); if (_currency_id.success == true) { privateClient.ExchangeInfo.ApiCallWait(TradeType.Private); var _params = new Dictionary <string, object>(); { _params.Add("currency", _currency_id.result); // asset being withdrawn _params.Add("address", address); // withdrawal key name, as set up on your account _params.Add("amount", quantity); // amount to withdraw, including fees if (tag != null || tag != "") { _params.Add("addr-tag", tag); // only in xrp,xem,bts,steem,eos,xmr } privateClient.MergeParamsAndArgs(_params, args); } var _json_value = await privateClient.CallApiPost1Async("/v1/dw/withdraw/api/create", _params); #if DEBUG _result.rawJson = _json_value.Content; #endif var _json_result = privateClient.GetResponseMessage(_json_value.Response); if (_json_result.success == true) { var _json_data = privateClient.DeserializeObject <HWithdraw>(_json_value.Content); { var _withdraw = new HTransferItem { transferId = _json_data.result.transferId, transactionId = privateClient.GenerateNonceString(16), timestamp = CUnixTime.NowMilli, transactionType = TransactionType.Withdraw, currency = currency_name, toAddress = address, toTag = tag, amount = quantity, fee = 0, confirmations = 0, isCompleted = true }; _result.result = _withdraw; } } _result.SetResult(_json_result); } else { _result.SetResult(_currency_id); } return(_result); }