Skip to content

Commit

Permalink
Adding optimism and binance
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed Jul 27, 2023
1 parent 226371c commit 96290cf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Nethereum.DataServices.Etherscan/EtherscanChain.cs
Expand Up @@ -5,9 +5,12 @@ namespace Nethereum.DataServices.Etherscan
public enum EtherscanChain
{
Mainnet,

Binance,
Optimism
}



public enum EtherscanResultSort
{
Ascending,
Expand Down
Expand Up @@ -17,6 +17,12 @@ public static string GetBaseUrl(EtherscanChain chain)
{
case EtherscanChain.Mainnet:
return "https://api.etherscan.io/";

case EtherscanChain.Binance:
return "https://api.bscscan.com/";

case EtherscanChain.Optimism:
return "https://api-optimistic.etherscan.io/";
}
throw new NotImplementedException();
}
Expand Down
Expand Up @@ -97,6 +97,34 @@ public async void ShouldGetAccountTransactions()
});
}

[Fact]
public async void ShouldGetAccountTransactionsBinance()
{
await ThrottleEtherscanCallAsync(async () =>
{
var etherscanService = new EtherscanApiService(EtherscanChain.Binance);
var result = await etherscanService.Accounts.GetAccountTransactionsAsync("0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82");
Assert.Equal("1", result.Status);
Assert.Equal(10, result.Result.Count);
});
}

[Fact]
public async void ShouldGetAccountTransactionsOptimism()
{
await ThrottleEtherscanCallAsync(async () =>
{
var etherscanService = new EtherscanApiService(EtherscanChain.Optimism);
var result = await etherscanService.Accounts.GetAccountTransactionsAsync("0x6fd9d7AD17242c41f7131d257212c54A0e816691");
Assert.Equal("1", result.Status);
Assert.Equal(10, result.Result.Count);
});
}

//

[Fact]
public async void ShouldGetAccountInternalTransactions()
{
Expand Down

0 comments on commit 96290cf

Please sign in to comment.