viem 0.0.0-main.20230603T024327 → 0.0.0-main.20230604T221342

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/cjs/actions/ens/getEnsAddress.js +34 -23
  2. package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
  3. package/dist/cjs/actions/public/call.js +1 -1
  4. package/dist/cjs/actions/public/call.js.map +1 -1
  5. package/dist/cjs/actions/public/createContractEventFilter.js +2 -1
  6. package/dist/cjs/actions/public/createContractEventFilter.js.map +1 -1
  7. package/dist/cjs/actions/public/createEventFilter.js +2 -1
  8. package/dist/cjs/actions/public/createEventFilter.js.map +1 -1
  9. package/dist/cjs/actions/public/estimateGas.js.map +1 -1
  10. package/dist/cjs/actions/public/getBlock.js.map +1 -1
  11. package/dist/cjs/actions/public/getBlockTransactionCount.js +1 -1
  12. package/dist/cjs/actions/public/getBlockTransactionCount.js.map +1 -1
  13. package/dist/cjs/actions/public/getChainId.js +3 -1
  14. package/dist/cjs/actions/public/getChainId.js.map +1 -1
  15. package/dist/cjs/actions/public/getFilterChanges.js +11 -3
  16. package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
  17. package/dist/cjs/actions/public/getFilterLogs.js +10 -2
  18. package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
  19. package/dist/cjs/actions/public/getGasPrice.js.map +1 -1
  20. package/dist/cjs/actions/public/getLogs.js +11 -3
  21. package/dist/cjs/actions/public/getLogs.js.map +1 -1
  22. package/dist/cjs/actions/public/getTransactionCount.js.map +1 -1
  23. package/dist/cjs/clients/createClient.js +1 -1
  24. package/dist/cjs/clients/createClient.js.map +1 -1
  25. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  26. package/dist/cjs/clients/createTestClient.js.map +1 -1
  27. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  28. package/dist/cjs/clients/decorators/public.js.map +1 -1
  29. package/dist/cjs/clients/transports/createTransport.js.map +1 -1
  30. package/dist/cjs/clients/transports/custom.js.map +1 -1
  31. package/dist/cjs/clients/transports/fallback.js.map +1 -1
  32. package/dist/cjs/clients/transports/http.js +25 -7
  33. package/dist/cjs/clients/transports/http.js.map +1 -1
  34. package/dist/cjs/clients/transports/webSocket.js +22 -14
  35. package/dist/cjs/clients/transports/webSocket.js.map +1 -1
  36. package/dist/cjs/errors/abi.js +15 -1
  37. package/dist/cjs/errors/abi.js.map +1 -1
  38. package/dist/cjs/errors/request.js.map +1 -1
  39. package/dist/cjs/errors/version.js +1 -1
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/cjs/types/eip1193.js.map +1 -1
  42. package/dist/cjs/utils/abi/decodeEventLog.js +10 -2
  43. package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
  44. package/dist/cjs/utils/ens/encodeLabelhash.js +8 -0
  45. package/dist/cjs/utils/ens/encodeLabelhash.js.map +1 -0
  46. package/dist/cjs/utils/ens/encodedLabelToLabelhash.js +18 -0
  47. package/dist/cjs/utils/ens/encodedLabelToLabelhash.js.map +1 -0
  48. package/dist/cjs/utils/ens/labelhash.js +2 -1
  49. package/dist/cjs/utils/ens/labelhash.js.map +1 -1
  50. package/dist/cjs/utils/ens/namehash.js +5 -1
  51. package/dist/cjs/utils/ens/namehash.js.map +1 -1
  52. package/dist/cjs/utils/ens/packetToBytes.js +10 -9
  53. package/dist/cjs/utils/ens/packetToBytes.js.map +1 -1
  54. package/dist/cjs/utils/filters/createFilterRequestScope.js.map +1 -1
  55. package/dist/cjs/utils/formatters/log.js +2 -2
  56. package/dist/cjs/utils/index.js.map +1 -1
  57. package/dist/cjs/utils/rpc.js +12 -17
  58. package/dist/cjs/utils/rpc.js.map +1 -1
  59. package/dist/esm/actions/ens/getEnsAddress.js +34 -23
  60. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  61. package/dist/esm/actions/public/call.js +1 -1
  62. package/dist/esm/actions/public/call.js.map +1 -1
  63. package/dist/esm/actions/public/createContractEventFilter.js +2 -1
  64. package/dist/esm/actions/public/createContractEventFilter.js.map +1 -1
  65. package/dist/esm/actions/public/createEventFilter.js +2 -1
  66. package/dist/esm/actions/public/createEventFilter.js.map +1 -1
  67. package/dist/esm/actions/public/estimateGas.js.map +1 -1
  68. package/dist/esm/actions/public/getBlock.js.map +1 -1
  69. package/dist/esm/actions/public/getBlockTransactionCount.js +1 -1
  70. package/dist/esm/actions/public/getBlockTransactionCount.js.map +1 -1
  71. package/dist/esm/actions/public/getChainId.js +3 -1
  72. package/dist/esm/actions/public/getChainId.js.map +1 -1
  73. package/dist/esm/actions/public/getFilterChanges.js +11 -3
  74. package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
  75. package/dist/esm/actions/public/getFilterLogs.js +10 -2
  76. package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
  77. package/dist/esm/actions/public/getGasPrice.js.map +1 -1
  78. package/dist/esm/actions/public/getLogs.js +11 -3
  79. package/dist/esm/actions/public/getLogs.js.map +1 -1
  80. package/dist/esm/actions/public/getTransactionCount.js.map +1 -1
  81. package/dist/esm/clients/createClient.js +1 -1
  82. package/dist/esm/clients/createClient.js.map +1 -1
  83. package/dist/esm/clients/createPublicClient.js.map +1 -1
  84. package/dist/esm/clients/createTestClient.js.map +1 -1
  85. package/dist/esm/clients/createWalletClient.js.map +1 -1
  86. package/dist/esm/clients/decorators/public.js.map +1 -1
  87. package/dist/esm/clients/transports/createTransport.js.map +1 -1
  88. package/dist/esm/clients/transports/custom.js.map +1 -1
  89. package/dist/esm/clients/transports/fallback.js.map +1 -1
  90. package/dist/esm/clients/transports/http.js +25 -7
  91. package/dist/esm/clients/transports/http.js.map +1 -1
  92. package/dist/esm/clients/transports/webSocket.js +22 -14
  93. package/dist/esm/clients/transports/webSocket.js.map +1 -1
  94. package/dist/esm/errors/abi.js +15 -1
  95. package/dist/esm/errors/abi.js.map +1 -1
  96. package/dist/esm/errors/request.js.map +1 -1
  97. package/dist/esm/errors/version.js +1 -1
  98. package/dist/esm/index.js.map +1 -1
  99. package/dist/esm/types/eip1193.js.map +1 -1
  100. package/dist/esm/utils/abi/decodeEventLog.js +10 -2
  101. package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
  102. package/dist/esm/utils/ens/encodeLabelhash.js +4 -0
  103. package/dist/esm/utils/ens/encodeLabelhash.js.map +1 -0
  104. package/dist/esm/utils/ens/encodedLabelToLabelhash.js +14 -0
  105. package/dist/esm/utils/ens/encodedLabelToLabelhash.js.map +1 -0
  106. package/dist/esm/utils/ens/labelhash.js +2 -1
  107. package/dist/esm/utils/ens/labelhash.js.map +1 -1
  108. package/dist/esm/utils/ens/namehash.js +6 -2
  109. package/dist/esm/utils/ens/namehash.js.map +1 -1
  110. package/dist/esm/utils/ens/packetToBytes.js +10 -9
  111. package/dist/esm/utils/ens/packetToBytes.js.map +1 -1
  112. package/dist/esm/utils/filters/createFilterRequestScope.js.map +1 -1
  113. package/dist/esm/utils/formatters/log.js +2 -2
  114. package/dist/esm/utils/index.js.map +1 -1
  115. package/dist/esm/utils/rpc.js +13 -18
  116. package/dist/esm/utils/rpc.js.map +1 -1
  117. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
  118. package/dist/types/actions/public/createContractEventFilter.d.ts +8 -3
  119. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
  120. package/dist/types/actions/public/createEventFilter.d.ts +17 -5
  121. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
  122. package/dist/types/actions/public/getChainId.d.ts.map +1 -1
  123. package/dist/types/actions/public/getFilterChanges.d.ts +4 -4
  124. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  125. package/dist/types/actions/public/getFilterLogs.d.ts +4 -4
  126. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  127. package/dist/types/actions/public/getLogs.d.ts +10 -4
  128. package/dist/types/actions/public/getLogs.d.ts.map +1 -1
  129. package/dist/types/chains.d.ts +4 -4
  130. package/dist/types/clients/createClient.d.ts +5 -5
  131. package/dist/types/clients/createClient.d.ts.map +1 -1
  132. package/dist/types/clients/createPublicClient.d.ts +3 -3
  133. package/dist/types/clients/createPublicClient.d.ts.map +1 -1
  134. package/dist/types/clients/createTestClient.d.ts +2 -2
  135. package/dist/types/clients/createTestClient.d.ts.map +1 -1
  136. package/dist/types/clients/createWalletClient.d.ts +2 -2
  137. package/dist/types/clients/createWalletClient.d.ts.map +1 -1
  138. package/dist/types/clients/decorators/public.d.ts +5 -5
  139. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  140. package/dist/types/clients/transports/createTransport.d.ts +5 -8
  141. package/dist/types/clients/transports/createTransport.d.ts.map +1 -1
  142. package/dist/types/clients/transports/custom.d.ts +2 -2
  143. package/dist/types/clients/transports/custom.d.ts.map +1 -1
  144. package/dist/types/clients/transports/http.d.ts +11 -0
  145. package/dist/types/clients/transports/http.d.ts.map +1 -1
  146. package/dist/types/clients/transports/webSocket.d.ts.map +1 -1
  147. package/dist/types/errors/abi.d.ts +6 -4
  148. package/dist/types/errors/abi.d.ts.map +1 -1
  149. package/dist/types/errors/request.d.ts +16 -8
  150. package/dist/types/errors/request.d.ts.map +1 -1
  151. package/dist/types/errors/version.d.ts +1 -1
  152. package/dist/types/index.d.ts +1 -1
  153. package/dist/types/index.d.ts.map +1 -1
  154. package/dist/types/types/contract.d.ts +6 -3
  155. package/dist/types/types/contract.d.ts.map +1 -1
  156. package/dist/types/types/eip1193.d.ts +1037 -872
  157. package/dist/types/types/eip1193.d.ts.map +1 -1
  158. package/dist/types/types/filter.d.ts +12 -3
  159. package/dist/types/types/filter.d.ts.map +1 -1
  160. package/dist/types/types/log.d.ts +10 -7
  161. package/dist/types/types/log.d.ts.map +1 -1
  162. package/dist/types/types/utils.d.ts +11 -0
  163. package/dist/types/types/utils.d.ts.map +1 -1
  164. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -1
  165. package/dist/types/utils/ens/encodeLabelhash.d.ts +3 -0
  166. package/dist/types/utils/ens/encodeLabelhash.d.ts.map +1 -0
  167. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts +3 -0
  168. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts.map +1 -0
  169. package/dist/types/utils/ens/labelhash.d.ts.map +1 -1
  170. package/dist/types/utils/ens/namehash.d.ts.map +1 -1
  171. package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -1
  172. package/dist/types/utils/filters/createFilterRequestScope.d.ts +6 -2
  173. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -1
  174. package/dist/types/utils/index.d.ts +1 -1
  175. package/dist/types/utils/index.d.ts.map +1 -1
  176. package/dist/types/utils/rpc.d.ts +18 -10
  177. package/dist/types/utils/rpc.d.ts.map +1 -1
  178. package/package.json +2 -11
  179. package/src/actions/ens/getEnsAddress.ts +37 -22
  180. package/src/actions/public/call.ts +1 -1
  181. package/src/actions/public/createContractEventFilter.ts +21 -4
  182. package/src/actions/public/createEventFilter.ts +34 -13
  183. package/src/actions/public/estimateGas.ts +1 -1
  184. package/src/actions/public/getBlock.ts +2 -2
  185. package/src/actions/public/getBlockTransactionCount.ts +1 -1
  186. package/src/actions/public/getChainId.ts +3 -1
  187. package/src/actions/public/getFilterChanges.ts +27 -7
  188. package/src/actions/public/getFilterLogs.ts +29 -8
  189. package/src/actions/public/getGasPrice.ts +1 -1
  190. package/src/actions/public/getLogs.ts +34 -10
  191. package/src/actions/public/getTransactionCount.ts +1 -1
  192. package/src/clients/createClient.ts +13 -11
  193. package/src/clients/createPublicClient.ts +3 -4
  194. package/src/clients/createTestClient.ts +2 -3
  195. package/src/clients/createWalletClient.ts +2 -3
  196. package/src/clients/decorators/public.ts +33 -14
  197. package/src/clients/transports/createTransport.ts +5 -9
  198. package/src/clients/transports/custom.ts +1 -2
  199. package/src/clients/transports/fallback.ts +1 -1
  200. package/src/clients/transports/http.ts +44 -7
  201. package/src/clients/transports/webSocket.ts +23 -15
  202. package/src/errors/abi.ts +16 -4
  203. package/src/errors/request.ts +4 -4
  204. package/src/errors/version.ts +1 -1
  205. package/src/index.ts +10 -5
  206. package/src/types/contract.ts +17 -7
  207. package/src/types/eip1193.ts +1079 -872
  208. package/src/types/filter.ts +15 -3
  209. package/src/types/log.ts +18 -9
  210. package/src/types/utils.ts +15 -0
  211. package/src/utils/abi/decodeEventLog.ts +10 -2
  212. package/src/utils/ens/encodeLabelhash.ts +5 -0
  213. package/src/utils/ens/encodedLabelToLabelhash.ts +11 -0
  214. package/src/utils/ens/labelhash.ts +2 -1
  215. package/src/utils/ens/namehash.ts +6 -2
  216. package/src/utils/ens/packetToBytes.ts +12 -8
  217. package/src/utils/filters/createFilterRequestScope.ts +12 -4
  218. package/src/utils/formatters/log.ts +2 -2
  219. package/src/utils/index.ts +6 -0
  220. package/src/utils/rpc.ts +52 -52
  221. package/dist/cjs/adapters/ethers.js +0 -56
  222. package/dist/cjs/adapters/ethers.js.map +0 -1
  223. package/dist/cjs/ethers.js +0 -6
  224. package/dist/cjs/ethers.js.map +0 -1
  225. package/dist/esm/adapters/ethers.js +0 -52
  226. package/dist/esm/adapters/ethers.js.map +0 -1
  227. package/dist/esm/ethers.js +0 -2
  228. package/dist/esm/ethers.js.map +0 -1
  229. package/dist/types/adapters/ethers.d.ts +0 -27
  230. package/dist/types/adapters/ethers.d.ts.map +0 -1
  231. package/dist/types/ethers.d.ts +0 -2
  232. package/dist/types/ethers.d.ts.map +0 -1
  233. package/ethers/package.json +0 -5
  234. package/src/adapters/ethers.ts +0 -99
  235. package/src/ethers.ts +0 -1
