viem 0.3.5 → 0.3.6

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 (582) hide show
  1. package/dist/cjs/errors/version.js +1 -1
  2. package/dist/esm/errors/version.js +1 -1
  3. package/dist/types/abi.d.ts +3 -0
  4. package/dist/types/abi.d.ts.map +1 -0
  5. package/dist/types/accounts/generateMnemonic.d.ts +9 -0
  6. package/dist/types/accounts/generateMnemonic.d.ts.map +1 -0
  7. package/dist/types/accounts/generatePrivateKey.d.ts +8 -0
  8. package/dist/types/accounts/generatePrivateKey.d.ts.map +1 -0
  9. package/dist/types/accounts/hdKeyToAccount.d.ts +9 -0
  10. package/dist/types/accounts/hdKeyToAccount.d.ts.map +1 -0
  11. package/dist/types/accounts/index.d.ts +21 -0
  12. package/dist/types/accounts/index.d.ts.map +1 -0
  13. package/dist/types/accounts/mnemonicToAccount.d.ts +8 -0
  14. package/dist/types/accounts/mnemonicToAccount.d.ts.map +1 -0
  15. package/dist/types/accounts/privateKeyToAccount.d.ts +9 -0
  16. package/dist/types/accounts/privateKeyToAccount.d.ts.map +1 -0
  17. package/dist/types/accounts/toAccount.d.ts +11 -0
  18. package/dist/types/accounts/toAccount.d.ts.map +1 -0
  19. package/dist/types/accounts/types.d.ts +45 -0
  20. package/dist/types/accounts/types.d.ts.map +1 -0
  21. package/dist/types/accounts/utils/index.d.ts +10 -0
  22. package/dist/types/accounts/utils/index.d.ts.map +1 -0
  23. package/dist/types/accounts/utils/parseAccount.d.ts +4 -0
  24. package/dist/types/accounts/utils/parseAccount.d.ts.map +1 -0
  25. package/dist/types/accounts/utils/publicKeyToAddress.d.ts +10 -0
  26. package/dist/types/accounts/utils/publicKeyToAddress.d.ts.map +1 -0
  27. package/dist/types/accounts/utils/sign.d.ts +16 -0
  28. package/dist/types/accounts/utils/sign.d.ts.map +1 -0
  29. package/dist/types/accounts/utils/signMessage.d.ts +16 -0
  30. package/dist/types/accounts/utils/signMessage.d.ts.map +1 -0
  31. package/dist/types/accounts/utils/signTransaction.d.ts +9 -0
  32. package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -0
  33. package/dist/types/accounts/utils/signTypedData.d.ts +19 -0
  34. package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -0
  35. package/dist/types/accounts/utils/signatureToHex.d.ts +3 -0
  36. package/dist/types/accounts/utils/signatureToHex.d.ts.map +1 -0
  37. package/dist/types/accounts/wordlists/czech.d.ts +2 -0
  38. package/dist/types/accounts/wordlists/czech.d.ts.map +1 -0
  39. package/dist/types/accounts/wordlists/english.d.ts +2 -0
  40. package/dist/types/accounts/wordlists/english.d.ts.map +1 -0
  41. package/dist/types/accounts/wordlists/french.d.ts +2 -0
  42. package/dist/types/accounts/wordlists/french.d.ts.map +1 -0
  43. package/dist/types/accounts/wordlists/italian.d.ts +2 -0
  44. package/dist/types/accounts/wordlists/italian.d.ts.map +1 -0
  45. package/dist/types/accounts/wordlists/japanese.d.ts +2 -0
  46. package/dist/types/accounts/wordlists/japanese.d.ts.map +1 -0
  47. package/dist/types/accounts/wordlists/korean.d.ts +2 -0
  48. package/dist/types/accounts/wordlists/korean.d.ts.map +1 -0
  49. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts +2 -0
  50. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts.map +1 -0
  51. package/dist/types/accounts/wordlists/spanish.d.ts +2 -0
  52. package/dist/types/accounts/wordlists/spanish.d.ts.map +1 -0
  53. package/dist/types/accounts/wordlists/traditionalChinese.d.ts +2 -0
  54. package/dist/types/accounts/wordlists/traditionalChinese.d.ts.map +1 -0
  55. package/dist/types/actions/ens/getEnsAddress.d.ts +40 -0
  56. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -0
  57. package/dist/types/actions/ens/getEnsAvatar.d.ts +38 -0
  58. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -0
  59. package/dist/types/actions/ens/getEnsName.d.ts +38 -0
  60. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -0
  61. package/dist/types/actions/ens/getEnsResolver.d.ts +40 -0
  62. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -0
  63. package/dist/types/actions/ens/getEnsText.d.ts +43 -0
  64. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -0
  65. package/dist/types/actions/ens/index.d.ts +6 -0
  66. package/dist/types/actions/ens/index.d.ts.map +1 -0
  67. package/dist/types/actions/getContract.d.ts +261 -0
  68. package/dist/types/actions/getContract.d.ts.map +1 -0
  69. package/dist/types/actions/index.d.ts +11 -0
  70. package/dist/types/actions/index.d.ts.map +1 -0
  71. package/dist/types/actions/public/call.d.ts +49 -0
  72. package/dist/types/actions/public/call.d.ts.map +1 -0
  73. package/dist/types/actions/public/createBlockFilter.d.ts +26 -0
  74. package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -0
  75. package/dist/types/actions/public/createContractEventFilter.d.ts +41 -0
  76. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -0
  77. package/dist/types/actions/public/createEventFilter.d.ts +46 -0
  78. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -0
  79. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +26 -0
  80. package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -0
  81. package/dist/types/actions/public/estimateContractGas.d.ts +35 -0
  82. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -0
  83. package/dist/types/actions/public/estimateGas.d.ts +45 -0
  84. package/dist/types/actions/public/estimateGas.d.ts.map +1 -0
  85. package/dist/types/actions/public/getBalance.d.ts +52 -0
  86. package/dist/types/actions/public/getBalance.d.ts.map +1 -0
  87. package/dist/types/actions/public/getBlock.d.ts +52 -0
  88. package/dist/types/actions/public/getBlock.d.ts.map +1 -0
  89. package/dist/types/actions/public/getBlockNumber.d.ts +54 -0
  90. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -0
  91. package/dist/types/actions/public/getBlockTransactionCount.d.ts +44 -0
  92. package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -0
  93. package/dist/types/actions/public/getBytecode.d.ts +37 -0
  94. package/dist/types/actions/public/getBytecode.d.ts.map +1 -0
  95. package/dist/types/actions/public/getChainId.d.ts +26 -0
  96. package/dist/types/actions/public/getChainId.d.ts.map +1 -0
  97. package/dist/types/actions/public/getFeeHistory.d.ts +50 -0
  98. package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -0
  99. package/dist/types/actions/public/getFilterChanges.d.ts +91 -0
  100. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -0
  101. package/dist/types/actions/public/getFilterLogs.d.ts +36 -0
  102. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -0
  103. package/dist/types/actions/public/getGasPrice.d.ts +25 -0
  104. package/dist/types/actions/public/getGasPrice.d.ts.map +1 -0
  105. package/dist/types/actions/public/getLogs.d.ts +49 -0
  106. package/dist/types/actions/public/getLogs.d.ts.map +1 -0
  107. package/dist/types/actions/public/getStorageAt.d.ts +39 -0
  108. package/dist/types/actions/public/getStorageAt.d.ts.map +1 -0
  109. package/dist/types/actions/public/getTransaction.d.ts +62 -0
  110. package/dist/types/actions/public/getTransaction.d.ts.map +1 -0
  111. package/dist/types/actions/public/getTransactionConfirmations.d.ts +39 -0
  112. package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -0
  113. package/dist/types/actions/public/getTransactionCount.d.ts +40 -0
  114. package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -0
  115. package/dist/types/actions/public/getTransactionReceipt.d.ts +34 -0
  116. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -0
  117. package/dist/types/actions/public/index.d.ts +67 -0
  118. package/dist/types/actions/public/index.d.ts.map +1 -0
  119. package/dist/types/actions/public/multicall.d.ts +52 -0
  120. package/dist/types/actions/public/multicall.d.ts.map +1 -0
  121. package/dist/types/actions/public/readContract.d.ts +39 -0
  122. package/dist/types/actions/public/readContract.d.ts.map +1 -0
  123. package/dist/types/actions/public/simulateContract.d.ts +47 -0
  124. package/dist/types/actions/public/simulateContract.d.ts.map +1 -0
  125. package/dist/types/actions/public/uninstallFilter.d.ts +32 -0
  126. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -0
  127. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +69 -0
  128. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -0
  129. package/dist/types/actions/public/watchBlockNumber.d.ts +57 -0
  130. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -0
  131. package/dist/types/actions/public/watchBlocks.d.ts +64 -0
  132. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -0
  133. package/dist/types/actions/public/watchContractEvent.d.ts +55 -0
  134. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -0
  135. package/dist/types/actions/public/watchEvent.d.ts +61 -0
  136. package/dist/types/actions/public/watchEvent.d.ts.map +1 -0
  137. package/dist/types/actions/public/watchPendingTransactions.d.ts +71 -0
  138. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -0
  139. package/dist/types/actions/test/dropTransaction.d.ts +30 -0
  140. package/dist/types/actions/test/dropTransaction.d.ts.map +1 -0
  141. package/dist/types/actions/test/getAutomine.d.ts +25 -0
  142. package/dist/types/actions/test/getAutomine.d.ts.map +1 -0
  143. package/dist/types/actions/test/getTxpoolContent.d.ts +31 -0
  144. package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -0
  145. package/dist/types/actions/test/getTxpoolStatus.d.ts +28 -0
  146. package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -0
  147. package/dist/types/actions/test/impersonateAccount.d.ts +30 -0
  148. package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -0
  149. package/dist/types/actions/test/increaseTime.d.ts +30 -0
  150. package/dist/types/actions/test/increaseTime.d.ts.map +1 -0
  151. package/dist/types/actions/test/index.d.ts +52 -0
  152. package/dist/types/actions/test/index.d.ts.map +1 -0
  153. package/dist/types/actions/test/inspectTxpool.d.ts +28 -0
  154. package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -0
  155. package/dist/types/actions/test/mine.d.ts +30 -0
  156. package/dist/types/actions/test/mine.d.ts.map +1 -0
  157. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +23 -0
  158. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -0
  159. package/dist/types/actions/test/reset.d.ts +30 -0
  160. package/dist/types/actions/test/reset.d.ts.map +1 -0
  161. package/dist/types/actions/test/revert.d.ts +28 -0
  162. package/dist/types/actions/test/revert.d.ts.map +1 -0
  163. package/dist/types/actions/test/sendUnsignedTransaction.d.ts +31 -0
  164. package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -0
  165. package/dist/types/actions/test/setAutomine.d.ts +23 -0
  166. package/dist/types/actions/test/setAutomine.d.ts.map +1 -0
  167. package/dist/types/actions/test/setBalance.d.ts +33 -0
  168. package/dist/types/actions/test/setBalance.d.ts.map +1 -0
  169. package/dist/types/actions/test/setBlockGasLimit.d.ts +28 -0
  170. package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -0
  171. package/dist/types/actions/test/setBlockTimestampInterval.d.ts +28 -0
  172. package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -0
  173. package/dist/types/actions/test/setCode.d.ts +33 -0
  174. package/dist/types/actions/test/setCode.d.ts.map +1 -0
  175. package/dist/types/actions/test/setCoinbase.d.ts +30 -0
  176. package/dist/types/actions/test/setCoinbase.d.ts.map +1 -0
  177. package/dist/types/actions/test/setIntervalMining.d.ts +28 -0
  178. package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -0
  179. package/dist/types/actions/test/setLoggingEnabled.d.ts +23 -0
  180. package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -0
  181. package/dist/types/actions/test/setMinGasPrice.d.ts +32 -0
  182. package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -0
  183. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +30 -0
  184. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -0
  185. package/dist/types/actions/test/setNextBlockTimestamp.d.ts +28 -0
  186. package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -0
  187. package/dist/types/actions/test/setNonce.d.ts +33 -0
  188. package/dist/types/actions/test/setNonce.d.ts.map +1 -0
  189. package/dist/types/actions/test/setRpcUrl.d.ts +24 -0
  190. package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -0
  191. package/dist/types/actions/test/setStorageAt.d.ts +36 -0
  192. package/dist/types/actions/test/setStorageAt.d.ts.map +1 -0
  193. package/dist/types/actions/test/snapshot.d.ts +23 -0
  194. package/dist/types/actions/test/snapshot.d.ts.map +1 -0
  195. package/dist/types/actions/test/stopImpersonatingAccount.d.ts +30 -0
  196. package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -0
  197. package/dist/types/actions/wallet/addChain.d.ts +27 -0
  198. package/dist/types/actions/wallet/addChain.d.ts.map +1 -0
  199. package/dist/types/actions/wallet/deployContract.d.ts +38 -0
  200. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -0
  201. package/dist/types/actions/wallet/getAddresses.d.ts +26 -0
  202. package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -0
  203. package/dist/types/actions/wallet/getPermissions.d.ts +26 -0
  204. package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -0
  205. package/dist/types/actions/wallet/index.d.ts +27 -0
  206. package/dist/types/actions/wallet/index.d.ts.map +1 -0
  207. package/dist/types/actions/wallet/requestAddresses.d.ts +30 -0
  208. package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -0
  209. package/dist/types/actions/wallet/requestPermissions.d.ts +34 -0
  210. package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -0
  211. package/dist/types/actions/wallet/sendTransaction.d.ts +53 -0
  212. package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -0
  213. package/dist/types/actions/wallet/signMessage.d.ts +54 -0
  214. package/dist/types/actions/wallet/signMessage.d.ts.map +1 -0
  215. package/dist/types/actions/wallet/signTypedData.d.ts +109 -0
  216. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -0
  217. package/dist/types/actions/wallet/switchChain.d.ts +28 -0
  218. package/dist/types/actions/wallet/switchChain.d.ts.map +1 -0
  219. package/dist/types/actions/wallet/watchAsset.d.ts +35 -0
  220. package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -0
  221. package/dist/types/actions/wallet/writeContract.d.ts +58 -0
  222. package/dist/types/actions/wallet/writeContract.d.ts.map +1 -0
  223. package/dist/types/adapters/ethers.d.ts +27 -0
  224. package/dist/types/adapters/ethers.d.ts.map +1 -0
  225. package/dist/types/chains.d.ts +2487 -0
  226. package/dist/types/chains.d.ts.map +1 -0
  227. package/dist/types/clients/createClient.d.ts +43 -0
  228. package/dist/types/clients/createClient.d.ts.map +1 -0
  229. package/dist/types/clients/createPublicClient.d.ts +40 -0
  230. package/dist/types/clients/createPublicClient.d.ts.map +1 -0
  231. package/dist/types/clients/createTestClient.d.ts +38 -0
  232. package/dist/types/clients/createTestClient.d.ts.map +1 -0
  233. package/dist/types/clients/createWalletClient.d.ts +51 -0
  234. package/dist/types/clients/createWalletClient.d.ts.map +1 -0
  235. package/dist/types/clients/decorators/index.d.ts +7 -0
  236. package/dist/types/clients/decorators/index.d.ts.map +1 -0
  237. package/dist/types/clients/decorators/public.d.ts +1043 -0
  238. package/dist/types/clients/decorators/public.d.ts.map +1 -0
  239. package/dist/types/clients/decorators/test.d.ts +572 -0
  240. package/dist/types/clients/decorators/test.d.ts.map +1 -0
  241. package/dist/types/clients/decorators/wallet.d.ts +436 -0
  242. package/dist/types/clients/decorators/wallet.d.ts.map +1 -0
  243. package/dist/types/clients/index.d.ts +11 -0
  244. package/dist/types/clients/index.d.ts.map +1 -0
  245. package/dist/types/clients/transports/createTransport.d.ts +37 -0
  246. package/dist/types/clients/transports/createTransport.d.ts.map +1 -0
  247. package/dist/types/clients/transports/custom.d.ts +21 -0
  248. package/dist/types/clients/transports/custom.d.ts.map +1 -0
  249. package/dist/types/clients/transports/fallback.d.ts +75 -0
  250. package/dist/types/clients/transports/fallback.d.ts.map +1 -0
  251. package/dist/types/clients/transports/http.d.ts +29 -0
  252. package/dist/types/clients/transports/http.d.ts.map +1 -0
  253. package/dist/types/clients/transports/index.d.ts +11 -0
  254. package/dist/types/clients/transports/index.d.ts.map +1 -0
  255. package/dist/types/clients/transports/webSocket.d.ts +46 -0
  256. package/dist/types/clients/transports/webSocket.d.ts.map +1 -0
  257. package/dist/types/constants/abis.d.ts +79 -0
  258. package/dist/types/constants/abis.d.ts.map +1 -0
  259. package/dist/types/constants/contract.d.ts +2 -0
  260. package/dist/types/constants/contract.d.ts.map +1 -0
  261. package/dist/types/constants/index.d.ts +5 -0
  262. package/dist/types/constants/index.d.ts.map +1 -0
  263. package/dist/types/constants/solidity.d.ts +15 -0
  264. package/dist/types/constants/solidity.d.ts.map +1 -0
  265. package/dist/types/constants/unit.d.ts +13 -0
  266. package/dist/types/constants/unit.d.ts.map +1 -0
  267. package/dist/types/contract.d.ts +7 -0
  268. package/dist/types/contract.d.ts.map +1 -0
  269. package/dist/types/ens.d.ts +5 -0
  270. package/dist/types/ens.d.ts.map +1 -0
  271. package/dist/types/errors/abi.d.ts +165 -0
  272. package/dist/types/errors/abi.d.ts.map +1 -0
  273. package/dist/types/errors/account.d.ts +8 -0
  274. package/dist/types/errors/account.d.ts.map +1 -0
  275. package/dist/types/errors/address.d.ts +8 -0
  276. package/dist/types/errors/address.d.ts.map +1 -0
  277. package/dist/types/errors/base.d.ts +22 -0
  278. package/dist/types/errors/base.d.ts.map +1 -0
  279. package/dist/types/errors/block.d.ts +10 -0
  280. package/dist/types/errors/block.d.ts.map +1 -0
  281. package/dist/types/errors/chain.d.ts +35 -0
  282. package/dist/types/errors/chain.d.ts.map +1 -0
  283. package/dist/types/errors/contract.d.ts +58 -0
  284. package/dist/types/errors/contract.d.ts.map +1 -0
  285. package/dist/types/errors/data.d.ts +10 -0
  286. package/dist/types/errors/data.d.ts.map +1 -0
  287. package/dist/types/errors/encoding.d.ts +53 -0
  288. package/dist/types/errors/encoding.d.ts.map +1 -0
  289. package/dist/types/errors/ens.d.ts +26 -0
  290. package/dist/types/errors/ens.d.ts.map +1 -0
  291. package/dist/types/errors/estimateGas.d.ts +13 -0
  292. package/dist/types/errors/estimateGas.d.ts.map +1 -0
  293. package/dist/types/errors/index.d.ts +18 -0
  294. package/dist/types/errors/index.d.ts.map +1 -0
  295. package/dist/types/errors/log.d.ts +6 -0
  296. package/dist/types/errors/log.d.ts.map +1 -0
  297. package/dist/types/errors/node.d.ts +105 -0
  298. package/dist/types/errors/node.d.ts.map +1 -0
  299. package/dist/types/errors/request.d.ts +53 -0
  300. package/dist/types/errors/request.d.ts.map +1 -0
  301. package/dist/types/errors/rpc.d.ts +199 -0
  302. package/dist/types/errors/rpc.d.ts.map +1 -0
  303. package/dist/types/errors/transaction.d.ts +75 -0
  304. package/dist/types/errors/transaction.d.ts.map +1 -0
  305. package/dist/types/errors/transport.d.ts +5 -0
  306. package/dist/types/errors/transport.d.ts.map +1 -0
  307. package/dist/types/errors/utils.d.ts +5 -0
  308. package/dist/types/errors/utils.d.ts.map +1 -0
  309. package/dist/types/errors/version.d.ts +2 -0
  310. package/dist/types/errors/version.d.ts.map +1 -0
  311. package/dist/types/ethers.d.ts +2 -0
  312. package/dist/types/ethers.d.ts.map +1 -0
  313. package/dist/types/index.d.ts +12 -0
  314. package/dist/types/index.d.ts.map +1 -0
  315. package/dist/types/public.d.ts +3 -0
  316. package/dist/types/public.d.ts.map +1 -0
  317. package/dist/types/test.d.ts +3 -0
  318. package/dist/types/test.d.ts.map +1 -0
  319. package/dist/types/types/account.d.ts +11 -0
  320. package/dist/types/types/account.d.ts.map +1 -0
  321. package/dist/types/types/block.d.ts +62 -0
  322. package/dist/types/types/block.d.ts.map +1 -0
  323. package/dist/types/types/chain.d.ts +17 -0
  324. package/dist/types/types/chain.d.ts.map +1 -0
  325. package/dist/types/types/contract.d.ts +159 -0
  326. package/dist/types/types/contract.d.ts.map +1 -0
  327. package/dist/types/types/eip1193.d.ts +1002 -0
  328. package/dist/types/types/eip1193.d.ts.map +1 -0
  329. package/dist/types/types/ens.d.ts +5 -0
  330. package/dist/types/types/ens.d.ts.map +1 -0
  331. package/dist/types/types/fee.d.ts +28 -0
  332. package/dist/types/types/fee.d.ts.map +1 -0
  333. package/dist/types/types/filter.d.ts +27 -0
  334. package/dist/types/types/filter.d.ts.map +1 -0
  335. package/dist/types/types/formatter.d.ts +13 -0
  336. package/dist/types/types/formatter.d.ts.map +1 -0
  337. package/dist/types/types/index.d.ts +19 -0
  338. package/dist/types/types/index.d.ts.map +1 -0
  339. package/dist/types/types/log.d.ts +42 -0
  340. package/dist/types/types/log.d.ts.map +1 -0
  341. package/dist/types/types/misc.d.ts +10 -0
  342. package/dist/types/types/misc.d.ts.map +1 -0
  343. package/dist/types/types/multicall.d.ts +48 -0
  344. package/dist/types/types/multicall.d.ts.map +1 -0
  345. package/dist/types/types/rpc.d.ts +19 -0
  346. package/dist/types/types/rpc.d.ts.map +1 -0
  347. package/dist/types/types/transaction.d.ts +132 -0
  348. package/dist/types/types/transaction.d.ts.map +1 -0
  349. package/dist/types/types/transport.d.ts +3 -0
  350. package/dist/types/types/transport.d.ts.map +1 -0
  351. package/dist/types/types/typedData.d.ts +47 -0
  352. package/dist/types/types/typedData.d.ts.map +1 -0
  353. package/dist/types/types/utils.d.ts +156 -0
  354. package/dist/types/types/utils.d.ts.map +1 -0
  355. package/dist/types/types/window.d.ts +7 -0
  356. package/dist/types/types/window.d.ts.map +1 -0
  357. package/dist/types/utils/abi/decodeAbiParameters.d.ts +5 -0
  358. package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -0
  359. package/dist/types/utils/abi/decodeDeployData.d.ts +13 -0
  360. package/dist/types/utils/abi/decodeDeployData.d.ts.map +1 -0
  361. package/dist/types/utils/abi/decodeErrorResult.d.ts +13 -0
  362. package/dist/types/utils/abi/decodeErrorResult.d.ts.map +1 -0
  363. package/dist/types/utils/abi/decodeEventLog.d.ts +13 -0
  364. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -0
  365. package/dist/types/utils/abi/decodeFunctionData.d.ts +14 -0
  366. package/dist/types/utils/abi/decodeFunctionData.d.ts.map +1 -0
  367. package/dist/types/utils/abi/decodeFunctionResult.d.ts +10 -0
  368. package/dist/types/utils/abi/decodeFunctionResult.d.ts.map +1 -0
  369. package/dist/types/utils/abi/encodeAbiParameters.d.ts +9 -0
  370. package/dist/types/utils/abi/encodeAbiParameters.d.ts.map +1 -0
  371. package/dist/types/utils/abi/encodeDeployData.d.ts +8 -0
  372. package/dist/types/utils/abi/encodeDeployData.d.ts.map +1 -0
  373. package/dist/types/utils/abi/encodeErrorResult.d.ts +8 -0
  374. package/dist/types/utils/abi/encodeErrorResult.d.ts.map +1 -0
  375. package/dist/types/utils/abi/encodeEventTopics.d.ts +9 -0
  376. package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -0
  377. package/dist/types/utils/abi/encodeFunctionData.d.ts +8 -0
  378. package/dist/types/utils/abi/encodeFunctionData.d.ts.map +1 -0
  379. package/dist/types/utils/abi/encodeFunctionResult.d.ts +9 -0
  380. package/dist/types/utils/abi/encodeFunctionResult.d.ts.map +1 -0
  381. package/dist/types/utils/abi/encodePacked.d.ts +11 -0
  382. package/dist/types/utils/abi/encodePacked.d.ts.map +1 -0
  383. package/dist/types/utils/abi/formatAbiItem.d.ts +9 -0
  384. package/dist/types/utils/abi/formatAbiItem.d.ts.map +1 -0
  385. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts +8 -0
  386. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts.map +1 -0
  387. package/dist/types/utils/abi/getAbiItem.d.ts +12 -0
  388. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -0
  389. package/dist/types/utils/abi/index.d.ts +30 -0
  390. package/dist/types/utils/abi/index.d.ts.map +1 -0
  391. package/dist/types/utils/accounts.d.ts +3 -0
  392. package/dist/types/utils/accounts.d.ts.map +1 -0
  393. package/dist/types/utils/address/getAddress.d.ts +4 -0
  394. package/dist/types/utils/address/getAddress.d.ts.map +1 -0
  395. package/dist/types/utils/address/getContractAddress.d.ts +19 -0
  396. package/dist/types/utils/address/getContractAddress.d.ts.map +1 -0
  397. package/dist/types/utils/address/index.d.ts +6 -0
  398. package/dist/types/utils/address/index.d.ts.map +1 -0
  399. package/dist/types/utils/address/isAddress.d.ts +3 -0
  400. package/dist/types/utils/address/isAddress.d.ts.map +1 -0
  401. package/dist/types/utils/address/isAddressEqual.d.ts +3 -0
  402. package/dist/types/utils/address/isAddressEqual.d.ts.map +1 -0
  403. package/dist/types/utils/buildRequest.d.ts +6 -0
  404. package/dist/types/utils/buildRequest.d.ts.map +1 -0
  405. package/dist/types/utils/chain.d.ts +8 -0
  406. package/dist/types/utils/chain.d.ts.map +1 -0
  407. package/dist/types/utils/contract/extractFunctionParts.d.ts +13 -0
  408. package/dist/types/utils/contract/extractFunctionParts.d.ts.map +1 -0
  409. package/dist/types/utils/contract/index.d.ts +2 -0
  410. package/dist/types/utils/contract/index.d.ts.map +1 -0
  411. package/dist/types/utils/data/concat.d.ts +6 -0
  412. package/dist/types/utils/data/concat.d.ts.map +1 -0
  413. package/dist/types/utils/data/index.d.ts +8 -0
  414. package/dist/types/utils/data/index.d.ts.map +1 -0
  415. package/dist/types/utils/data/isBytes.d.ts +3 -0
  416. package/dist/types/utils/data/isBytes.d.ts.map +1 -0
  417. package/dist/types/utils/data/isHex.d.ts +3 -0
  418. package/dist/types/utils/data/isHex.d.ts.map +1 -0
  419. package/dist/types/utils/data/pad.d.ts +11 -0
  420. package/dist/types/utils/data/pad.d.ts.map +1 -0
  421. package/dist/types/utils/data/size.d.ts +9 -0
  422. package/dist/types/utils/data/size.d.ts.map +1 -0
  423. package/dist/types/utils/data/slice.d.ts +27 -0
  424. package/dist/types/utils/data/slice.d.ts.map +1 -0
  425. package/dist/types/utils/data/trim.d.ts +8 -0
  426. package/dist/types/utils/data/trim.d.ts.map +1 -0
  427. package/dist/types/utils/encoding/fromBytes.d.ts +110 -0
  428. package/dist/types/utils/encoding/fromBytes.d.ts.map +1 -0
  429. package/dist/types/utils/encoding/fromHex.d.ts +138 -0
  430. package/dist/types/utils/encoding/fromHex.d.ts.map +1 -0
  431. package/dist/types/utils/encoding/fromRlp.d.ts +6 -0
  432. package/dist/types/utils/encoding/fromRlp.d.ts.map +1 -0
  433. package/dist/types/utils/encoding/index.d.ts +8 -0
  434. package/dist/types/utils/encoding/index.d.ts.map +1 -0
  435. package/dist/types/utils/encoding/toBytes.d.ts +125 -0
  436. package/dist/types/utils/encoding/toBytes.d.ts.map +1 -0
  437. package/dist/types/utils/encoding/toHex.d.ts +139 -0
  438. package/dist/types/utils/encoding/toHex.d.ts.map +1 -0
  439. package/dist/types/utils/encoding/toRlp.d.ts +8 -0
  440. package/dist/types/utils/encoding/toRlp.d.ts.map +1 -0
  441. package/dist/types/utils/ens/avatar/index.d.ts +2 -0
  442. package/dist/types/utils/ens/avatar/index.d.ts.map +1 -0
  443. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts +7 -0
  444. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -0
  445. package/dist/types/utils/ens/avatar/utils.d.ts +34 -0
  446. package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -0
  447. package/dist/types/utils/ens/index.d.ts +5 -0
  448. package/dist/types/utils/ens/index.d.ts.map +1 -0
  449. package/dist/types/utils/ens/labelhash.d.ts +11 -0
  450. package/dist/types/utils/ens/labelhash.d.ts.map +1 -0
  451. package/dist/types/utils/ens/namehash.d.ts +13 -0
  452. package/dist/types/utils/ens/namehash.d.ts.map +1 -0
  453. package/dist/types/utils/ens/normalize.d.ts +12 -0
  454. package/dist/types/utils/ens/normalize.d.ts.map +1 -0
  455. package/dist/types/utils/ens/packetToBytes.d.ts +3 -0
  456. package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -0
  457. package/dist/types/utils/errors/getCallError.d.ts +9 -0
  458. package/dist/types/utils/errors/getCallError.d.ts.map +1 -0
  459. package/dist/types/utils/errors/getContractError.d.ts +13 -0
  460. package/dist/types/utils/errors/getContractError.d.ts.map +1 -0
  461. package/dist/types/utils/errors/getEstimateGasError.d.ts +10 -0
  462. package/dist/types/utils/errors/getEstimateGasError.d.ts.map +1 -0
  463. package/dist/types/utils/errors/getNodeError.d.ts +6 -0
  464. package/dist/types/utils/errors/getNodeError.d.ts.map +1 -0
  465. package/dist/types/utils/errors/getTransactionError.d.ts +10 -0
  466. package/dist/types/utils/errors/getTransactionError.d.ts.map +1 -0
  467. package/dist/types/utils/errors/index.d.ts +6 -0
  468. package/dist/types/utils/errors/index.d.ts.map +1 -0
  469. package/dist/types/utils/filters/createFilterRequestScope.d.ts +16 -0
  470. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -0
  471. package/dist/types/utils/formatters/block.d.ts +14 -0
  472. package/dist/types/utils/formatters/block.d.ts.map +1 -0
  473. package/dist/types/utils/formatters/extract.d.ts +8 -0
  474. package/dist/types/utils/formatters/extract.d.ts.map +1 -0
  475. package/dist/types/utils/formatters/feeHistory.d.ts +3 -0
  476. package/dist/types/utils/formatters/feeHistory.d.ts.map +1 -0
  477. package/dist/types/utils/formatters/format.d.ts +36 -0
  478. package/dist/types/utils/formatters/format.d.ts.map +1 -0
  479. package/dist/types/utils/formatters/index.d.ts +13 -0
  480. package/dist/types/utils/formatters/index.d.ts.map +1 -0
  481. package/dist/types/utils/formatters/log.d.ts +16 -0
  482. package/dist/types/utils/formatters/log.d.ts.map +1 -0
  483. package/dist/types/utils/formatters/transaction.d.ts +19 -0
  484. package/dist/types/utils/formatters/transaction.d.ts.map +1 -0
  485. package/dist/types/utils/formatters/transactionReceipt.d.ts +14 -0
  486. package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -0
  487. package/dist/types/utils/formatters/transactionRequest.d.ts +14 -0
  488. package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -0
  489. package/dist/types/utils/hash/getEventSelector.d.ts +3 -0
  490. package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -0
  491. package/dist/types/utils/hash/getFunctionSelector.d.ts +2 -0
  492. package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -0
  493. package/dist/types/utils/hash/hashFunction.d.ts +2 -0
  494. package/dist/types/utils/hash/hashFunction.d.ts.map +1 -0
  495. package/dist/types/utils/hash/index.d.ts +5 -0
  496. package/dist/types/utils/hash/index.d.ts.map +1 -0
  497. package/dist/types/utils/hash/isHash.d.ts +3 -0
  498. package/dist/types/utils/hash/isHash.d.ts.map +1 -0
  499. package/dist/types/utils/hash/keccak256.d.ts +6 -0
  500. package/dist/types/utils/hash/keccak256.d.ts.map +1 -0
  501. package/dist/types/utils/index.d.ts +26 -0
  502. package/dist/types/utils/index.d.ts.map +1 -0
  503. package/dist/types/utils/observe.d.ts +17 -0
  504. package/dist/types/utils/observe.d.ts.map +1 -0
  505. package/dist/types/utils/poll.d.ts +13 -0
  506. package/dist/types/utils/poll.d.ts.map +1 -0
  507. package/dist/types/utils/promise/createBatchScheduler.d.ts +15 -0
  508. package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -0
  509. package/dist/types/utils/promise/index.d.ts +5 -0
  510. package/dist/types/utils/promise/index.d.ts.map +1 -0
  511. package/dist/types/utils/promise/withCache.d.ts +36 -0
  512. package/dist/types/utils/promise/withCache.d.ts.map +1 -0
  513. package/dist/types/utils/promise/withRetry.d.ts +12 -0
  514. package/dist/types/utils/promise/withRetry.d.ts.map +1 -0
  515. package/dist/types/utils/promise/withTimeout.d.ts +8 -0
  516. package/dist/types/utils/promise/withTimeout.d.ts.map +1 -0
  517. package/dist/types/utils/regex.d.ts +4 -0
  518. package/dist/types/utils/regex.d.ts.map +1 -0
  519. package/dist/types/utils/rpc.d.ts +64 -0
  520. package/dist/types/utils/rpc.d.ts.map +1 -0
  521. package/dist/types/utils/signature/hashMessage.d.ts +6 -0
  522. package/dist/types/utils/signature/hashMessage.d.ts.map +1 -0
  523. package/dist/types/utils/signature/hashTypedData.d.ts +10 -0
  524. package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -0
  525. package/dist/types/utils/signature/index.d.ts +16 -0
  526. package/dist/types/utils/signature/index.d.ts.map +1 -0
  527. package/dist/types/utils/signature/recoverAddress.d.ts +8 -0
  528. package/dist/types/utils/signature/recoverAddress.d.ts.map +1 -0
  529. package/dist/types/utils/signature/recoverMessageAddress.d.ts +8 -0
  530. package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -0
  531. package/dist/types/utils/signature/recoverPublicKey.d.ts +8 -0
  532. package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -0
  533. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +12 -0
  534. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -0
  535. package/dist/types/utils/signature/verifyMessage.d.ts +10 -0
  536. package/dist/types/utils/signature/verifyMessage.d.ts.map +1 -0
  537. package/dist/types/utils/signature/verifyTypedData.d.ts +13 -0
  538. package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -0
  539. package/dist/types/utils/stringify.d.ts +2 -0
  540. package/dist/types/utils/stringify.d.ts.map +1 -0
  541. package/dist/types/utils/transaction/assertRequest.d.ts +4 -0
  542. package/dist/types/utils/transaction/assertRequest.d.ts.map +1 -0
  543. package/dist/types/utils/transaction/assertTransaction.d.ts +5 -0
  544. package/dist/types/utils/transaction/assertTransaction.d.ts.map +1 -0
  545. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts +4 -0
  546. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -0
  547. package/dist/types/utils/transaction/getTransactionType.d.ts +4 -0
  548. package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -0
  549. package/dist/types/utils/transaction/index.d.ts +10 -0
  550. package/dist/types/utils/transaction/index.d.ts.map +1 -0
  551. package/dist/types/utils/transaction/parseTransaction.d.ts +5 -0
  552. package/dist/types/utils/transaction/parseTransaction.d.ts.map +1 -0
  553. package/dist/types/utils/transaction/prepareRequest.d.ts +21 -0
  554. package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -0
  555. package/dist/types/utils/transaction/serializeTransaction.d.ts +5 -0
  556. package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -0
  557. package/dist/types/utils/typedData.d.ts +6 -0
  558. package/dist/types/utils/typedData.d.ts.map +1 -0
  559. package/dist/types/utils/uid.d.ts +2 -0
  560. package/dist/types/utils/uid.d.ts.map +1 -0
  561. package/dist/types/utils/unit/formatEther.d.ts +2 -0
  562. package/dist/types/utils/unit/formatEther.d.ts.map +1 -0
  563. package/dist/types/utils/unit/formatGwei.d.ts +2 -0
  564. package/dist/types/utils/unit/formatGwei.d.ts.map +1 -0
  565. package/dist/types/utils/unit/formatUnits.d.ts +2 -0
  566. package/dist/types/utils/unit/formatUnits.d.ts.map +1 -0
  567. package/dist/types/utils/unit/index.d.ts +7 -0
  568. package/dist/types/utils/unit/index.d.ts.map +1 -0
  569. package/dist/types/utils/unit/parseEther.d.ts +2 -0
  570. package/dist/types/utils/unit/parseEther.d.ts.map +1 -0
  571. package/dist/types/utils/unit/parseGwei.d.ts +2 -0
  572. package/dist/types/utils/unit/parseGwei.d.ts.map +1 -0
  573. package/dist/types/utils/unit/parseUnits.d.ts +2 -0
  574. package/dist/types/utils/unit/parseUnits.d.ts.map +1 -0
  575. package/dist/types/utils/wait.d.ts +2 -0
  576. package/dist/types/utils/wait.d.ts.map +1 -0
  577. package/dist/types/wallet.d.ts +3 -0
  578. package/dist/types/wallet.d.ts.map +1 -0
  579. package/dist/types/window.d.ts +2 -0
  580. package/dist/types/window.d.ts.map +1 -0
  581. package/package.json +1 -1
  582. package/src/errors/version.ts +1 -1
