viem 0.4.0-main.20230412T230143 → 0.4.0-main.20230413T040554

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 (314) hide show
  1. package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
  2. package/dist/cjs/actions/ens/getEnsAvatar.js.map +1 -1
  3. package/dist/cjs/actions/ens/getEnsName.js.map +1 -1
  4. package/dist/cjs/actions/ens/getEnsResolver.js.map +1 -1
  5. package/dist/cjs/actions/ens/getEnsText.js.map +1 -1
  6. package/dist/cjs/actions/getContract.js.map +1 -1
  7. package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
  8. package/dist/cjs/actions/public/getBalance.js.map +1 -1
  9. package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
  10. package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
  11. package/dist/cjs/actions/public/readContract.js.map +1 -1
  12. package/dist/cjs/actions/public/simulateContract.js.map +1 -1
  13. package/dist/cjs/actions/public/uninstallFilter.js.map +1 -1
  14. package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  15. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  16. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  17. package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
  18. package/dist/cjs/actions/test/dropTransaction.js.map +1 -1
  19. package/dist/cjs/actions/test/getAutomine.js.map +1 -1
  20. package/dist/cjs/actions/test/getTxpoolContent.js.map +1 -1
  21. package/dist/cjs/actions/test/getTxpoolStatus.js.map +1 -1
  22. package/dist/cjs/actions/test/impersonateAccount.js.map +1 -1
  23. package/dist/cjs/actions/test/increaseTime.js.map +1 -1
  24. package/dist/cjs/actions/test/inspectTxpool.js.map +1 -1
  25. package/dist/cjs/actions/test/mine.js.map +1 -1
  26. package/dist/cjs/actions/test/removeBlockTimestampInterval.js.map +1 -1
  27. package/dist/cjs/actions/test/reset.js.map +1 -1
  28. package/dist/cjs/actions/test/revert.js.map +1 -1
  29. package/dist/cjs/actions/test/sendUnsignedTransaction.js.map +1 -1
  30. package/dist/cjs/actions/test/setAutomine.js.map +1 -1
  31. package/dist/cjs/actions/test/setBalance.js.map +1 -1
  32. package/dist/cjs/actions/test/setBlockGasLimit.js.map +1 -1
  33. package/dist/cjs/actions/test/setBlockTimestampInterval.js.map +1 -1
  34. package/dist/cjs/actions/test/setCode.js.map +1 -1
  35. package/dist/cjs/actions/test/setCoinbase.js.map +1 -1
  36. package/dist/cjs/actions/test/setIntervalMining.js.map +1 -1
  37. package/dist/cjs/actions/test/setLoggingEnabled.js.map +1 -1
  38. package/dist/cjs/actions/test/setMinGasPrice.js.map +1 -1
  39. package/dist/cjs/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
  40. package/dist/cjs/actions/test/setNextBlockTimestamp.js.map +1 -1
  41. package/dist/cjs/actions/test/setNonce.js.map +1 -1
  42. package/dist/cjs/actions/test/setRpcUrl.js.map +1 -1
  43. package/dist/cjs/actions/test/setStorageAt.js.map +1 -1
  44. package/dist/cjs/actions/test/snapshot.js.map +1 -1
  45. package/dist/cjs/actions/test/stopImpersonatingAccount.js.map +1 -1
  46. package/dist/cjs/actions/wallet/addChain.js.map +1 -1
  47. package/dist/cjs/actions/wallet/getAddresses.js.map +1 -1
  48. package/dist/cjs/actions/wallet/getPermissions.js.map +1 -1
  49. package/dist/cjs/actions/wallet/requestAddresses.js.map +1 -1
  50. package/dist/cjs/actions/wallet/requestPermissions.js.map +1 -1
  51. package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
  52. package/dist/cjs/actions/wallet/signMessage.js.map +1 -1
  53. package/dist/cjs/actions/wallet/signTypedData.js.map +1 -1
  54. package/dist/cjs/actions/wallet/switchChain.js.map +1 -1
  55. package/dist/cjs/actions/wallet/watchAsset.js.map +1 -1
  56. package/dist/cjs/actions/wallet/writeContract.js.map +1 -1
  57. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  58. package/dist/cjs/clients/createTestClient.js.map +1 -1
  59. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  60. package/dist/cjs/clients/decorators/test.js.map +1 -1
  61. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  62. package/dist/cjs/errors/version.js +1 -1
  63. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  64. package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
  65. package/dist/esm/actions/ens/getEnsName.js.map +1 -1
  66. package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
  67. package/dist/esm/actions/ens/getEnsText.js.map +1 -1
  68. package/dist/esm/actions/getContract.js.map +1 -1
  69. package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
  70. package/dist/esm/actions/public/getBalance.js.map +1 -1
  71. package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
  72. package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
  73. package/dist/esm/actions/public/readContract.js.map +1 -1
  74. package/dist/esm/actions/public/simulateContract.js.map +1 -1
  75. package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
  76. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  77. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  78. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  79. package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
  80. package/dist/esm/actions/test/dropTransaction.js.map +1 -1
  81. package/dist/esm/actions/test/getAutomine.js.map +1 -1
  82. package/dist/esm/actions/test/getTxpoolContent.js.map +1 -1
  83. package/dist/esm/actions/test/getTxpoolStatus.js.map +1 -1
  84. package/dist/esm/actions/test/impersonateAccount.js.map +1 -1
  85. package/dist/esm/actions/test/increaseTime.js.map +1 -1
  86. package/dist/esm/actions/test/inspectTxpool.js.map +1 -1
  87. package/dist/esm/actions/test/mine.js.map +1 -1
  88. package/dist/esm/actions/test/removeBlockTimestampInterval.js.map +1 -1
  89. package/dist/esm/actions/test/reset.js.map +1 -1
  90. package/dist/esm/actions/test/revert.js.map +1 -1
  91. package/dist/esm/actions/test/sendUnsignedTransaction.js.map +1 -1
  92. package/dist/esm/actions/test/setAutomine.js.map +1 -1
  93. package/dist/esm/actions/test/setBalance.js.map +1 -1
  94. package/dist/esm/actions/test/setBlockGasLimit.js.map +1 -1
  95. package/dist/esm/actions/test/setBlockTimestampInterval.js.map +1 -1
  96. package/dist/esm/actions/test/setCode.js.map +1 -1
  97. package/dist/esm/actions/test/setCoinbase.js.map +1 -1
  98. package/dist/esm/actions/test/setIntervalMining.js.map +1 -1
  99. package/dist/esm/actions/test/setLoggingEnabled.js.map +1 -1
  100. package/dist/esm/actions/test/setMinGasPrice.js.map +1 -1
  101. package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
  102. package/dist/esm/actions/test/setNextBlockTimestamp.js.map +1 -1
  103. package/dist/esm/actions/test/setNonce.js.map +1 -1
  104. package/dist/esm/actions/test/setRpcUrl.js.map +1 -1
  105. package/dist/esm/actions/test/setStorageAt.js.map +1 -1
  106. package/dist/esm/actions/test/snapshot.js.map +1 -1
  107. package/dist/esm/actions/test/stopImpersonatingAccount.js.map +1 -1
  108. package/dist/esm/actions/wallet/addChain.js.map +1 -1
  109. package/dist/esm/actions/wallet/getAddresses.js.map +1 -1
  110. package/dist/esm/actions/wallet/getPermissions.js.map +1 -1
  111. package/dist/esm/actions/wallet/requestAddresses.js.map +1 -1
  112. package/dist/esm/actions/wallet/requestPermissions.js.map +1 -1
  113. package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
  114. package/dist/esm/actions/wallet/signMessage.js.map +1 -1
  115. package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
  116. package/dist/esm/actions/wallet/switchChain.js.map +1 -1
  117. package/dist/esm/actions/wallet/watchAsset.js.map +1 -1
  118. package/dist/esm/actions/wallet/writeContract.js.map +1 -1
  119. package/dist/esm/clients/createPublicClient.js.map +1 -1
  120. package/dist/esm/clients/createTestClient.js.map +1 -1
  121. package/dist/esm/clients/createWalletClient.js.map +1 -1
  122. package/dist/esm/clients/decorators/test.js.map +1 -1
  123. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  124. package/dist/esm/errors/version.js +1 -1
  125. package/dist/types/actions/ens/getEnsAddress.d.ts +0 -1
  126. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
  127. package/dist/types/actions/ens/getEnsAvatar.d.ts +0 -1
  128. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -1
  129. package/dist/types/actions/ens/getEnsName.d.ts +0 -1
  130. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -1
  131. package/dist/types/actions/ens/getEnsResolver.d.ts +0 -1
  132. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -1
  133. package/dist/types/actions/ens/getEnsText.d.ts +0 -1
  134. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -1
  135. package/dist/types/actions/getContract.d.ts +104 -2
  136. package/dist/types/actions/getContract.d.ts.map +1 -1
  137. package/dist/types/actions/public/estimateContractGas.d.ts +0 -1
  138. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
  139. package/dist/types/actions/public/getBalance.d.ts +0 -1
  140. package/dist/types/actions/public/getBalance.d.ts.map +1 -1
  141. package/dist/types/actions/public/getFilterChanges.d.ts +0 -1
  142. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  143. package/dist/types/actions/public/getFilterLogs.d.ts +0 -1
  144. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  145. package/dist/types/actions/public/readContract.d.ts +2 -3
  146. package/dist/types/actions/public/readContract.d.ts.map +1 -1
  147. package/dist/types/actions/public/simulateContract.d.ts +1 -2
  148. package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
  149. package/dist/types/actions/public/uninstallFilter.d.ts +0 -1
  150. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -1
  151. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +0 -1
  152. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  153. package/dist/types/actions/public/watchContractEvent.d.ts +0 -1
  154. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  155. package/dist/types/actions/public/watchEvent.d.ts +0 -1
  156. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  157. package/dist/types/actions/public/watchPendingTransactions.d.ts +0 -1
  158. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  159. package/dist/types/actions/test/dropTransaction.d.ts +22 -0
  160. package/dist/types/actions/test/dropTransaction.d.ts.map +1 -1
  161. package/dist/types/actions/test/getAutomine.d.ts +20 -0
  162. package/dist/types/actions/test/getAutomine.d.ts.map +1 -1
  163. package/dist/types/actions/test/getTxpoolContent.d.ts +22 -0
  164. package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -1
  165. package/dist/types/actions/test/getTxpoolStatus.d.ts +20 -0
  166. package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -1
  167. package/dist/types/actions/test/impersonateAccount.d.ts +22 -0
  168. package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -1
  169. package/dist/types/actions/test/increaseTime.d.ts +22 -0
  170. package/dist/types/actions/test/increaseTime.d.ts.map +1 -1
  171. package/dist/types/actions/test/inspectTxpool.d.ts +20 -0
  172. package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -1
  173. package/dist/types/actions/test/mine.d.ts +20 -0
  174. package/dist/types/actions/test/mine.d.ts.map +1 -1
  175. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +19 -0
  176. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -1
  177. package/dist/types/actions/test/reset.d.ts +20 -0
  178. package/dist/types/actions/test/reset.d.ts.map +1 -1
  179. package/dist/types/actions/test/revert.d.ts +20 -0
  180. package/dist/types/actions/test/revert.d.ts.map +1 -1
  181. package/dist/types/actions/test/sendUnsignedTransaction.d.ts +25 -0
  182. package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -1
  183. package/dist/types/actions/test/setAutomine.d.ts +19 -0
  184. package/dist/types/actions/test/setAutomine.d.ts.map +1 -1
  185. package/dist/types/actions/test/setBalance.d.ts +23 -0
  186. package/dist/types/actions/test/setBalance.d.ts.map +1 -1
  187. package/dist/types/actions/test/setBlockGasLimit.d.ts +20 -0
  188. package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -1
  189. package/dist/types/actions/test/setBlockTimestampInterval.d.ts +20 -0
  190. package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -1
  191. package/dist/types/actions/test/setCode.d.ts +23 -0
  192. package/dist/types/actions/test/setCode.d.ts.map +1 -1
  193. package/dist/types/actions/test/setCoinbase.d.ts +22 -0
  194. package/dist/types/actions/test/setCoinbase.d.ts.map +1 -1
  195. package/dist/types/actions/test/setIntervalMining.d.ts +20 -0
  196. package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -1
  197. package/dist/types/actions/test/setLoggingEnabled.d.ts +19 -0
  198. package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -1
  199. package/dist/types/actions/test/setMinGasPrice.d.ts +24 -0
  200. package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -1
  201. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +22 -0
  202. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -1
  203. package/dist/types/actions/test/setNextBlockTimestamp.d.ts +20 -0
  204. package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -1
  205. package/dist/types/actions/test/setNonce.d.ts +23 -0
  206. package/dist/types/actions/test/setNonce.d.ts.map +1 -1
  207. package/dist/types/actions/test/setRpcUrl.d.ts +20 -0
  208. package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -1
  209. package/dist/types/actions/test/setStorageAt.d.ts +24 -0
  210. package/dist/types/actions/test/setStorageAt.d.ts.map +1 -1
  211. package/dist/types/actions/test/snapshot.d.ts +19 -0
  212. package/dist/types/actions/test/snapshot.d.ts.map +1 -1
  213. package/dist/types/actions/test/stopImpersonatingAccount.d.ts +22 -0
  214. package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -1
  215. package/dist/types/actions/wallet/addChain.d.ts +20 -0
  216. package/dist/types/actions/wallet/addChain.d.ts.map +1 -1
  217. package/dist/types/actions/wallet/deployContract.d.ts +1 -1
  218. package/dist/types/actions/wallet/getAddresses.d.ts +20 -0
  219. package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -1
  220. package/dist/types/actions/wallet/getPermissions.d.ts +20 -0
  221. package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -1
  222. package/dist/types/actions/wallet/requestAddresses.d.ts +24 -0
  223. package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -1
  224. package/dist/types/actions/wallet/requestPermissions.d.ts +26 -3
  225. package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -1
  226. package/dist/types/actions/wallet/sendTransaction.d.ts +45 -0
  227. package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -1
  228. package/dist/types/actions/wallet/signMessage.d.ts +46 -0
  229. package/dist/types/actions/wallet/signMessage.d.ts.map +1 -1
  230. package/dist/types/actions/wallet/signTypedData.d.ts +98 -0
  231. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -1
  232. package/dist/types/actions/wallet/switchChain.d.ts +21 -0
  233. package/dist/types/actions/wallet/switchChain.d.ts.map +1 -1
  234. package/dist/types/actions/wallet/watchAsset.d.ts +28 -0
  235. package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -1
  236. package/dist/types/actions/wallet/writeContract.d.ts +50 -0
  237. package/dist/types/actions/wallet/writeContract.d.ts.map +1 -1
  238. package/dist/types/clients/createPublicClient.d.ts +17 -1
  239. package/dist/types/clients/createPublicClient.d.ts.map +1 -1
  240. package/dist/types/clients/createTestClient.d.ts +20 -0
  241. package/dist/types/clients/createTestClient.d.ts.map +1 -1
  242. package/dist/types/clients/createWalletClient.d.ts +34 -1
  243. package/dist/types/clients/createWalletClient.d.ts.map +1 -1
  244. package/dist/types/clients/decorators/public.d.ts +37 -37
  245. package/dist/types/clients/decorators/test.d.ts +536 -0
  246. package/dist/types/clients/decorators/test.d.ts.map +1 -1
  247. package/dist/types/clients/decorators/wallet.d.ts +389 -2
  248. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  249. package/dist/types/errors/version.d.ts +1 -1
  250. package/package.json +1 -1
  251. package/src/actions/ens/getEnsAddress.ts +0 -1
  252. package/src/actions/ens/getEnsAvatar.ts +0 -1
  253. package/src/actions/ens/getEnsName.ts +0 -1
  254. package/src/actions/ens/getEnsResolver.ts +0 -1
  255. package/src/actions/ens/getEnsText.ts +0 -1
  256. package/src/actions/getContract.ts +104 -2
  257. package/src/actions/public/estimateContractGas.ts +0 -1
  258. package/src/actions/public/getBalance.ts +0 -1
  259. package/src/actions/public/getFilterChanges.ts +0 -1
  260. package/src/actions/public/getFilterLogs.ts +0 -1
  261. package/src/actions/public/readContract.ts +2 -3
  262. package/src/actions/public/simulateContract.ts +1 -2
  263. package/src/actions/public/uninstallFilter.ts +0 -1
  264. package/src/actions/public/waitForTransactionReceipt.ts +0 -1
  265. package/src/actions/public/watchContractEvent.ts +0 -1
  266. package/src/actions/public/watchEvent.ts +0 -1
  267. package/src/actions/public/watchPendingTransactions.ts +0 -1
  268. package/src/actions/test/dropTransaction.ts +22 -0
  269. package/src/actions/test/getAutomine.ts +20 -0
  270. package/src/actions/test/getTxpoolContent.ts +22 -0
  271. package/src/actions/test/getTxpoolStatus.ts +20 -0
  272. package/src/actions/test/impersonateAccount.ts +22 -0
  273. package/src/actions/test/increaseTime.ts +22 -0
  274. package/src/actions/test/inspectTxpool.ts +20 -0
  275. package/src/actions/test/mine.ts +20 -0
  276. package/src/actions/test/removeBlockTimestampInterval.ts +19 -0
  277. package/src/actions/test/reset.ts +20 -0
  278. package/src/actions/test/revert.ts +20 -0
  279. package/src/actions/test/sendUnsignedTransaction.ts +25 -0
  280. package/src/actions/test/setAutomine.ts +19 -0
  281. package/src/actions/test/setBalance.ts +23 -0
  282. package/src/actions/test/setBlockGasLimit.ts +20 -0
  283. package/src/actions/test/setBlockTimestampInterval.ts +20 -0
  284. package/src/actions/test/setCode.ts +23 -0
  285. package/src/actions/test/setCoinbase.ts +22 -0
  286. package/src/actions/test/setIntervalMining.ts +20 -0
  287. package/src/actions/test/setLoggingEnabled.ts +19 -0
  288. package/src/actions/test/setMinGasPrice.ts +24 -0
  289. package/src/actions/test/setNextBlockBaseFeePerGas.ts +22 -0
  290. package/src/actions/test/setNextBlockTimestamp.ts +20 -0
  291. package/src/actions/test/setNonce.ts +23 -0
  292. package/src/actions/test/setRpcUrl.ts +20 -0
  293. package/src/actions/test/setStorageAt.ts +24 -0
  294. package/src/actions/test/snapshot.ts +19 -0
  295. package/src/actions/test/stopImpersonatingAccount.ts +22 -0
  296. package/src/actions/wallet/addChain.ts +20 -0
  297. package/src/actions/wallet/deployContract.ts +1 -1
  298. package/src/actions/wallet/getAddresses.ts +20 -0
  299. package/src/actions/wallet/getPermissions.ts +20 -0
  300. package/src/actions/wallet/requestAddresses.ts +24 -0
  301. package/src/actions/wallet/requestPermissions.ts +31 -6
  302. package/src/actions/wallet/sendTransaction.ts +45 -0
  303. package/src/actions/wallet/signMessage.ts +46 -0
  304. package/src/actions/wallet/signTypedData.ts +98 -0
  305. package/src/actions/wallet/switchChain.ts +24 -1
  306. package/src/actions/wallet/watchAsset.ts +28 -0
  307. package/src/actions/wallet/writeContract.ts +50 -0
  308. package/src/clients/createPublicClient.ts +17 -1
  309. package/src/clients/createTestClient.ts +20 -0
  310. package/src/clients/createWalletClient.ts +34 -1
  311. package/src/clients/decorators/public.ts +37 -37
  312. package/src/clients/decorators/test.ts +536 -0
  313. package/src/clients/decorators/wallet.ts +389 -2
  314. package/src/errors/version.ts +1 -1
