diff --git a/src/BscScan.NetCore/Constants/Constants.cs b/src/BscScan.NetCore/Constants/Constants.cs
index 041100a..d5a5d09 100644
--- a/src/BscScan.NetCore/Constants/Constants.cs
+++ b/src/BscScan.NetCore/Constants/Constants.cs
@@ -68,6 +68,7 @@ internal static class ProxyModuleAction
public const string ETH_GET_BLOCk_TRANSACTION_COUNT_BY_NUMBER = "eth_getBlockTransactionCountByNumber";
public const string ETH_GET_TRANSACTION_BY_HASH = "eth_getTransactionByHash";
public const string ETH_GET_TRANSACTION_BY_BLOCK_NUMBER_AND_INDEX = "eth_getTransactionByBlockNumberAndIndex";
+ public const string ETH_GET_TRANSACTION_COUNT = "eth_getTransactionCount";
}
diff --git a/src/BscScan.NetCore/Contracts/IBscScanGethProxyService.cs b/src/BscScan.NetCore/Contracts/IBscScanGethProxyService.cs
index 7d87f1c..a25c332 100644
--- a/src/BscScan.NetCore/Contracts/IBscScanGethProxyService.cs
+++ b/src/BscScan.NetCore/Contracts/IBscScanGethProxyService.cs
@@ -1,4 +1,5 @@
-using BscScan.NetCore.Models.Response.Proxy;
+using BscScan.NetCore.Models;
+using BscScan.NetCore.Models.Response.Proxy;
namespace BscScan.NetCore.Contracts
{
@@ -44,5 +45,13 @@ public interface IBscScanGethProxyService
/// the position of the uncle's index in the block, in hex eg. 0x1
///
Task EthGetTransactionByBlockNumberAndIndex(string tag, string index);
+
+ ///
+ ///
+ ///
+ /// the string representing the address to get transaction count
+ /// the string pre-defined block parameter, either earliest, pending or latest
+ /// Returns the number of transactions performed by an address.
+ Task EthGetTransactionCount(string address, Tag tag = Tag.Latest);
}
}
diff --git a/src/BscScan.NetCore/Models/Response/Proxy/TransactionCount.cs b/src/BscScan.NetCore/Models/Response/Proxy/TransactionCount.cs
new file mode 100644
index 0000000..9e3f7f5
--- /dev/null
+++ b/src/BscScan.NetCore/Models/Response/Proxy/TransactionCount.cs
@@ -0,0 +1,9 @@
+namespace BscScan.NetCore.Models.Response.Proxy
+{
+ ///
+ /// TransactionCount
+ ///
+ public class TransactionCount : EthBlockNumber
+ {
+ }
+}
diff --git a/src/BscScan.NetCore/Services/BscScanGethProxyService.cs b/src/BscScan.NetCore/Services/BscScanGethProxyService.cs
index 105beb1..167b705 100644
--- a/src/BscScan.NetCore/Services/BscScanGethProxyService.cs
+++ b/src/BscScan.NetCore/Services/BscScanGethProxyService.cs
@@ -3,6 +3,7 @@
using BscScan.NetCore.Constants;
using BscScan.NetCore.Contracts;
using BscScan.NetCore.Extensions;
+using BscScan.NetCore.Models;
using BscScan.NetCore.Models.Response.Proxy;
namespace BscScan.NetCore.Services
@@ -85,5 +86,19 @@ public BscScanGethProxyService(HttpClient bscScanHttpClient, BscScanConfiguratio
var result = await JsonSerializer.DeserializeAsync(responseStream);
return result;
}
+
+ ///
+ public async Task EthGetTransactionCount(string address, Tag tag)
+ {
+ var queryParameters = $"{_bscScanModule}".AddAction(ProxyModuleAction.ETH_GET_TRANSACTION_COUNT)
+ .AddQuery(BscQueryParam.Tag.AppendValue(tag.ToString().ToLower())).AddQuery(BscQueryParam.Address.AppendValue(address));
+ using var response = await BscScanHttpClient.GetAsync($"{queryParameters}")
+ .ConfigureAwait(false);
+
+ response.EnsureSuccessStatusCode();
+ await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
+ var result = await JsonSerializer.DeserializeAsync(responseStream);
+ return result;
+ }
}
}