protected override async Task <ExchangeDepositDetails> OnGetDepositAddressAsync(string symbol, bool forceRegenerate = false)
        {
            symbol = NormalizeSymbol(symbol);
            JToken token = await MakeJsonRequestAsync <JToken>("/payment/get/address?" + "currency=" + symbol, BaseUrl, await OnGetNoncePayloadAsync());

            if (token != null && token.HasValues && token["currency"].ToStringInvariant() == symbol && token["wallet"].ToStringInvariant().Length != 0)
            {
                ExchangeDepositDetails address = new ExchangeDepositDetails()
                {
                    Symbol = symbol
                };
                if (token["wallet"].ToStringInvariant().Contains("::"))
                {
                    // address tags are separated with a '::'
                    var split = token["wallet"].ToStringInvariant().Replace("::", ":").Split(':');
                    address.Address    = split[0];
                    address.AddressTag = split[1];
                }
                else
                {
                    address.Address = token["wallet"].ToStringInvariant();
                }
                return(address);
            }
            return(null);
        }
Esempio n. 2
0
        protected override async Task <ExchangeDepositDetails> OnGetDepositAddressAsync(string symbol, bool forceRegenerate = false)
        {
            symbol = NormalizeSymbol(symbol);
            var payload = await OnGetNoncePayloadAsync();

            JArray array = MakeJsonRequest <JArray>("/payment-methods", null, await OnGetNoncePayloadAsync());

            if (array != null)
            {
                var rc = array.Where(t => t["currency"].ToStringInvariant() == symbol).FirstOrDefault();
                payload = await OnGetNoncePayloadAsync();

                payload["currency"] = NormalizeSymbol(symbol);
                payload["method"]   = rc["id"].ToStringInvariant();

                JToken token = await MakeJsonRequestAsync <JToken>("/deposits/make", null, payload, "POST");

                ExchangeDepositDetails deposit = new ExchangeDepositDetails()
                {
                    Symbol     = symbol,
                    Address    = token["address"].ToStringInvariant(),
                    AddressTag = token["tag"].ToStringInvariant()
                };
                return(deposit);
            }
            return(null);
        }
        protected override async Task <ExchangeDepositDetails> OnGetDepositAddressAsync(string symbol, bool forceRegenerate = false)
        {
            ExchangeDepositDetails deposit = new ExchangeDepositDetails()
            {
                Symbol = symbol
            };
            JToken token = await MakeJsonRequestAsync <JToken>("/payment/address/" + symbol, null, await OnGetNoncePayloadAsync());

            if (token != null)
            {
                deposit.Address = token["address"].ToStringInvariant();
                if (deposit.Address.StartsWith("bitcoincash:"))
                {
                    deposit.Address = deposit.Address.Replace("bitcoincash:", string.Empty);  // don't know why they do this for bitcoincash
                }
                deposit.AddressTag = token["wallet"].ToStringInvariant();
            }
            return(deposit);
        }
        /// <summary>
        /// Gets the address to deposit to and applicable details.
        /// </summary>
        /// <param name="symbol">Symbol to get address for</param>
        /// <param name="forceRegenerate">(ignored) Binance does not provide the ability to generate new addresses</param>
        /// <returns>
        /// Deposit address details (including tag if applicable, such as XRP)
        /// </returns>
        protected override async Task <ExchangeDepositDetails> OnGetDepositAddressAsync(string symbol, bool forceRegenerate = false)
        {
            /*
             * TODO: Binance does not offer a "regenerate" option in the API, but a second IOTA deposit to the same address will not be credited
             * How does Binance handle GetDepositAddress for IOTA after it's been used once?
             * Need to test calling this API after depositing IOTA.
             */

            Dictionary <string, object> payload = await OnGetNoncePayloadAsync();

            payload["asset"] = NormalizeSymbol(symbol);

            JToken response = await MakeJsonRequestAsync <JToken>("/depositAddress.html", WithdrawalUrlPrivate, payload);

            ExchangeDepositDetails depositDetails = new ExchangeDepositDetails
            {
                Symbol     = response["asset"].ToStringInvariant(),
                Address    = response["address"].ToStringInvariant(),
                AddressTag = response["addressTag"].ToStringInvariant()
            };

            return(depositDetails);
        }