Skip to content

Commit

Permalink
Adding source address filter to deposit request history endpoint (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
mceprnja-codemage authored Aug 20, 2024
1 parent ea85142 commit d29b077
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Binance.Net.UnitTests/BinanceRestIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task TestSpotAccount()
await RunAndCheckResult(client => client.SpotApi.Account.GetFiatDepositWithdrawHistoryAsync(Enums.TransactionType.Withdrawal, default, default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetWithdrawalHistoryAsync(default, default, default, default, default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetWithdrawalAddressesAsync(default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetDepositHistoryAsync(default, default, default, default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetDepositHistoryAsync(default, default, default, default, default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetDailySpotAccountSnapshotAsync(default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetDailyFutureAccountSnapshotAsync(default, default, default, default, default), true);
await RunAndCheckResult(client => client.SpotApi.Account.GetAccountStatusAsync(default, default), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public async Task<WebCallResult<IEnumerable<BinanceWithdrawalAddress>>> GetWithd

#region Deposit history
/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BinanceDeposit>>> GetDepositHistoryAsync(string? asset = null, DepositStatus? status = null, DateTime? startTime = null, DateTime? endTime = null, int? offset = null, int? limit = null, int? receiveWindow = null, CancellationToken ct = default)
public async Task<WebCallResult<IEnumerable<BinanceDeposit>>> GetDepositHistoryAsync(string? asset = null, DepositStatus? status = null, DateTime? startTime = null, DateTime? endTime = null, int? offset = null, int? limit = null, int? receiveWindow = null, bool includeSource = false, CancellationToken ct = default)
{
var parameters = new ParameterCollection();
parameters.AddOptionalParameter("coin", asset);
Expand All @@ -153,6 +153,7 @@ public async Task<WebCallResult<IEnumerable<BinanceDeposit>>> GetDepositHistoryA
parameters.AddOptionalParameter("startTime", DateTimeConverter.ConvertToMilliseconds(startTime));
parameters.AddOptionalParameter("endTime", DateTimeConverter.ConvertToMilliseconds(endTime));
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("includeSource", includeSource.ToString());

var request = _definitions.GetOrCreate(HttpMethod.Get, "sapi/v1/capital/deposit/hisrec", BinanceExchange.RateLimiter.SpotRestIp, 1, true);
return await _baseClient.SendAsync<IEnumerable<BinanceDeposit>>(request, parameters, ct).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,10 @@ Task<WebCallResult<IEnumerable<BinanceFuturesAccountSnapshot>>> GetDailyFutureAc
/// <param name="startTime">Filter start time from</param>
/// <param name="endTime">Filter end time till</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="includeSource">Include source address to response</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of deposits</returns>
Task<WebCallResult<IEnumerable<BinanceDeposit>>> GetDepositHistoryAsync(string? asset = null, DepositStatus? status = null, DateTime? startTime = null, DateTime? endTime = null, int? offset = null, int? limit = null, int? receiveWindow = null, CancellationToken ct = default);
Task<WebCallResult<IEnumerable<BinanceDeposit>>> GetDepositHistoryAsync(string? asset = null, DepositStatus? status = null, DateTime? startTime = null, DateTime? endTime = null, int? offset = null, int? limit = null, int? receiveWindow = null, bool includeSource = false, CancellationToken ct = default);

/// <summary>
/// Gets the deposit address for an asset
Expand Down
6 changes: 6 additions & 0 deletions Binance.Net/Objects/Models/Spot/BinanceDepositList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,11 @@ public record BinanceDeposit
[JsonPropertyName("walletType")]
[JsonConverter(typeof(EnumConverter))]
public WalletType WalletType { get; set; }

/// <summary>
/// Transaction source address. Note: Please note that the source address returned may not be accurate due to network-specific characteristics. If multiple source addresses found, only the first address will be returned
/// </summary>
[JsonPropertyName("sourceAddress")]
public string? SourceAddress { get; set; }
}
}

0 comments on commit d29b077

Please sign in to comment.