@@ -2,7 +2,11 @@ import type { Address } from 'abitype';
2
2
  import type { BlockTag } from './block.js';
3
3
  import type { Hash, Hex, LogTopic } from './misc.js';
4
4
  import type { Quantity, RpcBlock as Block, RpcBlockIdentifier as BlockIdentifier, RpcBlockNumber as BlockNumber, RpcFeeHistory as FeeHistory, RpcLog as Log, RpcTransaction as Transaction, RpcTransactionReceipt as TransactionReceipt, RpcTransactionRequest as TransactionRequest, RpcUncle as Uncle } from './rpc.js';
5
- export type EIP1193Provider = Requests & Events;
5
+ import type { Prettify } from './utils.js';
6
+ export type EIP1474Methods = [...PublicRpcSchema, ...WalletRpcSchema];
7
+ export type EIP1193Provider = EIP1193Events & {
8
+ request: EIP1193RequestFn<EIP1474Methods>;
9
+ };
6
10
  export declare class ProviderRpcError extends Error {
7
11
  code: number;
8
12
  details: string;
@@ -15,7 +19,7 @@ export type ProviderMessage = {
15
19
  type: string;
16
20
  data: unknown;
17
21
  };
18
- export type Events = {
22
+ export type EIP1193Events = {
19
23
  on(event: 'connect', listener: (connectInfo: ProviderConnectInfo) => void): void;
20
24
  on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void;
21
25
  on(event: 'chainChanged', listener: (chainId: string) => void): void;
@@ -75,133 +79,149 @@ export type WatchAssetParams = {
75
79
  image?: string;
76
80
  };
77
81
  };
78
- export type PublicRequests = {
79
- request(args: {
80
- /**
81
- * @description Returns the version of the current client
82
- * @link https://eips.ethereum.org/EIPS/eip-1474
83
- * @example
84
- * provider.request({ method: 'web3_clientVersion' })
85
- * // => 'MetaMask/v1.0.0'
86
- */
87
- method: 'web3_clientVersion';
88
- params?: never;
89
- }): Promise<string>;
90
- request(args: {
91
- /**
92
- * @description Hashes data using the Keccak-256 algorithm
93
- * @link https://eips.ethereum.org/EIPS/eip-1474
94
- * @example
95
- * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
96
- * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
97
- */
98
- method: 'web3_sha3';
99
- params: [data: Hash];
100
- }): Promise<string>;
101
- request(args: {
102
- /**
103
- * @description Determines if this client is listening for new network connections
104
- * @link https://eips.ethereum.org/EIPS/eip-1474
105
- * @example
106
- * provider.request({ method: 'net_listening' })
107
- * // => true
108
- */
109
- method: 'net_listening';
110
- params?: never;
111
- }): Promise<boolean>;
112
- request(args: {
113
- /**
114
- * @description Returns the number of peers currently connected to this client
115
- * @link https://eips.ethereum.org/EIPS/eip-1474
116
- * @example
117
- * provider.request({ method: 'net_peerCount' })
118
- * // => '0x1'
119
- */
120
- method: 'net_peerCount';
121
- params?: never;
122
- }): Promise<Quantity>;
123
- request(args: {
124
- /**
125
- * @description Returns the chain ID associated with the current network
126
- * @link https://eips.ethereum.org/EIPS/eip-1474
127
- * @example
128
- * provider.request({ method: 'net_version' })
129
- * // => '1'
130
- */
131
- method: 'net_version';
132
- params?: never;
133
- }): Promise<Quantity>;
134
- request(args: {
135
- /**
136
- * @description Returns the number of the most recent block seen by this client
137
- * @link https://eips.ethereum.org/EIPS/eip-1474
138
- * @example
139
- * provider.request({ method: 'eth_blockNumber' })
140
- * // => '0x1b4'
141
- * */
142
- method: 'eth_blockNumber';
143
- params?: never;
144
- }): Promise<Quantity>;
145
- request(args: {
146
- /**
147
- * @description Executes a new message call immediately without submitting a transaction to the network
148
- * @link https://eips.ethereum.org/EIPS/eip-1474
149
- * @example
150
- * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
151
- * // => '0x...'
152
- */
153
- method: 'eth_call';
154
- params: [
155
- request: Partial<TransactionRequest>,
156
- block?: BlockNumber | BlockTag | BlockIdentifier
82
+ export type PublicRpcSchema = [
83
+ /**
84
+ * @description Returns the version of the current client
85
+ *
86
+ * @example
87
+ * provider.request({ method: 'web3_clientVersion' })
88
+ * // => 'MetaMask/v1.0.0'
89
+ */
90
+ {
91
+ Method: 'web3_clientVersion';
92
+ Parameters?: never;
93
+ ReturnType: string;
94
+ },
95
+ /**
96
+ * @description Hashes data using the Keccak-256 algorithm
97
+ *
98
+ * @example
99
+ * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
100
+ * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
101
+ */
102
+ {
103
+ Method: 'web3_sha3';
104
+ Parameters: [data: Hash];
105
+ ReturnType: string;
106
+ },
107
+ /**
108
+ * @description Determines if this client is listening for new network connections
109
+ *
110
+ * @example
111
+ * provider.request({ method: 'net_listening' })
112
+ * // => true
113
+ */
114
+ {
115
+ Method: 'net_listening';
116
+ Parameters?: never;
117
+ ReturnType: boolean;
118
+ },
119
+ /**
120
+ * @description Returns the number of peers currently connected to this client
121
+ *
122
+ * @example
123
+ * provider.request({ method: 'net_peerCount' })
124
+ * // => '0x1'
125
+ */
126
+ {
127
+ Method: 'net_peerCount';
128
+ Parameters?: never;
129
+ ReturnType: Quantity;
130
+ },
131
+ /**
132
+ * @description Returns the chain ID associated with the current network
133
+ *
134
+ * @example
135
+ * provider.request({ method: 'net_version' })
136
+ * // => '1'
137
+ */
138
+ {
139
+ Method: 'net_version';
140
+ Parameters?: never;
141
+ ReturnType: Quantity;
142
+ },
143
+ /**
144
+ * @description Returns the number of the most recent block seen by this client
145
+ *
146
+ * @example
147
+ * provider.request({ method: 'eth_blockNumber' })
148
+ * // => '0x1b4'
149
+ */
150
+ {
151
+ Method: 'eth_blockNumber';
152
+ Parameters?: never;
153
+ ReturnType: Quantity;
154
+ },
155
+ /**
156
+ * @description Executes a new message call immediately without submitting a transaction to the network
157
+ *
158
+ * @example
159
+ * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
160
+ * // => '0x...'
161
+ */
162
+ {
163
+ Method: 'eth_call';
164
+ Parameters: [transaction: Partial<TransactionRequest>] | [
165
+ transaction: Partial<TransactionRequest>,
166
+ block: BlockNumber | BlockTag | BlockIdentifier
157
167
  ];
158
- }): Promise<Hex>;
159
- request(args: {
160
- /**
161
- * @description Returns the chain ID associated with the current network
162
- * @example
163
- * provider.request({ method: 'eth_chainId' })
164
- * // => '1'
165
- */
166
- method: 'eth_chainId';
167
- params?: never;
168
- }): Promise<Quantity>;
169
- request(args: {
170
- method: 'eth_coinbase';
171
- params?: never;
172
- }): Promise<Address>;
173
- request(args: {
174
- /**
175
- * @description Estimates the gas necessary to complete a transaction without submitting it to the network
176
- * @link https://eips.ethereum.org/EIPS/eip-1474
177
- * @example
178
- * provider.request({
179
- * method: 'eth_estimateGas',
180
- * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
181
- * })
182
- * // => '0x5208'
183
- * */
184
- method: 'eth_estimateGas';
185
- params: [parameters: TransactionRequest, block?: BlockNumber | BlockTag];
186
- }): Promise<Quantity>;
187
- request(args: {
188
- /**
189
- * @description Returns a collection of historical gas information
190
- * @link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md
191
- * @example
192
- * provider.request({
193
- * method: 'eth_feeHistory',
194
- * params: ['4', 'latest', ['25', '75']]
195
- * })
196
- * // => {
197
- * // oldestBlock: '0x1',
198
- * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
199
- * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
200
- * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
201
- * // }
202
- * */
203
- method: 'eth_feeHistory';
204
- params: [
168
+ ReturnType: Hex;
169
+ },
170
+ /**
171
+ * @description Returns the chain ID associated with the current network
172
+ * @example
173
+ * provider.request({ method: 'eth_chainId' })
174
+ * // => '1'
175
+ */
176
+ {
177
+ Method: 'eth_chainId';
178
+ Parameters?: never;
179
+ ReturnType: Quantity;
180
+ },
181
+ /**
182
+ * @description Returns the client coinbase address.
183
+ * @example
184
+ * provider.request({ method: 'eth_coinbase' })
185
+ * // => '0x...'
186
+ */
187
+ {
188
+ Method: 'eth_coinbase';
189
+ Parameters?: never;
190
+ ReturnType: Address;
191
+ },
192
+ /**
193
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
194
+ *
195
+ * @example
196
+ * provider.request({
197
+ * method: 'eth_estimateGas',
198
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
199
+ * })
200
+ * // => '0x5208'
201
+ */
202
+ {
203
+ Method: 'eth_estimateGas';
204
+ Parameters: [transaction: TransactionRequest] | [transaction: TransactionRequest, block: BlockNumber | BlockTag];
205
+ ReturnType: Quantity;
206
+ },
207
+ /**
208
+ * @description Returns a collection of historical gas information
209
+ *
210
+ * @example
211
+ * provider.request({
212
+ * method: 'eth_feeHistory',
213
+ * params: ['4', 'latest', ['25', '75']]
214
+ * })
215
+ * // => {
216
+ * // oldestBlock: '0x1',
217
+ * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
218
+ * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
219
+ * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
220
+ * // }
221
+ * */
222
+ {
223
+ Method: 'eth_feeHistory';
224
+ Parameters: [
205
225
  /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */
206
226
  blockCount: Quantity,
207
227
  /** Highest number block of the requested range. */
@@ -209,137 +229,153 @@ export type PublicRequests = {
209
229
  /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */
210
230
  rewardPercentiles: number[] | undefined
211
231
  ];
212
- }): Promise<FeeHistory>;
213
- request(args: {
214
- /**
215
- * @description Returns the current price of gas expressed in wei
216
- * @link https://eips.ethereum.org/EIPS/eip-1474
217
- * @example
218
- * provider.request({ method: 'eth_gasPrice' })
219
- * // => '0x09184e72a000'
220
- * */
221
- method: 'eth_gasPrice';
222
- params?: never;
223
- }): Promise<Quantity>;
224
- request(args: {
225
- /**
226
- * @description Returns the balance of an address in wei
227
- * @link https://eips.ethereum.org/EIPS/eip-1474
228
- * @example
229
- * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
230
- * // => '0x12a05...'
231
- * */
232
- method: 'eth_getBalance';
233
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
234
- }): Promise<Quantity>;
235
- request(args: {
236
- /**
237
- * @description Returns information about a block specified by hash
238
- * @link https://eips.ethereum.org/EIPS/eip-1474
239
- * @example
240
- * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
241
- * // => {
242
- * // number: '0x1b4',
243
- * // hash: '0x...',
244
- * // parentHash: '0x...',
245
- * // ...
246
- * // }
247
- * */
248
- method: 'eth_getBlockByHash';
249
- params: [
232
+ ReturnType: FeeHistory;
233
+ },
234
+ /**
235
+ * @description Returns the current price of gas expressed in wei
236
+ *
237
+ * @example
238
+ * provider.request({ method: 'eth_gasPrice' })
239
+ * // => '0x09184e72a000'
240
+ */
241
+ {
242
+ Method: 'eth_gasPrice';
243
+ Parameters?: never;
244
+ ReturnType: Quantity;
245
+ },
246
+ /**
247
+ * @description Returns the balance of an address in wei
248
+ *
249
+ * @example
250
+ * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
251
+ * // => '0x12a05...'
252
+ */
253
+ {
254
+ Method: 'eth_getBalance';
255
+ Parameters: [
256
+ address: Address,
257
+ block: BlockNumber | BlockTag | BlockIdentifier
258
+ ];
259
+ ReturnType: Quantity;
260
+ },
261
+ /**
262
+ * @description Returns information about a block specified by hash
263
+ * @link https://eips.ethereum.org/EIPS/eip-1474
264
+ * @example
265
+ * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
266
+ * // => {
267
+ * // number: '0x1b4',
268
+ * // hash: '0x...',
269
+ * // parentHash: '0x...',
270
+ * // ...
271
+ * // }
272
+ */
273
+ {
274
+ Method: 'eth_getBlockByHash';
275
+ Parameters: [
250
276
  /** hash of a block */
251
277
  hash: Hash,
252
278
  /** true will pull full transaction objects, false will pull transaction hashes */
253
279
  includeTransactionObjects: boolean
254
280
  ];
255
- }): Promise<Block | null>;
256
- request(args: {
257
- /**
258
- * @description Returns information about a block specified by number
259
- * @link https://eips.ethereum.org/EIPS/eip-1474
260
- * @example
261
- * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
262
- * // => {
263
- * // number: '0x1b4',
264
- * // hash: '0x...',
265
- * // parentHash: '0x...',
266
- * // ...
267
- * // }
268
- * */
269
- method: 'eth_getBlockByNumber';
270
- params: [
281
+ ReturnType: Block | null;
282
+ },
283
+ /**
284
+ * @description Returns information about a block specified by number
285
+ * @link https://eips.ethereum.org/EIPS/eip-1474
286
+ * @example
287
+ * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
288
+ * // => {
289
+ * // number: '0x1b4',
290
+ * // hash: '0x...',
291
+ * // parentHash: '0x...',
292
+ * // ...
293
+ * // }
294
+ */
295
+ {
296
+ Method: 'eth_getBlockByNumber';
297
+ Parameters: [
271
298
  /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */
272
299
  block: BlockNumber | BlockTag,
273
300
  /** true will pull full transaction objects, false will pull transaction hashes */
274
301
  includeTransactionObjects: boolean
275
302
  ];
276
- }): Promise<Block | null>;
277
- request(args: {
278
- /**
279
- * @description Returns the number of transactions in a block specified by block hash
280
- * @link https://eips.ethereum.org/EIPS/eip-1474
281
- * @example
282
- * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
283
- * // => '0x1'
284
- * */
285
- method: 'eth_getBlockTransactionCountByHash';
286
- params: [hash: Hash];
287
- }): Promise<Quantity>;
288
- request(args: {
289
- /**
290
- * @description Returns the number of transactions in a block specified by block number
291
- * @link https://eips.ethereum.org/EIPS/eip-1474
292
- * @example
293
- * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
294
- * // => '0x1'
295
- * */
296
- method: 'eth_getBlockTransactionCountByNumber';
297
- params: [block: BlockNumber | BlockTag];
298
- }): Promise<Quantity>;
299
- request(args: {
300
- /**
301
- * @description Returns the contract code stored at a given address
302
- * @link https://eips.ethereum.org/EIPS/eip-1474
303
- * @example
304
- * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
305
- * // => '0x...'
306
- * */
307
- method: 'eth_getCode';
308
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
309
- }): Promise<Hex>;
310
- request(args: {
311
- /**
312
- * @description Returns a list of all logs based on filter ID since the last log retrieval
313
- * @link https://eips.ethereum.org/EIPS/eip-1474
314
- * @example
315
- * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
316
- * // => [{ ... }, { ... }]
317
- * */
318
- method: 'eth_getFilterChanges';
319
- params: [filterId: Quantity];
320
- }): Promise<Log[] | Hex[]>;
321
- request(args: {
322
- /**
323
- * @description Returns a list of all logs based on filter ID
324
- * @link https://eips.ethereum.org/EIPS/eip-1474
325
- * @example
326
- * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
327
- * // => [{ ... }, { ... }]
328
- * */
329
- method: 'eth_getFilterLogs';
330
- params: [filterId: Quantity];
331
- }): Promise<Log[]>;
332
- request(args: {
333
- /**
334
- * @description Returns a list of all logs based on a filter object
335
- * @link https://eips.ethereum.org/EIPS/eip-1474
336
- * @example
337
- * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
338
- * // => [{ ... }, { ... }]
339
- * */
340
- method: 'eth_getLogs';
341
- params: [
342
- parameters: {
303
+ ReturnType: Block | null;
304
+ },
305
+ /**
306
+ * @description Returns the number of transactions in a block specified by block hash
307
+ * @link https://eips.ethereum.org/EIPS/eip-1474
308
+ * @example
309
+ * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
310
+ * // => '0x1'
311
+ */
312
+ {
313
+ Method: 'eth_getBlockTransactionCountByHash';
314
+ Parameters: [hash: Hash];
315
+ ReturnType: Quantity;
316
+ },
317
+ /**
318
+ * @description Returns the number of transactions in a block specified by block number
319
+ * @link https://eips.ethereum.org/EIPS/eip-1474
320
+ * @example
321
+ * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
322
+ * // => '0x1'
323
+ */
324
+ {
325
+ Method: 'eth_getBlockTransactionCountByNumber';
326
+ Parameters: [block: BlockNumber | BlockTag];
327
+ ReturnType: Quantity;
328
+ },
329
+ /**
330
+ * @description Returns the contract code stored at a given address
331
+ * @link https://eips.ethereum.org/EIPS/eip-1474
332
+ * @example
333
+ * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
334
+ * // => '0x...'
335
+ */
336
+ {
337
+ Method: 'eth_getCode';
338
+ Parameters: [
339
+ address: Address,
340
+ block: BlockNumber | BlockTag | BlockIdentifier
341
+ ];
342
+ ReturnType: Hex;
343
+ },
344
+ /**
345
+ * @description Returns a list of all logs based on filter ID since the last log retrieval
346
+ * @link https://eips.ethereum.org/EIPS/eip-1474
347
+ * @example
348
+ * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
349
+ * // => [{ ... }, { ... }]
350
+ */
351
+ {
352
+ Method: 'eth_getFilterChanges';
353
+ Parameters: [filterId: Quantity];
354
+ ReturnType: Log[] | Hex[];
355
+ },
356
+ /**
357
+ * @description Returns a list of all logs based on filter ID
358
+ * @link https://eips.ethereum.org/EIPS/eip-1474
359
+ * @example
360
+ * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
361
+ * // => [{ ... }, { ... }]
362
+ */
363
+ {
364
+ Method: 'eth_getFilterLogs';
365
+ Parameters: [filterId: Quantity];
366
+ ReturnType: Log[];
367
+ },
368
+ /**
369
+ * @description Returns a list of all logs based on a filter object
370
+ * @link https://eips.ethereum.org/EIPS/eip-1474
371
+ * @example
372
+ * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
373
+ * // => [{ ... }, { ... }]
374
+ */
375
+ {
376
+ Method: 'eth_getLogs';
377
+ Parameters: [
378
+ {
343
379
  address?: Address | Address[];
344
380
  topics?: LogTopic[];
345
381
  } & ({
@@ -352,142 +388,157 @@ export type PublicRequests = {
352
388
  blockHash?: Hash;
353
389
  })
354
390
  ];
355
- }): Promise<Log[]>;
356
- request(args: {
357
- /**
358
- * @description Returns the value from a storage position at an address
359
- * @link https://eips.ethereum.org/EIPS/eip-1474
360
- * @example
361
- * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
362
- * // => '0x...'
363
- * */
364
- method: 'eth_getStorageAt';
365
- params: [
391
+ ReturnType: Log[];
392
+ },
393
+ /**
394
+ * @description Returns the value from a storage position at an address
395
+ * @link https://eips.ethereum.org/EIPS/eip-1474
396
+ * @example
397
+ * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
398
+ * // => '0x...'
399
+ */
400
+ {
401
+ Method: 'eth_getStorageAt';
402
+ Parameters: [
366
403
  address: Address,
367
404
  index: Quantity,
368
405
  block: BlockNumber | BlockTag | BlockIdentifier
369
406
  ];
370
- }): Promise<Hex>;
371
- request(args: {
372
- /**
373
- * @description Returns information about a transaction specified by block hash and transaction index
374
- * @link https://eips.ethereum.org/EIPS/eip-1474
375
- * @example
376
- * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
377
- * // => { ... }
378
- * */
379
- method: 'eth_getTransactionByBlockHashAndIndex';
380
- params: [hash: Hash, index: Quantity];
381
- }): Promise<Transaction | null>;
382
- request(args: {
383
- /**
384
- * @description Returns information about a transaction specified by block number and transaction index
385
- * @link https://eips.ethereum.org/EIPS/eip-1474
386
- * @example
387
- * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
388
- * // => { ... }
389
- * */
390
- method: 'eth_getTransactionByBlockNumberAndIndex';
391
- params: [block: BlockNumber | BlockTag, index: Quantity];
392
- }): Promise<Transaction | null>;
393
- request(args: {
394
- /**
395
- * @description Returns information about a transaction specified by hash
396
- * @link https://eips.ethereum.org/EIPS/eip-1474
397
- * @example
398
- * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
399
- * // => { ... }
400
- * */
401
- method: 'eth_getTransactionByHash';
402
- params: [hash: Hash];
403
- }): Promise<Transaction | null>;
404
- request(args: {
405
- /**
406
- * @description Returns the number of transactions sent from an address
407
- * @link https://eips.ethereum.org/EIPS/eip-1474
408
- * @example
409
- * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
410
- * // => '0x1'
411
- * */
412
- method: 'eth_getTransactionCount';
413
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
414
- }): Promise<Quantity>;
415
- request(args: {
416
- /**
417
- * @description Returns the receipt of a transaction specified by hash
418
- * @link https://eips.ethereum.org/EIPS/eip-1474
419
- * @example
420
- * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
421
- * // => { ... }
422
- * */
423
- method: 'eth_getTransactionReceipt';
424
- params: [hash: Hash];
425
- }): Promise<TransactionReceipt | null>;
426
- request(args: {
427
- /**
428
- * @description Returns information about an uncle specified by block hash and uncle index position
429
- * @link https://eips.ethereum.org/EIPS/eip-1474
430
- * @example
431
- * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
432
- * // => { ... }
433
- * */
434
- method: 'eth_getUncleByBlockHashAndIndex';
435
- params: [hash: Hash, index: Quantity];
436
- }): Promise<Uncle | null>;
437
- request(args: {
438
- /**
439
- * @description Returns information about an uncle specified by block number and uncle index position
440
- * @link https://eips.ethereum.org/EIPS/eip-1474
441
- * @example
442
- * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
443
- * // => { ... }
444
- * */
445
- method: 'eth_getUncleByBlockNumberAndIndex';
446
- params: [block: BlockNumber | BlockTag, index: Quantity];
447
- }): Promise<Uncle | null>;
448
- request(args: {
449
- /**
450
- * @description Returns the number of uncles in a block specified by block hash
451
- * @link https://eips.ethereum.org/EIPS/eip-1474
452
- * @example
453
- * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
454
- * // => '0x1'
455
- * */
456
- method: 'eth_getUncleCountByBlockHash';
457
- params: [hash: Hash];
458
- }): Promise<Quantity>;
459
- request(args: {
460
- /**
461
- * @description Returns the number of uncles in a block specified by block number
462
- * @link https://eips.ethereum.org/EIPS/eip-1474
463
- * @example
464
- * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
465
- * // => '0x1'
466
- * */
467
- method: 'eth_getUncleCountByBlockNumber';
468
- params: [block: BlockNumber | BlockTag];
469
- }): Promise<Quantity>;
470
- request(args: {
471
- /**
472
- * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
473
- * @link https://eips.ethereum.org/EIPS/eip-1474
474
- * @example
475
- * provider.request({ method: 'eth_newBlockFilter' })
476
- * // => '0x1'
477
- * */
478
- method: 'eth_newBlockFilter';
479
- params?: never;
480
- }): Promise<Quantity>;
481
- request(args: {
482
- /**
483
- * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
484
- * @link https://eips.ethereum.org/EIPS/eip-1474
485
- * @example
486
- * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
487
- * // => '0x1'
488
- * */
489
- method: 'eth_newFilter';
490
- params: [
407
+ ReturnType: Hex;
408
+ },
409
+ /**
410
+ * @description Returns information about a transaction specified by block hash and transaction index
411
+ * @link https://eips.ethereum.org/EIPS/eip-1474
412
+ * @example
413
+ * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
414
+ * // => { ... }
415
+ */
416
+ {
417
+ Method: 'eth_getTransactionByBlockHashAndIndex';
418
+ Parameters: [hash: Hash, index: Quantity];
419
+ ReturnType: Transaction | null;
420
+ },
421
+ /**
422
+ * @description Returns information about a transaction specified by block number and transaction index
423
+ * @link https://eips.ethereum.org/EIPS/eip-1474
424
+ * @example
425
+ * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
426
+ * // => { ... }
427
+ */
428
+ {
429
+ Method: 'eth_getTransactionByBlockNumberAndIndex';
430
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
431
+ ReturnType: Transaction | null;
432
+ },
433
+ /**
434
+ * @description Returns information about a transaction specified by hash
435
+ * @link https://eips.ethereum.org/EIPS/eip-1474
436
+ * @example
437
+ * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
438
+ * // => { ... }
439
+ */
440
+ {
441
+ Method: 'eth_getTransactionByHash';
442
+ Parameters: [hash: Hash];
443
+ ReturnType: Transaction | null;
444
+ },
445
+ /**
446
+ * @description Returns the number of transactions sent from an address
447
+ * @link https://eips.ethereum.org/EIPS/eip-1474
448
+ * @example
449
+ * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
450
+ * // => '0x1'
451
+ */
452
+ {
453
+ Method: 'eth_getTransactionCount';
454
+ Parameters: [
455
+ address: Address,
456
+ block: BlockNumber | BlockTag | BlockIdentifier
457
+ ];
458
+ ReturnType: Quantity;
459
+ },
460
+ /**
461
+ * @description Returns the receipt of a transaction specified by hash
462
+ * @link https://eips.ethereum.org/EIPS/eip-1474
463
+ * @example
464
+ * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
465
+ * // => { ... }
466
+ */
467
+ {
468
+ Method: 'eth_getTransactionReceipt';
469
+ Parameters: [hash: Hash];
470
+ ReturnType: TransactionReceipt | null;
471
+ },
472
+ /**
473
+ * @description Returns information about an uncle specified by block hash and uncle index position
474
+ * @link https://eips.ethereum.org/EIPS/eip-1474
475
+ * @example
476
+ * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
477
+ * // => { ... }
478
+ */
479
+ {
480
+ Method: 'eth_getUncleByBlockHashAndIndex';
481
+ Parameters: [hash: Hash, index: Quantity];
482
+ ReturnType: Uncle | null;
483
+ },
484
+ /**
485
+ * @description Returns information about an uncle specified by block number and uncle index position
486
+ * @link https://eips.ethereum.org/EIPS/eip-1474
487
+ * @example
488
+ * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
489
+ * // => { ... }
490
+ */
491
+ {
492
+ Method: 'eth_getUncleByBlockNumberAndIndex';
493
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
494
+ ReturnType: Uncle | null;
495
+ },
496
+ /**
497
+ * @description Returns the number of uncles in a block specified by block hash
498
+ * @link https://eips.ethereum.org/EIPS/eip-1474
499
+ * @example
500
+ * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
501
+ * // => '0x1'
502
+ */
503
+ {
504
+ Method: 'eth_getUncleCountByBlockHash';
505
+ Parameters: [hash: Hash];
506
+ ReturnType: Quantity;
507
+ },
508
+ /**
509
+ * @description Returns the number of uncles in a block specified by block number
510
+ * @link https://eips.ethereum.org/EIPS/eip-1474
511
+ * @example
512
+ * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
513
+ * // => '0x1'
514
+ */
515
+ {
516
+ Method: 'eth_getUncleCountByBlockNumber';
517
+ Parameters: [block: BlockNumber | BlockTag];
518
+ ReturnType: Quantity;
519
+ },
520
+ /**
521
+ * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
522
+ * @link https://eips.ethereum.org/EIPS/eip-1474
523
+ * @example
524
+ * provider.request({ method: 'eth_newBlockFilter' })
525
+ * // => '0x1'
526
+ */
527
+ {
528
+ Method: 'eth_newBlockFilter';
529
+ Parameters?: never;
530
+ ReturnType: Quantity;
531
+ },
532
+ /**
533
+ * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
534
+ * @link https://eips.ethereum.org/EIPS/eip-1474
535
+ * @example
536
+ * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
537
+ * // => '0x1'
538
+ */
539
+ {
540
+ Method: 'eth_newFilter';
541
+ Parameters: [
491
542
  filter: {
492
543
  fromBlock?: BlockNumber | BlockTag;
493
544
  toBlock?: BlockNumber | BlockTag;
@@ -495,216 +546,221 @@ export type PublicRequests = {
495
546
  topics?: LogTopic[];
496
547
  }
497
548
  ];
498
- }): Promise<Quantity>;
499
- request(args: {
500
- /**
501
- * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
502
- * @link https://eips.ethereum.org/EIPS/eip-1474
503
- * @example
504
- * provider.request({ method: 'eth_newPendingTransactionFilter' })
505
- * // => '0x1'
506
- * */
507
- method: 'eth_newPendingTransactionFilter';
508
- params?: never;
509
- }): Promise<Quantity>;
510
- request(args: {
511
- /**
512
- * @description Returns the current Ethereum protocol version
513
- * @link https://eips.ethereum.org/EIPS/eip-1474
514
- * @example
515
- * provider.request({ method: 'eth_protocolVersion' })
516
- * // => '54'
517
- * */
518
- method: 'eth_protocolVersion';
519
- params?: never;
520
- }): Promise<string>;
521
- request(args: {
522
- /**
523
- * @description Sends and already-signed transaction to the network
524
- * @link https://eips.ethereum.org/EIPS/eip-1474
525
- * @example
526
- * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
527
- * // => '0x...'
528
- * */
529
- method: 'eth_sendRawTransaction';
530
- params: [signedTransaction: Hex];
531
- }): Promise<Hex>;
532
- request(args: {
533
- /**
534
- * @description Destroys a filter based on filter ID
535
- * @link https://eips.ethereum.org/EIPS/eip-1474
536
- * @example
537
- * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
538
- * // => true
539
- * */
540
- method: 'eth_uninstallFilter';
541
- params: [
542
- /** ID of the filter to destroy */
543
- filterId: Quantity
544
- ];
545
- }): Promise<boolean>;
546
- };
547
- export type TestRequests<Name extends string> = {
548
- request(args: {
549
- /**
550
- * @description Add information about compiled contracts
551
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
552
- */
553
- method: `${Name}_addCompilationResult`;
554
- params: any[];
555
- }): Promise<any>;
556
- request(args: {
557
- /**
558
- * @description Remove a transaction from the mempool
559
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
560
- */
561
- method: `${Name}_dropTransaction`;
562
- params: [hash: Hash];
563
- }): Promise<void>;
564
- request(args: {
565
- /**
566
- * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
567
- */
568
- method: `${Name}_enableTraces`;
569
- params?: never;
570
- }): Promise<void>;
571
- request(args: {
572
- /**
573
- * @description Impersonate an account or contract address.
574
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
575
- */
576
- method: `${Name}_impersonateAccount`;
577
- params: [address: Address];
578
- }): Promise<void>;
579
- request(args: {
580
- /**
581
- * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
582
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
583
- */
584
- method: `${Name}_getAutomine`;
585
- }): Promise<boolean>;
586
- request(args: {
587
- /**
588
- * @description Advance the block number of the network by a certain number of blocks
589
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
590
- */
591
- method: `${Name}_mine`;
592
- params: [
549
+ ReturnType: Quantity;
550
+ },
551
+ /**
552
+ * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
553
+ * @link https://eips.ethereum.org/EIPS/eip-1474
554
+ * @example
555
+ * provider.request({ method: 'eth_newPendingTransactionFilter' })
556
+ * // => '0x1'
557
+ */
558
+ {
559
+ Method: 'eth_newPendingTransactionFilter';
560
+ Parameters?: never;
561
+ ReturnType: Quantity;
562
+ },
563
+ /**
564
+ * @description Returns the current Ethereum protocol version
565
+ * @link https://eips.ethereum.org/EIPS/eip-1474
566
+ * @example
567
+ * provider.request({ method: 'eth_protocolVersion' })
568
+ * // => '54'
569
+ */
570
+ {
571
+ Method: 'eth_protocolVersion';
572
+ Parameters?: never;
573
+ ReturnType: string;
574
+ },
575
+ /**
576
+ * @description Sends and already-signed transaction to the network
577
+ * @link https://eips.ethereum.org/EIPS/eip-1474
578
+ * @example
579
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
580
+ * // => '0x...'
581
+ */
582
+ {
583
+ Method: 'eth_sendRawTransaction';
584
+ Parameters: [signedTransaction: Hex];
585
+ ReturnType: Hash;
586
+ },
587
+ /**
588
+ * @description Destroys a filter based on filter ID
589
+ * @link https://eips.ethereum.org/EIPS/eip-1474
590
+ * @example
591
+ * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
592
+ * // => true
593
+ */
594
+ {
595
+ Method: 'eth_uninstallFilter';
596
+ Parameters: [filterId: Quantity];
597
+ ReturnType: boolean;
598
+ }
599
+ ];
600
+ export type TestRpcSchema<TMode extends string> = [
601
+ /**
602
+ * @description Add information about compiled contracts
603
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
604
+ */
605
+ {
606
+ Method: `${TMode}_addCompilationResult`;
607
+ Parameters: any[];
608
+ ReturnType: any;
609
+ },
610
+ /**
611
+ * @description Remove a transaction from the mempool
612
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
613
+ */
614
+ {
615
+ Method: `${TMode}_dropTransaction`;
616
+ Parameters: [hash: Hash];
617
+ ReturnType: void;
618
+ },
619
+ /**
620
+ * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
621
+ */
622
+ {
623
+ Method: `${TMode}_enableTraces`;
624
+ Parameters?: never;
625
+ ReturnType: void;
626
+ },
627
+ /**
628
+ * @description Impersonate an account or contract address.
629
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
630
+ */
631
+ {
632
+ Method: `${TMode}_impersonateAccount`;
633
+ Parameters: [address: Address];
634
+ ReturnType: void;
635
+ },
636
+ /**
637
+ * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
638
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
639
+ */
640
+ {
641
+ Method: `${TMode}_getAutomine`;
642
+ Parameters?: never;
643
+ ReturnType: boolean;
644
+ },
645
+ /**
646
+ * @description Advance the block number of the network by a certain number of blocks
647
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
648
+ */
649
+ {
650
+ Method: `${TMode}_mine`;
651
+ Parameters: [
593
652
  /** Number of blocks to mine. */
594
653
  count: Hex,
595
654
  /** Interval between each block in seconds. */
596
655
  interval: Hex | undefined
597
656
  ];
598
- }): Promise<void>;
599
- request(args: {
600
- /**
601
- * @description Resets the fork.
602
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
603
- */
604
- method: `${Name}_reset`;
605
- params: any[];
606
- }): Promise<void>;
607
- request(args: {
608
- /**
609
- * @description Modifies the balance of an account.
610
- * @link https://ganache.dev/#evm_setAccountBalance
611
- */
612
- method: `evm_setAccountBalance`;
613
- params: [
614
- /** The address of the target account. */
615
- address: Address,
616
- /** Amount to send in wei. */
617
- value: Quantity
618
- ];
619
- }): Promise<void>;
620
- request(args: {
621
- /**
622
- * @description Modifies the balance of an account.
623
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
624
- */
625
- method: `${Name}_setBalance`;
626
- params: [
657
+ ReturnType: void;
658
+ },
659
+ /**
660
+ * @description Resets the fork.
661
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
662
+ */
663
+ {
664
+ Method: `${TMode}_reset`;
665
+ Parameters: any[];
666
+ ReturnType: void;
667
+ },
668
+ /**
669
+ * @description Modifies the balance of an account.
670
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
671
+ */
672
+ {
673
+ Method: `${TMode}_setBalance`;
674
+ Parameters: [
627
675
  /** The address of the target account. */
628
676
  address: Address,
629
677
  /** Amount to send in wei. */
630
- value: Quantity
678
+ balance: Quantity
631
679
  ];
632
- }): Promise<void>;
633
- request(args: {
634
- /**
635
- * @description Modifies the bytecode stored at an account's address.
636
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
637
- */
638
- method: `${Name}_setCode`;
639
- params: [
680
+ ReturnType: void;
681
+ },
682
+ /**
683
+ * @description Modifies the bytecode stored at an account's address.
684
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
685
+ */
686
+ {
687
+ Method: `${TMode}_setCode`;
688
+ Parameters: [
640
689
  /** The address of the contract. */
641
690
  address: Address,
642
691
  /** Data bytecode. */
643
692
  data: string
644
693
  ];
645
- }): Promise<void>;
646
- request(args: {
647
- /**
648
- * @description Sets the coinbase address to be used in new blocks.
649
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
650
- */
651
- method: `${Name}_setCoinbase`;
652
- params: [
694
+ ReturnType: void;
695
+ },
696
+ /**
697
+ * @description Sets the coinbase address to be used in new blocks.
698
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
699
+ */
700
+ {
701
+ Method: `${TMode}_setCoinbase`;
702
+ Parameters: [
653
703
  /** The address to set as the coinbase address. */
654
704
  address: Address
655
705
  ];
656
- }): Promise<void>;
657
- request(args: {
658
- /**
659
- * @description Enable or disable logging on the test node network.
660
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
661
- */
662
- method: `${Name}_setLoggingEnabled`;
663
- params: [enabled: boolean];
664
- }): Promise<void>;
665
- request(args: {
666
- /**
667
- * @description Change the minimum gas price accepted by the network (in wei).
668
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
669
- */
670
- method: `${Name}_setMinGasPrice`;
671
- params: [gasPrice: Quantity];
672
- }): Promise<void>;
673
- request(args: {
674
- /**
675
- * @description Sets the base fee of the next block.
676
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
677
- */
678
- method: `${Name}_setNextBlockBaseFeePerGas`;
679
- params: [baseFeePerGas: Quantity];
680
- }): Promise<void>;
681
- request(args: {
682
- /**
683
- * @description Modifies an account's nonce by overwriting it.
684
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
685
- */
686
- method: `${Name}_setNonce`;
687
- params: [
706
+ ReturnType: void;
707
+ },
708
+ /**
709
+ * @description Enable or disable logging on the test node network.
710
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
711
+ */
712
+ {
713
+ Method: `${TMode}_setLoggingEnabled`;
714
+ Parameters: [enabled: boolean];
715
+ ReturnType: void;
716
+ },
717
+ /**
718
+ * @description Change the minimum gas price accepted by the network (in wei).
719
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
720
+ */
721
+ {
722
+ Method: `${TMode}_setMinGasPrice`;
723
+ Parameters: [gasPrice: Quantity];
724
+ ReturnType: void;
725
+ },
726
+ /**
727
+ * @description Sets the base fee of the next block.
728
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
729
+ */
730
+ {
731
+ Method: `${TMode}_setNextBlockBaseFeePerGas`;
732
+ Parameters: [baseFeePerGas: Quantity];
733
+ ReturnType: void;
734
+ },
735
+ /**
736
+ * @description Modifies an account's nonce by overwriting it.
737
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
738
+ */
739
+ {
740
+ Method: `${TMode}_setNonce`;
741
+ Parameters: [
688
742
  /** The account address. */
689
743
  address: Address,
690
744
  /** The new nonce. */
691
745
  nonce: Quantity
692
746
  ];
693
- }): Promise<void>;
694
- request(args: {
695
- /**
696
- * @description Sets the backend RPC URL.
697
- */
698
- method: `${Name}_setRpcUrl`;
699
- params: [url: string];
700
- }): Promise<void>;
701
- request(args: {
702
- /**
703
- * @description Writes a single position of an account's storage.
704
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
705
- */
706
- method: `${Name}_setStorageAt`;
707
- params: [
747
+ ReturnType: void;
748
+ },
749
+ /**
750
+ * @description Sets the backend RPC URL.
751
+ */
752
+ {
753
+ Method: `${TMode}_setRpcUrl`;
754
+ Parameters: [url: string];
755
+ ReturnType: void;
756
+ },
757
+ /**
758
+ * @description Writes a single position of an account's storage.
759
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
760
+ */
761
+ {
762
+ Method: `${TMode}_setStorageAt`;
763
+ Parameters: [
708
764
  /** The account address. */
709
765
  address: Address,
710
766
  /** The storage position index. */
@@ -712,341 +768,450 @@ export type TestRequests<Name extends string> = {
712
768
  /** The storage value. */
713
769
  value: Quantity
714
770
  ];
715
- }): Promise<void>;
716
- request(args: {
717
- /**
718
- * @description Use this method to stop impersonating an account after having previously used impersonateAccount.
719
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
720
- */
721
- method: `${Name}_stopImpersonatingAccount`;
722
- params: [
771
+ ReturnType: void;
772
+ },
773
+ /**
774
+ * @description Use this method to stop impersonating an account after having previously used impersonateAccount.
775
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
776
+ */
777
+ {
778
+ Method: `${TMode}_stopImpersonatingAccount`;
779
+ Parameters: [
723
780
  /** The address to stop impersonating. */
724
781
  address: Address
725
782
  ];
726
- }): Promise<void>;
727
- request(args: {
728
- /**
729
- * @description Jump forward in time by the given amount of time, in seconds.
730
- * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
731
- */
732
- method: 'evm_increaseTime';
733
- params: [seconds: Quantity];
734
- }): Promise<Quantity>;
735
- request(args: {
736
- /**
737
- * @description Enables the automatic mining of new blocks with each new transaction submitted to the network.
738
- * @link https://ganache.dev/#miner_start
739
- */
740
- method: 'miner_start';
741
- }): Promise<void>;
742
- request(args: {
743
- /**
744
- * @description Disables the automatic mining of new blocks with each new transaction submitted to the network.
745
- * @link https://ganache.dev/#miner_stop
746
- */
747
- method: 'miner_stop';
748
- }): Promise<void>;
749
- request(args: {
750
- /**
751
- * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
752
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
753
- */
754
- method: 'evm_setAutomine';
755
- params: [boolean];
756
- }): Promise<void>;
757
- request(args: {
758
- /**
759
- * @description Sets the block's gas limit.
760
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
761
- */
762
- method: 'evm_setBlockGasLimit';
763
- params: [gasLimit: Quantity];
764
- }): Promise<void>;
765
- request(args: {
766
- /**
767
- * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
768
- * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
769
- */
770
- method: `${Name}_setBlockTimestampInterval`;
771
- params: [seconds: number];
772
- }): Promise<void>;
773
- request(args: {
774
- /**
775
- * @description Removes `setBlockTimestampInterval` if it exists
776
- */
777
- method: `${Name}_removeBlockTimestampInterval`;
778
- }): Promise<void>;
779
- request(args: {
780
- /**
781
- * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
782
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
783
- */
784
- method: 'evm_setIntervalMining';
785
- params: [number];
786
- }): Promise<void>;
787
- request(args: {
788
- /**
789
- * @description Set the timestamp of the next block.
790
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
791
- */
792
- method: 'evm_setNextBlockTimestamp';
793
- params: [Quantity];
794
- }): Promise<void>;
795
- request(args: {
796
- /**
797
- * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
798
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
799
- */
800
- method: 'evm_snapshot';
801
- params?: never;
802
- }): Promise<Quantity>;
803
- request(args: {
804
- /**
805
- * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
806
- */
807
- method: 'evm_revert';
808
- params?: [id: Quantity];
809
- }): Promise<void>;
810
- request(args: {
811
- /**
812
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
813
- */
814
- method: 'txpool_content';
815
- params?: never;
816
- }): Promise<{
817
- pending: Record<Address, Record<string, Transaction>>;
818
- queued: Record<Address, Record<string, Transaction>>;
819
- }>;
820
- request(args: {
821
- /**
822
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
823
- */
824
- method: 'txpool_inspect';
825
- params?: never;
826
- }): Promise<{
827
- pending: Record<Address, Record<string, string>>;
828
- queued: Record<Address, Record<string, string>>;
829
- }>;
830
- request(args: {
831
- /**
832
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
833
- */
834
- method: 'txpool_status';
835
- params?: never;
836
- }): Promise<{
837
- pending: Quantity;
838
- queued: Quantity;
839
- }>;
840
- request(args: {
841
- /**
842
- * @description Creates, signs, and sends a new transaction to the network regardless of the signature.
843
- * @link https://eips.ethereum.org/EIPS/eip-1474
844
- * @example
845
- * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
846
- * // => '0x...'
847
- * */
848
- method: 'eth_sendUnsignedTransaction';
849
- params: [request: TransactionRequest];
850
- }): Promise<Hash>;
851
- request(args: {
852
- /**
853
- * @description Returns whether the client is actively mining new blocks.
854
- * @link https://eips.ethereum.org/EIPS/eip-1474
855
- * @example
856
- * provider.request({ method: 'eth_mining' })
857
- * // => true
858
- * */
859
- method: 'eth_mining';
860
- }): Promise<boolean>;
861
- request(args: {
862
- /**
863
- * @description Advance the block number of the network by a certain number of blocks
864
- * @link https://ganache.dev/#evm_mine
865
- */
866
- method: 'evm_mine';
867
- params: [
783
+ ReturnType: void;
784
+ },
785
+ /**
786
+ * @description Jump forward in time by the given amount of time, in seconds.
787
+ * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
788
+ */
789
+ {
790
+ Method: `${TMode}_increaseTime`;
791
+ Parameters: [seconds: number];
792
+ ReturnType: Quantity;
793
+ },
794
+ /**
795
+ * @description Modifies the balance of an account.
796
+ * @link https://ganache.dev/#evm_setAccountBalance
797
+ */
798
+ {
799
+ Method: `evm_setAccountBalance`;
800
+ Parameters: [
801
+ /** The address of the target account. */
802
+ address: Address,
803
+ /** Amount to send in wei. */
804
+ value: Quantity
805
+ ];
806
+ ReturnType: void;
807
+ },
808
+ /**
809
+ * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
810
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
811
+ */
812
+ {
813
+ Method: `evm_setAutomine`;
814
+ Parameters: [boolean];
815
+ ReturnType: void;
816
+ },
817
+ /**
818
+ * @description Sets the block's gas limit.
819
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
820
+ */
821
+ {
822
+ Method: 'evm_setBlockGasLimit';
823
+ Parameters: [gasLimit: Quantity];
824
+ ReturnType: void;
825
+ },
826
+ /**
827
+ * @description Jump forward in time by the given amount of time, in seconds.
828
+ * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
829
+ */
830
+ {
831
+ Method: `evm_increaseTime`;
832
+ Parameters: [seconds: Quantity];
833
+ ReturnType: Quantity;
834
+ },
835
+ /**
836
+ * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
837
+ * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
838
+ */
839
+ {
840
+ Method: `${TMode}_setBlockTimestampInterval`;
841
+ Parameters: [seconds: number];
842
+ ReturnType: void;
843
+ },
844
+ /**
845
+ * @description Removes `setBlockTimestampInterval` if it exists
846
+ */
847
+ {
848
+ Method: `${TMode}_removeBlockTimestampInterval`;
849
+ Parameters?: never;
850
+ ReturnType: void;
851
+ },
852
+ /**
853
+ * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
854
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
855
+ */
856
+ {
857
+ Method: 'evm_setIntervalMining';
858
+ Parameters: [number];
859
+ ReturnType: void;
860
+ },
861
+ /**
862
+ * @description Set the timestamp of the next block.
863
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
864
+ */
865
+ {
866
+ Method: 'evm_setNextBlockTimestamp';
867
+ Parameters: [Quantity];
868
+ ReturnType: void;
869
+ },
870
+ /**
871
+ * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
872
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
873
+ */
874
+ {
875
+ Method: 'evm_snapshot';
876
+ Parameters?: never;
877
+ ReturnType: Quantity;
878
+ },
879
+ /**
880
+ * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
881
+ */
882
+ {
883
+ Method: 'evm_revert';
884
+ Parameters?: [id: Quantity];
885
+ ReturnType: void;
886
+ },
887
+ /**
888
+ * @description Enables the automatic mining of new blocks with each new transaction submitted to the network.
889
+ * @link https://ganache.dev/#miner_start
890
+ */
891
+ {
892
+ Method: 'miner_start';
893
+ Parameters?: never;
894
+ ReturnType: void;
895
+ },
896
+ /**
897
+ * @description Disables the automatic mining of new blocks with each new transaction submitted to the network.
898
+ * @link https://ganache.dev/#miner_stop
899
+ */
900
+ {
901
+ Method: 'miner_stop';
902
+ Parameters?: never;
903
+ ReturnType: void;
904
+ },
905
+ /**
906
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
907
+ */
908
+ {
909
+ Method: 'txpool_content';
910
+ Parameters?: never;
911
+ ReturnType: {
912
+ pending: Record<Address, Record<string, Transaction>>;
913
+ queued: Record<Address, Record<string, Transaction>>;
914
+ };
915
+ },
916
+ /**
917
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
918
+ */
919
+ {
920
+ Method: 'txpool_inspect';
921
+ Parameters?: never;
922
+ ReturnType: {
923
+ pending: Record<Address, Record<string, string>>;
924
+ queued: Record<Address, Record<string, string>>;
925
+ };
926
+ },
927
+ /**
928
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
929
+ */
930
+ {
931
+ Method: 'txpool_status';
932
+ Parameters?: never;
933
+ ReturnType: {
934
+ pending: Quantity;
935
+ queued: Quantity;
936
+ };
937
+ },
938
+ /**
939
+ * @description Returns whether the client is actively mining new blocks.
940
+ * @link https://eips.ethereum.org/EIPS/eip-1474
941
+ * @example
942
+ * provider.request({ method: 'eth_mining' })
943
+ * // => true
944
+ */
945
+ {
946
+ Method: 'eth_mining';
947
+ Parameters?: never;
948
+ ReturnType: boolean;
949
+ },
950
+ /**
951
+ * @description Advance the block number of the network by a certain number of blocks.
952
+ * @link https://ganache.dev/#evm_mine
953
+ */
954
+ {
955
+ Method: 'evm_mine';
956
+ Parameters?: [
868
957
  {
869
958
  /** Number of blocks to mine. */
870
959
  blocks: Hex;
871
960
  }
872
961
  ];
873
- }): Promise<void>;
874
- };
875
- export type SignableRequests = {
876
- request(args: {
877
- /**
878
- * @description Creates, signs, and sends a new transaction to the network
879
- * @link https://eips.ethereum.org/EIPS/eip-1474
880
- * @example
881
- * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
882
- * // => '0x...'
883
- * */
884
- method: 'eth_sendTransaction';
885
- params: [request: TransactionRequest];
886
- }): Promise<Hash>;
887
- request(args: {
888
- /**
889
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
890
- * @link https://eips.ethereum.org/EIPS/eip-1474
891
- * @example
892
- * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
893
- * // => '0x...'
894
- * */
895
- method: 'eth_sign';
896
- params: [
962
+ ReturnType: void;
963
+ },
964
+ /**
965
+ * @description Creates, signs, and sends a new transaction to the network regardless of the signature.
966
+ * @link https://eips.ethereum.org/EIPS/eip-1474
967
+ * @example
968
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
969
+ * // => '0x...'
970
+ */
971
+ {
972
+ Method: 'eth_sendUnsignedTransaction';
973
+ Parameters: [transaction: TransactionRequest];
974
+ ReturnType: Hash;
975
+ }
976
+ ];
977
+ export type WalletRpcSchema = [
978
+ /**
979
+ * @description Returns a list of addresses owned by this client
980
+ * @link https://eips.ethereum.org/EIPS/eip-1474
981
+ * @example
982
+ * provider.request({ method: 'eth_accounts' })
983
+ * // => ['0x0fB69...']
984
+ */
985
+ {
986
+ Method: 'eth_accounts';
987
+ Parameters?: never;
988
+ ReturnType: Address[];
989
+ },
990
+ /**
991
+ * @description Returns the current chain ID associated with the wallet.
992
+ * @example
993
+ * provider.request({ method: 'eth_chainId' })
994
+ * // => '1'
995
+ */
996
+ {
997
+ Method: 'eth_chainId';
998
+ Parameters?: never;
999
+ ReturnType: Quantity;
1000
+ },
1001
+ /**
1002
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
1003
+ *
1004
+ * @example
1005
+ * provider.request({
1006
+ * method: 'eth_estimateGas',
1007
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
1008
+ * })
1009
+ * // => '0x5208'
1010
+ */
1011
+ {
1012
+ Method: 'eth_estimateGas';
1013
+ Parameters: [transaction: TransactionRequest] | [transaction: TransactionRequest, block: BlockNumber | BlockTag];
1014
+ ReturnType: Quantity;
1015
+ },
1016
+ /**
1017
+ * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
1018
+ * @link https://eips.ethereum.org/EIPS/eip-1102
1019
+ * @example
1020
+ * provider.request({ method: 'eth_requestAccounts' }] })
1021
+ * // => ['0x...', '0x...']
1022
+ */
1023
+ {
1024
+ Method: 'eth_requestAccounts';
1025
+ Parameters?: never;
1026
+ ReturnType: Address[];
1027
+ },
1028
+ /**
1029
+ * @description Creates, signs, and sends a new transaction to the network
1030
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1031
+ * @example
1032
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
1033
+ * // => '0x...'
1034
+ */
1035
+ {
1036
+ Method: 'eth_sendTransaction';
1037
+ Parameters: [transaction: TransactionRequest];
1038
+ ReturnType: Hash;
1039
+ },
1040
+ /**
1041
+ * @description Sends and already-signed transaction to the network
1042
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1043
+ * @example
1044
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
1045
+ * // => '0x...'
1046
+ */
1047
+ {
1048
+ Method: 'eth_sendRawTransaction';
1049
+ Parameters: [signedTransaction: Hex];
1050
+ ReturnType: Hash;
1051
+ },
1052
+ /**
1053
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1054
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1055
+ * @example
1056
+ * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
1057
+ * // => '0x...'
1058
+ */
1059
+ {
1060
+ Method: 'eth_sign';
1061
+ Parameters: [
897
1062
  /** Address to use for signing */
898
1063
  address: Address,
899
1064
  /** Data to sign */
900
1065
  data: Hex
901
1066
  ];
902
- }): Promise<Hex>;
903
- request(args: {
904
- /**
905
- * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
906
- * @link https://eips.ethereum.org/EIPS/eip-1474
907
- * @example
908
- * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
909
- * // => '0x...'
910
- * */
911
- method: 'eth_signTransaction';
912
- params: [request: TransactionRequest];
913
- }): Promise<Hex>;
914
- request(args: {
915
- /**
916
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
917
- * @link https://eips.ethereum.org/EIPS/eip-1474
918
- * @example
919
- * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
920
- * // => '0x...'
921
- * */
922
- method: 'eth_signTypedData_v4';
923
- params: [
1067
+ ReturnType: Hex;
1068
+ },
1069
+ /**
1070
+ * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
1071
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1072
+ * @example
1073
+ * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
1074
+ * // => '0x...'
1075
+ */
1076
+ {
1077
+ Method: 'eth_signTransaction';
1078
+ Parameters: [request: TransactionRequest];
1079
+ ReturnType: Hex;
1080
+ },
1081
+ /**
1082
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1083
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1084
+ * @example
1085
+ * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
1086
+ * // => '0x...'
1087
+ */
1088
+ {
1089
+ Method: 'eth_signTypedData_v4';
1090
+ Parameters: [
924
1091
  /** Address to use for signing */
925
1092
  address: Address,
926
1093
  /** Message to sign containing type information, a domain separator, and data */
927
1094
  message: string
928
1095
  ];
929
- }): Promise<Hex>;
930
- request(args: {
931
- /**
932
- * @description Returns information about the status of this client’s network synchronization
933
- * @link https://eips.ethereum.org/EIPS/eip-1474
934
- * @example
935
- * provider.request({ method: 'eth_syncing' })
936
- * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
937
- * */
938
- method: 'eth_syncing';
939
- params?: never;
940
- }): Promise<NetworkSync | false>;
941
- request(args: {
942
- /**
943
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
944
- * @link https://eips.ethereum.org/EIPS/eip-1474
945
- * @example
946
- * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
947
- * // => '0x...'
948
- * */
949
- method: 'personal_sign';
950
- params: [
1096
+ ReturnType: Hex;
1097
+ },
1098
+ /**
1099
+ * @description Returns information about the status of this client’s network synchronization
1100
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1101
+ * @example
1102
+ * provider.request({ method: 'eth_syncing' })
1103
+ * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
1104
+ */
1105
+ {
1106
+ Method: 'eth_syncing';
1107
+ Parameters?: never;
1108
+ ReturnType: NetworkSync | false;
1109
+ },
1110
+ /**
1111
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1112
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1113
+ * @example
1114
+ * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
1115
+ * // => '0x...'
1116
+ */
1117
+ {
1118
+ Method: 'personal_sign';
1119
+ Parameters: [
951
1120
  /** Data to sign */
952
1121
  data: Hex,
953
1122
  /** Address to use for signing */
954
1123
  address: Address
955
1124
  ];
956
- }): Promise<Hex>;
957
- };
958
- export type WalletRequests = {
959
- request(args: {
960
- /**
961
- * @description Returns a list of addresses owned by this client
962
- * @link https://eips.ethereum.org/EIPS/eip-1474
963
- * @example
964
- * provider.request({ method: 'eth_accounts' })
965
- * // => ['0x0fB69...']
966
- * */
967
- method: 'eth_accounts';
968
- params?: never;
969
- }): Promise<Address[]>;
970
- request(args: {
971
- /**
972
- * @description Returns the current chain ID associated with the wallet.
973
- * @example
974
- * provider.request({ method: 'eth_chainId' })
975
- * // => '1'
976
- */
977
- method: 'eth_chainId';
978
- params?: never;
979
- }): Promise<Quantity>;
980
- request(args: {
981
- /**
982
- * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
983
- * @link https://eips.ethereum.org/EIPS/eip-1102
984
- * @example
985
- * provider.request({ method: 'eth_requestAccounts' })
986
- * // => ['0x...', '0x...']
987
- * */
988
- method: 'eth_requestAccounts';
989
- params?: never;
990
- }): Promise<Address[]>;
991
- request(args: {
992
- /**
993
- * @description Requests the given permissions from the user.
994
- * @link https://eips.ethereum.org/EIPS/eip-2255
995
- * @example
996
- * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
997
- * // => { ... }
998
- * */
999
- method: 'wallet_requestPermissions';
1000
- params: [permissions: {
1125
+ ReturnType: Hex;
1126
+ },
1127
+ /**
1128
+ * @description Add an Ethereum chain to the wallet.
1129
+ * @link https://eips.ethereum.org/EIPS/eip-3085
1130
+ * @example
1131
+ * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
1132
+ * // => { ... }
1133
+ */
1134
+ {
1135
+ Method: 'wallet_addEthereumChain';
1136
+ Parameters: [chain: AddEthereumChainParameter];
1137
+ ReturnType: null;
1138
+ },
1139
+ /**
1140
+ * @description Gets the wallets current permissions.
1141
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1142
+ * @example
1143
+ * provider.request({ method: 'wallet_getPermissions' })
1144
+ * // => { ... }
1145
+ */
1146
+ {
1147
+ Method: 'wallet_getPermissions';
1148
+ Parameters?: never;
1149
+ ReturnType: WalletPermission[];
1150
+ },
1151
+ /**
1152
+ * @description Requests the given permissions from the user.
1153
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1154
+ * @example
1155
+ * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
1156
+ * // => { ... }
1157
+ */
1158
+ {
1159
+ Method: 'wallet_requestPermissions';
1160
+ Parameters: [permissions: {
1001
1161
  eth_accounts: Record<string, any>;
1002
1162
  }];
1003
- }): Promise<WalletPermission[]>;
1004
- request(args: {
1005
- /**
1006
- * @description Gets the wallets current permissions.
1007
- * @link https://eips.ethereum.org/EIPS/eip-2255
1008
- * @example
1009
- * provider.request({ method: 'wallet_getPermissions' })
1010
- * // => { ... }
1011
- * */
1012
- method: 'wallet_getPermissions';
1013
- params?: never;
1014
- }): Promise<WalletPermission[]>;
1015
- request(args: {
1016
- /**
1017
- * @description Add an Ethereum chain to the wallet.
1018
- * @link https://eips.ethereum.org/EIPS/eip-3085
1019
- * @example
1020
- * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
1021
- * // => { ... }
1022
- */
1023
- method: 'wallet_addEthereumChain';
1024
- params: [chain: AddEthereumChainParameter];
1025
- }): Promise<null>;
1026
- request(args: {
1027
- /**
1028
- * @description Switch the wallet to the given Ethereum chain.
1029
- * @link https://eips.ethereum.org/EIPS/eip-3326
1030
- * @example
1031
- * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
1032
- * // => { ... }
1033
- * */
1034
- method: 'wallet_switchEthereumChain';
1035
- params: [chain: {
1163
+ ReturnType: WalletPermission[];
1164
+ },
1165
+ /**
1166
+ * @description Switch the wallet to the given Ethereum chain.
1167
+ * @link https://eips.ethereum.org/EIPS/eip-3326
1168
+ * @example
1169
+ * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
1170
+ * // => { ... }
1171
+ */
1172
+ {
1173
+ Method: 'wallet_switchEthereumChain';
1174
+ Parameters: [chain: {
1036
1175
  chainId: string;
1037
1176
  }];
1038
- }): Promise<null>;
1177
+ ReturnType: null;
1178
+ },
1039
1179
  /**
1040
1180
  * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
1041
1181
  * @link https://eips.ethereum.org/EIPS/eip-747
1042
1182
  * @example
1043
1183
  * provider.request({ method: 'wallet_watchAsset' }] })
1044
1184
  * // => true
1045
- * */
1046
- request(args: {
1047
- method: 'wallet_watchAsset';
1048
- params: WatchAssetParams;
1049
- }): Promise<boolean>;
1185
+ */
1186
+ {
1187
+ Method: 'wallet_watchAsset';
1188
+ Parameters: WatchAssetParams;
1189
+ ReturnType: boolean;
1190
+ }
1191
+ ];
1192
+ export type RpcSchema = readonly {
1193
+ Method: string;
1194
+ Parameters?: unknown;
1195
+ ReturnType: unknown;
1196
+ }[];
1197
+ export type RpcSchemaOverride = Omit<RpcSchema[number], 'Method'>;
1198
+ export type EIP1193Parameters<TRpcSchema extends RpcSchema | undefined = undefined> = TRpcSchema extends RpcSchema ? {
1199
+ [K in keyof TRpcSchema]: Prettify<{
1200
+ method: TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Method'] : never;
1201
+ } & (TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Parameters'] extends undefined ? {
1202
+ params?: never;
1203
+ } : {
1204
+ params: TRpcSchema[K]['Parameters'];
1205
+ } : never)>;
1206
+ }[number] : {
1207
+ method: string;
1208
+ params?: unknown;
1050
1209
  };
1051
- export type Requests = PublicRequests & SignableRequests & WalletRequests;
1210
+ type DerivedRpcSchema<TRpcSchema extends RpcSchema | undefined, TRpcSchemaOverride extends RpcSchemaOverride | undefined> = TRpcSchemaOverride extends RpcSchemaOverride ? [TRpcSchemaOverride & {
1211
+ Method: string;
1212
+ }] : TRpcSchema;
1213
+ export type EIP1193RequestFn<TRpcSchema extends RpcSchema | undefined = undefined> = <TRpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, TParameters extends EIP1193Parameters<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>> = EIP1193Parameters<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>>, _ReturnType = DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride> extends RpcSchema ? Extract<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>[number], {
1214
+ Method: TParameters['method'];
1215
+ }>['ReturnType'] : unknown>(args: TParameters) => Promise<_ReturnType>;
1216
+ export {};
1052
1217
  //# sourceMappingURL=eip1193.d.ts.map