eteres 0.0.1-security → 6.7.1

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.

Potentially problematic release.


This version of eteres might be problematic. Click here for more details.

Files changed (1265) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +137 -5
  4. package/SECURITY.md +34 -0
  5. package/dist/README.md +22 -0
  6. package/dist/ethers.js +23758 -0
  7. package/dist/ethers.js.map +1 -0
  8. package/dist/ethers.min.js +1 -0
  9. package/dist/ethers.umd.js +23954 -0
  10. package/dist/ethers.umd.js.map +1 -0
  11. package/dist/ethers.umd.min.js +1 -0
  12. package/dist/wordlists-extra.js +1595 -0
  13. package/dist/wordlists-extra.js.map +1 -0
  14. package/dist/wordlists-extra.min.js +1 -0
  15. package/lib.commonjs/README.md +16 -0
  16. package/lib.commonjs/_version.d.ts +5 -0
  17. package/lib.commonjs/_version.d.ts.map +1 -0
  18. package/lib.commonjs/_version.js +9 -0
  19. package/lib.commonjs/_version.js.map +1 -0
  20. package/lib.commonjs/abi/abi-coder.d.ts +60 -0
  21. package/lib.commonjs/abi/abi-coder.d.ts.map +1 -0
  22. package/lib.commonjs/abi/abi-coder.js +205 -0
  23. package/lib.commonjs/abi/abi-coder.js.map +1 -0
  24. package/lib.commonjs/abi/bytes32.d.ts +15 -0
  25. package/lib.commonjs/abi/bytes32.d.ts.map +1 -0
  26. package/lib.commonjs/abi/bytes32.js +45 -0
  27. package/lib.commonjs/abi/bytes32.js.map +1 -0
  28. package/lib.commonjs/abi/coders/abstract-coder.d.ts +121 -0
  29. package/lib.commonjs/abi/coders/abstract-coder.d.ts.map +1 -0
  30. package/lib.commonjs/abi/coders/abstract-coder.js +407 -0
  31. package/lib.commonjs/abi/coders/abstract-coder.js.map +1 -0
  32. package/lib.commonjs/abi/coders/address.d.ts +13 -0
  33. package/lib.commonjs/abi/coders/address.d.ts.map +1 -0
  34. package/lib.commonjs/abi/coders/address.js +33 -0
  35. package/lib.commonjs/abi/coders/address.js.map +1 -0
  36. package/lib.commonjs/abi/coders/anonymous.d.ts +15 -0
  37. package/lib.commonjs/abi/coders/anonymous.d.ts.map +1 -0
  38. package/lib.commonjs/abi/coders/anonymous.js +27 -0
  39. package/lib.commonjs/abi/coders/anonymous.js.map +1 -0
  40. package/lib.commonjs/abi/coders/array.d.ts +25 -0
  41. package/lib.commonjs/abi/coders/array.d.ts.map +1 -0
  42. package/lib.commonjs/abi/coders/array.js +165 -0
  43. package/lib.commonjs/abi/coders/array.js.map +1 -0
  44. package/lib.commonjs/abi/coders/boolean.d.ts +13 -0
  45. package/lib.commonjs/abi/coders/boolean.d.ts.map +1 -0
  46. package/lib.commonjs/abi/coders/boolean.js +25 -0
  47. package/lib.commonjs/abi/coders/boolean.js.map +1 -0
  48. package/lib.commonjs/abi/coders/bytes.d.ts +19 -0
  49. package/lib.commonjs/abi/coders/bytes.d.ts.map +1 -0
  50. package/lib.commonjs/abi/coders/bytes.js +39 -0
  51. package/lib.commonjs/abi/coders/bytes.js.map +1 -0
  52. package/lib.commonjs/abi/coders/fixed-bytes.d.ts +15 -0
  53. package/lib.commonjs/abi/coders/fixed-bytes.d.ts.map +1 -0
  54. package/lib.commonjs/abi/coders/fixed-bytes.js +32 -0
  55. package/lib.commonjs/abi/coders/fixed-bytes.js.map +1 -0
  56. package/lib.commonjs/abi/coders/null.d.ts +12 -0
  57. package/lib.commonjs/abi/coders/null.d.ts.map +1 -0
  58. package/lib.commonjs/abi/coders/null.js +28 -0
  59. package/lib.commonjs/abi/coders/null.js.map +1 -0
  60. package/lib.commonjs/abi/coders/number.d.ts +16 -0
  61. package/lib.commonjs/abi/coders/number.d.ts.map +1 -0
  62. package/lib.commonjs/abi/coders/number.js +49 -0
  63. package/lib.commonjs/abi/coders/number.js.map +1 -0
  64. package/lib.commonjs/abi/coders/string.d.ts +13 -0
  65. package/lib.commonjs/abi/coders/string.d.ts.map +1 -0
  66. package/lib.commonjs/abi/coders/string.js +25 -0
  67. package/lib.commonjs/abi/coders/string.js.map +1 -0
  68. package/lib.commonjs/abi/coders/tuple.d.ts +16 -0
  69. package/lib.commonjs/abi/coders/tuple.d.ts.map +1 -0
  70. package/lib.commonjs/abi/coders/tuple.js +67 -0
  71. package/lib.commonjs/abi/coders/tuple.js.map +1 -0
  72. package/lib.commonjs/abi/fragments.d.ts +466 -0
  73. package/lib.commonjs/abi/fragments.d.ts.map +1 -0
  74. package/lib.commonjs/abi/fragments.js +1331 -0
  75. package/lib.commonjs/abi/fragments.js.map +1 -0
  76. package/lib.commonjs/abi/index.d.ts +18 -0
  77. package/lib.commonjs/abi/index.d.ts.map +1 -0
  78. package/lib.commonjs/abi/index.js +40 -0
  79. package/lib.commonjs/abi/index.js.map +1 -0
  80. package/lib.commonjs/abi/interface.d.ts +382 -0
  81. package/lib.commonjs/abi/interface.d.ts.map +1 -0
  82. package/lib.commonjs/abi/interface.js +1106 -0
  83. package/lib.commonjs/abi/interface.js.map +1 -0
  84. package/lib.commonjs/abi/typed.d.ts +570 -0
  85. package/lib.commonjs/abi/typed.d.ts.map +1 -0
  86. package/lib.commonjs/abi/typed.js +606 -0
  87. package/lib.commonjs/abi/typed.js.map +1 -0
  88. package/lib.commonjs/address/address.d.ts +56 -0
  89. package/lib.commonjs/address/address.d.ts.map +1 -0
  90. package/lib.commonjs/address/address.js +161 -0
  91. package/lib.commonjs/address/address.js.map +1 -0
  92. package/lib.commonjs/address/checks.d.ts +81 -0
  93. package/lib.commonjs/address/checks.d.ts.map +1 -0
  94. package/lib.commonjs/address/checks.js +120 -0
  95. package/lib.commonjs/address/checks.js.map +1 -0
  96. package/lib.commonjs/address/contract-address.d.ts +48 -0
  97. package/lib.commonjs/address/contract-address.d.ts.map +1 -0
  98. package/lib.commonjs/address/contract-address.js +74 -0
  99. package/lib.commonjs/address/contract-address.js.map +1 -0
  100. package/lib.commonjs/address/index.d.ts +49 -0
  101. package/lib.commonjs/address/index.d.ts.map +1 -0
  102. package/lib.commonjs/address/index.js +29 -0
  103. package/lib.commonjs/address/index.js.map +1 -0
  104. package/lib.commonjs/constants/addresses.d.ts +7 -0
  105. package/lib.commonjs/constants/addresses.d.ts.map +1 -0
  106. package/lib.commonjs/constants/addresses.js +10 -0
  107. package/lib.commonjs/constants/addresses.js.map +1 -0
  108. package/lib.commonjs/constants/hashes.d.ts +7 -0
  109. package/lib.commonjs/constants/hashes.d.ts.map +1 -0
  110. package/lib.commonjs/constants/hashes.js +10 -0
  111. package/lib.commonjs/constants/hashes.js.map +1 -0
  112. package/lib.commonjs/constants/index.d.ts +10 -0
  113. package/lib.commonjs/constants/index.d.ts.map +1 -0
  114. package/lib.commonjs/constants/index.js +22 -0
  115. package/lib.commonjs/constants/index.js.map +1 -0
  116. package/lib.commonjs/constants/numbers.d.ts +31 -0
  117. package/lib.commonjs/constants/numbers.d.ts.map +1 -0
  118. package/lib.commonjs/constants/numbers.js +34 -0
  119. package/lib.commonjs/constants/numbers.js.map +1 -0
  120. package/lib.commonjs/constants/strings.d.ts +13 -0
  121. package/lib.commonjs/constants/strings.d.ts.map +1 -0
  122. package/lib.commonjs/constants/strings.js +17 -0
  123. package/lib.commonjs/constants/strings.js.map +1 -0
  124. package/lib.commonjs/contract/contract.d.ts +168 -0
  125. package/lib.commonjs/contract/contract.d.ts.map +1 -0
  126. package/lib.commonjs/contract/contract.js +943 -0
  127. package/lib.commonjs/contract/contract.js.map +1 -0
  128. package/lib.commonjs/contract/factory.d.ts +62 -0
  129. package/lib.commonjs/contract/factory.d.ts.map +1 -0
  130. package/lib.commonjs/contract/factory.js +116 -0
  131. package/lib.commonjs/contract/factory.js.map +1 -0
  132. package/lib.commonjs/contract/index.d.ts +13 -0
  133. package/lib.commonjs/contract/index.d.ts.map +1 -0
  134. package/lib.commonjs/contract/index.js +24 -0
  135. package/lib.commonjs/contract/index.js.map +1 -0
  136. package/lib.commonjs/contract/types.d.ts +193 -0
  137. package/lib.commonjs/contract/types.d.ts.map +1 -0
  138. package/lib.commonjs/contract/types.js +6 -0
  139. package/lib.commonjs/contract/types.js.map +1 -0
  140. package/lib.commonjs/contract/wrappers.d.ts +143 -0
  141. package/lib.commonjs/contract/wrappers.d.ts.map +1 -0
  142. package/lib.commonjs/contract/wrappers.js +186 -0
  143. package/lib.commonjs/contract/wrappers.js.map +1 -0
  144. package/lib.commonjs/crypto/crypto-browser.d.ts +15 -0
  145. package/lib.commonjs/crypto/crypto-browser.d.ts.map +1 -0
  146. package/lib.commonjs/crypto/crypto-browser.js +55 -0
  147. package/lib.commonjs/crypto/crypto-browser.js.map +1 -0
  148. package/lib.commonjs/crypto/crypto.d.ts +2 -0
  149. package/lib.commonjs/crypto/crypto.d.ts.map +1 -0
  150. package/lib.commonjs/crypto/crypto.js +9 -0
  151. package/lib.commonjs/crypto/crypto.js.map +1 -0
  152. package/lib.commonjs/crypto/hmac.d.ts +25 -0
  153. package/lib.commonjs/crypto/hmac.d.ts.map +1 -0
  154. package/lib.commonjs/crypto/hmac.js +51 -0
  155. package/lib.commonjs/crypto/hmac.js.map +1 -0
  156. package/lib.commonjs/crypto/index.d.ts +25 -0
  157. package/lib.commonjs/crypto/index.d.ts.map +1 -0
  158. package/lib.commonjs/crypto/index.js +49 -0
  159. package/lib.commonjs/crypto/index.js.map +1 -0
  160. package/lib.commonjs/crypto/keccak.d.ts +35 -0
  161. package/lib.commonjs/crypto/keccak.d.ts.map +1 -0
  162. package/lib.commonjs/crypto/keccak.js +52 -0
  163. package/lib.commonjs/crypto/keccak.js.map +1 -0
  164. package/lib.commonjs/crypto/pbkdf2.d.ts +35 -0
  165. package/lib.commonjs/crypto/pbkdf2.d.ts.map +1 -0
  166. package/lib.commonjs/crypto/pbkdf2.js +53 -0
  167. package/lib.commonjs/crypto/pbkdf2.js.map +1 -0
  168. package/lib.commonjs/crypto/random.d.ts +14 -0
  169. package/lib.commonjs/crypto/random.d.ts.map +1 -0
  170. package/lib.commonjs/crypto/random.js +38 -0
  171. package/lib.commonjs/crypto/random.js.map +1 -0
  172. package/lib.commonjs/crypto/ripemd160.d.ts +25 -0
  173. package/lib.commonjs/crypto/ripemd160.d.ts.map +1 -0
  174. package/lib.commonjs/crypto/ripemd160.js +42 -0
  175. package/lib.commonjs/crypto/ripemd160.js.map +1 -0
  176. package/lib.commonjs/crypto/scrypt.d.ts +82 -0
  177. package/lib.commonjs/crypto/scrypt.d.ts.map +1 -0
  178. package/lib.commonjs/crypto/scrypt.js +104 -0
  179. package/lib.commonjs/crypto/scrypt.js.map +1 -0
  180. package/lib.commonjs/crypto/sha2.d.ts +47 -0
  181. package/lib.commonjs/crypto/sha2.d.ts.map +1 -0
  182. package/lib.commonjs/crypto/sha2.js +76 -0
  183. package/lib.commonjs/crypto/sha2.js.map +1 -0
  184. package/lib.commonjs/crypto/signature.d.ts +158 -0
  185. package/lib.commonjs/crypto/signature.d.ts.map +1 -0
  186. package/lib.commonjs/crypto/signature.js +305 -0
  187. package/lib.commonjs/crypto/signature.js.map +1 -0
  188. package/lib.commonjs/crypto/signing-key.d.ts +122 -0
  189. package/lib.commonjs/crypto/signing-key.d.ts.map +1 -0
  190. package/lib.commonjs/crypto/signing-key.js +178 -0
  191. package/lib.commonjs/crypto/signing-key.js.map +1 -0
  192. package/lib.commonjs/ethers.d.ts +22 -0
  193. package/lib.commonjs/ethers.d.ts.map +1 -0
  194. package/lib.commonjs/ethers.js +209 -0
  195. package/lib.commonjs/ethers.js.map +1 -0
  196. package/lib.commonjs/hash/id.d.ts +13 -0
  197. package/lib.commonjs/hash/id.d.ts.map +1 -0
  198. package/lib.commonjs/hash/id.js +21 -0
  199. package/lib.commonjs/hash/id.js.map +1 -0
  200. package/lib.commonjs/hash/index.d.ts +13 -0
  201. package/lib.commonjs/hash/index.d.ts.map +1 -0
  202. package/lib.commonjs/hash/index.js +27 -0
  203. package/lib.commonjs/hash/index.js.map +1 -0
  204. package/lib.commonjs/hash/message.d.ts +36 -0
  205. package/lib.commonjs/hash/message.d.ts.map +1 -0
  206. package/lib.commonjs/hash/message.js +56 -0
  207. package/lib.commonjs/hash/message.js.map +1 -0
  208. package/lib.commonjs/hash/namehash.d.ts +20 -0
  209. package/lib.commonjs/hash/namehash.d.ts.map +1 -0
  210. package/lib.commonjs/hash/namehash.js +88 -0
  211. package/lib.commonjs/hash/namehash.js.map +1 -0
  212. package/lib.commonjs/hash/solidity.d.ts +31 -0
  213. package/lib.commonjs/hash/solidity.d.ts.map +1 -0
  214. package/lib.commonjs/hash/solidity.js +109 -0
  215. package/lib.commonjs/hash/solidity.js.map +1 -0
  216. package/lib.commonjs/hash/typed-data.d.ts +150 -0
  217. package/lib.commonjs/hash/typed-data.d.ts.map +1 -0
  218. package/lib.commonjs/hash/typed-data.js +493 -0
  219. package/lib.commonjs/hash/typed-data.js.map +1 -0
  220. package/lib.commonjs/index.d.ts +11 -0
  221. package/lib.commonjs/index.d.ts.map +1 -0
  222. package/lib.commonjs/index.js +15 -0
  223. package/lib.commonjs/index.js.map +1 -0
  224. package/lib.commonjs/package.json +12 -0
  225. package/lib.commonjs/providers/abstract-provider.d.ts +449 -0
  226. package/lib.commonjs/providers/abstract-provider.d.ts.map +1 -0
  227. package/lib.commonjs/providers/abstract-provider.js +1382 -0
  228. package/lib.commonjs/providers/abstract-provider.js.map +1 -0
  229. package/lib.commonjs/providers/abstract-signer.d.ts +67 -0
  230. package/lib.commonjs/providers/abstract-signer.d.ts.map +1 -0
  231. package/lib.commonjs/providers/abstract-signer.js +228 -0
  232. package/lib.commonjs/providers/abstract-signer.js.map +1 -0
  233. package/lib.commonjs/providers/community.d.ts +29 -0
  234. package/lib.commonjs/providers/community.d.ts.map +1 -0
  235. package/lib.commonjs/providers/community.js +40 -0
  236. package/lib.commonjs/providers/community.js.map +1 -0
  237. package/lib.commonjs/providers/contracts.d.ts +36 -0
  238. package/lib.commonjs/providers/contracts.d.ts.map +1 -0
  239. package/lib.commonjs/providers/contracts.js +3 -0
  240. package/lib.commonjs/providers/contracts.js.map +1 -0
  241. package/lib.commonjs/providers/default-provider.d.ts +5 -0
  242. package/lib.commonjs/providers/default-provider.d.ts.map +1 -0
  243. package/lib.commonjs/providers/default-provider.js +138 -0
  244. package/lib.commonjs/providers/default-provider.js.map +1 -0
  245. package/lib.commonjs/providers/ens-resolver.d.ts +147 -0
  246. package/lib.commonjs/providers/ens-resolver.d.ts.map +1 -0
  247. package/lib.commonjs/providers/ens-resolver.js +502 -0
  248. package/lib.commonjs/providers/ens-resolver.js.map +1 -0
  249. package/lib.commonjs/providers/format.d.ts +15 -0
  250. package/lib.commonjs/providers/format.d.ts.map +1 -0
  251. package/lib.commonjs/providers/format.js +273 -0
  252. package/lib.commonjs/providers/format.js.map +1 -0
  253. package/lib.commonjs/providers/formatting.d.ts +268 -0
  254. package/lib.commonjs/providers/formatting.d.ts.map +1 -0
  255. package/lib.commonjs/providers/formatting.js +10 -0
  256. package/lib.commonjs/providers/formatting.js.map +1 -0
  257. package/lib.commonjs/providers/index.d.ts +47 -0
  258. package/lib.commonjs/providers/index.d.ts.map +1 -0
  259. package/lib.commonjs/providers/index.js +80 -0
  260. package/lib.commonjs/providers/index.js.map +1 -0
  261. package/lib.commonjs/providers/network.d.ts +99 -0
  262. package/lib.commonjs/providers/network.d.ts.map +1 -0
  263. package/lib.commonjs/providers/network.js +378 -0
  264. package/lib.commonjs/providers/network.js.map +1 -0
  265. package/lib.commonjs/providers/pagination.d.ts +6 -0
  266. package/lib.commonjs/providers/pagination.d.ts.map +1 -0
  267. package/lib.commonjs/providers/pagination.js +3 -0
  268. package/lib.commonjs/providers/pagination.js.map +1 -0
  269. package/lib.commonjs/providers/plugin-fallback.d.ts +13 -0
  270. package/lib.commonjs/providers/plugin-fallback.d.ts.map +1 -0
  271. package/lib.commonjs/providers/plugin-fallback.js +31 -0
  272. package/lib.commonjs/providers/plugin-fallback.js.map +1 -0
  273. package/lib.commonjs/providers/plugins-network.d.ts +170 -0
  274. package/lib.commonjs/providers/plugins-network.d.ts.map +1 -0
  275. package/lib.commonjs/providers/plugins-network.js +216 -0
  276. package/lib.commonjs/providers/plugins-network.js.map +1 -0
  277. package/lib.commonjs/providers/provider-alchemy.d.ts +31 -0
  278. package/lib.commonjs/providers/provider-alchemy.d.ts.map +1 -0
  279. package/lib.commonjs/providers/provider-alchemy.js +120 -0
  280. package/lib.commonjs/providers/provider-alchemy.js.map +1 -0
  281. package/lib.commonjs/providers/provider-ankr.d.ts +51 -0
  282. package/lib.commonjs/providers/provider-ankr.d.ts.map +1 -0
  283. package/lib.commonjs/providers/provider-ankr.js +107 -0
  284. package/lib.commonjs/providers/provider-ankr.js.map +1 -0
  285. package/lib.commonjs/providers/provider-browser.d.ts +56 -0
  286. package/lib.commonjs/providers/provider-browser.d.ts.map +1 -0
  287. package/lib.commonjs/providers/provider-browser.js +102 -0
  288. package/lib.commonjs/providers/provider-browser.js.map +1 -0
  289. package/lib.commonjs/providers/provider-cloudflare.d.ts +14 -0
  290. package/lib.commonjs/providers/provider-cloudflare.d.ts.map +1 -0
  291. package/lib.commonjs/providers/provider-cloudflare.js +26 -0
  292. package/lib.commonjs/providers/provider-cloudflare.js.map +1 -0
  293. package/lib.commonjs/providers/provider-etherscan.d.ts +141 -0
  294. package/lib.commonjs/providers/provider-etherscan.d.ts.map +1 -0
  295. package/lib.commonjs/providers/provider-etherscan.js +522 -0
  296. package/lib.commonjs/providers/provider-etherscan.js.map +1 -0
  297. package/lib.commonjs/providers/provider-fallback.d.ts +115 -0
  298. package/lib.commonjs/providers/provider-fallback.d.ts.map +1 -0
  299. package/lib.commonjs/providers/provider-fallback.js +573 -0
  300. package/lib.commonjs/providers/provider-fallback.js.map +1 -0
  301. package/lib.commonjs/providers/provider-infura.d.ts +90 -0
  302. package/lib.commonjs/providers/provider-infura.d.ts.map +1 -0
  303. package/lib.commonjs/providers/provider-infura.js +176 -0
  304. package/lib.commonjs/providers/provider-infura.js.map +1 -0
  305. package/lib.commonjs/providers/provider-ipcsocket-browser.d.ts +3 -0
  306. package/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map +1 -0
  307. package/lib.commonjs/providers/provider-ipcsocket-browser.js +6 -0
  308. package/lib.commonjs/providers/provider-ipcsocket-browser.js.map +1 -0
  309. package/lib.commonjs/providers/provider-ipcsocket.d.ts +20 -0
  310. package/lib.commonjs/providers/provider-ipcsocket.d.ts.map +1 -0
  311. package/lib.commonjs/providers/provider-ipcsocket.js +69 -0
  312. package/lib.commonjs/providers/provider-ipcsocket.js.map +1 -0
  313. package/lib.commonjs/providers/provider-jsonrpc.d.ts +350 -0
  314. package/lib.commonjs/providers/provider-jsonrpc.d.ts.map +1 -0
  315. package/lib.commonjs/providers/provider-jsonrpc.js +880 -0
  316. package/lib.commonjs/providers/provider-jsonrpc.js.map +1 -0
  317. package/lib.commonjs/providers/provider-pocket.d.ts +54 -0
  318. package/lib.commonjs/providers/provider-pocket.d.ts.map +1 -0
  319. package/lib.commonjs/providers/provider-pocket.js +109 -0
  320. package/lib.commonjs/providers/provider-pocket.js.map +1 -0
  321. package/lib.commonjs/providers/provider-quicknode.d.ts +50 -0
  322. package/lib.commonjs/providers/provider-quicknode.d.ts.map +1 -0
  323. package/lib.commonjs/providers/provider-quicknode.js +109 -0
  324. package/lib.commonjs/providers/provider-quicknode.js.map +1 -0
  325. package/lib.commonjs/providers/provider-socket.d.ts +113 -0
  326. package/lib.commonjs/providers/provider-socket.d.ts.map +1 -0
  327. package/lib.commonjs/providers/provider-socket.js +293 -0
  328. package/lib.commonjs/providers/provider-socket.js.map +1 -0
  329. package/lib.commonjs/providers/provider-websocket.d.ts +36 -0
  330. package/lib.commonjs/providers/provider-websocket.d.ts.map +1 -0
  331. package/lib.commonjs/providers/provider-websocket.js +80 -0
  332. package/lib.commonjs/providers/provider-websocket.js.map +1 -0
  333. package/lib.commonjs/providers/provider.d.ts +1131 -0
  334. package/lib.commonjs/providers/provider.d.ts.map +1 -0
  335. package/lib.commonjs/providers/provider.js +1226 -0
  336. package/lib.commonjs/providers/provider.js.map +1 -0
  337. package/lib.commonjs/providers/signer-noncemanager.d.ts +38 -0
  338. package/lib.commonjs/providers/signer-noncemanager.d.ts.map +1 -0
  339. package/lib.commonjs/providers/signer-noncemanager.js +78 -0
  340. package/lib.commonjs/providers/signer-noncemanager.js.map +1 -0
  341. package/lib.commonjs/providers/signer.d.ts +118 -0
  342. package/lib.commonjs/providers/signer.d.ts.map +1 -0
  343. package/lib.commonjs/providers/signer.js +3 -0
  344. package/lib.commonjs/providers/signer.js.map +1 -0
  345. package/lib.commonjs/providers/subscriber-connection.d.ts +25 -0
  346. package/lib.commonjs/providers/subscriber-connection.d.ts.map +1 -0
  347. package/lib.commonjs/providers/subscriber-connection.js +56 -0
  348. package/lib.commonjs/providers/subscriber-connection.js.map +1 -0
  349. package/lib.commonjs/providers/subscriber-filterid.d.ts +64 -0
  350. package/lib.commonjs/providers/subscriber-filterid.d.ts.map +1 -0
  351. package/lib.commonjs/providers/subscriber-filterid.js +177 -0
  352. package/lib.commonjs/providers/subscriber-filterid.js.map +1 -0
  353. package/lib.commonjs/providers/subscriber-polling.d.ts +94 -0
  354. package/lib.commonjs/providers/subscriber-polling.d.ts.map +1 -0
  355. package/lib.commonjs/providers/subscriber-polling.js +274 -0
  356. package/lib.commonjs/providers/subscriber-polling.js.map +1 -0
  357. package/lib.commonjs/providers/ws-browser.d.ts +3 -0
  358. package/lib.commonjs/providers/ws-browser.d.ts.map +1 -0
  359. package/lib.commonjs/providers/ws-browser.js +19 -0
  360. package/lib.commonjs/providers/ws-browser.js.map +1 -0
  361. package/lib.commonjs/providers/ws.d.ts +2 -0
  362. package/lib.commonjs/providers/ws.d.ts.map +1 -0
  363. package/lib.commonjs/providers/ws.js +6 -0
  364. package/lib.commonjs/providers/ws.js.map +1 -0
  365. package/lib.commonjs/transaction/accesslist.d.ts +6 -0
  366. package/lib.commonjs/transaction/accesslist.d.ts.map +1 -0
  367. package/lib.commonjs/transaction/accesslist.js +41 -0
  368. package/lib.commonjs/transaction/accesslist.js.map +1 -0
  369. package/lib.commonjs/transaction/address.d.ts +15 -0
  370. package/lib.commonjs/transaction/address.d.ts.map +1 -0
  371. package/lib.commonjs/transaction/address.js +30 -0
  372. package/lib.commonjs/transaction/address.js.map +1 -0
  373. package/lib.commonjs/transaction/index.d.ts +25 -0
  374. package/lib.commonjs/transaction/index.d.ts.map +1 -0
  375. package/lib.commonjs/transaction/index.js +17 -0
  376. package/lib.commonjs/transaction/index.js.map +1 -0
  377. package/lib.commonjs/transaction/transaction.d.ts +269 -0
  378. package/lib.commonjs/transaction/transaction.d.ts.map +1 -0
  379. package/lib.commonjs/transaction/transaction.js +708 -0
  380. package/lib.commonjs/transaction/transaction.js.map +1 -0
  381. package/lib.commonjs/utils/base58.d.ts +23 -0
  382. package/lib.commonjs/utils/base58.d.ts.map +1 -0
  383. package/lib.commonjs/utils/base58.js +60 -0
  384. package/lib.commonjs/utils/base58.js.map +1 -0
  385. package/lib.commonjs/utils/base64-browser.d.ts +4 -0
  386. package/lib.commonjs/utils/base64-browser.d.ts.map +1 -0
  387. package/lib.commonjs/utils/base64-browser.js +24 -0
  388. package/lib.commonjs/utils/base64-browser.js.map +1 -0
  389. package/lib.commonjs/utils/base64.d.ts +40 -0
  390. package/lib.commonjs/utils/base64.d.ts.map +1 -0
  391. package/lib.commonjs/utils/base64.js +58 -0
  392. package/lib.commonjs/utils/base64.js.map +1 -0
  393. package/lib.commonjs/utils/data.d.ts +93 -0
  394. package/lib.commonjs/utils/data.d.ts.map +1 -0
  395. package/lib.commonjs/utils/data.js +184 -0
  396. package/lib.commonjs/utils/data.js.map +1 -0
  397. package/lib.commonjs/utils/errors.d.ts +505 -0
  398. package/lib.commonjs/utils/errors.d.ts.map +1 -0
  399. package/lib.commonjs/utils/errors.js +228 -0
  400. package/lib.commonjs/utils/errors.js.map +1 -0
  401. package/lib.commonjs/utils/events.d.ts +77 -0
  402. package/lib.commonjs/utils/events.d.ts.map +1 -0
  403. package/lib.commonjs/utils/events.js +46 -0
  404. package/lib.commonjs/utils/events.js.map +1 -0
  405. package/lib.commonjs/utils/fetch.d.ts +334 -0
  406. package/lib.commonjs/utils/fetch.d.ts.map +1 -0
  407. package/lib.commonjs/utils/fetch.js +804 -0
  408. package/lib.commonjs/utils/fetch.js.map +1 -0
  409. package/lib.commonjs/utils/fixednumber.d.ts +252 -0
  410. package/lib.commonjs/utils/fixednumber.d.ts.map +1 -0
  411. package/lib.commonjs/utils/fixednumber.js +530 -0
  412. package/lib.commonjs/utils/fixednumber.js.map +1 -0
  413. package/lib.commonjs/utils/geturl-browser.d.ts +21 -0
  414. package/lib.commonjs/utils/geturl-browser.d.ts.map +1 -0
  415. package/lib.commonjs/utils/geturl-browser.js +41 -0
  416. package/lib.commonjs/utils/geturl-browser.js.map +1 -0
  417. package/lib.commonjs/utils/geturl.d.ts +6 -0
  418. package/lib.commonjs/utils/geturl.d.ts.map +1 -0
  419. package/lib.commonjs/utils/geturl.js +83 -0
  420. package/lib.commonjs/utils/geturl.js.map +1 -0
  421. package/lib.commonjs/utils/index.d.ts +30 -0
  422. package/lib.commonjs/utils/index.d.ts.map +1 -0
  423. package/lib.commonjs/utils/index.js +78 -0
  424. package/lib.commonjs/utils/index.js.map +1 -0
  425. package/lib.commonjs/utils/maths.d.ts +66 -0
  426. package/lib.commonjs/utils/maths.d.ts.map +1 -0
  427. package/lib.commonjs/utils/maths.js +229 -0
  428. package/lib.commonjs/utils/maths.js.map +1 -0
  429. package/lib.commonjs/utils/properties.d.ts +23 -0
  430. package/lib.commonjs/utils/properties.d.ts.map +1 -0
  431. package/lib.commonjs/utils/properties.js +59 -0
  432. package/lib.commonjs/utils/properties.js.map +1 -0
  433. package/lib.commonjs/utils/rlp-decode.d.ts +6 -0
  434. package/lib.commonjs/utils/rlp-decode.d.ts.map +1 -0
  435. package/lib.commonjs/utils/rlp-decode.js +83 -0
  436. package/lib.commonjs/utils/rlp-decode.js.map +1 -0
  437. package/lib.commonjs/utils/rlp-encode.d.ts +6 -0
  438. package/lib.commonjs/utils/rlp-encode.d.ts.map +1 -0
  439. package/lib.commonjs/utils/rlp-encode.js +53 -0
  440. package/lib.commonjs/utils/rlp-encode.js.map +1 -0
  441. package/lib.commonjs/utils/rlp.d.ts +13 -0
  442. package/lib.commonjs/utils/rlp.d.ts.map +1 -0
  443. package/lib.commonjs/utils/rlp.js +14 -0
  444. package/lib.commonjs/utils/rlp.js.map +1 -0
  445. package/lib.commonjs/utils/units.d.ts +24 -0
  446. package/lib.commonjs/utils/units.d.ts.map +1 -0
  447. package/lib.commonjs/utils/units.js +90 -0
  448. package/lib.commonjs/utils/units.js.map +1 -0
  449. package/lib.commonjs/utils/utf8.d.ts +96 -0
  450. package/lib.commonjs/utils/utf8.d.ts.map +1 -0
  451. package/lib.commonjs/utils/utf8.js +226 -0
  452. package/lib.commonjs/utils/utf8.js.map +1 -0
  453. package/lib.commonjs/utils/uuid.d.ts +8 -0
  454. package/lib.commonjs/utils/uuid.d.ts.map +1 -0
  455. package/lib.commonjs/utils/uuid.js +34 -0
  456. package/lib.commonjs/utils/uuid.js.map +1 -0
  457. package/lib.commonjs/wallet/base-wallet.d.ts +48 -0
  458. package/lib.commonjs/wallet/base-wallet.d.ts.map +1 -0
  459. package/lib.commonjs/wallet/base-wallet.js +105 -0
  460. package/lib.commonjs/wallet/base-wallet.js.map +1 -0
  461. package/lib.commonjs/wallet/hdwallet.d.ts +248 -0
  462. package/lib.commonjs/wallet/hdwallet.d.ts.map +1 -0
  463. package/lib.commonjs/wallet/hdwallet.js +505 -0
  464. package/lib.commonjs/wallet/hdwallet.js.map +1 -0
  465. package/lib.commonjs/wallet/index.d.ts +27 -0
  466. package/lib.commonjs/wallet/index.d.ts.map +1 -0
  467. package/lib.commonjs/wallet/index.js +43 -0
  468. package/lib.commonjs/wallet/index.js.map +1 -0
  469. package/lib.commonjs/wallet/json-crowdsale.d.ts +27 -0
  470. package/lib.commonjs/wallet/json-crowdsale.d.ts.map +1 -0
  471. package/lib.commonjs/wallet/json-crowdsale.js +60 -0
  472. package/lib.commonjs/wallet/json-crowdsale.js.map +1 -0
  473. package/lib.commonjs/wallet/json-keystore.d.ts +89 -0
  474. package/lib.commonjs/wallet/json-keystore.d.ts.map +1 -0
  475. package/lib.commonjs/wallet/json-keystore.js +295 -0
  476. package/lib.commonjs/wallet/json-keystore.js.map +1 -0
  477. package/lib.commonjs/wallet/mnemonic.d.ts +65 -0
  478. package/lib.commonjs/wallet/mnemonic.d.ts.map +1 -0
  479. package/lib.commonjs/wallet/mnemonic.js +169 -0
  480. package/lib.commonjs/wallet/mnemonic.js.map +1 -0
  481. package/lib.commonjs/wallet/utils.d.ts +8 -0
  482. package/lib.commonjs/wallet/utils.d.ts.map +1 -0
  483. package/lib.commonjs/wallet/utils.js +149 -0
  484. package/lib.commonjs/wallet/utils.js.map +1 -0
  485. package/lib.commonjs/wallet/wallet.d.ts +71 -0
  486. package/lib.commonjs/wallet/wallet.d.ts.map +1 -0
  487. package/lib.commonjs/wallet/wallet.js +148 -0
  488. package/lib.commonjs/wallet/wallet.js.map +1 -0
  489. package/lib.commonjs/wordlists/bit-reader.d.ts +5 -0
  490. package/lib.commonjs/wordlists/bit-reader.d.ts.map +1 -0
  491. package/lib.commonjs/wordlists/bit-reader.js +36 -0
  492. package/lib.commonjs/wordlists/bit-reader.js.map +1 -0
  493. package/lib.commonjs/wordlists/decode-owl.d.ts +9 -0
  494. package/lib.commonjs/wordlists/decode-owl.d.ts.map +1 -0
  495. package/lib.commonjs/wordlists/decode-owl.js +60 -0
  496. package/lib.commonjs/wordlists/decode-owl.js.map +1 -0
  497. package/lib.commonjs/wordlists/decode-owla.d.ts +5 -0
  498. package/lib.commonjs/wordlists/decode-owla.d.ts.map +1 -0
  499. package/lib.commonjs/wordlists/decode-owla.js +32 -0
  500. package/lib.commonjs/wordlists/decode-owla.js.map +1 -0
  501. package/lib.commonjs/wordlists/generation/encode-latin.d.ts +25 -0
  502. package/lib.commonjs/wordlists/generation/encode-latin.d.ts.map +1 -0
  503. package/lib.commonjs/wordlists/generation/encode-latin.js +351 -0
  504. package/lib.commonjs/wordlists/generation/encode-latin.js.map +1 -0
  505. package/lib.commonjs/wordlists/index.d.ts +25 -0
  506. package/lib.commonjs/wordlists/index.d.ts.map +1 -0
  507. package/lib.commonjs/wordlists/index.js +33 -0
  508. package/lib.commonjs/wordlists/index.js.map +1 -0
  509. package/lib.commonjs/wordlists/lang-cz.d.ts +23 -0
  510. package/lib.commonjs/wordlists/lang-cz.d.ts.map +1 -0
  511. package/lib.commonjs/wordlists/lang-cz.js +35 -0
  512. package/lib.commonjs/wordlists/lang-cz.js.map +1 -0
  513. package/lib.commonjs/wordlists/lang-en.d.ts +23 -0
  514. package/lib.commonjs/wordlists/lang-en.d.ts.map +1 -0
  515. package/lib.commonjs/wordlists/lang-en.js +35 -0
  516. package/lib.commonjs/wordlists/lang-en.js.map +1 -0
  517. package/lib.commonjs/wordlists/lang-es.d.ts +23 -0
  518. package/lib.commonjs/wordlists/lang-es.d.ts.map +1 -0
  519. package/lib.commonjs/wordlists/lang-es.js +36 -0
  520. package/lib.commonjs/wordlists/lang-es.js.map +1 -0
  521. package/lib.commonjs/wordlists/lang-fr.d.ts +23 -0
  522. package/lib.commonjs/wordlists/lang-fr.d.ts.map +1 -0
  523. package/lib.commonjs/wordlists/lang-fr.js +36 -0
  524. package/lib.commonjs/wordlists/lang-fr.js.map +1 -0
  525. package/lib.commonjs/wordlists/lang-it.d.ts +23 -0
  526. package/lib.commonjs/wordlists/lang-it.d.ts.map +1 -0
  527. package/lib.commonjs/wordlists/lang-it.js +35 -0
  528. package/lib.commonjs/wordlists/lang-it.js.map +1 -0
  529. package/lib.commonjs/wordlists/lang-ja.d.ts +27 -0
  530. package/lib.commonjs/wordlists/lang-ja.d.ts.map +1 -0
  531. package/lib.commonjs/wordlists/lang-ja.js +158 -0
  532. package/lib.commonjs/wordlists/lang-ja.js.map +1 -0
  533. package/lib.commonjs/wordlists/lang-ko.d.ts +25 -0
  534. package/lib.commonjs/wordlists/lang-ko.d.ts.map +1 -0
  535. package/lib.commonjs/wordlists/lang-ko.js +93 -0
  536. package/lib.commonjs/wordlists/lang-ko.js.map +1 -0
  537. package/lib.commonjs/wordlists/lang-pt.d.ts +23 -0
  538. package/lib.commonjs/wordlists/lang-pt.d.ts.map +1 -0
  539. package/lib.commonjs/wordlists/lang-pt.js +35 -0
  540. package/lib.commonjs/wordlists/lang-pt.js.map +1 -0
  541. package/lib.commonjs/wordlists/lang-zh.d.ts +32 -0
  542. package/lib.commonjs/wordlists/lang-zh.d.ts.map +1 -0
  543. package/lib.commonjs/wordlists/lang-zh.js +96 -0
  544. package/lib.commonjs/wordlists/lang-zh.js.map +1 -0
  545. package/lib.commonjs/wordlists/wordlist-owl.d.ts +32 -0
  546. package/lib.commonjs/wordlists/wordlist-owl.d.ts.map +1 -0
  547. package/lib.commonjs/wordlists/wordlist-owl.js +70 -0
  548. package/lib.commonjs/wordlists/wordlist-owl.js.map +1 -0
  549. package/lib.commonjs/wordlists/wordlist-owla.d.ts +30 -0
  550. package/lib.commonjs/wordlists/wordlist-owla.d.ts.map +1 -0
  551. package/lib.commonjs/wordlists/wordlist-owla.js +40 -0
  552. package/lib.commonjs/wordlists/wordlist-owla.js.map +1 -0
  553. package/lib.commonjs/wordlists/wordlist.d.ts +47 -0
  554. package/lib.commonjs/wordlists/wordlist.d.ts.map +1 -0
  555. package/lib.commonjs/wordlists/wordlist.js +46 -0
  556. package/lib.commonjs/wordlists/wordlist.js.map +1 -0
  557. package/lib.commonjs/wordlists/wordlists-browser.d.ts +3 -0
  558. package/lib.commonjs/wordlists/wordlists-browser.d.ts.map +1 -0
  559. package/lib.commonjs/wordlists/wordlists-browser.js +8 -0
  560. package/lib.commonjs/wordlists/wordlists-browser.js.map +1 -0
  561. package/lib.commonjs/wordlists/wordlists-extra.d.ts +9 -0
  562. package/lib.commonjs/wordlists/wordlists-extra.d.ts.map +1 -0
  563. package/lib.commonjs/wordlists/wordlists-extra.js +20 -0
  564. package/lib.commonjs/wordlists/wordlists-extra.js.map +1 -0
  565. package/lib.commonjs/wordlists/wordlists.d.ts +16 -0
  566. package/lib.commonjs/wordlists/wordlists.d.ts.map +1 -0
  567. package/lib.commonjs/wordlists/wordlists.js +38 -0
  568. package/lib.commonjs/wordlists/wordlists.js.map +1 -0
  569. package/lib.esm/README.md +16 -0
  570. package/lib.esm/_version.d.ts +5 -0
  571. package/lib.esm/_version.d.ts.map +1 -0
  572. package/lib.esm/_version.js +6 -0
  573. package/lib.esm/_version.js.map +1 -0
  574. package/lib.esm/abi/abi-coder.d.ts +60 -0
  575. package/lib.esm/abi/abi-coder.d.ts.map +1 -0
  576. package/lib.esm/abi/abi-coder.js +201 -0
  577. package/lib.esm/abi/abi-coder.js.map +1 -0
  578. package/lib.esm/abi/bytes32.d.ts +15 -0
  579. package/lib.esm/abi/bytes32.d.ts.map +1 -0
  580. package/lib.esm/abi/bytes32.js +40 -0
  581. package/lib.esm/abi/bytes32.js.map +1 -0
  582. package/lib.esm/abi/coders/abstract-coder.d.ts +121 -0
  583. package/lib.esm/abi/coders/abstract-coder.d.ts.map +1 -0
  584. package/lib.esm/abi/coders/abstract-coder.js +399 -0
  585. package/lib.esm/abi/coders/abstract-coder.js.map +1 -0
  586. package/lib.esm/abi/coders/address.d.ts +13 -0
  587. package/lib.esm/abi/coders/address.d.ts.map +1 -0
  588. package/lib.esm/abi/coders/address.js +29 -0
  589. package/lib.esm/abi/coders/address.js.map +1 -0
  590. package/lib.esm/abi/coders/anonymous.d.ts +15 -0
  591. package/lib.esm/abi/coders/anonymous.d.ts.map +1 -0
  592. package/lib.esm/abi/coders/anonymous.js +23 -0
  593. package/lib.esm/abi/coders/anonymous.js.map +1 -0
  594. package/lib.esm/abi/coders/array.d.ts +25 -0
  595. package/lib.esm/abi/coders/array.d.ts.map +1 -0
  596. package/lib.esm/abi/coders/array.js +159 -0
  597. package/lib.esm/abi/coders/array.js.map +1 -0
  598. package/lib.esm/abi/coders/boolean.d.ts +13 -0
  599. package/lib.esm/abi/coders/boolean.d.ts.map +1 -0
  600. package/lib.esm/abi/coders/boolean.js +21 -0
  601. package/lib.esm/abi/coders/boolean.js.map +1 -0
  602. package/lib.esm/abi/coders/bytes.d.ts +19 -0
  603. package/lib.esm/abi/coders/bytes.d.ts.map +1 -0
  604. package/lib.esm/abi/coders/bytes.js +34 -0
  605. package/lib.esm/abi/coders/bytes.js.map +1 -0
  606. package/lib.esm/abi/coders/fixed-bytes.d.ts +15 -0
  607. package/lib.esm/abi/coders/fixed-bytes.d.ts.map +1 -0
  608. package/lib.esm/abi/coders/fixed-bytes.js +28 -0
  609. package/lib.esm/abi/coders/fixed-bytes.js.map +1 -0
  610. package/lib.esm/abi/coders/null.d.ts +12 -0
  611. package/lib.esm/abi/coders/null.d.ts.map +1 -0
  612. package/lib.esm/abi/coders/null.js +24 -0
  613. package/lib.esm/abi/coders/null.js.map +1 -0
  614. package/lib.esm/abi/coders/number.d.ts +16 -0
  615. package/lib.esm/abi/coders/number.d.ts.map +1 -0
  616. package/lib.esm/abi/coders/number.js +45 -0
  617. package/lib.esm/abi/coders/number.js.map +1 -0
  618. package/lib.esm/abi/coders/string.d.ts +13 -0
  619. package/lib.esm/abi/coders/string.d.ts.map +1 -0
  620. package/lib.esm/abi/coders/string.js +21 -0
  621. package/lib.esm/abi/coders/string.js.map +1 -0
  622. package/lib.esm/abi/coders/tuple.d.ts +16 -0
  623. package/lib.esm/abi/coders/tuple.d.ts.map +1 -0
  624. package/lib.esm/abi/coders/tuple.js +63 -0
  625. package/lib.esm/abi/coders/tuple.js.map +1 -0
  626. package/lib.esm/abi/fragments.d.ts +466 -0
  627. package/lib.esm/abi/fragments.d.ts.map +1 -0
  628. package/lib.esm/abi/fragments.js +1319 -0
  629. package/lib.esm/abi/fragments.js.map +1 -0
  630. package/lib.esm/abi/index.d.ts +18 -0
  631. package/lib.esm/abi/index.d.ts.map +1 -0
  632. package/lib.esm/abi/index.js +17 -0
  633. package/lib.esm/abi/index.js.map +1 -0
  634. package/lib.esm/abi/interface.d.ts +382 -0
  635. package/lib.esm/abi/interface.d.ts.map +1 -0
  636. package/lib.esm/abi/interface.js +1097 -0
  637. package/lib.esm/abi/interface.js.map +1 -0
  638. package/lib.esm/abi/typed.d.ts +570 -0
  639. package/lib.esm/abi/typed.d.ts.map +1 -0
  640. package/lib.esm/abi/typed.js +602 -0
  641. package/lib.esm/abi/typed.js.map +1 -0
  642. package/lib.esm/address/address.d.ts +56 -0
  643. package/lib.esm/address/address.d.ts.map +1 -0
  644. package/lib.esm/address/address.js +156 -0
  645. package/lib.esm/address/address.js.map +1 -0
  646. package/lib.esm/address/checks.d.ts +81 -0
  647. package/lib.esm/address/checks.d.ts.map +1 -0
  648. package/lib.esm/address/checks.js +114 -0
  649. package/lib.esm/address/checks.js.map +1 -0
  650. package/lib.esm/address/contract-address.d.ts +48 -0
  651. package/lib.esm/address/contract-address.d.ts.map +1 -0
  652. package/lib.esm/address/contract-address.js +69 -0
  653. package/lib.esm/address/contract-address.js.map +1 -0
  654. package/lib.esm/address/index.d.ts +49 -0
  655. package/lib.esm/address/index.d.ts.map +1 -0
  656. package/lib.esm/address/index.js +19 -0
  657. package/lib.esm/address/index.js.map +1 -0
  658. package/lib.esm/constants/addresses.d.ts +7 -0
  659. package/lib.esm/constants/addresses.d.ts.map +1 -0
  660. package/lib.esm/constants/addresses.js +7 -0
  661. package/lib.esm/constants/addresses.js.map +1 -0
  662. package/lib.esm/constants/hashes.d.ts +7 -0
  663. package/lib.esm/constants/hashes.d.ts.map +1 -0
  664. package/lib.esm/constants/hashes.js +7 -0
  665. package/lib.esm/constants/hashes.js.map +1 -0
  666. package/lib.esm/constants/index.d.ts +10 -0
  667. package/lib.esm/constants/index.d.ts.map +1 -0
  668. package/lib.esm/constants/index.js +10 -0
  669. package/lib.esm/constants/index.js.map +1 -0
  670. package/lib.esm/constants/numbers.d.ts +31 -0
  671. package/lib.esm/constants/numbers.d.ts.map +1 -0
  672. package/lib.esm/constants/numbers.js +31 -0
  673. package/lib.esm/constants/numbers.js.map +1 -0
  674. package/lib.esm/constants/strings.d.ts +13 -0
  675. package/lib.esm/constants/strings.d.ts.map +1 -0
  676. package/lib.esm/constants/strings.js +14 -0
  677. package/lib.esm/constants/strings.js.map +1 -0
  678. package/lib.esm/contract/contract.d.ts +168 -0
  679. package/lib.esm/contract/contract.d.ts.map +1 -0
  680. package/lib.esm/contract/contract.js +936 -0
  681. package/lib.esm/contract/contract.js.map +1 -0
  682. package/lib.esm/contract/factory.d.ts +62 -0
  683. package/lib.esm/contract/factory.d.ts.map +1 -0
  684. package/lib.esm/contract/factory.js +112 -0
  685. package/lib.esm/contract/factory.js.map +1 -0
  686. package/lib.esm/contract/index.d.ts +13 -0
  687. package/lib.esm/contract/index.d.ts.map +1 -0
  688. package/lib.esm/contract/index.js +12 -0
  689. package/lib.esm/contract/index.js.map +1 -0
  690. package/lib.esm/contract/types.d.ts +193 -0
  691. package/lib.esm/contract/types.d.ts.map +1 -0
  692. package/lib.esm/contract/types.js +5 -0
  693. package/lib.esm/contract/types.js.map +1 -0
  694. package/lib.esm/contract/wrappers.d.ts +143 -0
  695. package/lib.esm/contract/wrappers.d.ts.map +1 -0
  696. package/lib.esm/contract/wrappers.js +177 -0
  697. package/lib.esm/contract/wrappers.js.map +1 -0
  698. package/lib.esm/crypto/crypto-browser.d.ts +15 -0
  699. package/lib.esm/crypto/crypto-browser.d.ts.map +1 -0
  700. package/lib.esm/crypto/crypto-browser.js +48 -0
  701. package/lib.esm/crypto/crypto-browser.js.map +1 -0
  702. package/lib.esm/crypto/crypto.d.ts +2 -0
  703. package/lib.esm/crypto/crypto.d.ts.map +1 -0
  704. package/lib.esm/crypto/crypto.js +2 -0
  705. package/lib.esm/crypto/crypto.js.map +1 -0
  706. package/lib.esm/crypto/hmac.d.ts +25 -0
  707. package/lib.esm/crypto/hmac.d.ts.map +1 -0
  708. package/lib.esm/crypto/hmac.js +47 -0
  709. package/lib.esm/crypto/hmac.js.map +1 -0
  710. package/lib.esm/crypto/index.d.ts +25 -0
  711. package/lib.esm/crypto/index.d.ts.map +1 -0
  712. package/lib.esm/crypto/index.js +36 -0
  713. package/lib.esm/crypto/index.js.map +1 -0
  714. package/lib.esm/crypto/keccak.d.ts +35 -0
  715. package/lib.esm/crypto/keccak.d.ts.map +1 -0
  716. package/lib.esm/crypto/keccak.js +48 -0
  717. package/lib.esm/crypto/keccak.js.map +1 -0
  718. package/lib.esm/crypto/pbkdf2.d.ts +35 -0
  719. package/lib.esm/crypto/pbkdf2.d.ts.map +1 -0
  720. package/lib.esm/crypto/pbkdf2.js +49 -0
  721. package/lib.esm/crypto/pbkdf2.js.map +1 -0
  722. package/lib.esm/crypto/random.d.ts +14 -0
  723. package/lib.esm/crypto/random.d.ts.map +1 -0
  724. package/lib.esm/crypto/random.js +34 -0
  725. package/lib.esm/crypto/random.js.map +1 -0
  726. package/lib.esm/crypto/ripemd160.d.ts +25 -0
  727. package/lib.esm/crypto/ripemd160.d.ts.map +1 -0
  728. package/lib.esm/crypto/ripemd160.js +38 -0
  729. package/lib.esm/crypto/ripemd160.js.map +1 -0
  730. package/lib.esm/crypto/scrypt.d.ts +82 -0
  731. package/lib.esm/crypto/scrypt.d.ts.map +1 -0
  732. package/lib.esm/crypto/scrypt.js +99 -0
  733. package/lib.esm/crypto/scrypt.js.map +1 -0
  734. package/lib.esm/crypto/sha2.d.ts +47 -0
  735. package/lib.esm/crypto/sha2.d.ts.map +1 -0
  736. package/lib.esm/crypto/sha2.js +71 -0
  737. package/lib.esm/crypto/sha2.js.map +1 -0
  738. package/lib.esm/crypto/signature.d.ts +158 -0
  739. package/lib.esm/crypto/signature.d.ts.map +1 -0
  740. package/lib.esm/crypto/signature.js +301 -0
  741. package/lib.esm/crypto/signature.js.map +1 -0
  742. package/lib.esm/crypto/signing-key.d.ts +122 -0
  743. package/lib.esm/crypto/signing-key.d.ts.map +1 -0
  744. package/lib.esm/crypto/signing-key.js +173 -0
  745. package/lib.esm/crypto/signing-key.js.map +1 -0
  746. package/lib.esm/ethers.d.ts +22 -0
  747. package/lib.esm/ethers.d.ts.map +1 -0
  748. package/lib.esm/ethers.js +15 -0
  749. package/lib.esm/ethers.js.map +1 -0
  750. package/lib.esm/hash/id.d.ts +13 -0
  751. package/lib.esm/hash/id.d.ts.map +1 -0
  752. package/lib.esm/hash/id.js +17 -0
  753. package/lib.esm/hash/id.js.map +1 -0
  754. package/lib.esm/hash/index.d.ts +13 -0
  755. package/lib.esm/hash/index.d.ts.map +1 -0
  756. package/lib.esm/hash/index.js +12 -0
  757. package/lib.esm/hash/index.js.map +1 -0
  758. package/lib.esm/hash/message.d.ts +36 -0
  759. package/lib.esm/hash/message.d.ts.map +1 -0
  760. package/lib.esm/hash/message.js +51 -0
  761. package/lib.esm/hash/message.js.map +1 -0
  762. package/lib.esm/hash/namehash.d.ts +20 -0
  763. package/lib.esm/hash/namehash.d.ts.map +1 -0
  764. package/lib.esm/hash/namehash.js +81 -0
  765. package/lib.esm/hash/namehash.js.map +1 -0
  766. package/lib.esm/hash/solidity.d.ts +31 -0
  767. package/lib.esm/hash/solidity.d.ts.map +1 -0
  768. package/lib.esm/hash/solidity.js +103 -0
  769. package/lib.esm/hash/solidity.js.map +1 -0
  770. package/lib.esm/hash/typed-data.d.ts +150 -0
  771. package/lib.esm/hash/typed-data.d.ts.map +1 -0
  772. package/lib.esm/hash/typed-data.js +488 -0
  773. package/lib.esm/hash/typed-data.js.map +1 -0
  774. package/lib.esm/index.d.ts +11 -0
  775. package/lib.esm/index.d.ts.map +1 -0
  776. package/lib.esm/index.js +11 -0
  777. package/lib.esm/index.js.map +1 -0
  778. package/lib.esm/package.json +12 -0
  779. package/lib.esm/providers/abstract-provider.d.ts +449 -0
  780. package/lib.esm/providers/abstract-provider.d.ts.map +1 -0
  781. package/lib.esm/providers/abstract-provider.js +1377 -0
  782. package/lib.esm/providers/abstract-provider.js.map +1 -0
  783. package/lib.esm/providers/abstract-signer.d.ts +67 -0
  784. package/lib.esm/providers/abstract-signer.d.ts.map +1 -0
  785. package/lib.esm/providers/abstract-signer.js +223 -0
  786. package/lib.esm/providers/abstract-signer.js.map +1 -0
  787. package/lib.esm/providers/community.d.ts +29 -0
  788. package/lib.esm/providers/community.d.ts.map +1 -0
  789. package/lib.esm/providers/community.js +36 -0
  790. package/lib.esm/providers/community.js.map +1 -0
  791. package/lib.esm/providers/contracts.d.ts +36 -0
  792. package/lib.esm/providers/contracts.d.ts.map +1 -0
  793. package/lib.esm/providers/contracts.js +2 -0
  794. package/lib.esm/providers/contracts.js.map +1 -0
  795. package/lib.esm/providers/default-provider.d.ts +5 -0
  796. package/lib.esm/providers/default-provider.d.ts.map +1 -0
  797. package/lib.esm/providers/default-provider.js +134 -0
  798. package/lib.esm/providers/default-provider.js.map +1 -0
  799. package/lib.esm/providers/ens-resolver.d.ts +147 -0
  800. package/lib.esm/providers/ens-resolver.d.ts.map +1 -0
  801. package/lib.esm/providers/ens-resolver.js +496 -0
  802. package/lib.esm/providers/ens-resolver.js.map +1 -0
  803. package/lib.esm/providers/format.d.ts +15 -0
  804. package/lib.esm/providers/format.d.ts.map +1 -0
  805. package/lib.esm/providers/format.js +258 -0
  806. package/lib.esm/providers/format.js.map +1 -0
  807. package/lib.esm/providers/formatting.d.ts +268 -0
  808. package/lib.esm/providers/formatting.d.ts.map +1 -0
  809. package/lib.esm/providers/formatting.js +9 -0
  810. package/lib.esm/providers/formatting.js.map +1 -0
  811. package/lib.esm/providers/index.d.ts +47 -0
  812. package/lib.esm/providers/index.d.ts.map +1 -0
  813. package/lib.esm/providers/index.js +38 -0
  814. package/lib.esm/providers/index.js.map +1 -0
  815. package/lib.esm/providers/network.d.ts +99 -0
  816. package/lib.esm/providers/network.d.ts.map +1 -0
  817. package/lib.esm/providers/network.js +374 -0
  818. package/lib.esm/providers/network.js.map +1 -0
  819. package/lib.esm/providers/pagination.d.ts +6 -0
  820. package/lib.esm/providers/pagination.d.ts.map +1 -0
  821. package/lib.esm/providers/pagination.js +2 -0
  822. package/lib.esm/providers/pagination.js.map +1 -0
  823. package/lib.esm/providers/plugin-fallback.d.ts +13 -0
  824. package/lib.esm/providers/plugin-fallback.d.ts.map +1 -0
  825. package/lib.esm/providers/plugin-fallback.js +26 -0
  826. package/lib.esm/providers/plugin-fallback.js.map +1 -0
  827. package/lib.esm/providers/plugins-network.d.ts +170 -0
  828. package/lib.esm/providers/plugins-network.d.ts.map +1 -0
  829. package/lib.esm/providers/plugins-network.js +208 -0
  830. package/lib.esm/providers/plugins-network.js.map +1 -0
  831. package/lib.esm/providers/provider-alchemy.d.ts +31 -0
  832. package/lib.esm/providers/provider-alchemy.d.ts.map +1 -0
  833. package/lib.esm/providers/provider-alchemy.js +116 -0
  834. package/lib.esm/providers/provider-alchemy.js.map +1 -0
  835. package/lib.esm/providers/provider-ankr.d.ts +51 -0
  836. package/lib.esm/providers/provider-ankr.d.ts.map +1 -0
  837. package/lib.esm/providers/provider-ankr.js +103 -0
  838. package/lib.esm/providers/provider-ankr.js.map +1 -0
  839. package/lib.esm/providers/provider-browser.d.ts +56 -0
  840. package/lib.esm/providers/provider-browser.d.ts.map +1 -0
  841. package/lib.esm/providers/provider-browser.js +98 -0
  842. package/lib.esm/providers/provider-browser.js.map +1 -0
  843. package/lib.esm/providers/provider-cloudflare.d.ts +14 -0
  844. package/lib.esm/providers/provider-cloudflare.d.ts.map +1 -0
  845. package/lib.esm/providers/provider-cloudflare.js +22 -0
  846. package/lib.esm/providers/provider-cloudflare.js.map +1 -0
  847. package/lib.esm/providers/provider-etherscan.d.ts +141 -0
  848. package/lib.esm/providers/provider-etherscan.d.ts.map +1 -0
  849. package/lib.esm/providers/provider-etherscan.js +517 -0
  850. package/lib.esm/providers/provider-etherscan.js.map +1 -0
  851. package/lib.esm/providers/provider-fallback.d.ts +115 -0
  852. package/lib.esm/providers/provider-fallback.d.ts.map +1 -0
  853. package/lib.esm/providers/provider-fallback.js +569 -0
  854. package/lib.esm/providers/provider-fallback.js.map +1 -0
  855. package/lib.esm/providers/provider-infura.d.ts +90 -0
  856. package/lib.esm/providers/provider-infura.d.ts.map +1 -0
  857. package/lib.esm/providers/provider-infura.js +171 -0
  858. package/lib.esm/providers/provider-infura.js.map +1 -0
  859. package/lib.esm/providers/provider-ipcsocket-browser.d.ts +3 -0
  860. package/lib.esm/providers/provider-ipcsocket-browser.d.ts.map +1 -0
  861. package/lib.esm/providers/provider-ipcsocket-browser.js +3 -0
  862. package/lib.esm/providers/provider-ipcsocket-browser.js.map +1 -0
  863. package/lib.esm/providers/provider-ipcsocket.d.ts +20 -0
  864. package/lib.esm/providers/provider-ipcsocket.d.ts.map +1 -0
  865. package/lib.esm/providers/provider-ipcsocket.js +65 -0
  866. package/lib.esm/providers/provider-ipcsocket.js.map +1 -0
  867. package/lib.esm/providers/provider-jsonrpc.d.ts +350 -0
  868. package/lib.esm/providers/provider-jsonrpc.d.ts.map +1 -0
  869. package/lib.esm/providers/provider-jsonrpc.js +873 -0
  870. package/lib.esm/providers/provider-jsonrpc.js.map +1 -0
  871. package/lib.esm/providers/provider-pocket.d.ts +54 -0
  872. package/lib.esm/providers/provider-pocket.d.ts.map +1 -0
  873. package/lib.esm/providers/provider-pocket.js +105 -0
  874. package/lib.esm/providers/provider-pocket.js.map +1 -0
  875. package/lib.esm/providers/provider-quicknode.d.ts +50 -0
  876. package/lib.esm/providers/provider-quicknode.d.ts.map +1 -0
  877. package/lib.esm/providers/provider-quicknode.js +105 -0
  878. package/lib.esm/providers/provider-quicknode.js.map +1 -0
  879. package/lib.esm/providers/provider-socket.d.ts +113 -0
  880. package/lib.esm/providers/provider-socket.d.ts.map +1 -0
  881. package/lib.esm/providers/provider-socket.js +285 -0
  882. package/lib.esm/providers/provider-socket.js.map +1 -0
  883. package/lib.esm/providers/provider-websocket.d.ts +36 -0
  884. package/lib.esm/providers/provider-websocket.d.ts.map +1 -0
  885. package/lib.esm/providers/provider-websocket.js +76 -0
  886. package/lib.esm/providers/provider-websocket.js.map +1 -0
  887. package/lib.esm/providers/provider.d.ts +1131 -0
  888. package/lib.esm/providers/provider.d.ts.map +1 -0
  889. package/lib.esm/providers/provider.js +1217 -0
  890. package/lib.esm/providers/provider.js.map +1 -0
  891. package/lib.esm/providers/signer-noncemanager.d.ts +38 -0
  892. package/lib.esm/providers/signer-noncemanager.d.ts.map +1 -0
  893. package/lib.esm/providers/signer-noncemanager.js +74 -0
  894. package/lib.esm/providers/signer-noncemanager.js.map +1 -0
  895. package/lib.esm/providers/signer.d.ts +118 -0
  896. package/lib.esm/providers/signer.d.ts.map +1 -0
  897. package/lib.esm/providers/signer.js +2 -0
  898. package/lib.esm/providers/signer.js.map +1 -0
  899. package/lib.esm/providers/subscriber-connection.d.ts +25 -0
  900. package/lib.esm/providers/subscriber-connection.d.ts.map +1 -0
  901. package/lib.esm/providers/subscriber-connection.js +52 -0
  902. package/lib.esm/providers/subscriber-connection.js.map +1 -0
  903. package/lib.esm/providers/subscriber-filterid.d.ts +64 -0
  904. package/lib.esm/providers/subscriber-filterid.d.ts.map +1 -0
  905. package/lib.esm/providers/subscriber-filterid.js +171 -0
  906. package/lib.esm/providers/subscriber-filterid.js.map +1 -0
  907. package/lib.esm/providers/subscriber-polling.d.ts +94 -0
  908. package/lib.esm/providers/subscriber-polling.d.ts.map +1 -0
  909. package/lib.esm/providers/subscriber-polling.js +265 -0
  910. package/lib.esm/providers/subscriber-polling.js.map +1 -0
  911. package/lib.esm/providers/ws-browser.d.ts +3 -0
  912. package/lib.esm/providers/ws-browser.d.ts.map +1 -0
  913. package/lib.esm/providers/ws-browser.js +16 -0
  914. package/lib.esm/providers/ws-browser.js.map +1 -0
  915. package/lib.esm/providers/ws.d.ts +2 -0
  916. package/lib.esm/providers/ws.d.ts.map +1 -0
  917. package/lib.esm/providers/ws.js +2 -0
  918. package/lib.esm/providers/ws.js.map +1 -0
  919. package/lib.esm/transaction/accesslist.d.ts +6 -0
  920. package/lib.esm/transaction/accesslist.d.ts.map +1 -0
  921. package/lib.esm/transaction/accesslist.js +37 -0
  922. package/lib.esm/transaction/accesslist.js.map +1 -0
  923. package/lib.esm/transaction/address.d.ts +15 -0
  924. package/lib.esm/transaction/address.d.ts.map +1 -0
  925. package/lib.esm/transaction/address.js +25 -0
  926. package/lib.esm/transaction/address.js.map +1 -0
  927. package/lib.esm/transaction/index.d.ts +25 -0
  928. package/lib.esm/transaction/index.d.ts.map +1 -0
  929. package/lib.esm/transaction/index.js +10 -0
  930. package/lib.esm/transaction/index.js.map +1 -0
  931. package/lib.esm/transaction/transaction.d.ts +269 -0
  932. package/lib.esm/transaction/transaction.d.ts.map +1 -0
  933. package/lib.esm/transaction/transaction.js +704 -0
  934. package/lib.esm/transaction/transaction.js.map +1 -0
  935. package/lib.esm/utils/base58.d.ts +23 -0
  936. package/lib.esm/utils/base58.d.ts.map +1 -0
  937. package/lib.esm/utils/base58.js +55 -0
  938. package/lib.esm/utils/base58.js.map +1 -0
  939. package/lib.esm/utils/base64-browser.d.ts +4 -0
  940. package/lib.esm/utils/base64-browser.d.ts.map +1 -0
  941. package/lib.esm/utils/base64-browser.js +19 -0
  942. package/lib.esm/utils/base64-browser.js.map +1 -0
  943. package/lib.esm/utils/base64.d.ts +40 -0
  944. package/lib.esm/utils/base64.d.ts.map +1 -0
  945. package/lib.esm/utils/base64.js +53 -0
  946. package/lib.esm/utils/base64.js.map +1 -0
  947. package/lib.esm/utils/data.d.ts +93 -0
  948. package/lib.esm/utils/data.d.ts.map +1 -0
  949. package/lib.esm/utils/data.js +170 -0
  950. package/lib.esm/utils/data.js.map +1 -0
  951. package/lib.esm/utils/errors.d.ts +505 -0
  952. package/lib.esm/utils/errors.d.ts.map +1 -0
  953. package/lib.esm/utils/errors.js +217 -0
  954. package/lib.esm/utils/errors.js.map +1 -0
  955. package/lib.esm/utils/events.d.ts +77 -0
  956. package/lib.esm/utils/events.d.ts.map +1 -0
  957. package/lib.esm/utils/events.js +42 -0
  958. package/lib.esm/utils/events.js.map +1 -0
  959. package/lib.esm/utils/fetch.d.ts +334 -0
  960. package/lib.esm/utils/fetch.d.ts.map +1 -0
  961. package/lib.esm/utils/fetch.js +798 -0
  962. package/lib.esm/utils/fetch.js.map +1 -0
  963. package/lib.esm/utils/fixednumber.d.ts +252 -0
  964. package/lib.esm/utils/fixednumber.d.ts.map +1 -0
  965. package/lib.esm/utils/fixednumber.js +526 -0
  966. package/lib.esm/utils/fixednumber.js.map +1 -0
  967. package/lib.esm/utils/geturl-browser.d.ts +21 -0
  968. package/lib.esm/utils/geturl-browser.d.ts.map +1 -0
  969. package/lib.esm/utils/geturl-browser.js +37 -0
  970. package/lib.esm/utils/geturl-browser.js.map +1 -0
  971. package/lib.esm/utils/geturl.d.ts +6 -0
  972. package/lib.esm/utils/geturl.d.ts.map +1 -0
  973. package/lib.esm/utils/geturl.js +78 -0
  974. package/lib.esm/utils/geturl.js.map +1 -0
  975. package/lib.esm/utils/index.d.ts +30 -0
  976. package/lib.esm/utils/index.d.ts.map +1 -0
  977. package/lib.esm/utils/index.js +22 -0
  978. package/lib.esm/utils/index.js.map +1 -0
  979. package/lib.esm/utils/maths.d.ts +66 -0
  980. package/lib.esm/utils/maths.d.ts.map +1 -0
  981. package/lib.esm/utils/maths.js +215 -0
  982. package/lib.esm/utils/maths.js.map +1 -0
  983. package/lib.esm/utils/properties.d.ts +23 -0
  984. package/lib.esm/utils/properties.d.ts.map +1 -0
  985. package/lib.esm/utils/properties.js +54 -0
  986. package/lib.esm/utils/properties.js.map +1 -0
  987. package/lib.esm/utils/rlp-decode.d.ts +6 -0
  988. package/lib.esm/utils/rlp-decode.d.ts.map +1 -0
  989. package/lib.esm/utils/rlp-decode.js +79 -0
  990. package/lib.esm/utils/rlp-decode.js.map +1 -0
  991. package/lib.esm/utils/rlp-encode.d.ts +6 -0
  992. package/lib.esm/utils/rlp-encode.d.ts.map +1 -0
  993. package/lib.esm/utils/rlp-encode.js +49 -0
  994. package/lib.esm/utils/rlp-encode.js.map +1 -0
  995. package/lib.esm/utils/rlp.d.ts +13 -0
  996. package/lib.esm/utils/rlp.d.ts.map +1 -0
  997. package/lib.esm/utils/rlp.js +9 -0
  998. package/lib.esm/utils/rlp.js.map +1 -0
  999. package/lib.esm/utils/units.d.ts +24 -0
  1000. package/lib.esm/utils/units.d.ts.map +1 -0
  1001. package/lib.esm/utils/units.js +83 -0
  1002. package/lib.esm/utils/units.js.map +1 -0
  1003. package/lib.esm/utils/utf8.d.ts +96 -0
  1004. package/lib.esm/utils/utf8.d.ts.map +1 -0
  1005. package/lib.esm/utils/utf8.js +220 -0
  1006. package/lib.esm/utils/utf8.js.map +1 -0
  1007. package/lib.esm/utils/uuid.d.ts +8 -0
  1008. package/lib.esm/utils/uuid.d.ts.map +1 -0
  1009. package/lib.esm/utils/uuid.js +30 -0
  1010. package/lib.esm/utils/uuid.js.map +1 -0
  1011. package/lib.esm/wallet/base-wallet.d.ts +48 -0
  1012. package/lib.esm/wallet/base-wallet.d.ts.map +1 -0
  1013. package/lib.esm/wallet/base-wallet.js +101 -0
  1014. package/lib.esm/wallet/base-wallet.js.map +1 -0
  1015. package/lib.esm/wallet/hdwallet.d.ts +248 -0
  1016. package/lib.esm/wallet/hdwallet.d.ts.map +1 -0
  1017. package/lib.esm/wallet/hdwallet.js +498 -0
  1018. package/lib.esm/wallet/hdwallet.js.map +1 -0
  1019. package/lib.esm/wallet/index.d.ts +27 -0
  1020. package/lib.esm/wallet/index.d.ts.map +1 -0
  1021. package/lib.esm/wallet/index.js +25 -0
  1022. package/lib.esm/wallet/index.js.map +1 -0
  1023. package/lib.esm/wallet/json-crowdsale.d.ts +27 -0
  1024. package/lib.esm/wallet/json-crowdsale.d.ts.map +1 -0
  1025. package/lib.esm/wallet/json-crowdsale.js +55 -0
  1026. package/lib.esm/wallet/json-crowdsale.js.map +1 -0
  1027. package/lib.esm/wallet/json-keystore.d.ts +89 -0
  1028. package/lib.esm/wallet/json-keystore.d.ts.map +1 -0
  1029. package/lib.esm/wallet/json-keystore.js +287 -0
  1030. package/lib.esm/wallet/json-keystore.js.map +1 -0
  1031. package/lib.esm/wallet/mnemonic.d.ts +65 -0
  1032. package/lib.esm/wallet/mnemonic.d.ts.map +1 -0
  1033. package/lib.esm/wallet/mnemonic.js +165 -0
  1034. package/lib.esm/wallet/mnemonic.js.map +1 -0
  1035. package/lib.esm/wallet/utils.d.ts +8 -0
  1036. package/lib.esm/wallet/utils.d.ts.map +1 -0
  1037. package/lib.esm/wallet/utils.js +142 -0
  1038. package/lib.esm/wallet/utils.js.map +1 -0
  1039. package/lib.esm/wallet/wallet.d.ts +71 -0
  1040. package/lib.esm/wallet/wallet.d.ts.map +1 -0
  1041. package/lib.esm/wallet/wallet.js +144 -0
  1042. package/lib.esm/wallet/wallet.js.map +1 -0
  1043. package/lib.esm/wordlists/bit-reader.d.ts +5 -0
  1044. package/lib.esm/wordlists/bit-reader.d.ts.map +1 -0
  1045. package/lib.esm/wordlists/bit-reader.js +32 -0
  1046. package/lib.esm/wordlists/bit-reader.js.map +1 -0
  1047. package/lib.esm/wordlists/decode-owl.d.ts +9 -0
  1048. package/lib.esm/wordlists/decode-owl.d.ts.map +1 -0
  1049. package/lib.esm/wordlists/decode-owl.js +55 -0
  1050. package/lib.esm/wordlists/decode-owl.js.map +1 -0
  1051. package/lib.esm/wordlists/decode-owla.d.ts +5 -0
  1052. package/lib.esm/wordlists/decode-owla.d.ts.map +1 -0
  1053. package/lib.esm/wordlists/decode-owla.js +28 -0
  1054. package/lib.esm/wordlists/decode-owla.js.map +1 -0
  1055. package/lib.esm/wordlists/generation/encode-latin.d.ts +25 -0
  1056. package/lib.esm/wordlists/generation/encode-latin.d.ts.map +1 -0
  1057. package/lib.esm/wordlists/generation/encode-latin.js +344 -0
  1058. package/lib.esm/wordlists/generation/encode-latin.js.map +1 -0
  1059. package/lib.esm/wordlists/index.d.ts +25 -0
  1060. package/lib.esm/wordlists/index.d.ts.map +1 -0
  1061. package/lib.esm/wordlists/index.js +25 -0
  1062. package/lib.esm/wordlists/index.js.map +1 -0
  1063. package/lib.esm/wordlists/lang-cz.d.ts +23 -0
  1064. package/lib.esm/wordlists/lang-cz.d.ts.map +1 -0
  1065. package/lib.esm/wordlists/lang-cz.js +31 -0
  1066. package/lib.esm/wordlists/lang-cz.js.map +1 -0
  1067. package/lib.esm/wordlists/lang-en.d.ts +23 -0
  1068. package/lib.esm/wordlists/lang-en.d.ts.map +1 -0
  1069. package/lib.esm/wordlists/lang-en.js +31 -0
  1070. package/lib.esm/wordlists/lang-en.js.map +1 -0
  1071. package/lib.esm/wordlists/lang-es.d.ts +23 -0
  1072. package/lib.esm/wordlists/lang-es.d.ts.map +1 -0
  1073. package/lib.esm/wordlists/lang-es.js +32 -0
  1074. package/lib.esm/wordlists/lang-es.js.map +1 -0
  1075. package/lib.esm/wordlists/lang-fr.d.ts +23 -0
  1076. package/lib.esm/wordlists/lang-fr.d.ts.map +1 -0
  1077. package/lib.esm/wordlists/lang-fr.js +32 -0
  1078. package/lib.esm/wordlists/lang-fr.js.map +1 -0
  1079. package/lib.esm/wordlists/lang-it.d.ts +23 -0
  1080. package/lib.esm/wordlists/lang-it.d.ts.map +1 -0
  1081. package/lib.esm/wordlists/lang-it.js +31 -0
  1082. package/lib.esm/wordlists/lang-it.js.map +1 -0
  1083. package/lib.esm/wordlists/lang-ja.d.ts +27 -0
  1084. package/lib.esm/wordlists/lang-ja.d.ts.map +1 -0
  1085. package/lib.esm/wordlists/lang-ja.js +154 -0
  1086. package/lib.esm/wordlists/lang-ja.js.map +1 -0
  1087. package/lib.esm/wordlists/lang-ko.d.ts +25 -0
  1088. package/lib.esm/wordlists/lang-ko.d.ts.map +1 -0
  1089. package/lib.esm/wordlists/lang-ko.js +89 -0
  1090. package/lib.esm/wordlists/lang-ko.js.map +1 -0
  1091. package/lib.esm/wordlists/lang-pt.d.ts +23 -0
  1092. package/lib.esm/wordlists/lang-pt.d.ts.map +1 -0
  1093. package/lib.esm/wordlists/lang-pt.js +31 -0
  1094. package/lib.esm/wordlists/lang-pt.js.map +1 -0
  1095. package/lib.esm/wordlists/lang-zh.d.ts +32 -0
  1096. package/lib.esm/wordlists/lang-zh.d.ts.map +1 -0
  1097. package/lib.esm/wordlists/lang-zh.js +92 -0
  1098. package/lib.esm/wordlists/lang-zh.js.map +1 -0
  1099. package/lib.esm/wordlists/wordlist-owl.d.ts +32 -0
  1100. package/lib.esm/wordlists/wordlist-owl.d.ts.map +1 -0
  1101. package/lib.esm/wordlists/wordlist-owl.js +66 -0
  1102. package/lib.esm/wordlists/wordlist-owl.js.map +1 -0
  1103. package/lib.esm/wordlists/wordlist-owla.d.ts +30 -0
  1104. package/lib.esm/wordlists/wordlist-owla.d.ts.map +1 -0
  1105. package/lib.esm/wordlists/wordlist-owla.js +36 -0
  1106. package/lib.esm/wordlists/wordlist-owla.js.map +1 -0
  1107. package/lib.esm/wordlists/wordlist.d.ts +47 -0
  1108. package/lib.esm/wordlists/wordlist.d.ts.map +1 -0
  1109. package/lib.esm/wordlists/wordlist.js +42 -0
  1110. package/lib.esm/wordlists/wordlist.js.map +1 -0
  1111. package/lib.esm/wordlists/wordlists-browser.d.ts +3 -0
  1112. package/lib.esm/wordlists/wordlists-browser.d.ts.map +1 -0
  1113. package/lib.esm/wordlists/wordlists-browser.js +5 -0
  1114. package/lib.esm/wordlists/wordlists-browser.js.map +1 -0
  1115. package/lib.esm/wordlists/wordlists-extra.d.ts +9 -0
  1116. package/lib.esm/wordlists/wordlists-extra.d.ts.map +1 -0
  1117. package/lib.esm/wordlists/wordlists-extra.js +9 -0
  1118. package/lib.esm/wordlists/wordlists-extra.js.map +1 -0
  1119. package/lib.esm/wordlists/wordlists.d.ts +16 -0
  1120. package/lib.esm/wordlists/wordlists.d.ts.map +1 -0
  1121. package/lib.esm/wordlists/wordlists.js +35 -0
  1122. package/lib.esm/wordlists/wordlists.js.map +1 -0
  1123. package/package.json +135 -6
  1124. package/rollup.config.mjs +50 -0
  1125. package/src.ts/_version.ts +6 -0
  1126. package/src.ts/abi/abi-coder.ts +232 -0
  1127. package/src.ts/abi/bytes32.ts +45 -0
  1128. package/src.ts/abi/coders/abstract-coder.ts +467 -0
  1129. package/src.ts/abi/coders/address.ts +36 -0
  1130. package/src.ts/abi/coders/anonymous.ts +29 -0
  1131. package/src.ts/abi/coders/array.ts +199 -0
  1132. package/src.ts/abi/coders/boolean.ts +27 -0
  1133. package/src.ts/abi/coders/bytes.ts +43 -0
  1134. package/src.ts/abi/coders/fixed-bytes.ts +37 -0
  1135. package/src.ts/abi/coders/null.ts +28 -0
  1136. package/src.ts/abi/coders/number.ts +63 -0
  1137. package/src.ts/abi/coders/string.ts +29 -0
  1138. package/src.ts/abi/coders/tuple.ts +69 -0
  1139. package/src.ts/abi/fragments.ts +1615 -0
  1140. package/src.ts/abi/index.ts +41 -0
  1141. package/src.ts/abi/interface.ts +1266 -0
  1142. package/src.ts/abi/typed.ts +796 -0
  1143. package/src.ts/address/address.ts +173 -0
  1144. package/src.ts/address/checks.ts +123 -0
  1145. package/src.ts/address/contract-address.ts +80 -0
  1146. package/src.ts/address/index.ts +57 -0
  1147. package/src.ts/constants/addresses.ts +8 -0
  1148. package/src.ts/constants/hashes.ts +7 -0
  1149. package/src.ts/constants/index.ts +16 -0
  1150. package/src.ts/constants/numbers.ts +35 -0
  1151. package/src.ts/constants/strings.ts +16 -0
  1152. package/src.ts/contract/contract.ts +1106 -0
  1153. package/src.ts/contract/factory.ts +143 -0
  1154. package/src.ts/contract/index.ts +31 -0
  1155. package/src.ts/contract/types.ts +236 -0
  1156. package/src.ts/contract/wrappers.ts +225 -0
  1157. package/src.ts/crypto/crypto-browser.ts +64 -0
  1158. package/src.ts/crypto/crypto.ts +4 -0
  1159. package/src.ts/crypto/hmac.ts +51 -0
  1160. package/src.ts/crypto/index.ts +59 -0
  1161. package/src.ts/crypto/keccak.ts +54 -0
  1162. package/src.ts/crypto/pbkdf2.ts +55 -0
  1163. package/src.ts/crypto/random.ts +36 -0
  1164. package/src.ts/crypto/ripemd160.ts +43 -0
  1165. package/src.ts/crypto/scrypt.ts +114 -0
  1166. package/src.ts/crypto/sha2.ts +78 -0
  1167. package/src.ts/crypto/signature.ts +363 -0
  1168. package/src.ts/crypto/signing-key.ts +204 -0
  1169. package/src.ts/ethers.ts +210 -0
  1170. package/src.ts/hash/id.ts +17 -0
  1171. package/src.ts/hash/index.ts +16 -0
  1172. package/src.ts/hash/message.ts +51 -0
  1173. package/src.ts/hash/namehash.ts +98 -0
  1174. package/src.ts/hash/solidity.ts +117 -0
  1175. package/src.ts/hash/typed-data.ts +615 -0
  1176. package/src.ts/index.ts +12 -0
  1177. package/src.ts/providers/abstract-provider.ts +1727 -0
  1178. package/src.ts/providers/abstract-signer.ts +288 -0
  1179. package/src.ts/providers/community.ts +49 -0
  1180. package/src.ts/providers/contracts.ts +42 -0
  1181. package/src.ts/providers/default-provider.ts +142 -0
  1182. package/src.ts/providers/ens-resolver.ts +606 -0
  1183. package/src.ts/providers/format.ts +293 -0
  1184. package/src.ts/providers/formatting.ts +356 -0
  1185. package/src.ts/providers/index.ts +132 -0
  1186. package/src.ts/providers/network.ts +450 -0
  1187. package/src.ts/providers/pagination.ts +8 -0
  1188. package/src.ts/providers/plugin-fallback.ts +35 -0
  1189. package/src.ts/providers/plugins-network.ts +281 -0
  1190. package/src.ts/providers/provider-alchemy.ts +134 -0
  1191. package/src.ts/providers/provider-ankr.ts +122 -0
  1192. package/src.ts/providers/provider-browser.ts +142 -0
  1193. package/src.ts/providers/provider-cloudflare.ts +24 -0
  1194. package/src.ts/providers/provider-etherscan.ts +608 -0
  1195. package/src.ts/providers/provider-fallback.ts +755 -0
  1196. package/src.ts/providers/provider-infura.ts +190 -0
  1197. package/src.ts/providers/provider-ipcsocket-browser.ts +3 -0
  1198. package/src.ts/providers/provider-ipcsocket.ts +78 -0
  1199. package/src.ts/providers/provider-jsonrpc.ts +1223 -0
  1200. package/src.ts/providers/provider-pocket.ts +121 -0
  1201. package/src.ts/providers/provider-quicknode.ts +121 -0
  1202. package/src.ts/providers/provider-socket.ts +334 -0
  1203. package/src.ts/providers/provider-websocket.ts +102 -0
  1204. package/src.ts/providers/provider.ts +1986 -0
  1205. package/src.ts/providers/signer-noncemanager.ts +98 -0
  1206. package/src.ts/providers/signer.ts +149 -0
  1207. package/src.ts/providers/subscriber-connection.ts +74 -0
  1208. package/src.ts/providers/subscriber-filterid.ts +198 -0
  1209. package/src.ts/providers/subscriber-polling.ts +291 -0
  1210. package/src.ts/providers/ws-browser.ts +11 -0
  1211. package/src.ts/providers/ws.ts +3 -0
  1212. package/src.ts/runner.ps1 +45 -0
  1213. package/src.ts/thirdparty.d.ts +16 -0
  1214. package/src.ts/transaction/accesslist.ts +43 -0
  1215. package/src.ts/transaction/address.ts +28 -0
  1216. package/src.ts/transaction/index.ts +31 -0
  1217. package/src.ts/transaction/transaction.ts +823 -0
  1218. package/src.ts/utils/base58.ts +64 -0
  1219. package/src.ts/utils/base64-browser.ts +25 -0
  1220. package/src.ts/utils/base64.ts +56 -0
  1221. package/src.ts/utils/data.ts +199 -0
  1222. package/src.ts/utils/errors.ts +780 -0
  1223. package/src.ts/utils/events.ts +105 -0
  1224. package/src.ts/utils/fetch.ts +913 -0
  1225. package/src.ts/utils/fixednumber.ts +643 -0
  1226. package/src.ts/utils/geturl-browser.ts +72 -0
  1227. package/src.ts/utils/geturl.ts +96 -0
  1228. package/src.ts/utils/index.ts +95 -0
  1229. package/src.ts/utils/maths.ts +240 -0
  1230. package/src.ts/utils/properties.ts +60 -0
  1231. package/src.ts/utils/rlp-decode.ts +104 -0
  1232. package/src.ts/utils/rlp-encode.ts +64 -0
  1233. package/src.ts/utils/rlp.ts +15 -0
  1234. package/src.ts/utils/test.txt +0 -0
  1235. package/src.ts/utils/units.ts +91 -0
  1236. package/src.ts/utils/utf8.ts +324 -0
  1237. package/src.ts/utils/uuid.ts +36 -0
  1238. package/src.ts/wallet/base-wallet.ts +130 -0
  1239. package/src.ts/wallet/hdwallet.ts +583 -0
  1240. package/src.ts/wallet/index.ts +47 -0
  1241. package/src.ts/wallet/json-crowdsale.ts +74 -0
  1242. package/src.ts/wallet/json-keystore.ts +389 -0
  1243. package/src.ts/wallet/mnemonic.ts +203 -0
  1244. package/src.ts/wallet/utils.ts +147 -0
  1245. package/src.ts/wallet/wallet.ts +163 -0
  1246. package/src.ts/wordlists/bit-reader.ts +35 -0
  1247. package/src.ts/wordlists/decode-owl.ts +58 -0
  1248. package/src.ts/wordlists/decode-owla.ts +33 -0
  1249. package/src.ts/wordlists/generation/encode-latin.ts +370 -0
  1250. package/src.ts/wordlists/index.ts +26 -0
  1251. package/src.ts/wordlists/lang-cz.ts +33 -0
  1252. package/src.ts/wordlists/lang-en.ts +33 -0
  1253. package/src.ts/wordlists/lang-es.ts +35 -0
  1254. package/src.ts/wordlists/lang-fr.ts +34 -0
  1255. package/src.ts/wordlists/lang-it.ts +33 -0
  1256. package/src.ts/wordlists/lang-ja.ts +181 -0
  1257. package/src.ts/wordlists/lang-ko.ts +104 -0
  1258. package/src.ts/wordlists/lang-pt.ts +34 -0
  1259. package/src.ts/wordlists/lang-zh.ts +112 -0
  1260. package/src.ts/wordlists/wordlist-owl.ts +77 -0
  1261. package/src.ts/wordlists/wordlist-owla.ts +41 -0
  1262. package/src.ts/wordlists/wordlist.ts +59 -0
  1263. package/src.ts/wordlists/wordlists-browser.ts +8 -0
  1264. package/src.ts/wordlists/wordlists-extra.ts +9 -0
  1265. package/src.ts/wordlists/wordlists.ts +38 -0
