示例#1
0
 public BitfinexApiResult <BitfinexWithdrawResult> WithdrawWire(WithdrawType withdrawType,
                                                                WalletType2 walletType,
                                                                double amount,
                                                                string accountNumber,
                                                                string bankName,
                                                                string bankAddress,
                                                                string bankCity,
                                                                string bankCountry,
                                                                string accountName             = null,
                                                                string swiftCode               = null,
                                                                string detailPayment           = null,
                                                                bool?useExpressWire            = null,
                                                                string intermediaryBankName    = null,
                                                                string intermediaryBankAddress = null,
                                                                string intermediaryBankCity    = null,
                                                                string intermediaryBankCountry = null,
                                                                string intermediaryBankAccount = null,
                                                                string intermediaryBankSwift   = null) => WithdrawCryptoAsync(withdrawType, walletType, amount, accountNumber, bankName, bankAddress, bankCity, bankCountry, accountName,
                                                                                                                              swiftCode, detailPayment, useExpressWire, intermediaryBankName, intermediaryBankAddress, intermediaryBankCity, intermediaryBankAccount, intermediaryBankSwift).Result;
示例#2
0
        public async Task <BitfinexApiResult <BitfinexWithdrawResult> > WithdrawCryptoAsync(WithdrawType withdrawType,
                                                                                            WalletType2 walletType,
                                                                                            double amount,
                                                                                            string accountNumber,
                                                                                            string bankName,
                                                                                            string bankAddress,
                                                                                            string bankCity,
                                                                                            string bankCountry,
                                                                                            string accountName             = null,
                                                                                            string swiftCode               = null,
                                                                                            string detailPayment           = null,
                                                                                            bool?useExpressWire            = null,
                                                                                            string intermediaryBankName    = null,
                                                                                            string intermediaryBankAddress = null,
                                                                                            string intermediaryBankCity    = null,
                                                                                            string intermediaryBankCountry = null,
                                                                                            string intermediaryBankAccount = null,
                                                                                            string intermediaryBankSwift   = null)
        {
            if (string.IsNullOrEmpty(apiKey) || encryptor == null)
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(BitfinexErrors.GetError(BitfinexErrorKey.NoApiCredentialsProvided)));
            }

            var parameters = new Dictionary <string, object>()
            {
                { "withdraw_type", JsonConvert.SerializeObject(withdrawType, new WithdrawTypeConverter(false)) },
                { "walletselected", JsonConvert.SerializeObject(walletType, new WalletType2Converter(false)) },
                { "amount", amount.ToString(CultureInfo.InvariantCulture) },
                { "account_number", accountNumber },
                { "bank_name", bankName },
                { "bank_address", bankAddress },
                { "bank_city", bankCity },
                { "bank_country", bankCountry }
            };

            AddOptionalParameter(parameters, "account_name", accountName);
            AddOptionalParameter(parameters, "swift", swiftCode);
            AddOptionalParameter(parameters, "detail_payment", detailPayment);
            AddOptionalParameter(parameters, "expressWire", useExpressWire != null ? JsonConvert.SerializeObject(useExpressWire, new BoolToIntConverter(false)) : null);
            AddOptionalParameter(parameters, "intermediary_bank_name", intermediaryBankName);
            AddOptionalParameter(parameters, "intermediary_bank_address", intermediaryBankAddress);
            AddOptionalParameter(parameters, "intermediary_bank_city", intermediaryBankCity);
            AddOptionalParameter(parameters, "intermediary_bank_country", intermediaryBankCountry);
            AddOptionalParameter(parameters, "intermediary_bank_account", intermediaryBankAccount);
            AddOptionalParameter(parameters, "intermediary_bank_swift", intermediaryBankSwift);

            var result = await ExecuteAuthenticatedRequestV1 <BitfinexWithdrawResult[]>(GetUrl(WithdrawEndpoint, OldApiVersion), PostMethod, parameters);

            if (result.Error != null)
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(result.Error));
            }
            if (result.Result[0].Status != "success")
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(BitfinexErrors.GetError(BitfinexErrorKey.WithdrawFailed), result.Result[0].Message));
            }
            return(ReturnResult(result.Result[0]));
        }
示例#3
0
        public async Task <BitfinexApiResult <BitfinexWithdrawResult> > WithdrawCryptoAsync(WithdrawType withdrawType, WalletType2 walletType, double amount, string address, string paymentId = null)
        {
            if (string.IsNullOrEmpty(apiKey) || encryptor == null)
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(BitfinexErrors.GetError(BitfinexErrorKey.NoApiCredentialsProvided)));
            }

            var parameters = new Dictionary <string, object>()
            {
                { "withdraw_type", JsonConvert.SerializeObject(withdrawType, new WithdrawTypeConverter(false)) },
                { "walletselected", JsonConvert.SerializeObject(walletType, new WalletType2Converter(false)) },
                { "amount", amount.ToString(CultureInfo.InvariantCulture) },
                { "address", address }
            };

            AddOptionalParameter(parameters, "payment_id", paymentId);

            var result = await ExecuteAuthenticatedRequestV1 <BitfinexWithdrawResult[]>(GetUrl(WithdrawEndpoint, OldApiVersion), PostMethod, parameters);

            if (result.Error != null)
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(result.Error));
            }
            if (result.Result[0].Status != "success")
            {
                return(ThrowErrorMessage <BitfinexWithdrawResult>(BitfinexErrors.GetError(BitfinexErrorKey.WithdrawFailed), result.Result[0].Message));
            }
            return(ReturnResult(result.Result[0]));
        }
示例#4
0
 public BitfinexApiResult <BitfinexWithdrawResult> WithdrawCrypto(WithdrawType withdrawType, WalletType2 walletType, double amount, string address, string paymentId = null) => WithdrawCryptoAsync(withdrawType, walletType, amount, address, paymentId).Result;