Skip to content

Return TxId and AddressTag in DepositHistory response #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public interface IBinanceClient
/// <param name="addressName">Address name.</param>
/// <param name="recvWindow">Specific number of milliseconds the request is valid for.</param>
/// <returns></returns>
Task<WithdrawResponse> Withdraw(string asset, decimal amount, string address, string addressName = "", long recvWindow = 6000000);
Task<WithdrawResponse> Withdraw(string asset, decimal amount, string address, string addressTag = "", string addressName = "", long recvWindow = 6000000);

/// <summary>
/// Fetch deposit history.
Expand Down
6 changes: 6 additions & 0 deletions Binance.API.Csharp.Client.Models/Account/DepositHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public class Deposit
public string Asset { get; set; }
[JsonProperty("status")]
public int Status { get; set; }
[JsonProperty("address")]
public string Address { get; set; }
[JsonProperty("addressTag")]
public string AddressTag { get; set; }
[JsonProperty("txId")]
public string TxId { get; set; }
}

public class DepositHistory
Expand Down
6 changes: 6 additions & 0 deletions Binance.API.Csharp.Client.Models/Account/WithdrawResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ public class WithdrawResponse
public string Msg { get; set; }
[JsonProperty("success")]
public bool Success { get; set; }


public override string ToString()
{
return $"WithdrawResponse.Success={Success} --- WithdrawResponse.Msg{Msg}";
}
}
}
14 changes: 11 additions & 3 deletions Binance.API.Csharp.Client.Test/BinanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
using Binance.API.Csharp.Client.Models.Enums;
using System.Threading;
using Binance.API.Csharp.Client.Models.WebSocket;
using System;

namespace Binance.API.Csharp.Client.Test
{
[TestClass]
public class BinanceTest
{
private static ApiClient apiClient = new ApiClient("@YourApiKey", "@YourApiSecret");
private static ApiClient apiClient = new ApiClient("Ax8fVbYarOuq3hJGiYlw62Oae78U0xvDbFUYlnenQxIQBWpbcxlC6N5NzFlviiUZ", "e3cKGFASMdaZKaRa64tKHnpTwOcKrZF1992xjWVWKEsjf7f2dL9prEHedtGltSWN");
private static BinanceClient binanceClient = new BinanceClient(apiClient,false);

#region General
Expand Down Expand Up @@ -119,7 +120,9 @@ public void GetAllOrders()
[TestMethod]
public void GetAccountInfo()
{
// I need
var accountInfo = binanceClient.GetAccountInfo().Result;

}

[TestMethod]
Expand All @@ -131,13 +134,18 @@ public void GetTradeList()
[TestMethod]
public void Withdraw()
{
var withdrawResult = binanceClient.Withdraw("AST", 100m, "@YourDepositAddress").Result;
// I need
var withdrawResult = binanceClient.Withdraw("AST", 100m, "@YourDepositAddress", null).Result;
}

[TestMethod]
public void GetDepositHistory()
{
var depositHistory = binanceClient.GetDepositHistory("neo", DepositStatus.Success).Result;
// I need
var depositHistory = binanceClient.GetDepositHistory("btc", DepositStatus.Success, new DateTime(2020)).Result;

Assert.IsTrue(depositHistory.Success);
Assert.IsNotNull(depositHistory.DepositList);
}

[TestMethod]
Expand Down
6 changes: 4 additions & 2 deletions Binance.API.Csharp.Client/BinanceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,10 @@ public async Task<IEnumerable<Trade>> GetTradeList(string symbol, long recvWindo
/// <param name="amount">Amount to withdraw.</param>
/// <param name="address">Address where the asset will be deposited.</param>
/// <param name="addressName">Address name.</param>
/// <param name="addressTag">Address tag.</param>
/// <param name="recvWindow">Specific number of milliseconds the request is valid for.</param>
/// <returns></returns>
public async Task<WithdrawResponse> Withdraw(string asset, decimal amount, string address, string addressName = "", long recvWindow = 5000)
public async Task<WithdrawResponse> Withdraw(string asset, decimal amount, string address, string addressTag = "", string addressName = "", long recvWindow = 5000)
{
if (string.IsNullOrWhiteSpace(asset))
{
Expand All @@ -447,6 +448,7 @@ public async Task<WithdrawResponse> Withdraw(string asset, decimal amount, strin
}

var args = $"asset={asset.ToUpper()}&amount={amount}&address={address}"
+ (!string.IsNullOrWhiteSpace(addressTag) && !string.IsNullOrEmpty(addressTag) ? $"&addressTag={addressTag}" : "")
+ (!string.IsNullOrWhiteSpace(addressName) ? $"&name={addressName}" : "")
+ $"&recvWindow={recvWindow}";

Expand Down Expand Up @@ -477,7 +479,7 @@ public async Task<DepositHistory> GetDepositHistory(string asset, DepositStatus?
+ (endTime.HasValue ? $"&endTime={endTime.Value.GetUnixTimeStamp()}" : "")
+ $"&recvWindow={recvWindow}";

var result = await _apiClient.CallAsync<DepositHistory>(ApiMethod.POST, EndPoints.DepositHistory, true, args);
var result = await _apiClient.CallAsync<DepositHistory>(ApiMethod.GET, EndPoints.DepositHistory, true, args);

return result;
}
Expand Down