@@ -10,6 +10,26 @@ export type SetIntervalMiningParameters = {
10
10
  interval: number
11
11
  }
12
12
 
13
+ /**
14
+ * Sets the automatic mining interval (in seconds) of blocks. Setting the interval to 0 will disable automatic mining.
15
+ *
16
+ * - Docs: https://viem.sh/docs/actions/test/setIntervalMining.html
17
+ *
18
+ * @param client - Client to use
19
+ * @param parameters – {@link SetIntervalMiningParameters}
20
+ *
21
+ * @example
22
+ * import { createTestClient, http } from 'viem'
23
+ * import { foundry } from 'viem/chains'
24
+ * import { setIntervalMining } from 'viem/test'
25
+ *
26
+ * const client = createTestClient({
27
+ * mode: 'anvil',
28
+ * chain: 'foundry',
29
+ * transport: http(),
30
+ * })
31
+ * await setIntervalMining(client, { interval: 5 })
32
+ */
13
33
  export async function setIntervalMining<TChain extends Chain | undefined>(
14
34
  client: TestClient<TestClientMode, Transport, TChain>,
15
35
  { interval }: SetIntervalMiningParameters,
@@ -5,6 +5,25 @@ import type {
5
5
  } from '../../clients/index.js'
6
6
  import type { Chain } from '../../types/index.js'
7
7
 
8
+ /**
9
+ * Enable or disable logging on the test node network.
10
+ *
11
+ * - Docs: https://viem.sh/docs/actions/test/setLoggingEnabled.html
12
+ *
13
+ * @param client - Client to use
14
+ *
15
+ * @example
16
+ * import { createTestClient, http } from 'viem'
17
+ * import { foundry } from 'viem/chains'
18
+ * import { setLoggingEnabled } from 'viem/test'
19
+ *
20
+ * const client = createTestClient({
21
+ * mode: 'anvil',
22
+ * chain: 'foundry',
23
+ * transport: http(),
24
+ * })
25
+ * await setLoggingEnabled(client)
26
+ */
8
27
  export async function setLoggingEnabled<TChain extends Chain | undefined>(
9
28
  client: TestClient<TestClientMode, Transport, TChain>,
10
29
  enabled: boolean,
@@ -11,6 +11,30 @@ export type SetMinGasPriceParameters = {
11
11
  gasPrice: bigint
12
12
  }
13
13
 
14
+ /**
15
+ * Change the minimum gas price accepted by the network (in wei).
16
+ *
17
+ * - Docs: https://viem.sh/docs/actions/test/setMinGasPrice.html
18
+ *
19
+ * Note: `setMinGasPrice` can only be used on clients that do not have EIP-1559 enabled.
20
+ *
21
+ * @param client - Client to use
22
+ * @param parameters – {@link SetBlockGasLimitParameters}
23
+ *
24
+ * @example
25
+ * import { createTestClient, http, parseGwei } from 'viem'
26
+ * import { foundry } from 'viem/chains'
27
+ * import { setMinGasPrice } from 'viem/test'
28
+ *
29
+ * const client = createTestClient({
30
+ * mode: 'anvil',
31
+ * chain: 'foundry',
32
+ * transport: http(),
33
+ * })
34
+ * await setMinGasPrice(client, {
35
+ * gasPrice: parseGwei('20'),
36
+ * })
37
+ */
14
38
  export async function setMinGasPrice<TChain extends Chain | undefined>(
15
39
  client: TestClient<TestClientMode, Transport, TChain>,
16
40
  { gasPrice }: SetMinGasPriceParameters,
@@ -11,6 +11,28 @@ export type SetNextBlockBaseFeePerGasParameters = {
11
11
  baseFeePerGas: bigint
12
12
  }
13
13
 
14
+ /**
15
+ * Sets the next block's base fee per gas.
16
+ *
17
+ * - Docs: https://viem.sh/docs/actions/test/setNextBlockBaseFeePerGas.html
18
+ *
19
+ * @param client - Client to use
20
+ * @param parameters – {@link SetNextBlockBaseFeePerGasParameters}
21
+ *
22
+ * @example
23
+ * import { createTestClient, http, parseGwei } from 'viem'
24
+ * import { foundry } from 'viem/chains'
25
+ * import { setNextBlockBaseFeePerGas } from 'viem/test'
26
+ *
27
+ * const client = createTestClient({
28
+ * mode: 'anvil',
29
+ * chain: 'foundry',
30
+ * transport: http(),
31
+ * })
32
+ * await setNextBlockBaseFeePerGas(client, {
33
+ * baseFeePerGas: parseGwei('20'),
34
+ * })
35
+ */
14
36
  export async function setNextBlockBaseFeePerGas<
15
37
  TChain extends Chain | undefined,
16
38
  >(
@@ -11,6 +11,26 @@ export type SetNextBlockTimestampParameters = {
11
11
  timestamp: bigint
12
12
  }
13
13
 
14
+ /**
15
+ * Sets the next block's timestamp.
16
+ *
17
+ * - Docs: https://viem.sh/docs/actions/test/setNextBlockTimestamp.html
18
+ *
19
+ * @param client - Client to use
20
+ * @param parameters – {@link SetNextBlockTimestampParameters}
21
+ *
22
+ * @example
23
+ * import { createTestClient, http } from 'viem'
24
+ * import { foundry } from 'viem/chains'
25
+ * import { setNextBlockTimestamp } from 'viem/test'
26
+ *
27
+ * const client = createTestClient({
28
+ * mode: 'anvil',
29
+ * chain: 'foundry',
30
+ * transport: http(),
31
+ * })
32
+ * await setNextBlockTimestamp(client, { timestamp: 1671744314n })
33
+ */
14
34
  export async function setNextBlockTimestamp<TChain extends Chain | undefined>(
15
35
  client: TestClient<TestClientMode, Transport, TChain>,
16
36
  { timestamp }: SetNextBlockTimestampParameters,
@@ -13,6 +13,29 @@ export type SetNonceParameters = {
13
13
  nonce: number
14
14
  }
15
15
 
16
+ /**
17
+ * Modifies (overrides) the nonce of an account.
18
+ *
19
+ * - Docs: https://viem.sh/docs/actions/test/setNonce.html
20
+ *
21
+ * @param client - Client to use
22
+ * @param parameters – {@link SetNonceParameters}
23
+ *
24
+ * @example
25
+ * import { createTestClient, http } from 'viem'
26
+ * import { foundry } from 'viem/chains'
27
+ * import { setNonce } from 'viem/test'
28
+ *
29
+ * const client = createTestClient({
30
+ * mode: 'anvil',
31
+ * chain: 'foundry',
32
+ * transport: http(),
33
+ * })
34
+ * await setNonce(client, {
35
+ * address: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
36
+ * nonce: 420,
37
+ * })
38
+ */
16
39
  export async function setNonce<TChain extends Chain | undefined>(
17
40
  client: TestClient<TestClientMode, Transport, TChain>,
18
41
  { address, nonce }: SetNonceParameters,
@@ -5,6 +5,26 @@ import type {
5
5
  } from '../../clients/index.js'
6
6
  import type { Chain } from '../../types/index.js'
7
7
 
8
+ /**
9
+ * Sets the backend RPC URL.
10
+ *
11
+ * - Docs: https://viem.sh/docs/actions/test/setRpcUrl.html
12
+ *
13
+ * @param client - Client to use
14
+ * @param jsonRpcUrl – RPC URL
15
+ *
16
+ * @example
17
+ * import { createTestClient, http } from 'viem'
18
+ * import { foundry } from 'viem/chains'
19
+ * import { setRpcUrl } from 'viem/test'
20
+ *
21
+ * const client = createTestClient({
22
+ * mode: 'anvil',
23
+ * chain: 'foundry',
24
+ * transport: http(),
25
+ * })
26
+ * await setRpcUrl(client, 'https://eth-mainnet.g.alchemy.com/v2')
27
+ */
8
28
  export async function setRpcUrl<TChain extends Chain | undefined>(
9
29
  client: TestClient<TestClientMode, Transport, TChain>,
10
30
  jsonRpcUrl: string,
@@ -15,6 +15,30 @@ export type SetStorageAtParameters = {
15
15
  value: Hex
16
16
  }
17
17
 
18
+ /**
19
+ * Writes to a slot of an account's storage.
20
+ *
21
+ * - Docs: https://viem.sh/docs/actions/test/setStorageAt.html
22
+ *
23
+ * @param client - Client to use
24
+ * @param parameters – {@link SetStorageAtParameters}
25
+ *
26
+ * @example
27
+ * import { createTestClient, http } from 'viem'
28
+ * import { foundry } from 'viem/chains'
29
+ * import { setStorageAt } from 'viem/test'
30
+ *
31
+ * const client = createTestClient({
32
+ * mode: 'anvil',
33
+ * chain: 'foundry',
34
+ * transport: http(),
35
+ * })
36
+ * await setStorageAt(client, {
37
+ * address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
38
+ * index: 2,
39
+ * value: '0x0000000000000000000000000000000000000000000000000000000000000069',
40
+ * })
41
+ */
18
42
  export async function setStorageAt<TChain extends Chain | undefined>(
19
43
  client: TestClient<TestClientMode, Transport, TChain>,
20
44
  { address, index, value }: SetStorageAtParameters,
@@ -5,6 +5,25 @@ import type {
5
5
  } from '../../clients/index.js'
6
6
  import type { Chain } from '../../types/index.js'
7
7
 
8
+ /**
9
+ * Snapshot the state of the blockchain at the current block.
10
+ *
11
+ * - Docs: https://viem.sh/docs/actions/test/snapshot.html
12
+ *
13
+ * @param client - Client to use
14
+ *
15
+ * @example
16
+ * import { createTestClient, http } from 'viem'
17
+ * import { foundry } from 'viem/chains'
18
+ * import { snapshot } from 'viem/test'
19
+ *
20
+ * const client = createTestClient({
21
+ * mode: 'anvil',
22
+ * chain: 'foundry',
23
+ * transport: http(),
24
+ * })
25
+ * await snapshot(client)
26
+ */
8
27
  export async function snapshot<TChain extends Chain | undefined>(
9
28
  client: TestClient<TestClientMode, Transport, TChain>,
10
29
  ) {
@@ -10,6 +10,28 @@ export type StopImpersonatingAccountParameters = {
10
10
  address: Address
11
11
  }
12
12
 
13
+ /**
14
+ * Stop impersonating an account after having previously used [`impersonateAccount`](https://viem.sh/docs/actions/test/impersonateAccount).
15
+ *
16
+ * - Docs: https://viem.sh/docs/actions/test/stopImpersonatingAccount.html
17
+ *
18
+ * @param client - Client to use
19
+ * @param parameters – {@link StopImpersonatingAccountParameters}
20
+ *
21
+ * @example
22
+ * import { createTestClient, http } from 'viem'
23
+ * import { foundry } from 'viem/chains'
24
+ * import { stopImpersonatingAccount } from 'viem/test'
25
+ *
26
+ * const client = createTestClient({
27
+ * mode: 'anvil',
28
+ * chain: 'foundry',
29
+ * transport: http(),
30
+ * })
31
+ * await stopImpersonatingAccount(client, {
32
+ * address: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
33
+ * })
34
+ */
13
35
  export async function stopImpersonatingAccount<
14
36
  TChain extends Chain | undefined,
15
37
  >(
@@ -3,9 +3,29 @@ import type { Account, Chain } from '../../types/index.js'
3
3
  import { numberToHex } from '../../utils/index.js'
4
4
 
5
5
  export type AddChainParameters = {
6
+ /** The chain to add to the wallet. */
6
7
  chain: Chain
7
8
  }
8
9
 
10
+ /**
11
+ * Adds an EVM chain to the wallet.
12
+ *
13
+ * - Docs: https://viem.sh/docs/actions/wallet/addChain.html
14
+ * - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
15
+ *
16
+ * @param client - Client to use
17
+ * @param parameters - {@link AddChainParameters}
18
+ *
19
+ * @example
20
+ * import { createWalletClient, custom } from 'viem'
21
+ * import { optimism } from 'viem/chains'
22
+ * import { addChain } from 'viem/wallet'
23
+ *
24
+ * const client = createWalletClient({
25
+ * transport: custom(window.ethereum),
26
+ * })
27
+ * await addChain(client, { chain: optimism })
28
+ */
9
29
  export async function addChain<
10
30
  TChain extends Chain | undefined,
11
31
  TAccount extends Account | undefined,
@@ -47,7 +47,7 @@ export type DeployContractReturnType = SendTransactionReturnType
47
47
  * import { deployContract } from 'viem/contract'
48
48
  *
49
49
  * const client = createWalletClient({
50
- * account = privateKeyToAccount('0x…'),
50
+ * account: privateKeyToAccount('0x…'),
51
51
  * chain: mainnet,
52
52
  * transport: http(),
53
53
  * })
@@ -6,6 +6,26 @@ import { checksumAddress } from '../../utils/address/index.js'
6
6
 
7
7
  export type GetAddressesReturnType = Address[]
8
8
 
9
+ /**
10
+ * Returns a list of account addresses owned by the wallet or client.
11
+ *
12
+ * - Docs: https://viem.sh/docs/actions/wallet/getAddresses.html
13
+ * - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
14
+ *
15
+ * @param client - Client to use
16
+ * @returns List of account addresses owned by the wallet or client. {@link GetAddressesReturnType}
17
+ *
18
+ * @example
19
+ * import { createWalletClient, custom } from 'viem'
20
+ * import { mainnet } from 'viem/chains'
21
+ * import { getAddresses } from 'viem/wallet'
22
+ *
23
+ * const client = createWalletClient({
24
+ * chain: mainnet,
25
+ * transport: custom(window.ethereum),
26
+ * })
27
+ * const accounts = await getAddresses(client)
28
+ */
9
29
  export async function getAddresses<
10
30
  TChain extends Chain | undefined,
11
31
  TAccount extends Account | undefined = undefined,
@@ -4,6 +4,26 @@ import type { WalletPermission } from '../../types/eip1193.js'
4
4
 
5
5
  export type GetPermissionsReturnType = WalletPermission[]
6
6
 
7
+ /**
8
+ * Gets the wallets current permissions.
9
+ *
10
+ * - Docs: https://viem.sh/docs/actions/wallet/getPermissions.html
11
+ * - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
12
+ *
13
+ * @param client - Client to use
14
+ * @returns The wallet permissions. {@link GetPermissionsReturnType}
15
+ *
16
+ * @example
17
+ * import { createWalletClient, custom } from 'viem'
18
+ * import { mainnet } from 'viem/chains'
19
+ * import { getPermissions } from 'viem/wallet'
20
+ *
21
+ * const client = createWalletClient({
22
+ * chain: mainnet,
23
+ * transport: custom(window.ethereum),
24
+ * })
25
+ * const permissions = await getPermissions(client)
26
+ */
7
27
  export async function getPermissions<
8
28
  TChain extends Chain | undefined,
9
29
  TAccount extends Account | undefined = undefined,
@@ -6,6 +6,30 @@ import { getAddress } from '../../utils/index.js'
6
6
 
7
7
  export type RequestAddressesReturnType = Address[]
8
8
 
9
+ /**
10
+ * Requests a list of accounts managed by a wallet.
11
+ *
12
+ * - Docs: https://viem.sh/docs/actions/wallet/requestAddresses.html
13
+ * - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
14
+ *
15
+ * 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).
16
+ *
17
+ * 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.
18
+ *
19
+ * @param client - Client to use
20
+ * @returns List of accounts managed by a wallet {@link RequestAddressesReturnType}
21
+ *
22
+ * @example
23
+ * import { createWalletClient, custom } from 'viem'
24
+ * import { mainnet } from 'viem/chains'
25
+ * import { requestAddresses } from 'viem/wallet'
26
+ *
27
+ * const client = createWalletClient({
28
+ * chain: mainnet,
29
+ * transport: custom(window.ethereum),
30
+ * })
31
+ * const accounts = await requestAddresses(client)
32
+ */
9
33
  export async function requestAddresses<
10
34
  TChain extends Chain | undefined,
11
35
  TAccount extends Account | undefined = undefined,
@@ -1,14 +1,39 @@
1
1
  import type { Transport, WalletClient } from '../../clients/index.js'
2
- import type { Account, Chain } from '../../types/index.js'
2
+ import type { Account, Chain, Prettify } from '../../types/index.js'
3
3
  import type { WalletPermission } from '../../types/eip1193.js'
4
4
 
5
- export type RequestPermissionsParameters = {
6
- eth_accounts: Record<string, any>
7
- } & {
8
- [key: string]: Record<string, any>
9
- }
5
+ export type RequestPermissionsParameters = Prettify<
6
+ {
7
+ eth_accounts: Record<string, any>
8
+ } & {
9
+ [key: string]: Record<string, any>
10
+ }
11
+ >
10
12
  export type RequestPermissionsReturnType = WalletPermission[]
11
13
 
14
+ /**
15
+ * Requests permissions for a wallet.
16
+ *
17
+ * - Docs: https://viem.sh/docs/actions/wallet/requestPermissions.html
18
+ * - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
19
+ *
20
+ * @param client - Client to use
21
+ * @param parameters - {@link RequestPermissionsParameters}
22
+ * @returns The wallet permissions. {@link RequestPermissionsReturnType}
23
+ *
24
+ * @example
25
+ * import { createWalletClient, custom } from 'viem'
26
+ * import { mainnet } from 'viem/chains'
27
+ * import { requestPermissions } from 'viem/wallet'
28
+ *
29
+ * const client = createWalletClient({
30
+ * chain: mainnet,
31
+ * transport: custom(window.ethereum),
32
+ * })
33
+ * const permissions = await requestPermissions(client, {
34
+ * eth_accounts: {}
35
+ * })
36
+ */
12
37
  export async function requestPermissions<
13
38
  TChain extends Chain | undefined,
14
39
  TAccount extends Account | undefined = undefined,
@@ -48,6 +48,51 @@ export type SendTransactionParameters<
48
48
 
49
49
  export type SendTransactionReturnType = Hash
50
50
 
51
+ /**
52
+ * Creates, signs, and sends a new transaction to the network.
53
+ *
54
+ * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
55
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
56
+ * - JSON-RPC Methods:
57
+ * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
58
+ * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
59
+ *
60
+ * @param client - Client to use
61
+ * @param parameters - {@link SendTransactionParameters}
62
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
63
+ *
64
+ * @example
65
+ * import { createWalletClient, custom } from 'viem'
66
+ * import { mainnet } from 'viem/chains'
67
+ * import { sendTransaction } from 'viem/wallet'
68
+ *
69
+ * const client = createWalletClient({
70
+ * chain: mainnet,
71
+ * transport: custom(window.ethereum),
72
+ * })
73
+ * const hash = await sendTransaction(client, {
74
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
75
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
76
+ * value: 1000000000000000000n,
77
+ * })
78
+ *
79
+ * @example
80
+ * // Account Hoisting
81
+ * import { createWalletClient, http } from 'viem'
82
+ * import { privateKeyToAccount } from 'viem/accounts'
83
+ * import { mainnet } from 'viem/chains'
84
+ * import { sendTransaction } from 'viem/wallet'
85
+ *
86
+ * const client = createWalletClient({
87
+ * account: privateKeyToAccount('0x…'),
88
+ * chain: mainnet,
89
+ * transport: http(),
90
+ * })
91
+ * const hash = await sendTransaction(client, {
92
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
93
+ * value: 1000000000000000000n,
94
+ * })
95
+ */
51
96
  export async function sendTransaction<
52
97
  TChain extends Chain | undefined,
53
98
  TAccount extends Account | undefined,
@@ -16,6 +16,52 @@ export type SignMessageParameters<
16
16
 
17
17
  export type SignMessageReturnType = Hex
18
18
 
19
+ /**
20
+ * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
21
+ *
22
+ * - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
23
+ * - JSON-RPC Methods:
24
+ * - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
25
+ * - Local Accounts: Signs locally. No JSON-RPC request.
26
+ *
27
+ * With the calculated signature, you can:
28
+ * - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature,
29
+ * - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature.
30
+ *
31
+ * @param client - Client to use
32
+ * @param parameters - {@link SignMessageParameters}
33
+ * @returns The signed message. {@link SignMessageReturnType}
34
+ *
35
+ * @example
36
+ * import { createWalletClient, custom } from 'viem'
37
+ * import { mainnet } from 'viem/chains'
38
+ * import { signMessage } from 'viem/wallet'
39
+ *
40
+ * const client = createWalletClient({
41
+ * chain: mainnet,
42
+ * transport: custom(window.ethereum),
43
+ * })
44
+ * const signature = await signMessage(client, {
45
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
46
+ * message: 'hello world',
47
+ * })
48
+ *
49
+ * @example
50
+ * // Account Hoisting
51
+ * import { createWalletClient, custom } from 'viem'
52
+ * import { privateKeyToAccount } from 'viem/accounts'
53
+ * import { mainnet } from 'viem/chains'
54
+ * import { signMessage } from 'viem/wallet'
55
+ *
56
+ * const client = createWalletClient({
57
+ * account: privateKeyToAccount('0x…'),
58
+ * chain: mainnet,
59
+ * transport: custom(window.ethereum),
60
+ * })
61
+ * const signature = await signMessage(client, {
62
+ * message: 'hello world',
63
+ * })
64
+ */
19
65
  export async function signMessage<
20
66
  TChain extends Chain | undefined,
21
67
  TAccount extends Account | undefined,
@@ -24,6 +24,104 @@ export type SignTypedDataParameters<
24
24
 
25
25
  export type SignTypedDataReturnType = Hex
26
26
 
27
+ /**
28
+ * 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))`.
29
+ *
30
+ * - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
31
+ * - JSON-RPC Methods:
32
+ * - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
33
+ * - Local Accounts: Signs locally. No JSON-RPC request.
34
+ *
35
+ * @param client - Client to use
36
+ * @param parameters - {@link SignTypedDataParameters}
37
+ * @returns The signed data. {@link SignTypedDataReturnType}
38
+ *
39
+ * @example
40
+ * import { createWalletClient, custom } from 'viem'
41
+ * import { mainnet } from 'viem/chains'
42
+ * import { signTypedData } from 'viem/wallet'
43
+ *
44
+ * const client = createWalletClient({
45
+ * chain: mainnet,
46
+ * transport: custom(window.ethereum),
47
+ * })
48
+ * const signature = await signTypedData(client, {
49
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
50
+ * domain: {
51
+ * name: 'Ether Mail',
52
+ * version: '1',
53
+ * chainId: 1,
54
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
55
+ * },
56
+ * types: {
57
+ * Person: [
58
+ * { name: 'name', type: 'string' },
59
+ * { name: 'wallet', type: 'address' },
60
+ * ],
61
+ * Mail: [
62
+ * { name: 'from', type: 'Person' },
63
+ * { name: 'to', type: 'Person' },
64
+ * { name: 'contents', type: 'string' },
65
+ * ],
66
+ * },
67
+ * primaryType: 'Mail',
68
+ * message: {
69
+ * from: {
70
+ * name: 'Cow',
71
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
72
+ * },
73
+ * to: {
74
+ * name: 'Bob',
75
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
76
+ * },
77
+ * contents: 'Hello, Bob!',
78
+ * },
79
+ * })
80
+ *
81
+ * @example
82
+ * // Account Hoisting
83
+ * import { createWalletClient, http } from 'viem'
84
+ * import { privateKeyToAccount } from 'viem/accounts'
85
+ * import { mainnet } from 'viem/chains'
86
+ * import { signTypedData } from 'viem/wallet'
87
+ *
88
+ * const client = createWalletClient({
89
+ * account: privateKeyToAccount('0x…'),
90
+ * chain: mainnet,
91
+ * transport: http(),
92
+ * })
93
+ * const signature = await signTypedData(client, {
94
+ * domain: {
95
+ * name: 'Ether Mail',
96
+ * version: '1',
97
+ * chainId: 1,
98
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
99
+ * },
100
+ * types: {
101
+ * Person: [
102
+ * { name: 'name', type: 'string' },
103
+ * { name: 'wallet', type: 'address' },
104
+ * ],
105
+ * Mail: [
106
+ * { name: 'from', type: 'Person' },
107
+ * { name: 'to', type: 'Person' },
108
+ * { name: 'contents', type: 'string' },
109
+ * ],
110
+ * },
111
+ * primaryType: 'Mail',
112
+ * message: {
113
+ * from: {
114
+ * name: 'Cow',
115
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
116
+ * },
117
+ * to: {
118
+ * name: 'Bob',
119
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
120
+ * },
121
+ * contents: 'Hello, Bob!',
122
+ * },
123
+ * })
124
+ */
27
125
  export async function signTypedData<
28
126
  TTypedData extends TypedData | { [key: string]: unknown },
29
127
  TPrimaryType extends string,