Esempio n. 1
0
        /// <summary>
        /// Validates address belongs to specified currency.
        /// </summary>
        /// <param name="Address">Address to check.</param>
        /// <param name="Symbol">Ticker symbol for currency to check.</param>
        /// <returns>Validation results.</returns>
        internal static async Task <ValidateAddress> ValidateAsync(string Address, string Symbol)
        {
            Uri    uri      = GetUri(Address, Symbol);
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets market info for specific currency pair.
        /// </summary>
        /// <param name="Pair">Pair to get information for.</param>
        /// <returns>Market Information.</returns>
        internal static async Task <TradingMarketInfo> GetMarketInfoAsync(string Pair)
        {
            Uri    uri      = GetUri(Pair);
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets status of transaction (to be) deposited to supplied address.
        /// </summary>
        /// <param name="Address">Deposit address.</param>
        /// <returns>Transaction status.</returns>
        internal static async Task <TxStatus> GetStatusAsync(string Address)
        {
            Uri    uri      = GetUri(Address);
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 4
0
        /*url: shapeshift.io/txbyaddress/[address]/[apiKey]
         * method: GET
         *
         * [address] the address that output coin was sent to for the shift
         * [apiKey] is the affiliate's PRIVATE api key.
         *
         * Success Output:
         *
         *  [
         *      {
         *          inputTXID: [Transaction ID of the input coin going into shapeshift],
         *          inputAddress: [Address that the input coin was paid to for this shift],
         *          inputCurrency: [Currency type of the input coin],
         *          inputAmount: [Amount of input coin that was paid in on this shift],
         *          outputTXID: [Transaction ID of the output coin going out to user],
         *          outputAddress: [Address that the output coin was sent to for this shift],
         *          outputCurrency: [Currency type of the output coin],
         *          outputAmount: [Amount of output coin that was paid out on this shift],
         *          shiftRate: [The effective rate the user got on this shift.],
         *          status: [status of the shift]
         *      }
         *      (one listing per transaction returned)
         *  ]
         *
         * The status can be  "received", "complete", "returned", "failed".
         */

        /// <summary>
        /// Finds all transactions sent to specified address.
        /// </summary>
        /// <param name="Address">The address that output coin was sent to for the shift.</param>
        /// <param name="APIKey">The affiliate's PRIVATE api key.</param>
        /// <returns>List of transactions.</returns>
        internal static async Task <List <Tx> > GetTransactionsByAddressAsync(string Address, string APIKey)
        {
            Uri    uri      = GetAddressUri(Address, APIKey);
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 5
0
        /// <summary>
        /// Provides information on all currencies supported by ShapeShift.
        /// </summary>
        /// <returns>List of all supported currencies.</returns>
        internal static async Task <List <SupportedCoin> > GetCoinsAsync()
        {
            Uri    uri      = GetUri();
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 6
0
        /// <summary>
        /// Requests a quote for an exchange without exchanging.
        /// </summary>
        /// <param name="Pair">Coin pair to exchange between.</param>
        /// <param name="Amount">Amount of coin to be sent to withdrawal address.</param>
        /// <returns>Quote for exchange information.</returns>
        internal static async Task <QuoteRequest> RequestAsync(string Pair, double Amount)
        {
            Uri    uri      = GetUri();
            string data     = CreateData(Pair, Amount);
            string response = await RestServices.GetPostResponseAsync(uri, data).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 7
0
        /// <summary>
        /// Sends Shift request.
        /// </summary>
        /// <param name="Withdrawal">Address for resulting coins to be sent to.</param>
        /// <param name="Pair">Currency pair for exchange.</param>
        /// <param name="Return">Address to return coins to if exchange fails.</param>
        /// <param name="RippleTag">Destination tag that you want appended to a Ripple payment to you.</param>
        /// <param name="NXTRsAddress">For new NXT accounts to be funded, you supply this on NXT payment to you.</param>
        /// <param name="APIKey">Your affiliate PUBLIC KEY, for volume tracking, affiliate payments, split-shifts, etc...</param>
        /// <returns>Result of Shift request.</returns>
        internal static async Task <ShiftResult> ShiftAsync(string Withdrawal, string Pair, string Return = "", string RippleTag = "", string NXTRsAddress = "", string APIKey = "")
        {
            Uri    uri      = GetUri();
            string data     = CreateData(Withdrawal, Pair, Return, RippleTag, NXTRsAddress, APIKey);
            string response = await RestServices.GetPostResponseAsync(uri, data).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 8
0
        /// <summary>
        /// Gets information on pending exchange.
        /// </summary>
        /// <param name="Amount">Amount to be sent to withdrawal address.</param>
        /// <param name="Address">The withdrawal address.</param>
        /// <param name="Pair">The coin pair.</param>
        /// <param name="ReturnAddress">Address to return coins to if exchange fails.</param>
        /// <param name="RippleTag">Destination tag that you want appended to a Ripple payment to you.</param>
        /// <param name="NXTRsAddress">For new NXT accounts to be funded, supply this on NXT payment to you.</param>
        /// <param name="APIKey">Your affiliate PUBLIC KEY, for volume tracking, affiliate payments, split-shifts, etc...</param>
        /// <returns>Information on pending exchange.</returns>
        internal static async Task <SendAmountRequest> RequestAsync(double Amount, string Address, string Pair, string ReturnAddress = "", string RippleTag = "", string NXTRsAddress = "", string APIKey = "")
        {
            Uri    uri      = GetUri();
            string data     = CreateData(Amount, Address, Pair, ReturnAddress, RippleTag, NXTRsAddress, APIKey);
            string response = await RestServices.GetPostResponseAsync(uri, data).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 9
0
        /// <summary>
        /// Gets information on recent transactions completed by ShapeShift.
        /// </summary>
        /// <param name="Max">Maximum number of transactions to return. Must be betweeen 1 and 50, inclusive.</param>
        /// <returns>List of recent transactions.</returns>
        internal static async Task <List <RecentTx> > GetRecentTransactionsAsync(int Max)
        {
            if (Max < 1 || Max > 50)
            {
                throw new InvalidOperationException();
            }
            Uri    uri      = GetUri(Max);
            string response = await RestServices.GetResponseAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 10
0
        /// <summary>
        /// Attempts to cancel pending exchange
        /// </summary>
        /// <param name="Address">The deposit address associated with the pending transaction.</param>
        /// <returns>Result of cancel operation.</returns>
        internal static async Task <CancelResult> CancelAsync(string Address)
        {
            //Get URI for POST request
            Uri uri = GetUri();
            //Generate JSON data string
            string data = CreateData(Address);
            //Send POST request
            string response = await RestServices.GetPostResponseAsync(uri, data).ConfigureAwait(false);

            //Parse response for results
            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }
Esempio n. 11
0
        /// <summary>
        /// Requests a receipt for transaction to be sent via email.
        /// </summary>
        /// <param name="Email">Email address to send receipt to.</param>
        /// <param name="TxID">Transaction ID of the transaction sent to the user.</param>
        /// <returns>Result of receipt request.</returns>
        internal static async Task <EmailReceipt> RequestAsync(string Email, string TxID)
        {
            //Get URI for POST request
            Uri uri = GetUri();
            //Generate JSON data as string to send
            string data = CreateData(Email, TxID);
            //Send POST request and awaits response
            string response = await RestServices.GetPostResponseAsync(uri, data).ConfigureAwait(false);

            //Parse response for results
            return(await ParseResponseAsync(response).ConfigureAwait(false));
        }