viem 0.4.0-main.20230412T220621 → 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
@@ -4,6 +4,23 @@ import type { Account, Chain } from '../../types/index.js';
4
4
  import type { WalletClient } from '../createWalletClient.js';
5
5
  import type { Transport } from '../transports/index.js';
6
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
+ */
7
24
  addChain: (args: AddChainParameters) => Promise<void>;
8
25
  /**
9
26
  * Deploys a contract to the network, given bytecode and constructor arguments.
@@ -11,7 +28,7 @@ export type WalletActions<TChain extends Chain | undefined = Chain | undefined,
11
28
  * - Docs: https://viem.sh/docs/contract/deployContract.html
12
29
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
13
30
  *
14
- * @param parameters - {@link DeployContractParameters}
31
+ * @param args - {@link DeployContractParameters}
15
32
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
16
33
  *
17
34
  * @example
@@ -20,7 +37,7 @@ export type WalletActions<TChain extends Chain | undefined = Chain | undefined,
20
37
  * import { mainnet } from 'viem/chains'
21
38
  *
22
39
  * const client = createWalletClient({
23
- * account = privateKeyToAccount('0x…'),
40
+ * account: privateKeyToAccount('0x…'),
24
41
  * chain: mainnet,
25
42
  * transport: http(),
26
43
  * })
@@ -31,18 +48,388 @@ export type WalletActions<TChain extends Chain | undefined = Chain | undefined,
31
48
  * })
32
49
  */
33
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
+ */
34
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
+ */
35
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
+ */
36
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
+ */
37
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
+ */
38
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
+ */
39
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
+ */
40
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
+ */
41
337
  signTypedData: <TTypedData extends TypedData | {
42
338
  [key: string]: unknown;
43
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
+ */
44
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
+ */
45
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
+ */
46
433
  writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
47
434
  };
48
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>;
@@ -1 +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,EAA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ExC,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"}
@@ -1,2 +1,2 @@
1
- export declare const version = "0.4.0-main.20230412T220621";
1
+ export declare const version = "0.4.0-main.20230413T040554";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "isomorphic-ws": "5.0.0",
13
13
  "ws": "8.12.0"
14
14
  },
15
- "version": "0.4.0-main.20230412T220621",
15
+ "version": "0.4.0-main.20230413T040554",
16
16
  "files": [
17
17
  "dist",
18
18
  "!dist/**/*.tsbuildinfo",
@@ -32,7 +32,6 @@ export type GetEnsAddressReturnType = Address | null
32
32
  * - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html
33
33
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
34
34
  *
35
- * @remarks
36
35
  * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
37
36
  *
38
37
  * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
@@ -19,7 +19,6 @@ export type GetEnsAvatarReturnType = string | null
19
19
  * - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html
20
20
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
21
21
  *
22
- * @remarks
23
22
  * Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText.html) with `key` set to `'avatar'`.
24
23
  *
25
24
  * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
@@ -25,7 +25,6 @@ export type GetEnsNameReturnType = string | null
25
25
  * - Docs: https://viem.sh/docs/ens/actions/getEnsName.html
26
26
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
27
27
  *
28
- * @remarks
29
28
  * Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
30
29
  *
31
30
  * @param client - Client to use
@@ -22,7 +22,6 @@ export type GetEnsResolverReturnType = Address
22
22
  * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
23
23
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
24
24
  *
25
- * @remarks
26
25
  * Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
27
26
  *
28
27
  * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
@@ -30,7 +30,6 @@ export type GetEnsTextReturnType = string | null
30
30
  * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
31
31
  * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
32
32
  *
33
- * @remarks
34
33
  * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
35
34
  *
36
35
  * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
@@ -114,6 +114,24 @@ export type GetContractReturnType<
114
114
  * A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
115
115
  *
116
116
  * Internally, `read` uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
117
+ *
118
+ * @example
119
+ * import { createPublicClient, getContract, http, parseAbi } from 'viem'
120
+ * import { mainnet } from 'viem/chains'
121
+ *
122
+ * const publicClient = createPublicClient({
123
+ * chain: mainnet,
124
+ * transport: http(),
125
+ * })
126
+ * const contract = getContract({
127
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
128
+ * abi: parseAbi([
129
+ * 'function balanceOf(address owner) view returns (uint256)',
130
+ * ]),
131
+ * publicClient,
132
+ * })
133
+ * const result = await contract.read.balanceOf(['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'])
134
+ * // 424122n
117
135
  */
