/// <summary> /// Withdrawal of tokens. /// </summary> /// <param name="currency">Currency</param> /// <param name="amount">Amount</param> /// <param name="destination">Withdrawal destination address</param> /// <param name="toAddress">Verified digital currency address, email or mobile number. Some digital currency addresses are formatted as 'address+tag', e.g. 'ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456'</param> /// <param name="password">Trade password</param> /// <param name="fee">Transaction fee</param> /// <param name="chain">Chain name. There are multiple chains under some currencies, such as USDT has USDT-ERC20, USDT-TRC20, and USDT-Omni. If this parameter is not filled in because it is not available, it will default to the main chain.</param> /// <param name="ct">Cancellation Token</param> /// <returns></returns> public virtual async Task <WebCallResult <OkexWithdrawalResponse> > Withdraw_Async( string currency, decimal amount, OkexWithdrawalDestination destination, string toAddress, string password, decimal fee, string chain = null, CancellationToken ct = default) { var parameters = new Dictionary <string, object> { { "ccy", currency }, { "amt", amount.ToString(OkexGlobals.OkexCultureInfo) }, { "dest", JsonConvert.SerializeObject(destination, new WithdrawalDestinationConverter(false)) }, { "toAddr", toAddress }, { "pwd", password }, { "fee", fee.ToString(OkexGlobals.OkexCultureInfo) }, }; parameters.AddOptionalParameter("chain", chain); var result = await SendRequestAsync <OkexRestApiResponse <IEnumerable <OkexWithdrawalResponse> > >(GetUrl(Endpoints_V5_Asset_Withdrawal), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false); if (!result.Success) { return(WebCallResult <OkexWithdrawalResponse> .CreateErrorResult(result.ResponseStatusCode, result.ResponseHeaders, result.Error)); } if (result.Data.ErrorCode > 0) { return(WebCallResult <OkexWithdrawalResponse> .CreateErrorResult(result.ResponseStatusCode, result.ResponseHeaders, new ServerError(result.Data.ErrorCode, result.Data.ErrorMessage, result.Data.Data))); } return(new WebCallResult <OkexWithdrawalResponse>(result.ResponseStatusCode, result.ResponseHeaders, result.Data.Data.FirstOrDefault(), null)); }
/// <summary> /// Withdrawal of tokens. /// </summary> /// <param name="currency">Currency</param> /// <param name="amount">Amount</param> /// <param name="destination">Withdrawal destination address</param> /// <param name="toAddress">Verified digital currency address, email or mobile number. Some digital currency addresses are formatted as 'address+tag', e.g. 'ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456'</param> /// <param name="password">Trade password</param> /// <param name="fee">Transaction fee</param> /// <param name="chain">Chain name. There are multiple chains under some currencies, such as USDT has USDT-ERC20, USDT-TRC20, and USDT-Omni. If this parameter is not filled in because it is not available, it will default to the main chain.</param> /// <param name="ct">Cancellation Token</param> /// <returns></returns> public virtual WebCallResult <OkexWithdrawalResponse> Withdraw( string currency, decimal amount, OkexWithdrawalDestination destination, string toAddress, string password, decimal fee, string chain = null, CancellationToken ct = default) => Withdraw_Async( currency, amount, destination, toAddress, password, fee, chain, ct).Result;