From d7518d82763c28fbb2d913e0e91dbb3c267a1b0e Mon Sep 17 00:00:00 2001 From: Kalakoi Date: Fri, 15 Dec 2017 15:25:34 -0500 Subject: [PATCH] Add files via upload --- src/ShapeShift.cs | 208 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 src/ShapeShift.cs diff --git a/src/ShapeShift.cs b/src/ShapeShift.cs new file mode 100644 index 0000000..0dd0462 --- /dev/null +++ b/src/ShapeShift.cs @@ -0,0 +1,208 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Kalakoi.Crypto.ShapeShift +{ + /// + /// Provides access the the ShapeShift service. + /// + public static class ShapeShift + { + /// + /// Attempts to cancel pending exchange + /// + /// The deposit address associated with the pending transaction. + /// Result of cancel operation. + public static async Task CancelExchangeAsync(string Address) => + await CancelResult.CancelAsync(Address).ConfigureAwait(false); + + /// + /// Requests a receipt for transaction to be sent via email. + /// + /// Email address to send receipt to. + /// Transaction ID of the transaction sent to the user. + /// Result of receipt request. + public static async Task RequestEmailReceiptAsync(string Email, string TxID) => + await EmailReceipt.RequestAsync(Email, TxID).ConfigureAwait(false); + + /// + /// Requests a quote for an exchange without exchanging. + /// + /// Coin pair to exchange between. + /// Amount of coin to be sent to withdrawal address. + /// Quote for exchange information. + public static async Task RequestQuoteAsync(string Pair, double Amount) => + await QuoteRequest.RequestAsync(Pair, Amount).ConfigureAwait(false); + + /// + /// Gets information on recent transactions completed by ShapeShift. + /// + /// Maximum number of transactions to return. Must be betweeen 1 and 50, inclusive. + /// List of recent transactions. + public static async Task> GetRecentTransactionsAsync(int Max = 5) => + await RecentTx.GetRecentTransactionsAsync(Max).ConfigureAwait(false); + + /// + /// Gets information on pending exchange. + /// + /// Amount to be sent to withdrawal address. + /// The withdrawal address. + /// The coin pair. + /// Address to return coins to if exchange fails. + /// Destination tag that you want appended to a Ripple payment to you. + /// For new NXT accounts to be funded, supply this on NXT payment to you. + /// Your affiliate PUBLIC KEY, for volume tracking, affiliate payments, split-shifts, etc... + /// Information on pending exchange. + public static async Task GetSendAmountAsync(double Amount, string Address, string Pair, string ReturnAddress = "", string RippleTag = "", string NXTRsAddress = "", string APIKey = "") => + await SendAmountRequest.RequestAsync(Amount, Address, Pair, ReturnAddress, RippleTag, NXTRsAddress, APIKey).ConfigureAwait(false); + + /// + /// Sends Shift request. + /// + /// Address for resulting coins to be sent to. + /// Currency pair for exchange. + /// Address to return coins to if exchange fails. + /// Destination tag that you want appended to a Ripple payment to you. + /// For new NXT accounts to be funded, you supply this on NXT payment to you. + /// Your affiliate PUBLIC KEY, for volume tracking, affiliate payments, split-shifts, etc... + /// Result of Shift request. + public static async Task ShiftAsync(string Withdrawal, string Pair, string Return = "", string RippleTag = "", string NXTRsAddress = "", string APIKey = "") => + await ShiftResult.ShiftAsync(Withdrawal, Pair, Return, RippleTag, NXTRsAddress, APIKey).ConfigureAwait(false); + + /// + /// Provides information on a specific currency supported by ShapeShift. + /// + /// Ticker symbol of currency. + /// Information on specific supported currency. + public static async Task GetCoinAsync(string Symbol) => + await SupportedCoin.GetCoinAsync(Symbol).ConfigureAwait(false); + + /// + /// Provides information on all currencies supported by ShapeShift. + /// + /// List of all supported currencies. + public static async Task> GetAllCoinsAsync() => + await SupportedCoin.GetCoinsAsync().ConfigureAwait(false); + + /// + /// Gets status of deposit and time remaining to complete deposit before expiration. + /// + /// The deposit address to look up. + /// Time remaining for deposit. + public static async Task CheckTimeRemainingAsync(string Address) => + await TimeRemaining.GetTimeRemainingAsync(Address).ConfigureAwait(false); + + /// + /// Gets trade limit for specified currency pair. + /// + /// Currency pair to exchange. + /// Trading limit information. + public static async Task GetTradeLimitAsync(string Pair) => + await TradingLimit.GetLimitAsync(Pair).ConfigureAwait(false); + + /// + /// Gets trade limit for specified currency pair. + /// + /// Ticker for currency to exchange from. + /// Ticker for currency to exchange to. + /// Trading limit information. + public static async Task GetTradeLimitAsync(string Ticker1, string Ticker2) => + await TradingLimit.GetLimitAsync(Ticker1, Ticker2).ConfigureAwait(false); + + /// + /// Gets list of all trade limits. + /// + /// List of all trade limits. + public static async Task> GetAllTradeLimitsAsync() => + await TradingLimit.GetAllLimitsAsync().ConfigureAwait(false); + + /// + /// Gets market info for specific currency pair. + /// + /// Pair to get information for. + /// Market Information. + public static async Task GetMarketInfoAsync(string Pair) => + await TradingMarketInfo.GetMarketInfoAsync(Pair).ConfigureAwait(false); + + /// + /// Gets market info for specific currency pair. + /// + /// Ticker for currency to exchange from. + /// Ticker for currency to exchange to. + /// Market Information. + public static async Task GetMarketInfoAsync(string Ticker1, string Ticker2) => + await TradingMarketInfo.GetMarketInfoAsync(Ticker1, Ticker2).ConfigureAwait(false); + + /// + /// Gets market info for all currency pairs. + /// + /// List of Market Information. + public static async Task> GetAllMarketInfosAsync() => + await TradingMarketInfo.GetAllMarketsAsync().ConfigureAwait(false); + + /// + /// Generates a list of all TradingPairs supported by ShapeShift. + /// + /// A List of TradingPairs. + public static async Task> GetAllPairsAsync() => + await TradingPair.GetAllPairsAsync().ConfigureAwait(false); + + /// + /// Finds exchange rate for specified coin pair. + /// + /// Coin pair to find rate for. + /// Exchange rate. + public static async Task GetExchangeRateAsync(string Pair) => + await TradingRate.GetRateAsync(Pair).ConfigureAwait(false); + + /// + /// Finds exchange rate for specified coin pair. + /// + /// Ticker symbol for coin to exchange. + /// Ticker symbol for resulting coin. + /// Exchange rate. + public static async Task GetExchangeRateAsync(string Ticker1, string Ticker2) => + await TradingRate.GetRateAsync(Ticker1, Ticker2).ConfigureAwait(false); + + /// + /// Finds exchange rates for all valid coin pairs. + /// + /// List of exchange rates. + public static async Task> GetAllExchangeRatesAsync() => + await TradingRate.GetAllRatesAsync().ConfigureAwait(false); + + /// + /// Finds all transactions sent using the specified API key. + /// + /// The affiliate's PRIVATE api key. + /// List of transactions. + public static async Task> GetTransactionsAsync(string APIKey) => + await Tx.GetTransactionsByAPIKeyAsync(APIKey).ConfigureAwait(false); + + /// + /// Finds all transactions sent to specified address. + /// + /// The address that output coin was sent to for the shift. + /// The affiliate's PRIVATE api key. + /// List of transactions. + public static async Task> GetTransactionsAsync(string Address, string APIKey) => + await Tx.GetTransactionsByAddressAsync(Address, APIKey).ConfigureAwait(false); + + /// + /// Gets status of transaction (to be) deposited to supplied address. + /// + /// Deposit address. + /// Transaction status. + public static async Task GetTransactionStatusAsync(string Address) => + await TxStatus.GetStatusAsync(Address).ConfigureAwait(false); + + /// + /// Validates address belongs to specified currency. + /// + /// Address to check. + /// Ticker symbol for currency to check. + /// Validation results. + public static async Task ValidateAddressAsync(string Address, string Symbol) => + await ValidateAddress.ValidateAsync(Address, Symbol).ConfigureAwait(false); + } +}