-
Notifications
You must be signed in to change notification settings - Fork 714
/
EtherscanApiService.cs
45 lines (37 loc) · 1.55 KB
/
EtherscanApiService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Nethereum.DataServices.Etherscan.Responses;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace Nethereum.DataServices.Etherscan
{
public class EtherscanApiService
{
private EtherscanRequestService requestService;
public EtherscanApiContractsService Contracts { get; private set; }
public EtherscanApiAccountsService Accounts { get; private set; }
public EtherscanApiService(HttpClient httpClient, string baseUrl, string apiKey = EtherscanRequestService.DefaultToken):this(new EtherscanRequestService(httpClient, baseUrl, apiKey))
{
}
public EtherscanApiService(HttpClient httpClient, EtherscanChain chain, string apiKey = EtherscanRequestService.DefaultToken):
this(new EtherscanRequestService(httpClient, chain, apiKey))
{
}
public EtherscanApiService(EtherscanChain chain = EtherscanChain.Mainnet, string apiKey = EtherscanRequestService.DefaultToken)
:this(new EtherscanRequestService(chain, apiKey))
{
}
public EtherscanApiService(EtherscanRequestService etherscanRequestService)
{
requestService = etherscanRequestService;
InitialiseServices();
}
private void InitialiseServices()
{
Contracts = new EtherscanApiContractsService(requestService);
Accounts = new EtherscanApiAccountsService(requestService);
}
}
}