etherwallets-latest 6.16.0

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