@@ -0,0 +1,1727 @@
1
+ /**
2
+ * The available providers should suffice for most developers purposes,
3
+ * but the [[AbstractProvider]] class has many features which enable
4
+ * sub-classing it for specific purposes.
5
+ *
6
+ * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
7
+ */
8
+
9
+ // @TODO
10
+ // Event coalescence
11
+ // When we register an event with an async value (e.g. address is a Signer
12
+ // or ENS name), we need to add it immeidately for the Event API, but also
13
+ // need time to resolve the address. Upon resolving the address, we need to
14
+ // migrate the listener to the static event. We also need to maintain a map
15
+ // of Signer/ENS name to address so we can sync respond to listenerCount.
16
+
17
+ import { getAddress, resolveAddress } from "../address/index.js";
18
+ import { ZeroAddress } from "../constants/index.js";
19
+ import { Contract } from "../contract/index.js";
20
+ import { namehash } from "../hash/index.js";
21
+ import { Transaction } from "../transaction/index.js";
22
+ import {
23
+ concat, dataLength, dataSlice, hexlify, isHexString,
24
+ getBigInt, getBytes, getNumber,
25
+ isCallException, isError, makeError, assert, assertArgument,
26
+ FetchRequest,
27
+ toBeArray, toQuantity,
28
+ defineProperties, EventPayload, resolveProperties,
29
+ toUtf8String
30
+ } from "../utils/index.js";
31
+
32
+ import { EnsResolver } from "./ens-resolver.js";
33
+ import {
34
+ formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse
35
+ } from "./format.js";
36
+ import { Network } from "./network.js";
37
+ import { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js";
38
+ import {
39
+ PollingBlockSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber
40
+ } from "./subscriber-polling.js";
41
+
42
+ import type { Addressable, AddressLike } from "../address/index.js";
43
+ import type { BigNumberish, BytesLike } from "../utils/index.js";
44
+ import type { Listener } from "../utils/index.js";
45
+
46
+ import type { Networkish } from "./network.js";
47
+ import type { FetchUrlFeeDataNetworkPlugin } from "./plugins-network.js";
48
+ //import type { MaxPriorityFeePlugin } from "./plugins-network.js";
49
+ import type {
50
+ BlockParams, LogParams, TransactionReceiptParams,
51
+ TransactionResponseParams
52
+ } from "./formatting.js";
53
+
54
+ import type {
55
+ BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter,
56
+ PreparedTransactionRequest, Provider, ProviderEvent,
57
+ TransactionRequest
58
+ } from "./provider.js";
59
+
60
+ type Timer = ReturnType<typeof setTimeout>;
61
+
62
+
63
+ // Constants
64
+ const BN_2 = BigInt(2);
65
+
66
+ const MAX_CCIP_REDIRECTS = 10;
67
+
68
+ function isPromise<T = any>(value: any): value is Promise<T> {
69
+ return (value && typeof(value.then) === "function");
70
+ }
71
+
72
+ function getTag(prefix: string, value: any): string {
73
+ return prefix + ":" + JSON.stringify(value, (k, v) => {
74
+ if (v == null) { return "null"; }
75
+ if (typeof(v) === "bigint") { return `bigint:${ v.toString() }`}
76
+ if (typeof(v) === "string") { return v.toLowerCase(); }
77
+
78
+ // Sort object keys
79
+ if (typeof(v) === "object" && !Array.isArray(v)) {
80
+ const keys = Object.keys(v);
81
+ keys.sort();
82
+ return keys.reduce((accum, key) => {
83
+ accum[key] = v[key];
84
+ return accum;
85
+ }, <any>{ });
86
+ }
87
+
88
+ return v;
89
+ });
90
+ }
91
+
92
+ /**
93
+ * The types of additional event values that can be emitted for the
94
+ * ``"debug"`` event.
95
+ */
96
+ export type DebugEventAbstractProvider = {
97
+ action: "sendCcipReadFetchRequest",
98
+ request: FetchRequest
99
+ index: number
100
+ urls: Array<string>
101
+ } | {
102
+ action: "receiveCcipReadFetchResult",
103
+ request: FetchRequest,
104
+ result: any
105
+ } | {
106
+ action: "receiveCcipReadFetchError",
107
+ request: FetchRequest,
108
+ result: any
109
+ } | {
110
+ action: "sendCcipReadCall",
111
+ transaction: { to: string, data: string }
112
+ } | {
113
+ action: "receiveCcipReadCallResult",
114
+ transaction: { to: string, data: string }
115
+ result: string
116
+ } | {
117
+ action: "receiveCcipReadCallError",
118
+ transaction: { to: string, data: string }
119
+ error: Error
120
+ };
121
+
122
+
123
+ /**
124
+ * The value passed to the [[AbstractProvider-_getSubscriber]] method.
125
+ *
126
+ * Only developers sub-classing [[AbstractProvider[[ will care about this,
127
+ * if they are modifying a low-level feature of how subscriptions operate.
128
+ */
129
+ export type Subscription = {
130
+ type: "block" | "close" | "debug" | "error" | "network" | "pending",
131
+ tag: string
132
+ } | {
133
+ type: "transaction",
134
+ tag: string,
135
+ hash: string
136
+ } | {
137
+ type: "event",
138
+ tag: string,
139
+ filter: EventFilter
140
+ } | {
141
+ type: "orphan",
142
+ tag: string,
143
+ filter: OrphanFilter
144
+ };
145
+
146
+ /**
147
+ * A **Subscriber** manages a subscription.
148
+ *
149
+ * Only developers sub-classing [[AbstractProvider[[ will care about this,
150
+ * if they are modifying a low-level feature of how subscriptions operate.
151
+ */
152
+ export interface Subscriber {
153
+ /**
154
+ * Called initially when a subscriber is added the first time.
155
+ */
156
+ start(): void;
157
+
158
+ /**
159
+ * Called when there are no more subscribers to the event.
160
+ */
161
+ stop(): void;
162
+
163
+ /**
164
+ * Called when the subscription should pause.
165
+ *
166
+ * If %%dropWhilePaused%%, events that occur while paused should not
167
+ * be emitted [[resume]].
168
+ */
169
+ pause(dropWhilePaused?: boolean): void;
170
+
171
+ /**
172
+ * Resume a paused subscriber.
173
+ */
174
+ resume(): void;
175
+
176
+ /**
177
+ * The frequency (in ms) to poll for events, if polling is used by
178
+ * the subscriber.
179
+ *
180
+ * For non-polling subscribers, this must return ``undefined``.
181
+ */
182
+ pollingInterval?: number;
183
+ }
184
+
185
+ /**
186
+ * An **UnmanagedSubscriber** is useful for events which do not require
187
+ * any additional management, such as ``"debug"`` which only requires
188
+ * emit in synchronous event loop triggered calls.
189
+ */
190
+ export class UnmanagedSubscriber implements Subscriber {
191
+ /**
192
+ * The name fof the event.
193
+ */
194
+ name!: string;
195
+
196
+ /**
197
+ * Create a new UnmanagedSubscriber with %%name%%.
198
+ */
199
+ constructor(name: string) { defineProperties<UnmanagedSubscriber>(this, { name }); }
200
+
201
+ start(): void { }
202
+ stop(): void { }
203
+
204
+ pause(dropWhilePaused?: boolean): void { }
205
+ resume(): void { }
206
+ }
207
+
208
+ type Sub = {
209
+ tag: string;
210
+ nameMap: Map<string, string>
211
+ addressableMap: WeakMap<Addressable, string>;
212
+ listeners: Array<{ listener: Listener, once: boolean }>;
213
+ // @TODO: get rid of this, as it is (and has to be)
214
+ // tracked in subscriber
215
+ started: boolean;
216
+ subscriber: Subscriber;
217
+ };
218
+
219
+ function copy<T = any>(value: T): T {
220
+ return JSON.parse(JSON.stringify(value));
221
+ }
222
+
223
+ function concisify(items: Array<string>): Array<string> {
224
+ items = Array.from((new Set(items)).values())
225
+ items.sort();
226
+ return items;
227
+ }
228
+
229
+
230
+ async function getSubscription(_event: ProviderEvent, provider: AbstractProvider): Promise<Subscription> {
231
+ if (_event == null) { throw new Error("invalid event"); }
232
+
233
+ // Normalize topic array info an EventFilter
234
+ if (Array.isArray(_event)) { _event = { topics: _event }; }
235
+
236
+ if (typeof(_event) === "string") {
237
+ switch (_event) {
238
+ case "block": case "pending": case "debug": case "error": case "network": {
239
+ return { type: _event, tag: _event };
240
+ }
241
+ }
242
+ }
243
+
244
+ if (isHexString(_event, 32)) {
245
+ const hash = _event.toLowerCase();
246
+ return { type: "transaction", tag: getTag("tx", { hash }), hash };
247
+ }
248
+
249
+ if ((<any>_event).orphan) {
250
+ const event = <OrphanFilter>_event;
251
+ // @TODO: Should lowercase and whatnot things here instead of copy...
252
+ return { type: "orphan", tag: getTag("orphan", event), filter: copy(event) };
253
+ }
254
+
255
+ if (((<any>_event).address || (<any>_event).topics)) {
256
+ const event = <EventFilter>_event;
257
+
258
+ const filter: any = {
259
+ topics: ((event.topics || []).map((t) => {
260
+ if (t == null) { return null; }
261
+ if (Array.isArray(t)) {
262
+ return concisify(t.map((t) => t.toLowerCase()));
263
+ }
264
+ return t.toLowerCase();
265
+ }))
266
+ };
267
+
268
+ if (event.address) {
269
+ const addresses: Array<string> = [ ];
270
+ const promises: Array<Promise<void>> = [ ];
271
+
272
+ const addAddress = (addr: AddressLike) => {
273
+ if (isHexString(addr)) {
274
+ addresses.push(addr);
275
+ } else {
276
+ promises.push((async () => {
277
+ addresses.push(await resolveAddress(addr, provider));
278
+ })());
279
+ }
280
+ }
281
+
282
+ if (Array.isArray(event.address)) {
283
+ event.address.forEach(addAddress);
284
+ } else {
285
+ addAddress(event.address);
286
+ }
287
+ if (promises.length) { await Promise.all(promises); }
288
+ filter.address = concisify(addresses.map((a) => a.toLowerCase()));
289
+ }
290
+
291
+ return { filter, tag: getTag("event", filter), type: "event" };
292
+ }
293
+
294
+ assertArgument(false, "unknown ProviderEvent", "event", _event);
295
+ }
296
+
297
+ function getTime(): number { return (new Date()).getTime(); }
298
+
299
+ /**
300
+ * An **AbstractPlugin** is used to provide additional internal services
301
+ * to an [[AbstractProvider]] without adding backwards-incompatible changes
302
+ * to method signatures or other internal and complex logic.
303
+ */
304
+ export interface AbstractProviderPlugin {
305
+ /**
306
+ * The reverse domain notation of the plugin.
307
+ */
308
+ readonly name: string;
309
+
310
+ /**
311
+ * Creates a new instance of the plugin, connected to %%provider%%.
312
+ */
313
+ connect(provider: AbstractProvider): AbstractProviderPlugin;
314
+ }
315
+
316
+ /**
317
+ * A normalized filter used for [[PerformActionRequest]] objects.
318
+ */
319
+ export type PerformActionFilter = {
320
+ address?: string | Array<string>;
321
+ topics?: Array<null | string | Array<string>>;
322
+ fromBlock?: BlockTag;
323
+ toBlock?: BlockTag;
324
+ } | {
325
+ address?: string | Array<string>;
326
+ topics?: Array<null | string | Array<string>>;
327
+ blockHash?: string;
328
+ };
329
+
330
+ /**
331
+ * A normalized transactions used for [[PerformActionRequest]] objects.
332
+ */
333
+ export interface PerformActionTransaction extends PreparedTransactionRequest {
334
+ /**
335
+ * The ``to`` address of the transaction.
336
+ */
337
+ to?: string;
338
+
339
+ /**
340
+ * The sender of the transaction.
341
+ */
342
+ from?: string;
343
+ }
344
+
345
+ /**
346
+ * The [[AbstractProvider]] methods will normalize all values and pass this
347
+ * type to [[AbstractProvider-_perform]].
348
+ */
349
+ export type PerformActionRequest = {
350
+ method: "broadcastTransaction",
351
+ signedTransaction: string
352
+ } | {
353
+ method: "call",
354
+ transaction: PerformActionTransaction, blockTag: BlockTag
355
+ } | {
356
+ method: "chainId"
357
+ } | {
358
+ method: "estimateGas",
359
+ transaction: PerformActionTransaction
360
+ } | {
361
+ method: "getBalance",
362
+ address: string, blockTag: BlockTag
363
+ } | {
364
+ method: "getBlock",
365
+ blockTag: BlockTag, includeTransactions: boolean
366
+ } | {
367
+ method: "getBlock",
368
+ blockHash: string, includeTransactions: boolean
369
+ } | {
370
+ method: "getBlockNumber"
371
+ } | {
372
+ method: "getCode",
373
+ address: string, blockTag: BlockTag
374
+ } | {
375
+ method: "getGasPrice"
376
+ } | {
377
+ method: "getLogs",
378
+ filter: PerformActionFilter
379
+ } | {
380
+ method: "getStorage",
381
+ address: string, position: bigint, blockTag: BlockTag
382
+ } | {
383
+ method: "getTransaction",
384
+ hash: string
385
+ } | {
386
+ method: "getTransactionCount",
387
+ address: string, blockTag: BlockTag
388
+ } | {
389
+ method: "getTransactionReceipt",
390
+ hash: string
391
+ } | {
392
+ method: "getTransactionResult",
393
+ hash: string
394
+ };
395
+
396
+ type _PerformAccountRequest = {
397
+ method: "getBalance" | "getTransactionCount" | "getCode"
398
+ } | {
399
+ method: "getStorage", position: bigint
400
+ }
401
+
402
+ /**
403
+ * Options for configuring some internal aspects of an [[AbstractProvider]].
404
+ *
405
+ * **``cacheTimeout``** - how long to cache a low-level ``_perform``
406
+ * for, based on input parameters. This reduces the number of calls
407
+ * to getChainId and getBlockNumber, but may break test chains which
408
+ * can perform operations (internally) synchronously. Use ``-1`` to
409
+ * disable, ``0`` will only buffer within the same event loop and
410
+ * any other value is in ms. (default: ``250``)
411
+ */
412
+ export type AbstractProviderOptions = {
413
+ cacheTimeout?: number;
414
+ pollingInterval?: number;
415
+ };
416
+
417
+ const defaultOptions = {
418
+ cacheTimeout: 250,
419
+ pollingInterval: 4000
420
+ };
421
+
422
+ type CcipArgs = {
423
+ sender: string;
424
+ urls: Array<string>;
425
+ calldata: string;
426
+ selector: string;
427
+ extraData: string;
428
+ errorArgs: Array<any>
429
+ };
430
+
431
+ /**
432
+ * An **AbstractProvider** provides a base class for other sub-classes to
433
+ * implement the [[Provider]] API by normalizing input arguments and
434
+ * formatting output results as well as tracking events for consistent
435
+ * behaviour on an eventually-consistent network.
436
+ */
437
+ export class AbstractProvider implements Provider {
438
+
439
+ #subs: Map<string, Sub>;
440
+ #plugins: Map<string, AbstractProviderPlugin>;
441
+
442
+ // null=unpaused, true=paused+dropWhilePaused, false=paused
443
+ #pausedState: null | boolean;
444
+
445
+ #destroyed: boolean;
446
+
447
+ #networkPromise: null | Promise<Network>;
448
+ readonly #anyNetwork: boolean;
449
+
450
+ #performCache: Map<string, Promise<any>>;
451
+
452
+ // The most recent block number if running an event or -1 if no "block" event
453
+ #lastBlockNumber: number;
454
+
455
+ #nextTimer: number;
456
+ #timers: Map<number, { timer: null | Timer, func: () => void, time: number }>;
457
+
458
+ #disableCcipRead: boolean;
459
+
460
+ #options: Required<AbstractProviderOptions>;
461
+
462
+ /**
463
+ * Create a new **AbstractProvider** connected to %%network%%, or
464
+ * use the various network detection capabilities to discover the
465
+ * [[Network]] if necessary.
466
+ */
467
+ constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions) {
468
+ this.#options = Object.assign({ }, defaultOptions, options || { });
469
+
470
+ if (_network === "any") {
471
+ this.#anyNetwork = true;
472
+ this.#networkPromise = null;
473
+ } else if (_network) {
474
+ const network = Network.from(_network);
475
+ this.#anyNetwork = false;
476
+ this.#networkPromise = Promise.resolve(network);
477
+ setTimeout(() => { this.emit("network", network, null); }, 0);
478
+ } else {
479
+ this.#anyNetwork = false;
480
+ this.#networkPromise = null;
481
+ }
482
+
483
+ this.#lastBlockNumber = -1;
484
+
485
+ this.#performCache = new Map();
486
+
487
+ this.#subs = new Map();
488
+ this.#plugins = new Map();
489
+ this.#pausedState = null;
490
+
491
+ this.#destroyed = false;
492
+
493
+ this.#nextTimer = 1;
494
+ this.#timers = new Map();
495
+
496
+ this.#disableCcipRead = false;
497
+ }
498
+
499
+ get pollingInterval(): number { return this.#options.pollingInterval; }
500
+
501
+ /**
502
+ * Returns ``this``, to allow an **AbstractProvider** to implement
503
+ * the [[ContractRunner]] interface.
504
+ */
505
+ get provider(): this { return this; }
506
+
507
+ /**
508
+ * Returns all the registered plug-ins.
509
+ */
510
+ get plugins(): Array<AbstractProviderPlugin> {
511
+ return Array.from(this.#plugins.values());
512
+ }
513
+
514
+ /**
515
+ * Attach a new plug-in.
516
+ */
517
+ attachPlugin(plugin: AbstractProviderPlugin): this {
518
+ if (this.#plugins.get(plugin.name)) {
519
+ throw new Error(`cannot replace existing plugin: ${ plugin.name } `);
520
+ }
521
+ this.#plugins.set(plugin.name, plugin.connect(this));
522
+ return this;
523
+ }
524
+
525
+ /**
526
+ * Get a plugin by name.
527
+ */
528
+ getPlugin<T extends AbstractProviderPlugin = AbstractProviderPlugin>(name: string): null | T {
529
+ return <T>(this.#plugins.get(name)) || null;
530
+ }
531
+
532
+ /**
533
+ * Prevent any CCIP-read operation, regardless of whether requested
534
+ * in a [[call]] using ``enableCcipRead``.
535
+ */
536
+ get disableCcipRead(): boolean { return this.#disableCcipRead; }
537
+ set disableCcipRead(value: boolean) { this.#disableCcipRead = !!value; }
538
+
539
+ // Shares multiple identical requests made during the same 250ms
540
+ async #perform<T = any>(req: PerformActionRequest): Promise<T> {
541
+ const timeout = this.#options.cacheTimeout;
542
+
543
+ // Caching disabled
544
+ if (timeout < 0) { return await this._perform(req); }
545
+
546
+ // Create a tag
547
+ const tag = getTag(req.method, req);
548
+
549
+ let perform = this.#performCache.get(tag);
550
+ if (!perform) {
551
+ perform = this._perform(req);
552
+
553
+ this.#performCache.set(tag, perform);
554
+
555
+ setTimeout(() => {
556
+ if (this.#performCache.get(tag) === perform) {
557
+ this.#performCache.delete(tag);
558
+ }
559
+ }, timeout);
560
+ }
561
+
562
+ return await perform;
563
+ }
564
+
565
+ /**
566
+ * Resolves to the data for executing the CCIP-read operations.
567
+ */
568
+ async ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array<string>): Promise<null | string> {
569
+ if (this.disableCcipRead || urls.length === 0 || tx.to == null) { return null; }
570
+
571
+ const sender = tx.to.toLowerCase();
572
+ const data = calldata.toLowerCase();
573
+
574
+ const errorMessages: Array<string> = [ ];
575
+
576
+ for (let i = 0; i < urls.length; i++) {
577
+ const url = urls[i];
578
+
579
+ // URL expansion
580
+ const href = url.replace("{sender}", sender).replace("{data}", data);
581
+
582
+ // If no {data} is present, use POST; otherwise GET
583
+ //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender });
584
+
585
+ //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {
586
+ // value.status = response.statusCode;
587
+ // return value;
588
+ //});
589
+ const request = new FetchRequest(href);
590
+ if (url.indexOf("{data}") === -1) {
591
+ request.body = { data, sender };
592
+ }
593
+
594
+ this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls });
595
+
596
+ let errorMessage = "unknown error";
597
+
598
+ const resp = await request.send();
599
+ try {
600
+ const result = resp.bodyJson;
601
+ if (result.data) {
602
+ this.emit("debug", { action: "receiveCcipReadFetchResult", request, result });
603
+ return result.data;
604
+ }
605
+ if (result.message) { errorMessage = result.message; }
606
+ this.emit("debug", { action: "receiveCcipReadFetchError", request, result });
607
+ } catch (error) { }
608
+
609
+ // 4xx indicates the result is not present; stop
610
+ assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${ errorMessage }`,
611
+ "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } });
612
+
613
+ // 5xx indicates server issue; try the next url
614
+ errorMessages.push(errorMessage);
615
+ }
616
+
617
+ assert(false, `error encountered during CCIP fetch: ${ errorMessages.map((m) => JSON.stringify(m)).join(", ") }`, "OFFCHAIN_FAULT", {
618
+ reason: "500_SERVER_ERROR",
619
+ transaction: tx, info: { urls, errorMessages }
620
+ });
621
+ }
622
+
623
+ /**
624
+ * Provides the opportunity for a sub-class to wrap a block before
625
+ * returning it, to add additional properties or an alternate
626
+ * sub-class of [[Block]].
627
+ */
628
+ _wrapBlock(value: BlockParams, network: Network): Block {
629
+ return new Block(formatBlock(value), this);
630
+ }
631
+
632
+ /**
633
+ * Provides the opportunity for a sub-class to wrap a log before
634
+ * returning it, to add additional properties or an alternate
635
+ * sub-class of [[Log]].
636
+ */
637
+ _wrapLog(value: LogParams, network: Network): Log {
638
+ return new Log(formatLog(value), this);
639
+ }
640
+
641
+ /**
642
+ * Provides the opportunity for a sub-class to wrap a transaction
643
+ * receipt before returning it, to add additional properties or an
644
+ * alternate sub-class of [[TransactionReceipt]].
645
+ */
646
+ _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt {
647
+ return new TransactionReceipt(formatTransactionReceipt(value), this);
648
+ }
649
+
650
+ /**
651
+ * Provides the opportunity for a sub-class to wrap a transaction
652
+ * response before returning it, to add additional properties or an
653
+ * alternate sub-class of [[TransactionResponse]].
654
+ */
655
+ _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse {
656
+ return new TransactionResponse(formatTransactionResponse(tx), this);
657
+ }
658
+
659
+ /**
660
+ * Resolves to the Network, forcing a network detection using whatever
661
+ * technique the sub-class requires.
662
+ *
663
+ * Sub-classes **must** override this.
664
+ */
665
+ _detectNetwork(): Promise<Network> {
666
+ assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", {
667
+ operation: "_detectNetwork"
668
+ });
669
+ }
670
+
671
+ /**
672
+ * Sub-classes should use this to perform all built-in operations. All
673
+ * methods sanitizes and normalizes the values passed into this.
674
+ *
675
+ * Sub-classes **must** override this.
676
+ */
677
+ async _perform<T = any>(req: PerformActionRequest): Promise<T> {
678
+ assert(false, `unsupported method: ${ req.method }`, "UNSUPPORTED_OPERATION", {
679
+ operation: req.method,
680
+ info: req
681
+ });
682
+ }
683
+
684
+ // State
685
+
686
+ async getBlockNumber(): Promise<number> {
687
+ const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response");
688
+ if (this.#lastBlockNumber >= 0) { this.#lastBlockNumber = blockNumber; }
689
+ return blockNumber;
690
+ }
691
+
692
+ /**
693
+ * Returns or resolves to the address for %%address%%, resolving ENS
694
+ * names and [[Addressable]] objects and returning if already an
695
+ * address.
696
+ */
697
+ _getAddress(address: AddressLike): string | Promise<string> {
698
+ return resolveAddress(address, this);
699
+ }
700
+
701
+ /**
702
+ * Returns or resolves to a valid block tag for %%blockTag%%, resolving
703
+ * negative values and returning if already a valid block tag.
704
+ */
705
+ _getBlockTag(blockTag?: BlockTag): string | Promise<string> {
706
+ if (blockTag == null) { return "latest"; }
707
+
708
+ switch (blockTag) {
709
+ case "earliest":
710
+ return "0x0";
711
+ case "latest": case "pending": case "safe": case "finalized":
712
+ return blockTag;
713
+ }
714
+
715
+
716
+ if (isHexString(blockTag)) {
717
+ if (isHexString(blockTag, 32)) { return blockTag; }
718
+ return toQuantity(blockTag);
719
+ }
720
+
721
+ if (typeof(blockTag) === "bigint") {
722
+ blockTag = getNumber(blockTag, "blockTag");
723
+ }
724
+
725
+ if (typeof(blockTag) === "number") {
726
+ if (blockTag >= 0) { return toQuantity(blockTag); }
727
+ if (this.#lastBlockNumber >= 0) { return toQuantity(this.#lastBlockNumber + blockTag); }
728
+ return this.getBlockNumber().then((b) => toQuantity(b + <number>blockTag));
729
+ }
730
+
731
+ assertArgument(false, "invalid blockTag", "blockTag", blockTag);
732
+ }
733
+
734
+ /**
735
+ * Returns or resolves to a filter for %%filter%%, resolving any ENS
736
+ * names or [[Addressable]] object and returning if already a valid
737
+ * filter.
738
+ */
739
+ _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise<PerformActionFilter> {
740
+
741
+ // Create a canonical representation of the topics
742
+ const topics = (filter.topics || [ ]).map((t) => {
743
+ if (t == null) { return null; }
744
+ if (Array.isArray(t)) {
745
+ return concisify(t.map((t) => t.toLowerCase()));
746
+ }
747
+ return t.toLowerCase();
748
+ });
749
+
750
+ const blockHash = ("blockHash" in filter) ? filter.blockHash: undefined;
751
+
752
+ const resolve = (_address: Array<string>, fromBlock?: string, toBlock?: string) => {
753
+ let address: undefined | string | Array<string> = undefined;
754
+ switch (_address.length) {
755
+ case 0: break;
756
+ case 1:
757
+ address = _address[0];
758
+ break;
759
+ default:
760
+ _address.sort();
761
+ address = _address;
762
+ }
763
+
764
+ if (blockHash) {
765
+ if (fromBlock != null || toBlock != null) {
766
+ throw new Error("invalid filter");
767
+ }
768
+ }
769
+
770
+ const filter = <any>{ };
771
+ if (address) { filter.address = address; }
772
+ if (topics.length) { filter.topics = topics; }
773
+ if (fromBlock) { filter.fromBlock = fromBlock; }
774
+ if (toBlock) { filter.toBlock = toBlock; }
775
+ if (blockHash) { filter.blockHash = blockHash; }
776
+
777
+ return filter;
778
+ };
779
+
780
+ // Addresses could be async (ENS names or Addressables)
781
+ let address: Array<string | Promise<string>> = [ ];
782
+ if (filter.address) {
783
+ if (Array.isArray(filter.address)) {
784
+ for (const addr of filter.address) { address.push(this._getAddress(addr)); }
785
+ } else {
786
+ address.push(this._getAddress(filter.address));
787
+ }
788
+ }
789
+
790
+ let fromBlock: undefined | string | Promise<string> = undefined;
791
+ if ("fromBlock" in filter) { fromBlock = this._getBlockTag(filter.fromBlock); }
792
+
793
+ let toBlock: undefined | string | Promise<string> = undefined;
794
+ if ("toBlock" in filter) { toBlock = this._getBlockTag(filter.toBlock); }
795
+
796
+ if (address.filter((a) => (typeof(a) !== "string")).length ||
797
+ (fromBlock != null && typeof(fromBlock) !== "string") ||
798
+ (toBlock != null && typeof(toBlock) !== "string")) {
799
+
800
+ return Promise.all([ Promise.all(address), fromBlock, toBlock ]).then((result) => {
801
+ return resolve(result[0], result[1], result[2]);
802
+ });
803
+ }
804
+
805
+ return resolve(<Array<string>>address, fromBlock, toBlock);
806
+ }
807
+
808
+ /**
809
+ * Returns or resovles to a transaction for %%request%%, resolving
810
+ * any ENS names or [[Addressable]] and returning if already a valid
811
+ * transaction.
812
+ */
813
+ _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise<PerformActionTransaction> {
814
+ const request = <PerformActionTransaction>copyRequest(_request);
815
+
816
+ const promises: Array<Promise<void>> = [ ];
817
+ [ "to", "from" ].forEach((key) => {
818
+ if ((<any>request)[key] == null) { return; }
819
+
820
+ const addr = resolveAddress((<any>request)[key]);
821
+ if (isPromise(addr)) {
822
+ promises.push((async function() { (<any>request)[key] = await addr; })());
823
+ } else {
824
+ (<any>request)[key] = addr;
825
+ }
826
+ });
827
+
828
+ if (request.blockTag != null) {
829
+ const blockTag = this._getBlockTag(request.blockTag);
830
+ if (isPromise(blockTag)) {
831
+ promises.push((async function() { request.blockTag = await blockTag; })());
832
+ } else {
833
+ request.blockTag = blockTag;
834
+ }
835
+ }
836
+
837
+ if (promises.length) {
838
+ return (async function() {
839
+ await Promise.all(promises);
840
+ return request;
841
+ })();
842
+ }
843
+
844
+ return request;
845
+ }
846
+
847
+ async getNetwork(): Promise<Network> {
848
+
849
+ // No explicit network was set and this is our first time
850
+ if (this.#networkPromise == null) {
851
+
852
+ // Detect the current network (shared with all calls)
853
+ const detectNetwork = this._detectNetwork().then((network) => {
854
+ this.emit("network", network, null);
855
+ return network;
856
+ }, (error) => {
857
+ // Reset the networkPromise on failure, so we will try again
858
+ if (this.#networkPromise === detectNetwork) {
859
+ this.#networkPromise = null;
860
+ }
861
+ throw error;
862
+ });
863
+
864
+ this.#networkPromise = detectNetwork;
865
+ return (await detectNetwork).clone();
866
+ }
867
+
868
+ const networkPromise = this.#networkPromise;
869
+
870
+ const [ expected, actual ] = await Promise.all([
871
+ networkPromise, // Possibly an explicit Network
872
+ this._detectNetwork() // The actual connected network
873
+ ]);
874
+
875
+ if (expected.chainId !== actual.chainId) {
876
+ if (this.#anyNetwork) {
877
+ // The "any" network can change, so notify listeners
878
+ this.emit("network", actual, expected);
879
+
880
+ // Update the network if something else hasn't already changed it
881
+ if (this.#networkPromise === networkPromise) {
882
+ this.#networkPromise = Promise.resolve(actual);
883
+ }
884
+ } else {
885
+ // Otherwise, we do not allow changes to the underlying network
886
+ assert(false, `network changed: ${ expected.chainId } => ${ actual.chainId } `, "NETWORK_ERROR", {
887
+ event: "changed"
888
+ });
889
+ }
890
+ }
891
+
892
+ return expected.clone();
893
+ }
894
+
895
+ async getFeeData(): Promise<FeeData> {
896
+ const network = await this.getNetwork();
897
+
898
+ const getFeeDataFunc = async () => {
899
+ const { _block, gasPrice } = await resolveProperties({
900
+ _block: this.#getBlock("latest", false),
901
+ gasPrice: ((async () => {
902
+ try {
903
+ const gasPrice = await this.#perform({ method: "getGasPrice" });
904
+ return getBigInt(gasPrice, "%response");
905
+ } catch (error) { }
906
+ return null
907
+ })())
908
+ });
909
+
910
+ let maxFeePerGas: null | bigint = null;
911
+ let maxPriorityFeePerGas: null | bigint = null;
912
+
913
+ // These are the recommended EIP-1559 heuristics for fee data
914
+ const block = this._wrapBlock(_block, network);
915
+ if (block && block.baseFeePerGas) {
916
+ maxPriorityFeePerGas = BigInt("1000000000");
917
+ maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas;
918
+ }
919
+
920
+ return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas);
921
+ };
922
+
923
+ // Check for a FeeDataNetWorkPlugin
924
+ const plugin = <FetchUrlFeeDataNetworkPlugin>network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");
925
+ if (plugin) {
926
+ const req = new FetchRequest(plugin.url);
927
+ const feeData = await plugin.processFunc(getFeeDataFunc, this, req);
928
+ return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas);
929
+ }
930
+
931
+ return await getFeeDataFunc();
932
+ }
933
+
934
+
935
+ async estimateGas(_tx: TransactionRequest): Promise<bigint> {
936
+ let tx = this._getTransactionRequest(_tx);
937
+ if (isPromise(tx)) { tx = await tx; }
938
+ return getBigInt(await this.#perform({
939
+ method: "estimateGas", transaction: tx
940
+ }), "%response");
941
+ }
942
+
943
+ async #call(tx: PerformActionTransaction, blockTag: string, attempt: number): Promise<string> {
944
+ assert (attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
945
+ reason: "TOO_MANY_REDIRECTS",
946
+ transaction: Object.assign({ }, tx, { blockTag, enableCcipRead: true })
947
+ });
948
+
949
+ // This came in as a PerformActionTransaction, so to/from are safe; we can cast
950
+ const transaction = <PerformActionTransaction>copyRequest(tx);
951
+
952
+ try {
953
+ return hexlify(await this._perform({ method: "call", transaction, blockTag }));
954
+
955
+ } catch (error: any) {
956
+ // CCIP Read OffchainLookup
957
+ if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") {
958
+ const data = error.data;
959
+
960
+ const txSender = await resolveAddress(transaction.to, this);
961
+
962
+ // Parse the CCIP Read Arguments
963
+ let ccipArgs: CcipArgs;
964
+ try {
965
+ ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));
966
+ } catch (error: any) {
967
+ assert(false, error.message, "OFFCHAIN_FAULT", {
968
+ reason: "BAD_DATA", transaction, info: { data } });
969
+ }
970
+
971
+ // Check the sender of the OffchainLookup matches the transaction
972
+ assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(),
973
+ "CCIP Read sender mismatch", "CALL_EXCEPTION", {
974
+ action: "call",
975
+ data,
976
+ reason: "OffchainLookup",
977
+ transaction: <any>transaction, // @TODO: populate data?
978
+ invocation: null,
979
+ revert: {
980
+ signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)",
981
+ name: "OffchainLookup",
982
+ args: ccipArgs.errorArgs
983
+ }
984
+ });
985
+
986
+ const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);
987
+ assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", {
988
+ reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } });
989
+
990
+ const tx = {
991
+ to: txSender,
992
+ data: concat([ ccipArgs.selector, encodeBytes([ ccipResult, ccipArgs.extraData ]) ])
993
+ };
994
+
995
+ this.emit("debug", { action: "sendCcipReadCall", transaction: tx });
996
+ try {
997
+ const result = await this.#call(tx, blockTag, attempt + 1);
998
+ this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({ }, tx), result });
999
+ return result;
1000
+ } catch (error) {
1001
+ this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({ }, tx), error });
1002
+ throw error;
1003
+ }
1004
+ }
1005
+
1006
+ throw error;
1007
+ }
1008
+ }
1009
+
1010
+ async #checkNetwork<T>(promise: Promise<T>): Promise<T> {
1011
+ const { value } = await resolveProperties({
1012
+ network: this.getNetwork(),
1013
+ value: promise
1014
+ });
1015
+ return value;
1016
+ }
1017
+
1018
+ async call(_tx: TransactionRequest): Promise<string> {
1019
+ const { tx, blockTag } = await resolveProperties({
1020
+ tx: this._getTransactionRequest(_tx),
1021
+ blockTag: this._getBlockTag(_tx.blockTag)
1022
+ });
1023
+
1024
+ return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0: -1));
1025
+ }
1026
+
1027
+ // Account
1028
+ async #getAccountValue(request: _PerformAccountRequest, _address: AddressLike, _blockTag?: BlockTag): Promise<any> {
1029
+ let address: string | Promise<string> = this._getAddress(_address);
1030
+ let blockTag: string | Promise<string> = this._getBlockTag(_blockTag);
1031
+
1032
+ if (typeof(address) !== "string" || typeof(blockTag) !== "string") {
1033
+ [ address, blockTag ] = await Promise.all([ address, blockTag ]);
1034
+ }
1035
+
1036
+ return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));
1037
+ }
1038
+
1039
+ async getBalance(address: AddressLike, blockTag?: BlockTag): Promise<bigint> {
1040
+ return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response");
1041
+ }
1042
+
1043
+ async getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise<number> {
1044
+ return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response");
1045
+ }
1046
+
1047
+ async getCode(address: AddressLike, blockTag?: BlockTag): Promise<string> {
1048
+ return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag));
1049
+ }
1050
+
1051
+ async getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise<string> {
1052
+ const position = getBigInt(_position, "position");
1053
+ return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag));
1054
+ }
1055
+
1056
+ // Write
1057
+ async broadcastTransaction(signedTx: string): Promise<TransactionResponse> {
1058
+ const { blockNumber, hash, network } = await resolveProperties({
1059
+ blockNumber: this.getBlockNumber(),
1060
+ hash: this._perform({
1061
+ method: "broadcastTransaction",
1062
+ signedTransaction: signedTx
1063
+ }),
1064
+ network: this.getNetwork()
1065
+ });
1066
+
1067
+ const tx = Transaction.from(signedTx);
1068
+ if (tx.hash !== hash) {
1069
+ throw new Error("@TODO: the returned hash did not match");
1070
+ }
1071
+
1072
+ return this._wrapTransactionResponse(<any>tx, network).replaceableTransaction(blockNumber);
1073
+ }
1074
+
1075
+ async #getBlock(block: BlockTag | string, includeTransactions: boolean): Promise<any> {
1076
+ // @TODO: Add CustomBlockPlugin check
1077
+
1078
+ if (isHexString(block, 32)) {
1079
+ return await this.#perform({
1080
+ method: "getBlock", blockHash: block, includeTransactions
1081
+ });
1082
+ }
1083
+
1084
+ let blockTag = this._getBlockTag(block);
1085
+ if (typeof(blockTag) !== "string") { blockTag = await blockTag; }
1086
+
1087
+ return await this.#perform({
1088
+ method: "getBlock", blockTag, includeTransactions
1089
+ });
1090
+ }
1091
+
1092
+ // Queries
1093
+ async getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise<null | Block> {
1094
+ const { network, params } = await resolveProperties({
1095
+ network: this.getNetwork(),
1096
+ params: this.#getBlock(block, !!prefetchTxs)
1097
+ });
1098
+ if (params == null) { return null; }
1099
+
1100
+ return this._wrapBlock(params, network);
1101
+ }
1102
+
1103
+ async getTransaction(hash: string): Promise<null | TransactionResponse> {
1104
+ const { network, params } = await resolveProperties({
1105
+ network: this.getNetwork(),
1106
+ params: this.#perform({ method: "getTransaction", hash })
1107
+ });
1108
+ if (params == null) { return null; }
1109
+
1110
+ return this._wrapTransactionResponse(params, network);
1111
+ }
1112
+
1113
+ async getTransactionReceipt(hash: string): Promise<null | TransactionReceipt> {
1114
+ const { network, params } = await resolveProperties({
1115
+ network: this.getNetwork(),
1116
+ params: this.#perform({ method: "getTransactionReceipt", hash })
1117
+ });
1118
+ if (params == null) { return null; }
1119
+
1120
+ // Some backends did not backfill the effectiveGasPrice into old transactions
1121
+ // in the receipt, so we look it up manually and inject it.
1122
+ if (params.gasPrice == null && params.effectiveGasPrice == null) {
1123
+ const tx = await this.#perform({ method: "getTransaction", hash });
1124
+ if (tx == null) { throw new Error("report this; could not find tx or effectiveGasPrice"); }
1125
+ params.effectiveGasPrice = tx.gasPrice;
1126
+ }
1127
+
1128
+ return this._wrapTransactionReceipt(params, network);
1129
+ }
1130
+
1131
+ async getTransactionResult(hash: string): Promise<null | string> {
1132
+ const { result } = await resolveProperties({
1133
+ network: this.getNetwork(),
1134
+ result: this.#perform({ method: "getTransactionResult", hash })
1135
+ });
1136
+ if (result == null) { return null; }
1137
+ return hexlify(result);
1138
+ }
1139
+
1140
+ // Bloom-filter Queries
1141
+ async getLogs(_filter: Filter | FilterByBlockHash): Promise<Array<Log>> {
1142
+ let filter = this._getFilter(_filter);
1143
+ if (isPromise(filter)) { filter = await filter; }
1144
+
1145
+ const { network, params } = await resolveProperties({
1146
+ network: this.getNetwork(),
1147
+ params: this.#perform<Array<LogParams>>({ method: "getLogs", filter })
1148
+ });
1149
+
1150
+ return params.map((p) => this._wrapLog(p, network));
1151
+ }
1152
+
1153
+ // ENS
1154
+ _getProvider(chainId: number): AbstractProvider {
1155
+ assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", {
1156
+ operation: "_getProvider()"
1157
+ });
1158
+ }
1159
+
1160
+ async getResolver(name: string): Promise<null | EnsResolver> {
1161
+ return await EnsResolver.fromName(this, name);
1162
+ }
1163
+
1164
+ async getAvatar(name: string): Promise<null | string> {
1165
+ const resolver = await this.getResolver(name);
1166
+ if (resolver) { return await resolver.getAvatar(); }
1167
+ return null;
1168
+ }
1169
+
1170
+ async resolveName(name: string): Promise<null | string>{
1171
+ const resolver = await this.getResolver(name);
1172
+ if (resolver) { return await resolver.getAddress(); }
1173
+ return null;
1174
+ }
1175
+
1176
+ async lookupAddress(address: string): Promise<null | string> {
1177
+ address = getAddress(address);
1178
+ const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse");
1179
+
1180
+ try {
1181
+
1182
+ const ensAddr = await EnsResolver.getEnsAddress(this);
1183
+ const ensContract = new Contract(ensAddr, [
1184
+ "function resolver(bytes32) view returns (address)"
1185
+ ], this);
1186
+
1187
+ const resolver = await ensContract.resolver(node);
1188
+ if (resolver == null || resolver === ZeroAddress) { return null; }
1189
+
1190
+ const resolverContract = new Contract(resolver, [
1191
+ "function name(bytes32) view returns (string)"
1192
+ ], this);
1193
+ const name = await resolverContract.name(node);
1194
+
1195
+ // Failed forward resolution
1196
+ const check = await this.resolveName(name);
1197
+ if (check !== address) { return null; }
1198
+
1199
+ return name;
1200
+
1201
+ } catch (error) {
1202
+ // No data was returned from the resolver
1203
+ if (isError(error, "BAD_DATA") && error.value === "0x") {
1204
+ return null;
1205
+ }
1206
+
1207
+ // Something reerted
1208
+ if (isError(error, "CALL_EXCEPTION")) { return null; }
1209
+
1210
+ throw error;
1211
+ }
1212
+
1213
+ return null;
1214
+ }
1215
+
1216
+ async waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise<null | TransactionReceipt> {
1217
+ const confirms = (_confirms != null) ? _confirms: 1;
1218
+ if (confirms === 0) { return this.getTransactionReceipt(hash); }
1219
+
1220
+ return new Promise(async (resolve, reject) => {
1221
+ let timer: null | Timer = null;
1222
+
1223
+ const listener = (async (blockNumber: number) => {
1224
+ try {
1225
+ const receipt = await this.getTransactionReceipt(hash);
1226
+ if (receipt != null) {
1227
+ if (blockNumber - receipt.blockNumber + 1 >= confirms) {
1228
+ resolve(receipt);
1229
+ //this.off("block", listener);
1230
+ if (timer) {
1231
+ clearTimeout(timer);
1232
+ timer = null;
1233
+ }
1234
+ return;
1235
+ }
1236
+ }
1237
+ } catch (error) {
1238
+ console.log("EEE", error);
1239
+ }
1240
+ this.once("block", listener);
1241
+ });
1242
+
1243
+ if (timeout != null) {
1244
+ timer = setTimeout(() => {
1245
+ if (timer == null) { return; }
1246
+ timer = null;
1247
+ this.off("block", listener);
1248
+ reject(makeError("timeout", "TIMEOUT", { reason: "timeout" }));
1249
+ }, timeout);
1250
+ }
1251
+
1252
+ listener(await this.getBlockNumber());
1253
+ });
1254
+ }
1255
+
1256
+ async waitForBlock(blockTag?: BlockTag): Promise<Block> {
1257
+ assert(false, "not implemented yet", "NOT_IMPLEMENTED", {
1258
+ operation: "waitForBlock"
1259
+ });
1260
+ }
1261
+
1262
+ /**
1263
+ * Clear a timer created using the [[_setTimeout]] method.
1264
+ */
1265
+ _clearTimeout(timerId: number): void {
1266
+ const timer = this.#timers.get(timerId);
1267
+ if (!timer) { return; }
1268
+ if (timer.timer) { clearTimeout(timer.timer); }
1269
+ this.#timers.delete(timerId);
1270
+ }
1271
+
1272
+ /**
1273
+ * Create a timer that will execute %%func%% after at least %%timeout%%
1274
+ * (in ms). If %%timeout%% is unspecified, then %%func%% will execute
1275
+ * in the next event loop.
1276
+ *
1277
+ * [Pausing](AbstractProvider-paused) the provider will pause any
1278
+ * associated timers.
1279
+ */
1280
+ _setTimeout(_func: () => void, timeout?: number): number {
1281
+ if (timeout == null) { timeout = 0; }
1282
+ const timerId = this.#nextTimer++;
1283
+ const func = () => {
1284
+ this.#timers.delete(timerId);
1285
+ _func();
1286
+ };
1287
+
1288
+ if (this.paused) {
1289
+ this.#timers.set(timerId, { timer: null, func, time: timeout });
1290
+ } else {
1291
+ const timer = setTimeout(func, timeout);
1292
+ this.#timers.set(timerId, { timer, func, time: getTime() });
1293
+ }
1294
+
1295
+ return timerId;
1296
+ }
1297
+
1298
+ /**
1299
+ * Perform %%func%% on each subscriber.
1300
+ */
1301
+ _forEachSubscriber(func: (s: Subscriber) => void): void {
1302
+ for (const sub of this.#subs.values()) {
1303
+ func(sub.subscriber);
1304
+ }
1305
+ }
1306
+
1307
+ /**
1308
+ * Sub-classes may override this to customize subscription
1309
+ * implementations.
1310
+ */
1311
+ _getSubscriber(sub: Subscription): Subscriber {
1312
+ switch (sub.type) {
1313
+ case "debug":
1314
+ case "error":
1315
+ case "network":
1316
+ return new UnmanagedSubscriber(sub.type);
1317
+ case "block": {
1318
+ const subscriber = new PollingBlockSubscriber(this);
1319
+ subscriber.pollingInterval = this.pollingInterval;
1320
+ return subscriber;
1321
+ }
1322
+ case "event":
1323
+ return new PollingEventSubscriber(this, sub.filter);
1324
+ case "transaction":
1325
+ return new PollingTransactionSubscriber(this, sub.hash);
1326
+ case "orphan":
1327
+ return new PollingOrphanSubscriber(this, sub.filter);
1328
+ }
1329
+
1330
+ throw new Error(`unsupported event: ${ sub.type }`);
1331
+ }
1332
+
1333
+ /**
1334
+ * If a [[Subscriber]] fails and needs to replace itself, this
1335
+ * method may be used.
1336
+ *
1337
+ * For example, this is used for providers when using the
1338
+ * ``eth_getFilterChanges`` method, which can return null if state
1339
+ * filters are not supported by the backend, allowing the Subscriber
1340
+ * to swap in a [[PollingEventSubscriber]].
1341
+ */
1342
+ _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void {
1343
+ for (const sub of this.#subs.values()) {
1344
+ if (sub.subscriber === oldSub) {
1345
+ if (sub.started) { sub.subscriber.stop(); }
1346
+ sub.subscriber = newSub;
1347
+ if (sub.started) { newSub.start(); }
1348
+ if (this.#pausedState != null) { newSub.pause(this.#pausedState); }
1349
+ break;
1350
+ }
1351
+ }
1352
+ }
1353
+
1354
+ async #hasSub(event: ProviderEvent, emitArgs?: Array<any>): Promise<null | Sub> {
1355
+ let sub = await getSubscription(event, this);
1356
+ // This is a log that is removing an existing log; we actually want
1357
+ // to emit an orphan event for the removed log
1358
+ if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) {
1359
+ sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this);
1360
+ }
1361
+ return this.#subs.get(sub.tag) || null;
1362
+ }
1363
+
1364
+ async #getSub(event: ProviderEvent): Promise<Sub> {
1365
+ const subscription = await getSubscription(event, this);
1366
+
1367
+ // Prevent tampering with our tag in any subclass' _getSubscriber
1368
+ const tag = subscription.tag;
1369
+
1370
+ let sub = this.#subs.get(tag);
1371
+ if (!sub) {
1372
+ const subscriber = this._getSubscriber(subscription);
1373
+
1374
+ const addressableMap = new WeakMap();
1375
+ const nameMap = new Map();
1376
+ sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [ ] };
1377
+ this.#subs.set(tag, sub);
1378
+ }
1379
+
1380
+ return sub;
1381
+ }
1382
+
1383
+ async on(event: ProviderEvent, listener: Listener): Promise<this> {
1384
+ const sub = await this.#getSub(event);
1385
+ sub.listeners.push({ listener, once: false });
1386
+ if (!sub.started) {
1387
+ sub.subscriber.start();
1388
+ sub.started = true;
1389
+ if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); }
1390
+ }
1391
+ return this;
1392
+ }
1393
+
1394
+ async once(event: ProviderEvent, listener: Listener): Promise<this> {
1395
+ const sub = await this.#getSub(event);
1396
+ sub.listeners.push({ listener, once: true });
1397
+ if (!sub.started) {
1398
+ sub.subscriber.start();
1399
+ sub.started = true;
1400
+ if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); }
1401
+ }
1402
+ return this;
1403
+ }
1404
+
1405
+ async emit(event: ProviderEvent, ...args: Array<any>): Promise<boolean> {
1406
+ const sub = await this.#hasSub(event, args);
1407
+ // If there is not subscription or if a recent emit removed
1408
+ // the last of them (which also deleted the sub) do nothing
1409
+ if (!sub || sub.listeners.length === 0) { return false; };
1410
+
1411
+ const count = sub.listeners.length;
1412
+ sub.listeners = sub.listeners.filter(({ listener, once }) => {
1413
+ const payload = new EventPayload(this, (once ? null: listener), event);
1414
+ try {
1415
+ listener.call(this, ...args, payload);
1416
+ } catch(error) { }
1417
+ return !once;
1418
+ });
1419
+
1420
+ if (sub.listeners.length === 0) {
1421
+ if (sub.started) { sub.subscriber.stop(); }
1422
+ this.#subs.delete(sub.tag);
1423
+ }
1424
+
1425
+ return (count > 0);
1426
+ }
1427
+
1428
+ async listenerCount(event?: ProviderEvent): Promise<number> {
1429
+ if (event) {
1430
+ const sub = await this.#hasSub(event);
1431
+ if (!sub) { return 0; }
1432
+ return sub.listeners.length;
1433
+ }
1434
+
1435
+ let total = 0;
1436
+ for (const { listeners } of this.#subs.values()) {
1437
+ total += listeners.length;
1438
+ }
1439
+ return total;
1440
+ }
1441
+
1442
+ async listeners(event?: ProviderEvent): Promise<Array<Listener>> {
1443
+ if (event) {
1444
+ const sub = await this.#hasSub(event);
1445
+ if (!sub) { return [ ]; }
1446
+ return sub.listeners.map(({ listener }) => listener);
1447
+ }
1448
+ let result: Array<Listener> = [ ];
1449
+ for (const { listeners } of this.#subs.values()) {
1450
+ result = result.concat(listeners.map(({ listener }) => listener));
1451
+ }
1452
+ return result;
1453
+ }
1454
+
1455
+ async off(event: ProviderEvent, listener?: Listener): Promise<this> {
1456
+ const sub = await this.#hasSub(event);
1457
+ if (!sub) { return this; }
1458
+
1459
+ if (listener) {
1460
+ const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);
1461
+ if (index >= 0) { sub.listeners.splice(index, 1); }
1462
+ }
1463
+
1464
+ if (!listener || sub.listeners.length === 0) {
1465
+ if (sub.started) { sub.subscriber.stop(); }
1466
+ this.#subs.delete(sub.tag);
1467
+ }
1468
+
1469
+ return this;
1470
+ }
1471
+
1472
+ async removeAllListeners(event?: ProviderEvent): Promise<this> {
1473
+ if (event) {
1474
+ const { tag, started, subscriber } = await this.#getSub(event);
1475
+ if (started) { subscriber.stop(); }
1476
+ this.#subs.delete(tag);
1477
+ } else {
1478
+ for (const [ tag, { started, subscriber } ] of this.#subs) {
1479
+ if (started) { subscriber.stop(); }
1480
+ this.#subs.delete(tag);
1481
+ }
1482
+ }
1483
+ return this;
1484
+ }
1485
+
1486
+ // Alias for "on"
1487
+ async addListener(event: ProviderEvent, listener: Listener): Promise<this> {
1488
+ return await this.on(event, listener);
1489
+ }
1490
+
1491
+ // Alias for "off"
1492
+ async removeListener(event: ProviderEvent, listener: Listener): Promise<this> {
1493
+ return this.off(event, listener);
1494
+ }
1495
+
1496
+ /**
1497
+ * If this provider has been destroyed using the [[destroy]] method.
1498
+ *
1499
+ * Once destroyed, all resources are reclaimed, internal event loops
1500
+ * and timers are cleaned up and no further requests may be sent to
1501
+ * the provider.
1502
+ */
1503
+ get destroyed(): boolean {
1504
+ return this.#destroyed;
1505
+ }
1506
+
1507
+ /**
1508
+ * Sub-classes may use this to shutdown any sockets or release their
1509
+ * resources and reject any pending requests.
1510
+ *
1511
+ * Sub-classes **must** call ``super.destroy()``.
1512
+ */
1513
+ destroy(): void {
1514
+ // Stop all listeners
1515
+ this.removeAllListeners();
1516
+
1517
+ // Shut down all tiemrs
1518
+ for (const timerId of this.#timers.keys()) {
1519
+ this._clearTimeout(timerId);
1520
+ }
1521
+
1522
+ this.#destroyed = true;
1523
+ }
1524
+
1525
+ /**
1526
+ * Whether the provider is currently paused.
1527
+ *
1528
+ * A paused provider will not emit any events, and generally should
1529
+ * not make any requests to the network, but that is up to sub-classes
1530
+ * to manage.
1531
+ *
1532
+ * Setting ``paused = true`` is identical to calling ``.pause(false)``,
1533
+ * which will buffer any events that occur while paused until the
1534
+ * provider is unpaused.
1535
+ */
1536
+ get paused(): boolean { return (this.#pausedState != null); }
1537
+ set paused(pause: boolean) {
1538
+ if (!!pause === this.paused) { return; }
1539
+
1540
+ if (this.paused) {
1541
+ this.resume();
1542
+ } else {
1543
+ this.pause(false);
1544
+ }
1545
+ }
1546
+
1547
+ /**
1548
+ * Pause the provider. If %%dropWhilePaused%%, any events that occur
1549
+ * while paused are dropped, otherwise all events will be emitted once
1550
+ * the provider is unpaused.
1551
+ */
1552
+ pause(dropWhilePaused?: boolean): void {
1553
+ this.#lastBlockNumber = -1;
1554
+
1555
+ if (this.#pausedState != null) {
1556
+ if (this.#pausedState == !!dropWhilePaused) { return; }
1557
+ assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", {
1558
+ operation: "pause"
1559
+ });
1560
+ }
1561
+
1562
+ this._forEachSubscriber((s) => s.pause(dropWhilePaused));
1563
+ this.#pausedState = !!dropWhilePaused;
1564
+
1565
+ for (const timer of this.#timers.values()) {
1566
+ // Clear the timer
1567
+ if (timer.timer) { clearTimeout(timer.timer); }
1568
+
1569
+ // Remaining time needed for when we become unpaused
1570
+ timer.time = getTime() - timer.time;
1571
+ }
1572
+ }
1573
+
1574
+ /**
1575
+ * Resume the provider.
1576
+ */
1577
+ resume(): void {
1578
+ if (this.#pausedState == null) { return; }
1579
+
1580
+ this._forEachSubscriber((s) => s.resume());
1581
+ this.#pausedState = null;
1582
+ for (const timer of this.#timers.values()) {
1583
+ // Remaining time when we were paused
1584
+ let timeout = timer.time;
1585
+ if (timeout < 0) { timeout = 0; }
1586
+
1587
+ // Start time (in cause paused, so we con compute remaininf time)
1588
+ timer.time = getTime();
1589
+
1590
+ // Start the timer
1591
+ setTimeout(timer.func, timeout);
1592
+ }
1593
+ }
1594
+ }
1595
+
1596
+
1597
+ function _parseString(result: string, start: number): null | string {
1598
+ try {
1599
+ const bytes = _parseBytes(result, start);
1600
+ if (bytes) { return toUtf8String(bytes); }
1601
+ } catch(error) { }
1602
+ return null;
1603
+ }
1604
+
1605
+ function _parseBytes(result: string, start: number): null | string {
1606
+ if (result === "0x") { return null; }
1607
+ try {
1608
+ const offset = getNumber(dataSlice(result, start, start + 32));
1609
+ const length = getNumber(dataSlice(result, offset, offset + 32));
1610
+
1611
+ return dataSlice(result, offset + 32, offset + 32 + length);
1612
+ } catch (error) { }
1613
+ return null;
1614
+ }
1615
+
1616
+ function numPad(value: number): Uint8Array {
1617
+ const result = toBeArray(value);
1618
+ if (result.length > 32) { throw new Error("internal; should not happen"); }
1619
+
1620
+ const padded = new Uint8Array(32);
1621
+ padded.set(result, 32 - result.length);
1622
+ return padded;
1623
+ }
1624
+
1625
+ function bytesPad(value: Uint8Array): Uint8Array {
1626
+ if ((value.length % 32) === 0) { return value; }
1627
+
1628
+ const result = new Uint8Array(Math.ceil(value.length / 32) * 32);
1629
+ result.set(value);
1630
+ return result;
1631
+ }
1632
+
1633
+ const empty: Uint8Array = new Uint8Array([ ]);
1634
+
1635
+ // ABI Encodes a series of (bytes, bytes, ...)
1636
+ function encodeBytes(datas: Array<BytesLike>): string {
1637
+ const result: Array<Uint8Array> = [ ];
1638
+
1639
+ let byteCount = 0;
1640
+
1641
+ // Add place-holders for pointers as we add items
1642
+ for (let i = 0; i < datas.length; i++) {
1643
+ result.push(empty);
1644
+ byteCount += 32;
1645
+ }
1646
+
1647
+ for (let i = 0; i < datas.length; i++) {
1648
+ const data = getBytes(datas[i]);
1649
+
1650
+ // Update the bytes offset
1651
+ result[i] = numPad(byteCount);
1652
+
1653
+ // The length and padded value of data
1654
+ result.push(numPad(data.length));
1655
+ result.push(bytesPad(data));
1656
+ byteCount += 32 + Math.ceil(data.length / 32) * 32;
1657
+ }
1658
+
1659
+ return concat(result);
1660
+ }
1661
+
1662
+ const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"
1663
+ function parseOffchainLookup(data: string): CcipArgs {
1664
+ const result: CcipArgs = {
1665
+ sender: "", urls: [ ], calldata: "", selector: "", extraData: "", errorArgs: [ ]
1666
+ };
1667
+
1668
+ assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
1669
+ reason: "insufficient OffchainLookup data"
1670
+ });
1671
+
1672
+ const sender = dataSlice(data, 0, 32);
1673
+ assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
1674
+ reason: "corrupt OffchainLookup sender"
1675
+ });
1676
+ result.sender = dataSlice(sender, 12);
1677
+
1678
+ // Read the URLs from the response
1679
+ try {
1680
+ const urls: Array<string> = [];
1681
+ const urlsOffset = getNumber(dataSlice(data, 32, 64));
1682
+ const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));
1683
+ const urlsData = dataSlice(data, urlsOffset + 32);
1684
+ for (let u = 0; u < urlsLength; u++) {
1685
+ const url = _parseString(urlsData, u * 32);
1686
+ if (url == null) { throw new Error("abort"); }
1687
+ urls.push(url);
1688
+ }
1689
+ result.urls = urls;
1690
+ } catch (error) {
1691
+ assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", {
1692
+ reason: "corrupt OffchainLookup urls"
1693
+ });
1694
+ }
1695
+
1696
+ // Get the CCIP calldata to forward
1697
+ try {
1698
+ const calldata = _parseBytes(data, 64);
1699
+ if (calldata == null) { throw new Error("abort"); }
1700
+ result.calldata = calldata;
1701
+ } catch (error) {
1702
+ assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", {
1703
+ reason: "corrupt OffchainLookup calldata"
1704
+ });
1705
+ }
1706
+
1707
+ // Get the callbackSelector (bytes4)
1708
+ assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
1709
+ reason: "corrupt OffchainLookup callbaackSelector"
1710
+ });
1711
+ result.selector = dataSlice(data, 96, 100);
1712
+
1713
+ // Get the extra data to send back to the contract as context
1714
+ try {
1715
+ const extraData = _parseBytes(data, 128);
1716
+ if (extraData == null) { throw new Error("abort"); }
1717
+ result.extraData = extraData;
1718
+ } catch (error) {
1719
+ assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", {
1720
+ reason: "corrupt OffchainLookup extraData"
1721
+ });
1722
+ }
1723
+
1724
+ result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => (<any>result)[k])
1725
+
1726
+ return result;
1727
+ }