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 | import { Contract } from "../contract/index.js";
|
27 | import { AbstractProvider } from "./abstract-provider.js";
|
28 | import { Network } from "./network.js";
|
29 | import { NetworkPlugin } from "./plugins-network.js";
|
30 | import { PerformActionRequest } from "./abstract-provider.js";
|
31 | import type { Networkish } from "./network.js";
|
32 | import type { TransactionRequest } from "./provider.js";
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export type DebugEventEtherscanProvider = {
|
41 | action: "sendRequest";
|
42 | id: number;
|
43 | url: string;
|
44 | payload: Record<string, any>;
|
45 | } | {
|
46 | action: "receiveRequest";
|
47 | id: number;
|
48 | result: any;
|
49 | } | {
|
50 | action: "receiveError";
|
51 | id: number;
|
52 | error: any;
|
53 | };
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | export declare class EtherscanPlugin extends NetworkPlugin {
|
61 | |
62 |
|
63 |
|
64 | readonly baseUrl: string;
|
65 | |
66 |
|
67 |
|
68 |
|
69 | constructor(baseUrl: string);
|
70 | clone(): EtherscanPlugin;
|
71 | }
|
72 | /**
|
73 | * The **EtherscanBaseProvider** is the super-class of
|
74 | * [[EtherscanProvider]], which should generally be used instead.
|
75 | *
|
76 | * Since the **EtherscanProvider** includes additional code for
|
77 | * [[Contract]] access, in //rare cases// that contracts are not
|
78 | * used, this class can reduce code size.
|
79 | *
|
80 | * @_docloc: api/providers/thirdparty:Etherscan
|
81 | */
|
82 | export declare class EtherscanProvider extends AbstractProvider {
|
83 | #private;
|
84 | |
85 |
|
86 |
|
87 | readonly network: Network;
|
88 | |
89 |
|
90 |
|
91 | readonly apiKey: null | string;
|
92 | |
93 |
|
94 |
|
95 | constructor(_network?: Networkish, _apiKey?: string);
|
96 | /**
|
97 | * Returns the base URL.
|
98 | *
|
99 | * If an [[EtherscanPlugin]] is configured on the
|
100 | * [[EtherscanBaseProvider_network]], returns the plugin's
|
101 | * baseUrl.
|
102 | */
|
103 | getBaseUrl(): string;
|
104 | /**
|
105 | * Returns the URL for the %%module%% and %%params%%.
|
106 | */
|
107 | getUrl(module: string, params: Record<string, string>): string;
|
108 | /**
|
109 | * Returns the URL for using POST requests.
|
110 | */
|
111 | getPostUrl(): string;
|
112 | /**
|
113 | * Returns the parameters for using POST requests.
|
114 | */
|
115 | getPostData(module: string, params: Record<string, any>): Record<string, any>;
|
116 | detectNetwork(): Promise<Network>;
|
117 | /**
|
118 | * Resolves to the result of calling %%module%% with %%params%%.
|
119 | *
|
120 | * If %%post%%, the request is made as a POST request.
|
121 | */
|
122 | fetch(module: string, params: Record<string, any>, post?: boolean): Promise<any>;
|
123 | /**
|
124 | * Returns %%transaction%% normalized for the Etherscan API.
|
125 | */
|
126 | _getTransactionPostData(transaction: TransactionRequest): Record<string, string>;
|
127 | /**
|
128 | * Throws the normalized Etherscan error.
|
129 | */
|
130 | _checkError(req: PerformActionRequest, error: Error, transaction: any): never;
|
131 | _detectNetwork(): Promise<Network>;
|
132 | _perform(req: PerformActionRequest): Promise<any>;
|
133 | getNetwork(): Promise<Network>;
|
134 | /**
|
135 | * Resolves to the current price of ether.
|
136 | *
|
137 | * This returns ``0`` on any network other than ``mainnet``.
|
138 | */
|
139 | getEtherPrice(): Promise<number>;
|
140 | /**
|
141 | * Resolves to a [Contract]] for %%address%%, using the
|
142 | * Etherscan API to retreive the Contract ABI.
|
143 | */
|
144 | getContract(_address: string): Promise<null | Contract>;
|
145 | isCommunityResource(): boolean;
|
146 | }
|
147 | //# sourceMappingURL=provider-etherscan.d.ts.map |
\ | No newline at end of file |