118
136
  read: {
119
137
  [FunctionName in _ReadFunctionNames]: GetReadFunction<
@@ -128,6 +146,23 @@ export type GetContractReturnType<
128
146
  : {
129
147
  /**
130
148
  * Estimates the gas necessary to complete a transaction without submitting it to the network.
149
+ *
150
+ * @example
151
+ * import { createPublicClient, getContract, http, parseAbi } from 'viem'
152
+ * import { mainnet } from 'viem/chains'
153
+ *
154
+ * const client = createPublicClient({
155
+ * chain: mainnet,
156
+ * transport: http(),
157
+ * })
158
+ * const contract = getContract({
159
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
160
+ * abi: parseAbi(['function mint() public']),
161
+ * publicClient,
162
+ * })
163
+ * const gas = await contract.estimateGas.mint({
164
+ * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
165
+ * })
131
166
  */
132
167
  estimateGas: {
133
168
  [FunctionName in _WriteFunctionNames]: GetEstimateFunction<
@@ -145,6 +180,23 @@ export type GetContractReturnType<
145
180
  * This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract.html), but also supports contract write functions.
146
181
  *
147
182
  * Internally, `simulate` uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
183
+ *
184
+ * @example
185
+ * import { createPublicClient, getContract, http, parseAbi } from 'viem'
186
+ * import { mainnet } from 'viem/chains'
187
+ *
188
+ * const client = createPublicClient({
189
+ * chain: mainnet,
190
+ * transport: http(),
191
+ * })
192
+ * const contract = getContract({
193
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
194
+ * abi: parseAbi(['function mint() public']),
195
+ * publicClient,
196
+ * })
197
+ * const result = await contract.simulate.mint({
198
+ * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
199
+ * })
148
200
  */
149
201
  simulate: {
150
202
  [FunctionName in _WriteFunctionNames]: GetSimulateFunction<
@@ -162,6 +214,21 @@ export type GetContractReturnType<
162
214
  : {
163
215
  /**
164
216
  * Creates a Filter to retrieve event logs that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges.html) or [`getFilterLogs`](https://viem.sh/docs/actions/public/getFilterLogs.html).
217
+ *
218
+ * @example
219
+ * import { createPublicClient, getContract, http, parseAbi } from 'viem'
220
+ * import { mainnet } from 'viem/chains'
221
+ *
222
+ * const client = createPublicClient({
223
+ * chain: mainnet,
224
+ * transport: http(),
225
+ * })
226
+ * const contract = getContract({
227
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
228
+ * abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
229
+ * publicClient,
230
+ * })
231
+ * const filter = await contract.createEventFilter.Transfer()
165
232
  */
166
233
  createEventFilter: {
167
234
  [EventName in _EventNames]: GetEventFilter<
@@ -176,6 +243,25 @@ export type GetContractReturnType<
176
243
  * This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent.html#onLogs).
177
244
  *
178
245
  * `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter.html) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs.html) instead.
246
+ *
247
+ * @example
248
+ * import { createPublicClient, getContract, http, parseAbi } from 'viem'
249
+ * import { mainnet } from 'viem/chains'
250
+ *
251
+ * const client = createPublicClient({
252
+ * chain: mainnet,
253
+ * transport: http(),
254
+ * })
255
+ * const contract = getContract({
256
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
257
+ * abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
258
+ * publicClient,
259
+ * })
260
+ * const filter = await contract.createEventFilter.Transfer()
261
+ * const unwatch = contract.watchEvent.Transfer(
262
+ * { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
263
+ * { onLogs: (logs) => console.log(logs) },
264
+ * )
179
265
  */
180
266
  watchEvent: {
181
267
  [EventName in _EventNames]: GetWatchEvent<
@@ -197,7 +283,24 @@ export type GetContractReturnType<
197
283
  *
198
284
  * Internally, `write` uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
199
285
  *
200
- * 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.
286
+ * __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.__
287
+ *
288
+ * @example
289
+ * import { createWalletClient, getContract, http, parseAbi } from 'viem'
290
+ * import { mainnet } from 'viem/chains'
291
+ *
292
+ * const client = createWalletClient({
293
+ * chain: mainnet,
294
+ * transport: http(),
295
+ * })
296
+ * const contract = getContract({
297
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
298
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
299
+ * publicClient,
300
+ * })
301
+ * const hash = await contract.write.min([69420], {
302
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
303
+ * })
201
304
  */
202
305
  write: {
203
306
  [FunctionName in _WriteFunctionNames]: GetWriteFunction<
@@ -221,7 +324,6 @@ export type GetContractReturnType<
221
324
  *
222
325
  * - Docs https://viem.sh/docs/contract/getContract.html
223
326
  *
224
- * @remarks
225
327
  * Using Contract Instances can make it easier to work with contracts if you don't want to pass the `abi` and `address` properites every time you perform contract actions, e.g. [`readContract`](https://viem.sh/docs/contract/readContract.html), [`writeContract`](https://viem.sh/docs/contract/writeContract.html), [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas.html), etc.
226
328
  *
227
329
  * @example