} // end of class SignatureHeaders public void GetTime() { string ep = string.Format("time"); SignatureHeaders sig = GetSignature(ep); var time = m_host .AppendPathSegment("v2/time") .WithHeader("CB-ACCESS-SIGN", sig.Signature) .WithHeader("CB-ACCESS-TIMESTAMP", sig.Timestamp) .WithHeader("CB-ACCESS-KEY", ApiKey) .WithHeader("CB-VERSION", ApiVersion) .GetJsonAsync <dynamic>() .Result; Console.WriteLine(time.ToString(Formatting.None) + "\n"); }
public void GetSpotPrices(string currency = "USD") { string ep = string.Format("prices/spot?currency={0}", currency); SignatureHeaders sig = GetSignature(ep); var price = m_host .AppendPathSegment("v2/prices/spot") .SetQueryParam("currency", currency) .WithHeader("CB-ACCESS-SIGN", sig.Signature) .WithHeader("CB-ACCESS-TIMESTAMP", sig.Timestamp) .WithHeader("CB-ACCESS-KEY", ApiKey) .WithHeader("CB-VERSION", ApiVersion) .GetJsonAsync <dynamic>() .Result; Console.WriteLine(price.ToString(Formatting.None) + "\n"); }
public void GetAccounts() { string ep = string.Format("accounts"); SignatureHeaders sig = GetSignature(ep); var response = m_host .AppendPathSegment("v2/accounts") //.SetQueryParam("currency", "BCH") .WithHeader("CB-ACCESS-SIGN", sig.Signature) .WithHeader("CB-ACCESS-TIMESTAMP", sig.Timestamp) .WithHeader("CB-ACCESS-KEY", ApiKey) .WithHeader("CB-VERSION", ApiVersion) .GetJsonAsync <dynamic>() .Result; string strResponse = response.ToString(Formatting.None); Console.WriteLine(strResponse + "\n"); var accts = JsonConvert.DeserializeObject <AccountResponse>(strResponse); foreach (var a in accts.data) { Console.WriteLine("'{0}' {1,-12} {2} id:{3}", a.name, a.balance.amount, a.balance.currency, a.id); } }
public void WalletSend() { //ep = string.Format("accounts/c73dd250-68bb-5ddc-aa30-e2206f3743a2/transactions?type=send&to=1FAVRhRkbJbjkYfN7NyKjQEr1o4PaSMyHw&amount=0.1¤cy=BCH&idem=999999"); //ep = string.Format("accounts/c73dd250-68bb-5ddc-aa30-e2206f3743a2/transactions"); //ep = string.Format("accounts/383a26ee-40e0-5ff5-9cc3-b25f7a945fe8/transactions"); string ep = string.Format("accounts/383a26ee-40e0-5ff5-9cc3-b25f7a945fe8/transactions?type=send&to=0xd126e31e03d5ca00cbccf12146a2eb7694b5f51c&amount=0.1¤cy=ETH&idem=9316dd16-0c05"); SignatureHeaders sig = GetSignature(ep, "POST"); //System.Net.Http.HttpResponseMessage response; dynamic response; response = m_host .AppendPathSegment("v2/accounts/383a26ee-40e0-5ff5-9cc3-b25f7a945fe8/transactions") /*.SetQueryParam("type", "send") * .SetQueryParam("to", "0xd126e31e03d5ca00cbccf12146a2eb7694b5f51c") * .SetQueryParam("amount", "0.1") * .SetQueryParam("currency", "ETH") * .SetQueryParam("idem", "9316dd16-0c05")*/ .WithHeader("CB-ACCESS-SIGN", sig.Signature) .WithHeader("CB-ACCESS-TIMESTAMP", sig.Timestamp) .WithHeader("CB-ACCESS-KEY", ApiKey) .WithHeader("CB-VERSION", ApiVersion) .PostStringAsync("type=send&to=0xd126e31e03d5ca00cbccf12146a2eb7694b5f51c&amount=0.1¤cy=ETH&idem=9316dd16-0c05") //.GetJsonAsync<dynamic>() .Result; string strResponse = response.ToString(Formatting.None); Console.WriteLine(strResponse + "\n"); var sent = JsonConvert.DeserializeObject <SendMoneyResponse>(strResponse); /*foreach (var a in accts.data) * { * Console.WriteLine("'{0}' {1} {2} id:{3}", a.name, a.balance.amount, a.balance.currency, a.id); * }*/ }