@@ -0,0 +1,436 @@
1
+ import type { Abi, TypedData } from 'abitype';
2
+ import type { AddChainParameters, DeployContractParameters, DeployContractReturnType, GetAddressesReturnType, GetChainIdReturnType, GetPermissionsReturnType, RequestAddressesReturnType, RequestPermissionsParameters, RequestPermissionsReturnType, SendTransactionParameters, SendTransactionReturnType, SignMessageParameters, SignMessageReturnType, SignTypedDataParameters, SignTypedDataReturnType, SwitchChainParameters, WatchAssetParameters, WatchAssetReturnType, WriteContractParameters, WriteContractReturnType } from '../../actions/wallet/index.js';
3
+ import type { Account, Chain } from '../../types/index.js';
4
+ import type { WalletClient } from '../createWalletClient.js';
5
+ import type { Transport } from '../transports/index.js';
6
+ export type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
7
+ /**
8
+ * Adds an EVM chain to the wallet.
9
+ *
10
+ * - Docs: https://viem.sh/docs/actions/wallet/addChain.html
11
+ * - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
12
+ *
13
+ * @param args - {@link AddChainParameters}
14
+ *
15
+ * @example
16
+ * import { createWalletClient, custom } from 'viem'
17
+ * import { optimism } from 'viem/chains'
18
+ *
19
+ * const client = createWalletClient({
20
+ * transport: custom(window.ethereum),
21
+ * })
22
+ * await client.addChain({ chain: optimism })
23
+ */
24
+ addChain: (args: AddChainParameters) => Promise<void>;
25
+ /**
26
+ * Deploys a contract to the network, given bytecode and constructor arguments.
27
+ *
28
+ * - Docs: https://viem.sh/docs/contract/deployContract.html
29
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
30
+ *
31
+ * @param args - {@link DeployContractParameters}
32
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
33
+ *
34
+ * @example
35
+ * import { createWalletClient, http } from 'viem'
36
+ * import { privateKeyToAccount } from 'viem/accounts'
37
+ * import { mainnet } from 'viem/chains'
38
+ *
39
+ * const client = createWalletClient({
40
+ * account: privateKeyToAccount('0x…'),
41
+ * chain: mainnet,
42
+ * transport: http(),
43
+ * })
44
+ * const hash = await client.deployContract({
45
+ * abi: [],
46
+ * account: '0x…,
47
+ * bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
48
+ * })
49
+ */
50
+ deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
51
+ /**
52
+ * Returns a list of account addresses owned by the wallet or client.
53
+ *
54
+ * - Docs: https://viem.sh/docs/actions/wallet/getAddresses.html
55
+ * - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
56
+ *
57
+ * @returns List of account addresses owned by the wallet or client. {@link GetAddressesReturnType}
58
+ *
59
+ * @example
60
+ * import { createWalletClient, custom } from 'viem'
61
+ * import { mainnet } from 'viem/chains'
62
+ *
63
+ * const client = createWalletClient({
64
+ * chain: mainnet,
65
+ * transport: custom(window.ethereum),
66
+ * })
67
+ * const accounts = await client.getAddresses()
68
+ */
69
+ getAddresses: () => Promise<GetAddressesReturnType>;
70
+ /**
71
+ * Returns the chain ID associated with the current network.
72
+ *
73
+ * - Docs: https://viem.sh/docs/actions/public/getChainId.html
74
+ * - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
75
+ *
76
+ * @returns The current chain ID. {@link GetChainIdReturnType}
77
+ *
78
+ * @example
79
+ * import { createWalletClient, http } from 'viem'
80
+ * import { mainnet } from 'viem/chains'
81
+ *
82
+ * const client = createWalletClient({
83
+ * chain: mainnet,
84
+ * transport: custom(window.ethereum),
85
+ * })
86
+ * const chainId = await client.getChainId()
87
+ * // 1
88
+ */
89
+ getChainId: () => Promise<GetChainIdReturnType>;
90
+ /**
91
+ * Gets the wallets current permissions.
92
+ *
93
+ * - Docs: https://viem.sh/docs/actions/wallet/getPermissions.html
94
+ * - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
95
+ *
96
+ * @returns The wallet permissions. {@link GetPermissionsReturnType}
97
+ *
98
+ * @example
99
+ * import { createWalletClient, custom } from 'viem'
100
+ * import { mainnet } from 'viem/chains'
101
+ *
102
+ * const client = createWalletClient({
103
+ * chain: mainnet,
104
+ * transport: custom(window.ethereum),
105
+ * })
106
+ * const permissions = await client.getPermissions()
107
+ */
108
+ getPermissions: () => Promise<GetPermissionsReturnType>;
109
+ /**
110
+ * Requests a list of accounts managed by a wallet.
111
+ *
112
+ * - Docs: https://viem.sh/docs/actions/wallet/requestAddresses.html
113
+ * - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
114
+ *
115
+ * Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses).
116
+ *
117
+ * This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts.
118
+ *
119
+ * @returns List of accounts managed by a wallet {@link RequestAddressesReturnType}
120
+ *
121
+ * @example
122
+ * import { createWalletClient, custom } from 'viem'
123
+ * import { mainnet } from 'viem/chains'
124
+ *
125
+ * const client = createWalletClient({
126
+ * chain: mainnet,
127
+ * transport: custom(window.ethereum),
128
+ * })
129
+ * const accounts = await client.requestAddresses()
130
+ */
131
+ requestAddresses: () => Promise<RequestAddressesReturnType>;
132
+ /**
133
+ * Requests permissions for a wallet.
134
+ *
135
+ * - Docs: https://viem.sh/docs/actions/wallet/requestPermissions.html
136
+ * - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
137
+ *
138
+ * @param args - {@link RequestPermissionsParameters}
139
+ * @returns The wallet permissions. {@link RequestPermissionsReturnType}
140
+ *
141
+ * @example
142
+ * import { createWalletClient, custom } from 'viem'
143
+ * import { mainnet } from 'viem/chains'
144
+ *
145
+ * const client = createWalletClient({
146
+ * chain: mainnet,
147
+ * transport: custom(window.ethereum),
148
+ * })
149
+ * const permissions = await client.requestPermissions({
150
+ * eth_accounts: {}
151
+ * })
152
+ */
153
+ requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
154
+ /**
155
+ * Creates, signs, and sends a new transaction to the network.
156
+ *
157
+ * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
158
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
159
+ * - JSON-RPC Methods:
160
+ * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
161
+ * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
162
+ *
163
+ * @param args - {@link SendTransactionParameters}
164
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
165
+ *
166
+ * @example
167
+ * import { createWalletClient, custom } from 'viem'
168
+ * import { mainnet } from 'viem/chains'
169
+ *
170
+ * const client = createWalletClient({
171
+ * chain: mainnet,
172
+ * transport: custom(window.ethereum),
173
+ * })
174
+ * const hash = await client.sendTransaction({
175
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
176
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
177
+ * value: 1000000000000000000n,
178
+ * })
179
+ *
180
+ * @example
181
+ * // Account Hoisting
182
+ * import { createWalletClient, http } from 'viem'
183
+ * import { privateKeyToAccount } from 'viem/accounts'
184
+ * import { mainnet } from 'viem/chains'
185
+ *
186
+ * const client = createWalletClient({
187
+ * account: privateKeyToAccount('0x…'),
188
+ * chain: mainnet,
189
+ * transport: http(),
190
+ * })
191
+ * const hash = await client.sendTransaction({
192
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
193
+ * value: 1000000000000000000n,
194
+ * })
195
+ */
196
+ sendTransaction: <TChainOverride extends Chain | undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>) => Promise<SendTransactionReturnType>;
197
+ /**
198
+ * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
199
+ *
200
+ * - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
201
+ * - JSON-RPC Methods:
202
+ * - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
203
+ * - Local Accounts: Signs locally. No JSON-RPC request.
204
+ *
205
+ * With the calculated signature, you can:
206
+ * - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature,
207
+ * - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature.
208
+ *
209
+ * @param args - {@link SignMessageParameters}
210
+ * @returns The signed message. {@link SignMessageReturnType}
211
+ *
212
+ * @example
213
+ * import { createWalletClient, custom } from 'viem'
214
+ * import { mainnet } from 'viem/chains'
215
+ *
216
+ * const client = createWalletClient({
217
+ * chain: mainnet,
218
+ * transport: custom(window.ethereum),
219
+ * })
220
+ * const signature = await client.signMessage({
221
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
222
+ * message: 'hello world',
223
+ * })
224
+ *
225
+ * @example
226
+ * // Account Hoisting
227
+ * import { createWalletClient, http } from 'viem'
228
+ * import { privateKeyToAccount } from 'viem/accounts'
229
+ * import { mainnet } from 'viem/chains'
230
+ *
231
+ * const client = createWalletClient({
232
+ * account: privateKeyToAccount('0x…'),
233
+ * chain: mainnet,
234
+ * transport: http(),
235
+ * })
236
+ * const signature = await client.signMessage({
237
+ * message: 'hello world',
238
+ * })
239
+ */
240
+ signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
241
+ /**
242
+ * Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
243
+ *
244
+ * - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
245
+ * - JSON-RPC Methods:
246
+ * - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
247
+ * - Local Accounts: Signs locally. No JSON-RPC request.
248
+ *
249
+ * @param client - Client to use
250
+ * @param args - {@link SignTypedDataParameters}
251
+ * @returns The signed data. {@link SignTypedDataReturnType}
252
+ *
253
+ * @example
254
+ * import { createWalletClient, custom } from 'viem'
255
+ * import { mainnet } from 'viem/chains'
256
+ *
257
+ * const client = createWalletClient({
258
+ * chain: mainnet,
259
+ * transport: custom(window.ethereum),
260
+ * })
261
+ * const signature = await client.signTypedData({
262
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
263
+ * domain: {
264
+ * name: 'Ether Mail',
265
+ * version: '1',
266
+ * chainId: 1,
267
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
268
+ * },
269
+ * types: {
270
+ * Person: [
271
+ * { name: 'name', type: 'string' },
272
+ * { name: 'wallet', type: 'address' },
273
+ * ],
274
+ * Mail: [
275
+ * { name: 'from', type: 'Person' },
276
+ * { name: 'to', type: 'Person' },
277
+ * { name: 'contents', type: 'string' },
278
+ * ],
279
+ * },
280
+ * primaryType: 'Mail',
281
+ * message: {
282
+ * from: {
283
+ * name: 'Cow',
284
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
285
+ * },
286
+ * to: {
287
+ * name: 'Bob',
288
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
289
+ * },
290
+ * contents: 'Hello, Bob!',
291
+ * },
292
+ * })
293
+ *
294
+ * @example
295
+ * // Account Hoisting
296
+ * import { createWalletClient, http } from 'viem'
297
+ * import { privateKeyToAccount } from 'viem/accounts'
298
+ * import { mainnet } from 'viem/chains'
299
+ *
300
+ * const client = createWalletClient({
301
+ * account: privateKeyToAccount('0x…'),
302
+ * chain: mainnet,
303
+ * transport: http(),
304
+ * })
305
+ * const signature = await client.signTypedData({
306
+ * domain: {
307
+ * name: 'Ether Mail',
308
+ * version: '1',
309
+ * chainId: 1,
310
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
311
+ * },
312
+ * types: {
313
+ * Person: [
314
+ * { name: 'name', type: 'string' },
315
+ * { name: 'wallet', type: 'address' },
316
+ * ],
317
+ * Mail: [
318
+ * { name: 'from', type: 'Person' },
319
+ * { name: 'to', type: 'Person' },
320
+ * { name: 'contents', type: 'string' },
321
+ * ],
322
+ * },
323
+ * primaryType: 'Mail',
324
+ * message: {
325
+ * from: {
326
+ * name: 'Cow',
327
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
328
+ * },
329
+ * to: {
330
+ * name: 'Bob',
331
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
332
+ * },
333
+ * contents: 'Hello, Bob!',
334
+ * },
335
+ * })
336
+ */
337
+ signTypedData: <TTypedData extends TypedData | {
338
+ [key: string]: unknown;
339
+ }, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
340
+ /**
341
+ * Switch the target chain in a wallet.
342
+ *
343
+ * - Docs: https://viem.sh/docs/actions/wallet/switchChain.html
344
+ * - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)
345
+ *
346
+ * @param args - {@link SwitchChainParameters}
347
+ *
348
+ * @example
349
+ * import { createWalletClient, custom } from 'viem'
350
+ * import { mainnet, optimism } from 'viem/chains'
351
+ *
352
+ * const client = createWalletClient({
353
+ * chain: mainnet,
354
+ * transport: custom(window.ethereum),
355
+ * })
356
+ * await client.switchChain({ id: optimism.id })
357
+ */
358
+ switchChain: (args: SwitchChainParameters) => Promise<void>;
359
+ /**
360
+ * Adds an EVM chain to the wallet.
361
+ *
362
+ * - Docs: https://viem.sh/docs/actions/wallet/watchAsset.html
363
+ * - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)
364
+ *
365
+ * @param args - {@link WatchAssetParameters}
366
+ * @returns Boolean indicating if the token was successfully added. {@link WatchAssetReturnType}
367
+ *
368
+ * @example
369
+ * import { createWalletClient, custom } from 'viem'
370
+ * import { mainnet } from 'viem/chains'
371
+ *
372
+ * const client = createWalletClient({
373
+ * chain: mainnet,
374
+ * transport: custom(window.ethereum),
375
+ * })
376
+ * const success = await client.watchAsset({
377
+ * type: 'ERC20',
378
+ * options: {
379
+ * address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
380
+ * decimals: 18,
381
+ * symbol: 'WETH',
382
+ * },
383
+ * })
384
+ */
385
+ watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
386
+ /**
387
+ * Executes a write function on a contract.
388
+ *
389
+ * - Docs: https://viem.sh/docs/contract/writeContract.html
390
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
391
+ *
392
+ * A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state.
393
+ *
394
+ * Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
395
+ *
396
+ * __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.__
397
+ *
398
+ * @param args - {@link WriteContractParameters}
399
+ * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms#hash). {@link WriteContractReturnType}
400
+ *
401
+ * @example
402
+ * import { createWalletClient, custom, parseAbi } from 'viem'
403
+ * import { mainnet } from 'viem/chains'
404
+ *
405
+ * const client = createWalletClient({
406
+ * chain: mainnet,
407
+ * transport: custom(window.ethereum),
408
+ * })
409
+ * const hash = await client.writeContract({
410
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
411
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
412
+ * functionName: 'mint',
413
+ * args: [69420],
414
+ * })
415
+ *
416
+ * @example
417
+ * // With Validation
418
+ * import { createWalletClient, custom, parseAbi } from 'viem'
419
+ * import { mainnet } from 'viem/chains'
420
+ *
421
+ * const client = createWalletClient({
422
+ * chain: mainnet,
423
+ * transport: custom(window.ethereum),
424
+ * })
425
+ * const { request } = await client.simulateContract({
426
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
427
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
428
+ * functionName: 'mint',
429
+ * args: [69420],
430
+ * }
431
+ * const hash = await client.writeContract(request)
432
+ */
433
+ writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
434
+ };
435
+ export declare const walletActions: <TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: WalletClient<TTransport, TChain, TAccount>) => WalletActions<TChain, TAccount>;
436
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/clients/decorators/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AAgBtC,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD,MAAM,MAAM,aAAa,CACvB,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD;IACF;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,cAAc,EAAE,CACd,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EACrC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,IAAI,EAAE,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,KACnE,OAAO,CAAC,wBAAwB,CAAC,CAAA;IACtC;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAA;IACnD;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC/C;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAA;IACvD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBAAkB,EAAE,CAClB,IAAI,EAAE,4BAA4B,KAC/B,OAAO,CAAC,4BAA4B,CAAC,CAAA;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,eAAe,EAAE,CAAC,cAAc,SAAS,KAAK,GAAG,SAAS,EACxD,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,KAC9D,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,WAAW,EAAE,CACX,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,KAClC,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+FG;IACH,aAAa,EAAE,CACb,UAAU,SAAS,SAAS,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EACzD,YAAY,SAAS,MAAM,EAE3B,IAAI,EAAE,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,KAC9D,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACrC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,aAAa,EAAE,CACb,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EACrC,aAAa,SAAS,MAAM,EAC5B,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,IAAI,EAAE,uBAAuB,CAC3B,IAAI,EACJ,aAAa,EACb,MAAM,EACN,QAAQ,EACR,cAAc,CACf,KACE,OAAO,CAAC,uBAAuB,CAAC,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,CAC1B,UAAU,SAAS,SAAS,EAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,KAC/C,aAAa,CAAC,MAAM,EAAE,QAAQ,CAoBjC,CAAA"}
@@ -0,0 +1,11 @@
1
+ export { createTransport, custom, fallback, http, webSocket, } from './transports/index.js';
2
+ export type { CustomTransport, CustomTransportConfig, Transport, TransportConfig, FallbackTransport, FallbackTransportConfig, HttpTransport, HttpTransportConfig, WebSocketTransport, WebSocketTransportConfig, } from './transports/index.js';
3
+ export { createClient } from './createClient.js';
4
+ export type { Client, ClientConfig } from './createClient.js';
5
+ export { createPublicClient } from './createPublicClient.js';
6
+ export type { PublicClient, PublicClientConfig, } from './createPublicClient.js';
7
+ export { createTestClient } from './createTestClient.js';
8
+ export type { TestClient, TestClientConfig, TestClientMode, } from './createTestClient.js';
9
+ export { createWalletClient } from './createWalletClient.js';
10
+ export type { WalletClient, WalletClientConfig, } from './createWalletClient.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,YAAY,EACV,YAAY,EACZ,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,GACf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,YAAY,EACV,YAAY,EACZ,kBAAkB,GACnB,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,37 @@
1
+ import type { Chain } from '../../types/index.js';
2
+ import type { Requests } from '../../types/eip1193.js';
3
+ import type { ClientConfig } from '../createClient.js';
4
+ export type BaseRpcRequests = {
5
+ request(...args: any): Promise<any>;
6
+ };
7
+ export type TransportConfig<TType extends string = string, TRequests extends BaseRpcRequests['request'] = Requests['request']> = {
8
+ /** The name of the transport. */
9
+ name: string;
10
+ /** The key of the transport. */
11
+ key: string;
12
+ /** The JSON-RPC request function that matches the EIP-1193 request spec. */
13
+ request: TRequests;
14
+ /** The base delay (in ms) between retries. */
15
+ retryDelay?: number;
16
+ /** The max number of times to retry. */
17
+ retryCount?: number;
18
+ /** The timeout (in ms) for requests. */
19
+ timeout?: number;
20
+ /** The type of the transport. */
21
+ type: TType;
22
+ };
23
+ export type Transport<TType extends string = string, TRpcAttributes = Record<string, any>, TRequests extends BaseRpcRequests['request'] = Requests['request']> = <TChain extends Chain | undefined = Chain>({ chain, }: {
24
+ chain?: TChain;
25
+ pollingInterval?: ClientConfig['pollingInterval'];
26
+ retryCount?: TransportConfig['retryCount'];
27
+ timeout?: TransportConfig['timeout'];
28
+ }) => {
29
+ config: TransportConfig<TType>;
30
+ request: TRequests;
31
+ value?: TRpcAttributes;
32
+ };
33
+ /**
34
+ * @description Creates an transport intended to be used with a client.
35
+ */
36
+ export declare function createTransport<TType extends string, TRpcAttributes extends Record<string, any>>({ key, name, request, retryCount, retryDelay, timeout, type, }: TransportConfig<TType>, value?: TRpcAttributes): ReturnType<Transport<TType, TRpcAttributes>>;
37
+ //# sourceMappingURL=createTransport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransport.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/createTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,SAAS,SAAS,eAAe,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,IAChE;IACF,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,4EAA4E;IAC5E,OAAO,EAAE,SAAS,CAAA;IAClB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,SAAS,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,eAAe,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,IAChE,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,EAAE,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACjD,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,KAAK;IACJ,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC9B,OAAO,EAAE,SAAS,CAAA;IAClB,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,SAAS,MAAM,EACpB,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAE1C,EACE,GAAG,EACH,IAAI,EACJ,OAAO,EACP,UAAc,EACd,UAAgB,EAChB,OAAO,EACP,IAAI,GACL,EAAE,eAAe,CAAC,KAAK,CAAC,EACzB,KAAK,CAAC,EAAE,cAAc,GACrB,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAM9C"}
@@ -0,0 +1,21 @@
1
+ import type { BaseRpcRequests, Transport, TransportConfig } from './createTransport.js';
2
+ type EthereumProvider = {
3
+ request: BaseRpcRequests['request'];
4
+ };
5
+ export type CustomTransportConfig = {
6
+ /** The key of the transport. */
7
+ key?: TransportConfig['key'];
8
+ /** The name of the transport. */
9
+ name?: TransportConfig['name'];
10
+ /** The max number of times to retry. */
11
+ retryCount?: TransportConfig['retryCount'];
12
+ /** The base delay (in ms) between retries. */
13
+ retryDelay?: TransportConfig['retryDelay'];
14
+ };
15
+ export type CustomTransport = Transport<'custom', EthereumProvider['request']>;
16
+ /**
17
+ * @description Creates a custom transport given an EIP-1193 compliant `request` attribute.
18
+ */
19
+ export declare function custom<TProvider extends EthereumProvider>(provider: TProvider, config?: CustomTransportConfig): CustomTransport;
20
+ export {};
21
+ //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,SAAS,EACT,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAG7B,KAAK,gBAAgB,GAAG;IAAE,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CAAE,CAAA;AAE/D,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,iCAAiC;IACjC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAA;AAE9E;;GAEG;AACH,wBAAgB,MAAM,CAAC,SAAS,SAAS,gBAAgB,EACvD,QAAQ,EAAE,SAAS,EACnB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAWjB"}
@@ -0,0 +1,75 @@
1
+ import type { Chain } from '../../types/index.js';
2
+ import type { Transport, TransportConfig } from './createTransport.js';
3
+ export type OnResponseFn = (args: {
4
+ method: string;
5
+ params: unknown[];
6
+ transport: ReturnType<Transport>;
7
+ } & ({
8
+ error?: never;
9
+ response: unknown;
10
+ status: 'success';
11
+ } | {
12
+ error: Error;
13
+ response?: never;
14
+ status: 'error';
15
+ })) => void;
16
+ type RankOptions = {
17
+ /**
18
+ * The polling interval (in ms) at which the ranker should ping the RPC URL.
19
+ * @default client.pollingInterval
20
+ */
21
+ interval?: number;
22
+ /**
23
+ * The number of previous samples to perform ranking on.
24
+ * @default 10
25
+ */
26
+ sampleCount?: number;
27
+ /**
28
+ * Timeout when sampling transports.
29
+ * @default 1_000
30
+ */
31
+ timeout?: number;
32
+ /**
33
+ * Weights to apply to the scores. Weight values are proportional.
34
+ */
35
+ weights?: {
36
+ /**
37
+ * The weight to apply to the latency score.
38
+ * @default 0.3
39
+ */
40
+ latency?: number;
41
+ /**
42
+ * The weight to apply to the stability score.
43
+ * @default 0.7
44
+ */
45
+ stability?: number;
46
+ };
47
+ };
48
+ export type FallbackTransportConfig = {
49
+ /** The key of the Fallback transport. */
50
+ key?: TransportConfig['key'];
51
+ /** The name of the Fallback transport. */
52
+ name?: TransportConfig['name'];
53
+ /** Toggle to enable ranking, or rank options. */
54
+ rank?: boolean | RankOptions;
55
+ /** The max number of times to retry. */
56
+ retryCount?: TransportConfig['retryCount'];
57
+ /** The base delay (in ms) between retries. */
58
+ retryDelay?: TransportConfig['retryDelay'];
59
+ };
60
+ export type FallbackTransport = Transport<'fallback', {
61
+ onResponse: (fn: OnResponseFn) => void;
62
+ transports: ReturnType<Transport>[];
63
+ }>;
64
+ export declare function fallback(transports_: Transport[], config?: FallbackTransportConfig): FallbackTransport;
65
+ export declare function rankTransports({ chain, interval, onTransports, sampleCount, timeout, transports, weights, }: {
66
+ chain?: Chain;
67
+ interval: RankOptions['interval'];
68
+ onTransports: (transports: Transport[]) => void;
69
+ sampleCount?: RankOptions['sampleCount'];
70
+ timeout?: RankOptions['timeout'];
71
+ transports: Transport[];
72
+ weights?: RankOptions['weights'];
73
+ }): void;
74
+ export {};
75
+ //# sourceMappingURL=fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/fallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAItE,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CACjC,GAAG,CACA;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,SAAS,CAAA;CAClB,GACD;IACE,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB,CACJ,KACE,IAAI,CAAA;AAET,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,yCAAyC;IACzC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAA;IAC5B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,CACvC,UAAU,EACV;IACE,UAAU,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,CAAA;CACpC,CACF,CAAA;AAED,wBAAgB,QAAQ,CACtB,WAAW,EAAE,SAAS,EAAE,EACxB,MAAM,GAAE,uBAA4B,GACnC,iBAAiB,CAiFnB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAgB,EAChB,YAAY,EACZ,WAAgB,EAChB,OAAe,EACf,UAAU,EACV,OAAY,GACb,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACjC,YAAY,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;CACjC,QAwEA"}
@@ -0,0 +1,29 @@
1
+ import type { HttpOptions } from '../../utils/index.js';
2
+ import type { Transport, TransportConfig } from './createTransport.js';
3
+ export type HttpTransportConfig = {
4
+ /**
5
+ * Request configuration to pass to `fetch`.
6
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch
7
+ */
8
+ fetchOptions?: HttpOptions['fetchOptions'];
9
+ /** The key of the HTTP transport. */
10
+ key?: TransportConfig['key'];
11
+ /** The name of the HTTP transport. */
12
+ name?: TransportConfig['name'];
13
+ /** The max number of times to retry. */
14
+ retryCount?: TransportConfig['retryCount'];
15
+ /** The base delay (in ms) between retries. */
16
+ retryDelay?: TransportConfig['retryDelay'];
17
+ /** The timeout (in ms) for the HTTP request. Default: 10_000 */
18
+ timeout?: TransportConfig['timeout'];
19
+ };
20
+ export type HttpTransport = Transport<'http', {
21
+ url?: string;
22
+ }>;
23
+ /**
24
+ * @description Creates a HTTP transport that connects to a JSON-RPC API.
25
+ */
26
+ export declare function http(
27
+ /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
28
+ url?: string, config?: HttpTransportConfig): HttpTransport;
29
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtE,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAC1C,qCAAqC;IACrC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,sCAAsC;IACtC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,gEAAgE;IAChE,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CACnC,MAAM,EACN;IACE,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CACF,CAAA;AAED;;GAEG;AACH,wBAAgB,IAAI;AAClB,uEAAuE;AACvE,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,GAAE,mBAAwB,GAC/B,aAAa,CAqCf"}
@@ -0,0 +1,11 @@
1
+ export { createTransport } from './createTransport.js';
2
+ export type { Transport, TransportConfig } from './createTransport.js';
3
+ export { custom } from './custom.js';
4
+ export type { CustomTransport, CustomTransportConfig, } from './custom.js';
5
+ export { fallback } from './fallback.js';
6
+ export type { FallbackTransport, FallbackTransportConfig } from './fallback.js';
7
+ export { http } from './http.js';
8
+ export type { HttpTransport, HttpTransportConfig } from './http.js';
9
+ export { webSocket } from './webSocket.js';
10
+ export type { WebSocketTransport, WebSocketTransportConfig, } from './webSocket.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EACV,eAAe,EACf,qBAAqB,GACtB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EACV,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,gBAAgB,CAAA"}