@aastar/sdk 0.14.0 → 0.14.3

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 (812) hide show
  1. package/.eslintrc.js +28 -0
  2. package/.gitmodules +9 -0
  3. package/README.md +170 -0
  4. package/aastar-sdk.code-workspace +14 -0
  5. package/abis/BLSAggregator.json +572 -0
  6. package/abis/BLSValidator.json +26 -0
  7. package/abis/DVTValidator.json +370 -0
  8. package/abis/Eip7702Support.json +24 -0
  9. package/abis/EntryPoint.json +1379 -0
  10. package/abis/GToken.json +479 -0
  11. package/abis/GTokenStaking.json +944 -0
  12. package/abis/LegacyAccount.json +625 -0
  13. package/abis/MySBT.json +1586 -0
  14. package/abis/Paymaster.json +1205 -0
  15. package/abis/PaymasterFactory.json +650 -0
  16. package/abis/PaymasterV4_2.json +1183 -0
  17. package/abis/Registry.json +1636 -0
  18. package/abis/ReputationSystem.json +477 -0
  19. package/abis/SenderCreator.json +99 -0
  20. package/abis/Simple7702Account.json +395 -0
  21. package/abis/SimpleAccount.json +625 -0
  22. package/abis/SimpleAccountFactory.json +108 -0
  23. package/abis/SimpleAccountFactoryV08.json +87 -0
  24. package/abis/SimpleAccountV08.json +557 -0
  25. package/abis/SuperPaymaster.json +1399 -0
  26. package/abis/UserOperationLib.json +57 -0
  27. package/abis/aPNTs.json +1173 -0
  28. package/abis/xPNTsFactory.json +728 -0
  29. package/abis/xPNTsToken.json +1173 -0
  30. package/config/networks/README.md +54 -0
  31. package/config/networks/mainnet.env.example +39 -0
  32. package/config/networks/optimism-sepolia.env.example +35 -0
  33. package/config/networks/optimism.env.example +36 -0
  34. package/config/networks/sepolia.env.example +36 -0
  35. package/data/experiment_data.csv +36 -0
  36. package/data/industry_baseline_2025-12-23.json +154 -0
  37. package/data/industry_baseline_latest.json +154 -0
  38. package/docs/API_REFERENCE.md +796 -0
  39. package/docs/DAO_Mining_Distribution_Plan.md +522 -0
  40. package/docs/DOCUMENTATION_PLAN.md +455 -0
  41. package/docs/Plan.md +266 -0
  42. package/docs/Regression_Testing_Guide.md +70 -0
  43. package/docs/SDK_Optimization_Evaluation_Plan.md +51 -0
  44. package/docs/SEPOLIA_ENV_REFERENCE.md +51 -0
  45. package/docs/STAGE_3_SCENARIO_EXP_PLAN.md +77 -0
  46. package/docs/Script_Comparison_Report.md +91 -0
  47. package/docs/Sepolia_Latest_Deployment.md +117 -0
  48. package/docs/TEST_COVERAGE_MATRIX.md +72 -0
  49. package/docs/TODO_SDK_COVERAGE.md +55 -0
  50. package/docs/USER_CASE_DESIGN.md +110 -0
  51. package/docs/api/@aastar/account/README.md +15 -0
  52. package/docs/api/@aastar/account/classes/UserOpClient.md +87 -0
  53. package/docs/api/@aastar/account/functions/createEOAWalletClient.md +21 -0
  54. package/docs/api/@aastar/account/functions/getUserOpHash.md +23 -0
  55. package/docs/api/@aastar/account/functions/packUserOpLimits.md +19 -0
  56. package/docs/api/@aastar/account/functions/toSimpleSmartAccount.md +83 -0
  57. package/docs/api/@aastar/account/type-aliases/EOAWalletClient.md +37 -0
  58. package/docs/api/@aastar/account/type-aliases/SimpleSmartAccount.md +39 -0
  59. package/docs/api/@aastar/core/README.md +136 -0
  60. package/docs/api/@aastar/core/classes/BLSSigner.md +147 -0
  61. package/docs/api/@aastar/core/enumerations/NodeType.md +33 -0
  62. package/docs/api/@aastar/core/functions/aggregatorActions.md +2714 -0
  63. package/docs/api/@aastar/core/functions/createAAStarPublicClient.md +3105 -0
  64. package/docs/api/@aastar/core/functions/dvtActions.md +2714 -0
  65. package/docs/api/@aastar/core/functions/factoryActions.md +2714 -0
  66. package/docs/api/@aastar/core/functions/getAddressUrl.md +32 -0
  67. package/docs/api/@aastar/core/functions/getAllCommunityConfigs.md +9 -0
  68. package/docs/api/@aastar/core/functions/getAllV2Contracts.md +20 -0
  69. package/docs/api/@aastar/core/functions/getBlockExplorer.md +26 -0
  70. package/docs/api/@aastar/core/functions/getChainId.md +26 -0
  71. package/docs/api/@aastar/core/functions/getCommunities.md +76 -0
  72. package/docs/api/@aastar/core/functions/getCommunity.md +32 -0
  73. package/docs/api/@aastar/core/functions/getCommunityConfig.md +15 -0
  74. package/docs/api/@aastar/core/functions/getContract.md +37 -0
  75. package/docs/api/@aastar/core/functions/getContractNetworks.md +18 -0
  76. package/docs/api/@aastar/core/functions/getContracts.md +178 -0
  77. package/docs/api/@aastar/core/functions/getCoreContracts.md +55 -0
  78. package/docs/api/@aastar/core/functions/getDeploymentDate.md +32 -0
  79. package/docs/api/@aastar/core/functions/getEntryPoint.md +25 -0
  80. package/docs/api/@aastar/core/functions/getNetwork.md +26 -0
  81. package/docs/api/@aastar/core/functions/getPaymasterV4_1.md +25 -0
  82. package/docs/api/@aastar/core/functions/getRpcUrl.md +25 -0
  83. package/docs/api/@aastar/core/functions/getSimpleAccountFactory.md +25 -0
  84. package/docs/api/@aastar/core/functions/getSuperPaymasterV2.md +25 -0
  85. package/docs/api/@aastar/core/functions/getTestAccounts.md +30 -0
  86. package/docs/api/@aastar/core/functions/getTestTokenContracts.md +38 -0
  87. package/docs/api/@aastar/core/functions/getTokenContracts.md +31 -0
  88. package/docs/api/@aastar/core/functions/getTxUrl.md +32 -0
  89. package/docs/api/@aastar/core/functions/getV2ContractByAddress.md +28 -0
  90. package/docs/api/@aastar/core/functions/getV2ContractByName.md +28 -0
  91. package/docs/api/@aastar/core/functions/getV2ContractsByDate.md +26 -0
  92. package/docs/api/@aastar/core/functions/isContractNetworkSupported.md +27 -0
  93. package/docs/api/@aastar/core/functions/isRegisteredCommunity.md +15 -0
  94. package/docs/api/@aastar/core/functions/isV2Contract.md +27 -0
  95. package/docs/api/@aastar/core/functions/paymasterV4Actions.md +2719 -0
  96. package/docs/api/@aastar/core/functions/registryActions.md +2720 -0
  97. package/docs/api/@aastar/core/functions/reputationActions.md +2720 -0
  98. package/docs/api/@aastar/core/functions/sbtActions.md +2720 -0
  99. package/docs/api/@aastar/core/functions/stakingActions.md +2720 -0
  100. package/docs/api/@aastar/core/functions/superPaymasterActions.md +2720 -0
  101. package/docs/api/@aastar/core/functions/tokenActions.md +2714 -0
  102. package/docs/api/@aastar/core/interfaces/CommunityConfig.md +81 -0
  103. package/docs/api/@aastar/core/interfaces/ContractVersion.md +63 -0
  104. package/docs/api/@aastar/core/type-aliases/AggregatorActions.md +79 -0
  105. package/docs/api/@aastar/core/type-aliases/ContractCategory.md +5 -0
  106. package/docs/api/@aastar/core/type-aliases/ContractNetwork.md +5 -0
  107. package/docs/api/@aastar/core/type-aliases/DVTActions.md +139 -0
  108. package/docs/api/@aastar/core/type-aliases/FactoryActions.md +99 -0
  109. package/docs/api/@aastar/core/type-aliases/NetworkContracts.md +5 -0
  110. package/docs/api/@aastar/core/type-aliases/PaymasterV4Actions.md +422 -0
  111. package/docs/api/@aastar/core/type-aliases/RegistryActions.md +263 -0
  112. package/docs/api/@aastar/core/type-aliases/ReputationActions.md +47 -0
  113. package/docs/api/@aastar/core/type-aliases/RoleConfig.md +83 -0
  114. package/docs/api/@aastar/core/type-aliases/SBTActions.md +203 -0
  115. package/docs/api/@aastar/core/type-aliases/StakingActions.md +179 -0
  116. package/docs/api/@aastar/core/type-aliases/SuperPaymasterActions.md +219 -0
  117. package/docs/api/@aastar/core/type-aliases/SupportedNetwork.md +3 -0
  118. package/docs/api/@aastar/core/type-aliases/TokenActions.md +151 -0
  119. package/docs/api/@aastar/core/variables/AASTAR_COMMUNITY.md +8 -0
  120. package/docs/api/@aastar/core/variables/ALL_ADDRESSES.md +71 -0
  121. package/docs/api/@aastar/core/variables/BLSAggregatorABI.md +3 -0
  122. package/docs/api/@aastar/core/variables/BLSHelpers.md +91 -0
  123. package/docs/api/@aastar/core/variables/BPS_DENOMINATOR.md +5 -0
  124. package/docs/api/@aastar/core/variables/BRANDING.md +67 -0
  125. package/docs/api/@aastar/core/variables/BREAD_COMMUNITY.md +8 -0
  126. package/docs/api/@aastar/core/variables/COMMUNITIES.md +5 -0
  127. package/docs/api/@aastar/core/variables/COMMUNITY_OWNERS.md +15 -0
  128. package/docs/api/@aastar/core/variables/CONTRACTS.md +163 -0
  129. package/docs/api/@aastar/core/variables/CONTRACT_METADATA.md +67 -0
  130. package/docs/api/@aastar/core/variables/CORE_ADDRESSES.md +35 -0
  131. package/docs/api/@aastar/core/variables/DEFAULT_APNTS_PRICE_USD.md +5 -0
  132. package/docs/api/@aastar/core/variables/DEFAULT_GAS_TOKEN_MINT_AMOUNT.md +5 -0
  133. package/docs/api/@aastar/core/variables/DEFAULT_USDT_MINT_AMOUNT.md +5 -0
  134. package/docs/api/@aastar/core/variables/DVTValidatorABI.md +3 -0
  135. package/docs/api/@aastar/core/variables/EntryPointABI.md +3 -0
  136. package/docs/api/@aastar/core/variables/FAUCET_API_URL.md +5 -0
  137. package/docs/api/@aastar/core/variables/GTokenABI.md +3 -0
  138. package/docs/api/@aastar/core/variables/GTokenStakingABI.md +3 -0
  139. package/docs/api/@aastar/core/variables/LINKS.md +33 -0
  140. package/docs/api/@aastar/core/variables/MAX_SERVICE_FEE.md +5 -0
  141. package/docs/api/@aastar/core/variables/MONITORING_ADDRESSES.md +15 -0
  142. package/docs/api/@aastar/core/variables/MySBTABI.md +3 -0
  143. package/docs/api/@aastar/core/variables/NETWORKS.md +79 -0
  144. package/docs/api/@aastar/core/variables/NODE_STAKE_AMOUNTS.md +31 -0
  145. package/docs/api/@aastar/core/variables/OFFICIAL_ADDRESSES.md +11 -0
  146. package/docs/api/@aastar/core/variables/PAYMASTER_ADDRESSES.md +15 -0
  147. package/docs/api/@aastar/core/variables/PaymasterABI.md +3 -0
  148. package/docs/api/@aastar/core/variables/PaymasterFactoryABI.md +3 -0
  149. package/docs/api/@aastar/core/variables/PaymasterV4ABI.md +3 -0
  150. package/docs/api/@aastar/core/variables/ROLE_ANODE.md +3 -0
  151. package/docs/api/@aastar/core/variables/ROLE_COMMUNITY.md +3 -0
  152. package/docs/api/@aastar/core/variables/ROLE_ENDUSER.md +5 -0
  153. package/docs/api/@aastar/core/variables/ROLE_KMS.md +3 -0
  154. package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_AOA.md +3 -0
  155. package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_SUPER.md +3 -0
  156. package/docs/api/@aastar/core/variables/RegistryABI.md +3 -0
  157. package/docs/api/@aastar/core/variables/ReputationSystemABI.md +3 -0
  158. package/docs/api/@aastar/core/variables/ReputationSystemV3ABI.md +3 -0
  159. package/docs/api/@aastar/core/variables/SEPOLIA_CONTRACTS.md +159 -0
  160. package/docs/api/@aastar/core/variables/SEPOLIA_V2_VERSIONS.md +67 -0
  161. package/docs/api/@aastar/core/variables/SERVICE_FEE_RATE.md +5 -0
  162. package/docs/api/@aastar/core/variables/Simple7702AccountABI.md +3 -0
  163. package/docs/api/@aastar/core/variables/SimpleAccountABI.md +3 -0
  164. package/docs/api/@aastar/core/variables/SimpleAccountFactoryABI.md +3 -0
  165. package/docs/api/@aastar/core/variables/SimpleAccountFactoryV08ABI.md +3 -0
  166. package/docs/api/@aastar/core/variables/SimpleAccountV08ABI.md +3 -0
  167. package/docs/api/@aastar/core/variables/SuperPaymasterABI.md +3 -0
  168. package/docs/api/@aastar/core/variables/SuperPaymasterV3ABI.md +3 -0
  169. package/docs/api/@aastar/core/variables/TEST_ACCOUNT_ADDRESSES.md +11 -0
  170. package/docs/api/@aastar/core/variables/TEST_ACCOUNT_POOL_SIZE.md +5 -0
  171. package/docs/api/@aastar/core/variables/TEST_COMMUNITIES.md +19 -0
  172. package/docs/api/@aastar/core/variables/TEST_TOKEN_ADDRESSES.md +19 -0
  173. package/docs/api/@aastar/core/variables/TOKEN_ADDRESSES.md +11 -0
  174. package/docs/api/@aastar/core/variables/V2_SUMMARY.md +39 -0
  175. package/docs/api/@aastar/core/variables/xPNTsFactoryABI.md +3 -0
  176. package/docs/api/@aastar/core/variables/xPNTsTokenABI.md +3 -0
  177. package/docs/api/@aastar/paymaster/README.md +14 -0
  178. package/docs/api/@aastar/paymaster/classes/SuperPaymasterClient.md +163 -0
  179. package/docs/api/@aastar/paymaster/functions/checkEligibility.md +28 -0
  180. package/docs/api/@aastar/paymaster/functions/getPaymasterV4Middleware.md +32 -0
  181. package/docs/api/@aastar/paymaster/functions/getSuperPaymasterMiddleware.md +32 -0
  182. package/docs/api/@aastar/paymaster/type-aliases/PaymasterConfig.md +35 -0
  183. package/docs/api/@aastar/paymaster/type-aliases/PaymasterV4MiddlewareConfig.md +35 -0
  184. package/docs/api/@aastar/tokens/README.md +3 -0
  185. package/docs/api/@aastar/tokens/classes/FinanceClient.md +8653 -0
  186. package/docs/api/README.md +6 -0
  187. package/docs/examples/community-flow.md +28 -0
  188. package/docs/examples/enduser-flow.md +24 -0
  189. package/docs/examples/index.md +18 -0
  190. package/docs/examples/multi-chain.md +31 -0
  191. package/docs/examples/operator-flow.md +28 -0
  192. package/docs/guide/CLI_GUIDE.md +65 -0
  193. package/docs/guide/DOCUMENTATION_PLAN.md +455 -0
  194. package/docs/guide/Security-solution.md +106 -0
  195. package/docs/guide/TEST_COMMANDS.md +320 -0
  196. package/docs/guide/getting-started.md +133 -0
  197. package/docs/guide/installation.md +40 -0
  198. package/docs/guide/paper-data-collection.md +69 -0
  199. package/docs/guide/quick-start.md +52 -0
  200. package/docs/guide/task_breakdown.md +121 -0
  201. package/docs/old-solution.md +1078 -0
  202. package/docs/paper-data-collection.md +69 -0
  203. package/docs/technical_plan.md +510 -0
  204. package/docs/zh/examples/community-flow.md +38 -0
  205. package/docs/zh/examples/complete-workflow.md +10 -0
  206. package/docs/zh/examples/enduser-flow.md +33 -0
  207. package/docs/zh/examples/index.md +18 -0
  208. package/docs/zh/examples/multi-chain.md +46 -0
  209. package/docs/zh/examples/operator-flow.md +37 -0
  210. package/docs/zh/guide/CLI_GUIDE.md +48 -0
  211. package/docs/zh/guide/DOCUMENTATION_PLAN.md +455 -0
  212. package/docs/zh/guide/Plan.md +266 -0
  213. package/docs/zh/guide/SDK_Optimization_Evaluation_Plan.md +51 -0
  214. package/docs/zh/guide/Security-solution.md +106 -0
  215. package/docs/zh/guide/TEST_COMMANDS.md +125 -0
  216. package/docs/zh/guide/TEST_COVERAGE_MATRIX.md +72 -0
  217. package/docs/zh/guide/concepts/account-abstraction.md +95 -0
  218. package/docs/zh/guide/concepts/rainbow-bridge.md +68 -0
  219. package/docs/zh/guide/concepts/reputation.md +95 -0
  220. package/docs/zh/guide/concepts/superpaymaster.md +141 -0
  221. package/docs/zh/guide/getting-started.md +133 -0
  222. package/docs/zh/guide/installation.md +107 -0
  223. package/docs/zh/guide/old-solution.md +1078 -0
  224. package/docs/zh/guide/paper-data-collection.md +69 -0
  225. package/docs/zh/guide/quick-start.md +134 -0
  226. package/docs/zh/guide/sdk-readme.md +253 -0
  227. package/docs/zh/guide/task_breakdown.md +76 -0
  228. package/docs/zh/guide/technical_plan.md +510 -0
  229. package/docs/zh/guide/use-cases/community-management.md +141 -0
  230. package/docs/zh/guide/use-cases/gasless-transactions.md +71 -0
  231. package/docs/zh/guide/use-cases/operator-staking.md +84 -0
  232. package/docs/zh/guide/use-cases/yop.md +72 -0
  233. package/examples/sdk-demo/DEVELOPER_GUIDE.md +159 -0
  234. package/examples/sdk-demo/README.md +30 -0
  235. package/examples/sdk-demo/usage.ts +137 -0
  236. package/ext/aastar-shared-config/.env.example +6 -0
  237. package/ext/aastar-shared-config/.github/workflows/check-secrets.yml +257 -0
  238. package/ext/aastar-shared-config/AGENTS.md +21 -0
  239. package/ext/aastar-shared-config/CHANGELOG.md +99 -0
  240. package/ext/aastar-shared-config/LICENSE +21 -0
  241. package/ext/aastar-shared-config/QUICK_START.md +215 -0
  242. package/ext/aastar-shared-config/README.md +412 -0
  243. package/ext/aastar-shared-config/SHARED_CONFIG_SUMMARY.md +273 -0
  244. package/ext/aastar-shared-config/check-locker-status.mjs +7 -0
  245. package/ext/aastar-shared-config/favicon.ico +0 -0
  246. package/ext/aastar-shared-config/generate-comparison-table.sh +67 -0
  247. package/ext/aastar-shared-config/package.json +46 -0
  248. package/ext/aastar-shared-config/pnpm-lock.yaml +1182 -0
  249. package/ext/aastar-shared-config/src/abis/BLSAggregator.json +1 -0
  250. package/ext/aastar-shared-config/src/abis/DVTValidator.json +1 -0
  251. package/ext/aastar-shared-config/src/abis/GToken.json +1 -0
  252. package/ext/aastar-shared-config/src/abis/GTokenStaking.json +1 -0
  253. package/ext/aastar-shared-config/src/abis/MySBT.json +1 -0
  254. package/ext/aastar-shared-config/src/abis/PaymasterFactory.json +1 -0
  255. package/ext/aastar-shared-config/src/abis/PaymasterV4.json +1098 -0
  256. package/ext/aastar-shared-config/src/abis/Registry.json +1 -0
  257. package/ext/aastar-shared-config/src/abis/SimpleAccount.json +557 -0
  258. package/ext/aastar-shared-config/src/abis/SimpleAccountFactory.json +87 -0
  259. package/ext/aastar-shared-config/src/abis/SuperPaymasterV2.json +1 -0
  260. package/ext/aastar-shared-config/src/abis/index.ts +45 -0
  261. package/ext/aastar-shared-config/src/abis/xPNTsFactory.json +1 -0
  262. package/ext/aastar-shared-config/src/abis/xPNTsToken.json +1 -0
  263. package/ext/aastar-shared-config/src/branding.ts +32 -0
  264. package/ext/aastar-shared-config/src/communities.ts +93 -0
  265. package/ext/aastar-shared-config/src/constants.ts +67 -0
  266. package/ext/aastar-shared-config/src/contract-addresses.ts +95 -0
  267. package/ext/aastar-shared-config/src/contract-versions.ts +374 -0
  268. package/ext/aastar-shared-config/src/contracts.ts +414 -0
  269. package/ext/aastar-shared-config/src/index.ts +14 -0
  270. package/ext/aastar-shared-config/src/networks.ts +117 -0
  271. package/ext/aastar-shared-config/sync-abis.sh +92 -0
  272. package/ext/aastar-shared-config/sync-versions.mjs +150 -0
  273. package/ext/aastar-shared-config/tsconfig.json +18 -0
  274. package/ext/aastar-shared-config/tsup.config.ts +10 -0
  275. package/ext/aastar-shared-config/verify-all.sh +207 -0
  276. package/ext/aastar-shared-config/verify-contracts.sh +85 -0
  277. package/ext/aastar-shared-config/verify-mysbt-v243.mjs +27 -0
  278. package/ext/aastar-shared-config/verify-onchain-versions.mjs +93 -0
  279. package/ext/permissionless.js/.changeset/README.md +8 -0
  280. package/ext/permissionless.js/.changeset/config.json +11 -0
  281. package/ext/permissionless.js/.env-example +2 -0
  282. package/ext/permissionless.js/.github/actions/install-dependencies/action.yml +17 -0
  283. package/ext/permissionless.js/.github/dependabot.yaml +10 -0
  284. package/ext/permissionless.js/.github/workflows/canary.yml +49 -0
  285. package/ext/permissionless.js/.github/workflows/on-pull-request.yml +61 -0
  286. package/ext/permissionless.js/.github/workflows/on-push-to-main.yml +59 -0
  287. package/ext/permissionless.js/.github/workflows/prune-tags.yml +92 -0
  288. package/ext/permissionless.js/.github/workflows/verify.yml +114 -0
  289. package/ext/permissionless.js/.size-limit.json +13 -0
  290. package/ext/permissionless.js/LICENSE +21 -0
  291. package/ext/permissionless.js/assets/banner.png +0 -0
  292. package/ext/permissionless.js/biome.json +46 -0
  293. package/ext/permissionless.js/bun.lock +2340 -0
  294. package/ext/permissionless.js/bun.lockb +0 -0
  295. package/ext/permissionless.js/package.json +82 -0
  296. package/ext/permissionless.js/packages/mock-paymaster/CHANGELOG.md +31 -0
  297. package/ext/permissionless.js/packages/mock-paymaster/constants.ts +84 -0
  298. package/ext/permissionless.js/packages/mock-paymaster/helpers/abi.ts +1048 -0
  299. package/ext/permissionless.js/packages/mock-paymaster/helpers/erc20-utils.ts +105 -0
  300. package/ext/permissionless.js/packages/mock-paymaster/helpers/schema.ts +307 -0
  301. package/ext/permissionless.js/packages/mock-paymaster/helpers/utils.ts +78 -0
  302. package/ext/permissionless.js/packages/mock-paymaster/index.ts +63 -0
  303. package/ext/permissionless.js/packages/mock-paymaster/package.json +33 -0
  304. package/ext/permissionless.js/packages/mock-paymaster/relay.ts +424 -0
  305. package/ext/permissionless.js/packages/mock-paymaster/setup.ts +163 -0
  306. package/ext/permissionless.js/packages/mock-paymaster/singletonPaymasters.ts +230 -0
  307. package/ext/permissionless.js/packages/permissionless/CHANGELOG.md +893 -0
  308. package/ext/permissionless.js/packages/permissionless/README.md +122 -0
  309. package/ext/permissionless.js/packages/permissionless/accounts/biconomy/abi/BiconomySmartAccountAbi.ts +128 -0
  310. package/ext/permissionless.js/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts +374 -0
  311. package/ext/permissionless.js/packages/permissionless/accounts/decodeCalls.test.ts +505 -0
  312. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/abi/EtherspotBootstrapAbi.ts +94 -0
  313. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/constants.ts +27 -0
  314. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/toEtherspotSmartAccount.ts +369 -0
  315. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/getInitMSAData.ts +56 -0
  316. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/getNonceKey.ts +21 -0
  317. package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/wrapMessageHash.ts +43 -0
  318. package/ext/permissionless.js/packages/permissionless/accounts/index.ts +86 -0
  319. package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelAccountAbi.ts +87 -0
  320. package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3AccountAbi.ts +813 -0
  321. package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3FactoryAbi.ts +12 -0
  322. package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3MetaFactoryAbi.ts +17 -0
  323. package/ext/permissionless.js/packages/permissionless/accounts/kernel/constants.ts +14 -0
  324. package/ext/permissionless.js/packages/permissionless/accounts/kernel/to7702KernelSmartAccount.ts +63 -0
  325. package/ext/permissionless.js/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts +62 -0
  326. package/ext/permissionless.js/packages/permissionless/accounts/kernel/toKernelSmartAccount.ts +984 -0
  327. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/decodeCallData.ts +43 -0
  328. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/encodeCallData.ts +57 -0
  329. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/getNonceKey.ts +33 -0
  330. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/isKernelV2.ts +6 -0
  331. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/isWebAuthnAccount.ts +8 -0
  332. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/signMessage.ts +115 -0
  333. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/signTypedData.ts +97 -0
  334. package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts +44 -0
  335. package/ext/permissionless.js/packages/permissionless/accounts/light/toLightSmartAccount.ts +496 -0
  336. package/ext/permissionless.js/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts +351 -0
  337. package/ext/permissionless.js/packages/permissionless/accounts/safe/index.ts +14 -0
  338. package/ext/permissionless.js/packages/permissionless/accounts/safe/signUserOperation.test.ts +275 -0
  339. package/ext/permissionless.js/packages/permissionless/accounts/safe/signUserOperation.ts +316 -0
  340. package/ext/permissionless.js/packages/permissionless/accounts/safe/toSafeSmartAccount.ts +1980 -0
  341. package/ext/permissionless.js/packages/permissionless/accounts/simple/to7702SimpleSmartAccount.ts +51 -0
  342. package/ext/permissionless.js/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts +585 -0
  343. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts +221 -0
  344. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/decodeCallData.ts +87 -0
  345. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts +81 -0
  346. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/getAccountAddress.ts +48 -0
  347. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/getFactoryData.ts +40 -0
  348. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/signMessage.ts +33 -0
  349. package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/signTypedData.ts +67 -0
  350. package/ext/permissionless.js/packages/permissionless/accounts/trust/toTrustSmartAccount.ts +232 -0
  351. package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/decodeCallData.ts +87 -0
  352. package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/encodeCallData.ts +81 -0
  353. package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/getFactoryData.ts +51 -0
  354. package/ext/permissionless.js/packages/permissionless/actions/erc7579/accountId.test.ts +39 -0
  355. package/ext/permissionless.js/packages/permissionless/actions/erc7579/accountId.ts +93 -0
  356. package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModule.test.ts +216 -0
  357. package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModule.ts +99 -0
  358. package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModules.test.ts +237 -0
  359. package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModules.ts +96 -0
  360. package/ext/permissionless.js/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts +72 -0
  361. package/ext/permissionless.js/packages/permissionless/actions/erc7579/isModuleInstalled.ts +132 -0
  362. package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsExecutionMode.test.ts +108 -0
  363. package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsExecutionMode.ts +158 -0
  364. package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsModule.test.ts +35 -0
  365. package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsModule.ts +120 -0
  366. package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModule.test.ts +129 -0
  367. package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModule.ts +98 -0
  368. package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModules.test.ts +117 -0
  369. package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModules.ts +87 -0
  370. package/ext/permissionless.js/packages/permissionless/actions/erc7579.ts +103 -0
  371. package/ext/permissionless.js/packages/permissionless/actions/etherspot/getUserOperationGasPrice.ts +32 -0
  372. package/ext/permissionless.js/packages/permissionless/actions/etherspot.ts +4 -0
  373. package/ext/permissionless.js/packages/permissionless/actions/index.ts +9 -0
  374. package/ext/permissionless.js/packages/permissionless/actions/package.json +6 -0
  375. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/getCredentials.ts +47 -0
  376. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/startAuthentication.ts +39 -0
  377. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/startRegistration.ts +126 -0
  378. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/verifyAuthentication.ts +142 -0
  379. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/verifyRegistration.ts +132 -0
  380. package/ext/permissionless.js/packages/permissionless/actions/passkeyServer.ts +17 -0
  381. package/ext/permissionless.js/packages/permissionless/actions/pimlico/estimateErc20PaymasterCost.ts +102 -0
  382. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getTokenQuotes.test.ts +90 -0
  383. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getTokenQuotes.ts +77 -0
  384. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationGasPrice.test.ts +82 -0
  385. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts +67 -0
  386. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationStatus.test.ts +199 -0
  387. package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationStatus.ts +49 -0
  388. package/ext/permissionless.js/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts +59 -0
  389. package/ext/permissionless.js/packages/permissionless/actions/pimlico/sponsorUserOperation.test.ts +236 -0
  390. package/ext/permissionless.js/packages/permissionless/actions/pimlico/sponsorUserOperation.ts +151 -0
  391. package/ext/permissionless.js/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.test.ts +153 -0
  392. package/ext/permissionless.js/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts +74 -0
  393. package/ext/permissionless.js/packages/permissionless/actions/pimlico.ts +38 -0
  394. package/ext/permissionless.js/packages/permissionless/actions/public/getAccountNonce.test.ts +96 -0
  395. package/ext/permissionless.js/packages/permissionless/actions/public/getAccountNonce.ts +75 -0
  396. package/ext/permissionless.js/packages/permissionless/actions/public/getSenderAddress.test.ts +154 -0
  397. package/ext/permissionless.js/packages/permissionless/actions/public/getSenderAddress.ts +129 -0
  398. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/getCallsStatus.test.ts +255 -0
  399. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/getCallsStatus.ts +91 -0
  400. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendCalls.test.ts +571 -0
  401. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendCalls.ts +38 -0
  402. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendTransaction.test.ts +416 -0
  403. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendTransaction.ts +133 -0
  404. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signMessage.test.ts +219 -0
  405. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signMessage.ts +73 -0
  406. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signTypedData.test.ts +228 -0
  407. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signTypedData.ts +157 -0
  408. package/ext/permissionless.js/packages/permissionless/actions/smartAccount/writeContract.ts +70 -0
  409. package/ext/permissionless.js/packages/permissionless/actions/smartAccount.ts +7 -0
  410. package/ext/permissionless.js/packages/permissionless/clients/createSmartAccountClient.ts +181 -0
  411. package/ext/permissionless.js/packages/permissionless/clients/decorators/passkeyServer.ts +57 -0
  412. package/ext/permissionless.js/packages/permissionless/clients/decorators/pimlico.ts +189 -0
  413. package/ext/permissionless.js/packages/permissionless/clients/decorators/smartAccount.ts +350 -0
  414. package/ext/permissionless.js/packages/permissionless/clients/index.ts +2 -0
  415. package/ext/permissionless.js/packages/permissionless/clients/passkeyServer.ts +69 -0
  416. package/ext/permissionless.js/packages/permissionless/clients/pimlico.ts +124 -0
  417. package/ext/permissionless.js/packages/permissionless/errors/index.ts +17 -0
  418. package/ext/permissionless.js/packages/permissionless/experimental/pimlico/index.ts +1 -0
  419. package/ext/permissionless.js/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +523 -0
  420. package/ext/permissionless.js/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +369 -0
  421. package/ext/permissionless.js/packages/permissionless/index.ts +3 -0
  422. package/ext/permissionless.js/packages/permissionless/package.json +102 -0
  423. package/ext/permissionless.js/packages/permissionless/types/etherspot.ts +12 -0
  424. package/ext/permissionless.js/packages/permissionless/types/package.json +6 -0
  425. package/ext/permissionless.js/packages/permissionless/types/passkeyServer.ts +125 -0
  426. package/ext/permissionless.js/packages/permissionless/types/pimlico.ts +151 -0
  427. package/ext/permissionless.js/packages/permissionless/utils/decode7579Calls.ts +133 -0
  428. package/ext/permissionless.js/packages/permissionless/utils/decodeNonce.test.ts +40 -0
  429. package/ext/permissionless.js/packages/permissionless/utils/decodeNonce.ts +10 -0
  430. package/ext/permissionless.js/packages/permissionless/utils/deepHexlify.test.ts +57 -0
  431. package/ext/permissionless.js/packages/permissionless/utils/deepHexlify.ts +35 -0
  432. package/ext/permissionless.js/packages/permissionless/utils/encode7579Calls.test.ts +69 -0
  433. package/ext/permissionless.js/packages/permissionless/utils/encode7579Calls.ts +114 -0
  434. package/ext/permissionless.js/packages/permissionless/utils/encodeInstallModule.ts +91 -0
  435. package/ext/permissionless.js/packages/permissionless/utils/encodeNonce.test.ts +38 -0
  436. package/ext/permissionless.js/packages/permissionless/utils/encodeNonce.ts +8 -0
  437. package/ext/permissionless.js/packages/permissionless/utils/encodeUninstallModule.ts +88 -0
  438. package/ext/permissionless.js/packages/permissionless/utils/erc20AllowanceOverride.test.ts +59 -0
  439. package/ext/permissionless.js/packages/permissionless/utils/erc20AllowanceOverride.ts +66 -0
  440. package/ext/permissionless.js/packages/permissionless/utils/erc20BalanceOverride.test.ts +57 -0
  441. package/ext/permissionless.js/packages/permissionless/utils/erc20BalanceOverride.ts +49 -0
  442. package/ext/permissionless.js/packages/permissionless/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +31 -0
  443. package/ext/permissionless.js/packages/permissionless/utils/getAddressFromInitCodeOrPaymasterAndData.ts +13 -0
  444. package/ext/permissionless.js/packages/permissionless/utils/getEstimationCallData.ts +297 -0
  445. package/ext/permissionless.js/packages/permissionless/utils/getPackedUserOperation.test.ts +204 -0
  446. package/ext/permissionless.js/packages/permissionless/utils/getPackedUserOperation.ts +122 -0
  447. package/ext/permissionless.js/packages/permissionless/utils/getRequiredPrefund.test.ts +90 -0
  448. package/ext/permissionless.js/packages/permissionless/utils/getRequiredPrefund.ts +56 -0
  449. package/ext/permissionless.js/packages/permissionless/utils/index.ts +43 -0
  450. package/ext/permissionless.js/packages/permissionless/utils/isSmartAccountDeployed.ts +13 -0
  451. package/ext/permissionless.js/packages/permissionless/utils/ox.ts +48 -0
  452. package/ext/permissionless.js/packages/permissionless/utils/toOwner.ts +89 -0
  453. package/ext/permissionless.js/packages/permissionless/vitest.config.ts +31 -0
  454. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/biconomy.ts +22 -0
  455. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/etherspot.ts +12 -0
  456. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/kernel.ts +63 -0
  457. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/light.ts +10 -0
  458. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/nexus.ts +16 -0
  459. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/safe.ts +75 -0
  460. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/simple.ts +16 -0
  461. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/thirdweb.ts +7 -0
  462. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/trust.ts +26 -0
  463. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/core.ts +24 -0
  464. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/index.ts +10 -0
  465. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/index.ts +783 -0
  466. package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/instance.ts +290 -0
  467. package/ext/permissionless.js/packages/permissionless-test/src/testWithRpc.ts +128 -0
  468. package/ext/permissionless.js/packages/permissionless-test/src/types.ts +12 -0
  469. package/ext/permissionless.js/packages/permissionless-test/src/utils.ts +1091 -0
  470. package/ext/permissionless.js/packages/wagmi/CHANGELOG.md +53 -0
  471. package/ext/permissionless.js/packages/wagmi/README.md +93 -0
  472. package/ext/permissionless.js/packages/wagmi/context.ts +22 -0
  473. package/ext/permissionless.js/packages/wagmi/hooks/useAvailableCapabilities.ts +43 -0
  474. package/ext/permissionless.js/packages/wagmi/hooks/useSendTransaction.ts +164 -0
  475. package/ext/permissionless.js/packages/wagmi/hooks/useWaitForTransactionReceipt.ts +427 -0
  476. package/ext/permissionless.js/packages/wagmi/index.ts +15 -0
  477. package/ext/permissionless.js/packages/wagmi/package.json +26 -0
  478. package/ext/permissionless.js/packages/wagmi/utils/observe.ts +76 -0
  479. package/ext/permissionless.js/packages/wagmi-demo/README.md +1 -0
  480. package/ext/permissionless.js/packages/wagmi-demo/biome.json +13 -0
  481. package/ext/permissionless.js/packages/wagmi-demo/index.html +12 -0
  482. package/ext/permissionless.js/packages/wagmi-demo/package.json +16 -0
  483. package/ext/permissionless.js/packages/wagmi-demo/src/App.tsx +98 -0
  484. package/ext/permissionless.js/packages/wagmi-demo/src/PasskeyServerDemo.tsx +286 -0
  485. package/ext/permissionless.js/packages/wagmi-demo/src/PasskeysDemo.tsx +457 -0
  486. package/ext/permissionless.js/packages/wagmi-demo/src/index.css +21 -0
  487. package/ext/permissionless.js/packages/wagmi-demo/src/main.tsx +275 -0
  488. package/ext/permissionless.js/packages/wagmi-demo/src/vite-env.d.ts +1 -0
  489. package/ext/permissionless.js/packages/wagmi-demo/src/wagmi.ts +33 -0
  490. package/ext/permissionless.js/packages/wagmi-demo/tsconfig.json +25 -0
  491. package/ext/permissionless.js/packages/wagmi-demo/tsconfig.node.json +12 -0
  492. package/ext/permissionless.js/packages/wagmi-demo/vite.config.ts +7 -0
  493. package/ext/permissionless.js/tsconfig/tsconfig.base.json +42 -0
  494. package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.cjs.json +11 -0
  495. package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.esm.json +9 -0
  496. package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.json +17 -0
  497. package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.types.json +13 -0
  498. package/ext/permissionless.js/tsconfig/tsconfig.permissionless.cjs.json +11 -0
  499. package/ext/permissionless.js/tsconfig/tsconfig.permissionless.esm.json +9 -0
  500. package/ext/permissionless.js/tsconfig/tsconfig.permissionless.json +18 -0
  501. package/ext/permissionless.js/tsconfig/tsconfig.permissionless.types.json +13 -0
  502. package/ext/permissionless.js/tsconfig/tsconfig.wagmi.esm.json +8 -0
  503. package/ext/permissionless.js/tsconfig/tsconfig.wagmi.json +19 -0
  504. package/ext/permissionless.js/tsconfig/tsconfig.wagmi.types.json +12 -0
  505. package/extract_abis.sh +140 -0
  506. package/extract_addresses_to_env.sh +67 -0
  507. package/final_safe_harmonize.py +77 -0
  508. package/lib/SHARED_CONFIG_REFERENCE.md +133 -0
  509. package/lib/shared-config/.env.example +6 -0
  510. package/lib/shared-config/.github/workflows/check-secrets.yml +257 -0
  511. package/lib/shared-config/AGENTS.md +21 -0
  512. package/lib/shared-config/CHANGELOG.md +99 -0
  513. package/lib/shared-config/LICENSE +21 -0
  514. package/lib/shared-config/QUICK_START.md +215 -0
  515. package/lib/shared-config/README.md +412 -0
  516. package/lib/shared-config/SHARED_CONFIG_SUMMARY.md +273 -0
  517. package/lib/shared-config/check-locker-status.mjs +7 -0
  518. package/lib/shared-config/favicon.ico +0 -0
  519. package/lib/shared-config/generate-comparison-table.sh +67 -0
  520. package/lib/shared-config/package.json +46 -0
  521. package/lib/shared-config/pnpm-lock.yaml +1182 -0
  522. package/lib/shared-config/src/abis/BLSAggregator.json +1 -0
  523. package/lib/shared-config/src/abis/DVTValidator.json +1 -0
  524. package/lib/shared-config/src/abis/GToken.json +1 -0
  525. package/lib/shared-config/src/abis/GTokenStaking.json +1 -0
  526. package/lib/shared-config/src/abis/MySBT.json +1 -0
  527. package/lib/shared-config/src/abis/PaymasterFactory.json +1 -0
  528. package/lib/shared-config/src/abis/PaymasterV4.json +1098 -0
  529. package/lib/shared-config/src/abis/Registry.json +1 -0
  530. package/lib/shared-config/src/abis/SimpleAccount.json +557 -0
  531. package/lib/shared-config/src/abis/SimpleAccountFactory.json +87 -0
  532. package/lib/shared-config/src/abis/SuperPaymasterV2.json +1 -0
  533. package/lib/shared-config/src/abis/index.ts +45 -0
  534. package/lib/shared-config/src/abis/xPNTsFactory.json +1 -0
  535. package/lib/shared-config/src/abis/xPNTsToken.json +1 -0
  536. package/lib/shared-config/src/branding.ts +32 -0
  537. package/lib/shared-config/src/communities.ts +93 -0
  538. package/lib/shared-config/src/constants.ts +67 -0
  539. package/lib/shared-config/src/contract-addresses.ts +95 -0
  540. package/lib/shared-config/src/contract-versions.ts +374 -0
  541. package/lib/shared-config/src/contracts.ts +414 -0
  542. package/lib/shared-config/src/index.ts +14 -0
  543. package/lib/shared-config/src/networks.ts +117 -0
  544. package/lib/shared-config/sync-abis.sh +92 -0
  545. package/lib/shared-config/sync-versions.mjs +150 -0
  546. package/lib/shared-config/tsconfig.json +18 -0
  547. package/lib/shared-config/tsup.config.ts +10 -0
  548. package/lib/shared-config/verify-all.sh +207 -0
  549. package/lib/shared-config/verify-contracts.sh +85 -0
  550. package/lib/shared-config/verify-mysbt-v243.mjs +27 -0
  551. package/lib/shared-config/verify-onchain-versions.mjs +93 -0
  552. package/package.json +53 -21
  553. package/packages/account/package.json +20 -0
  554. package/packages/account/src/accounts/simple.ts +84 -0
  555. package/packages/account/src/eoa.ts +31 -0
  556. package/packages/account/src/index.ts +61 -0
  557. package/packages/account/tsconfig.json +12 -0
  558. package/packages/analytics/package.json +21 -0
  559. package/packages/analytics/src/index.ts +145 -0
  560. package/packages/analytics/tsconfig.json +16 -0
  561. package/packages/community/package.json +22 -0
  562. package/packages/community/src/index.ts +306 -0
  563. package/packages/community/tsconfig.json +8 -0
  564. package/packages/core/package.json +22 -0
  565. package/packages/core/src/abis/BLSAggregator.json +572 -0
  566. package/packages/core/src/abis/BLSValidator.json +26 -0
  567. package/packages/core/src/abis/DVTValidator.json +370 -0
  568. package/packages/core/src/abis/Eip7702Support.json +24 -0
  569. package/packages/core/src/abis/EntryPoint.json +1379 -0
  570. package/packages/core/src/abis/GToken.json +523 -0
  571. package/packages/core/src/abis/GTokenStaking.json +931 -0
  572. package/packages/core/src/abis/LegacyAccount.json +625 -0
  573. package/packages/core/src/abis/MySBT.json +1586 -0
  574. package/packages/core/src/abis/Paymaster.json +1205 -0
  575. package/packages/core/src/abis/PaymasterFactory.json +650 -0
  576. package/packages/core/src/abis/PaymasterV4_2.json +1183 -0
  577. package/packages/core/src/abis/Registry.json +1636 -0
  578. package/packages/core/src/abis/ReputationSystem.json +477 -0
  579. package/packages/core/src/abis/SenderCreator.json +99 -0
  580. package/packages/core/src/abis/Simple7702Account.json +395 -0
  581. package/packages/core/src/abis/SimpleAccount.json +625 -0
  582. package/packages/core/src/abis/SimpleAccountFactory.json +108 -0
  583. package/packages/core/src/abis/SimpleAccountFactoryV08.json +87 -0
  584. package/packages/core/src/abis/SimpleAccountV08.json +557 -0
  585. package/packages/core/src/abis/SuperPaymaster.json +1399 -0
  586. package/packages/core/src/abis/UserOperationLib.json +57 -0
  587. package/packages/core/src/abis/aPNTs.json +1173 -0
  588. package/packages/core/src/abis/index.ts +68 -0
  589. package/packages/core/src/abis/xPNTsFactory.json +728 -0
  590. package/packages/core/src/abis/xPNTsToken.json +1173 -0
  591. package/packages/core/src/actions/aggregator.ts +41 -0
  592. package/packages/core/src/actions/dvt.ts +53 -0
  593. package/packages/core/src/actions/factory.ts +41 -0
  594. package/packages/core/src/actions/index.ts +10 -0
  595. package/packages/core/src/actions/paymasterV4.ts +263 -0
  596. package/packages/core/src/actions/registry.ts +120 -0
  597. package/packages/core/src/actions/reputation.ts +27 -0
  598. package/packages/core/src/actions/sbt.ts +97 -0
  599. package/packages/core/src/actions/staking.ts +79 -0
  600. package/packages/core/src/actions/superPaymaster.ts +117 -0
  601. package/packages/core/src/actions/tokens.ts +65 -0
  602. package/packages/core/src/branding.ts +32 -0
  603. package/packages/core/src/clients.ts +13 -0
  604. package/packages/core/src/communities.ts +93 -0
  605. package/packages/core/src/constants.ts +81 -0
  606. package/packages/core/src/contract-addresses.ts +101 -0
  607. package/packages/core/src/contract-versions.ts +374 -0
  608. package/packages/core/src/contracts.ts +414 -0
  609. package/packages/core/src/crypto/blsSigner.ts +124 -0
  610. package/packages/core/src/crypto/index.ts +1 -0
  611. package/packages/core/src/index.ts +19 -0
  612. package/packages/core/src/networks.ts +127 -0
  613. package/packages/core/src/requirementChecker.ts +225 -0
  614. package/packages/core/src/roles.ts +244 -0
  615. package/packages/core/src/utils.ts +23 -0
  616. package/packages/core/tsconfig.json +12 -0
  617. package/packages/dapp/package.json +27 -0
  618. package/packages/dapp/src/index.ts +4 -0
  619. package/packages/dapp/src/ui/components/EvaluationPanel.tsx +40 -0
  620. package/packages/dapp/src/ui/hooks/useCreditScore.ts +44 -0
  621. package/packages/dapp/src/ui/hooks/useSuperPaymaster.ts +31 -0
  622. package/packages/dapp/src/ui/index.ts +22 -0
  623. package/packages/dapp/tsconfig.json +13 -0
  624. package/packages/enduser/package.json +21 -0
  625. package/packages/enduser/src/index.ts +138 -0
  626. package/packages/enduser/tsconfig.json +8 -0
  627. package/packages/identity/package.json +22 -0
  628. package/packages/identity/src/index.ts +82 -0
  629. package/packages/identity/src/mysbt.ts +48 -0
  630. package/packages/identity/tsconfig.json +12 -0
  631. package/packages/operator/package.json +21 -0
  632. package/packages/operator/src/index.ts +172 -0
  633. package/packages/operator/tsconfig.json +8 -0
  634. package/packages/paymaster/package.json +22 -0
  635. package/packages/paymaster/src/SuperPaymaster/index.ts +168 -0
  636. package/packages/paymaster/src/V4/index.ts +123 -0
  637. package/packages/paymaster/src/index.ts +5 -0
  638. package/packages/paymaster/tsconfig.json +12 -0
  639. package/packages/sdk/README.md +150 -0
  640. package/packages/sdk/aastar/package.json +21 -0
  641. package/packages/sdk/aastar/src/index.ts +3 -0
  642. package/packages/sdk/aastar/tsconfig.json +8 -0
  643. package/packages/sdk/examples/config.json +1 -0
  644. package/packages/sdk/examples/regression_test.ts +106 -0
  645. package/packages/sdk/package.json +32 -0
  646. package/packages/sdk/src/clients/admin.ts +54 -0
  647. package/packages/sdk/src/clients/community.ts +403 -0
  648. package/packages/sdk/src/clients/endUser.ts +173 -0
  649. package/packages/sdk/src/clients/operator.ts +277 -0
  650. package/packages/sdk/src/errors/decoder.ts +48 -0
  651. package/{dist/index.js → packages/sdk/src/index.ts} +9 -1
  652. package/packages/sdk/src/utils/errorHandler.ts +167 -0
  653. package/packages/sdk/src/utils/funding.ts +280 -0
  654. package/packages/sdk/src/utils/keys.ts +159 -0
  655. package/packages/sdk/src/utils/roleData.ts +151 -0
  656. package/packages/sdk/src/utils/validation.ts +356 -0
  657. package/packages/sdk/tsconfig.json +12 -0
  658. package/packages/tokens/package.json +22 -0
  659. package/packages/tokens/src/index.ts +245 -0
  660. package/packages/tokens/tsconfig.json +12 -0
  661. package/pnpm-workspace.yaml +2 -0
  662. package/run_full_regression.sh +215 -0
  663. package/run_sdk_regression.sh +213 -0
  664. package/safe_harmonize.py +107 -0
  665. package/scripts/00_utils.ts +59 -0
  666. package/scripts/00_verify_phase1.ts +130 -0
  667. package/scripts/01_1_prep_gtoken.ts +81 -0
  668. package/scripts/01_2_register_sbt.ts +88 -0
  669. package/scripts/01_3_prep_tokens_paymaster.ts +102 -0
  670. package/scripts/01_prepare_all.ts +271 -0
  671. package/scripts/02_test_eoa.ts +50 -0
  672. package/scripts/03_test_standard_aa.ts +173 -0
  673. package/scripts/04_0_check_deploy.ts +24 -0
  674. package/scripts/04_1_check_allowance.ts +44 -0
  675. package/scripts/04_2_construct_verify.ts +96 -0
  676. package/scripts/04_3_verify_estimate.ts +66 -0
  677. package/scripts/04_4_verify_pack.ts +74 -0
  678. package/scripts/04_test_paymaster_v4.ts +217 -0
  679. package/scripts/05_1_deposit.ts +48 -0
  680. package/scripts/05_test_superpaymaster.ts +380 -0
  681. package/scripts/06_local_test_v3_admin.ts +163 -0
  682. package/scripts/06_local_test_v3_execution.ts +132 -0
  683. package/scripts/06_local_test_v3_full.ts +490 -0
  684. package/scripts/06_local_test_v3_funding.ts +124 -0
  685. package/scripts/06_local_test_v3_reputation.ts +234 -0
  686. package/scripts/07_local_test_v3_audit.ts +181 -0
  687. package/scripts/08_local_test_registry_lifecycle.ts +382 -0
  688. package/scripts/09_local_test_community_lifecycle.ts +384 -0
  689. package/scripts/09_local_test_community_simple.ts +108 -0
  690. package/scripts/09_scenario_bread_independent.ts +247 -0
  691. package/scripts/10_scenario_super_shared.ts +196 -0
  692. package/scripts/10_test_protocol_admin_full.ts +173 -0
  693. package/scripts/11_scenario_hacker_defense.ts +104 -0
  694. package/scripts/11_test_core_flows_full.ts +279 -0
  695. package/scripts/12_test_slash_mechanism.ts +205 -0
  696. package/scripts/12_test_slash_queries.ts +83 -0
  697. package/scripts/12_test_staking_exit.ts +152 -0
  698. package/scripts/12_test_staking_slash.ts +301 -0
  699. package/scripts/12_test_tier2_slash.ts +139 -0
  700. package/scripts/13_test_sbt_burn_linkage.ts +266 -0
  701. package/scripts/14_test_credit_redesign.ts +266 -0
  702. package/scripts/15_test_bls_full.ts +125 -0
  703. package/scripts/15_test_dvt_bls_full.ts +133 -0
  704. package/scripts/17_test_cross_role_collaboration.ts +95 -0
  705. package/scripts/18_sdk_e2e_verification.ts +67 -0
  706. package/scripts/18_test_dvt_sdk_flow.ts +138 -0
  707. package/scripts/18_test_lifecycle_completion.ts +144 -0
  708. package/scripts/19_sdk_experiment_runner.ts +89 -0
  709. package/scripts/19_sdk_experiment_runner.ts.backup +391 -0
  710. package/scripts/20_sdk_full_capability.ts +95 -0
  711. package/scripts/20_test_superpaymaster_new_apis.ts +193 -0
  712. package/scripts/21_test_paymasterv4_complete.ts +341 -0
  713. package/scripts/22_test_bls_signing.ts +260 -0
  714. package/scripts/23_test_middleware.ts +197 -0
  715. package/scripts/98_edge_reentrancy.ts +85 -0
  716. package/scripts/99_bug_hunting_fast.ts +216 -0
  717. package/scripts/collect_industry_baseline.ts +236 -0
  718. package/scripts/complete_env_config.ts +97 -0
  719. package/scripts/debug_account_c.ts +43 -0
  720. package/scripts/debug_bls.ts +58 -0
  721. package/scripts/debug_config_v036.ts +13 -0
  722. package/scripts/debug_contracts.ts +2 -0
  723. package/scripts/debug_env.ts +69 -0
  724. package/scripts/debug_find_paymaster.ts +98 -0
  725. package/scripts/debug_isolated_registration.ts +256 -0
  726. package/scripts/debug_paymaster_config.ts +19 -0
  727. package/scripts/debug_pim_addr.ts +23 -0
  728. package/scripts/debug_pm_status.ts +51 -0
  729. package/scripts/debug_registry.ts +39 -0
  730. package/scripts/debug_registry_setup.ts +129 -0
  731. package/scripts/debug_sanity.ts +32 -0
  732. package/scripts/debug_shared_config.ts +10 -0
  733. package/scripts/debug_token_compat.ts +51 -0
  734. package/scripts/debug_tokens.ts +41 -0
  735. package/scripts/debug_vcheck.ts +33 -0
  736. package/scripts/deploy_and_init_v3.sh +134 -0
  737. package/scripts/deploy_anvil_accounts.ts +144 -0
  738. package/scripts/deploy_paymaster_v4.ts +139 -0
  739. package/scripts/deploy_test_accounts.ts +401 -0
  740. package/scripts/experiment/stage3/SETUP_GUIDE.md +258 -0
  741. package/scripts/experiment/stage3/archived_scripts/00_token_distribution.ts +78 -0
  742. package/scripts/experiment/stage3/archived_scripts/01_dao_launch.ts +96 -0
  743. package/scripts/experiment/stage3/archived_scripts/01b_bread_launch.ts +112 -0
  744. package/scripts/experiment/stage3/archived_scripts/02_operator_setup.ts +84 -0
  745. package/scripts/experiment/stage3/archived_scripts/02b_operator_b_setup.ts +104 -0
  746. package/scripts/experiment/stage3/archived_scripts/02c_finalize_operators.ts +86 -0
  747. package/scripts/experiment/stage3/archived_scripts/02d_operator_collateral.ts +89 -0
  748. package/scripts/experiment/stage3/archived_scripts/03_user_onboarding.ts +83 -0
  749. package/scripts/experiment/stage3/archived_scripts/03b_deploy_aa_account.ts +61 -0
  750. package/scripts/experiment/stage3/archived_scripts/03c_aa_onboarding.ts +104 -0
  751. package/scripts/experiment/stage3/archived_scripts/03d_mint_points.ts +60 -0
  752. package/scripts/experiment/stage3/archived_scripts/04_benchmarking.ts +100 -0
  753. package/scripts/experiment/stage3/archived_scripts/05_multi_op_setup.ts +149 -0
  754. package/scripts/experiment/stage3/archived_scripts/README.md +58 -0
  755. package/scripts/experiment/stage3/archived_scripts/check_roles.ts +29 -0
  756. package/scripts/experiment/stage3/archived_scripts/decode_error.ts +23 -0
  757. package/scripts/experiment/stage3/archived_scripts/fund_user.ts +51 -0
  758. package/scripts/experiment/stage3/archived_scripts/gen_b_key.ts +3 -0
  759. package/scripts/experiment/stage3/archived_scripts/gen_keys.ts +4 -0
  760. package/scripts/experiment/stage3/archived_scripts/setup.ts +105 -0
  761. package/scripts/experiment/stage3/archived_scripts/test_key.ts +4 -0
  762. package/scripts/experiment/stage3/archived_scripts/verify_state.ts +59 -0
  763. package/scripts/experiment/stage3/refactored/00_token_distribution.ts +46 -0
  764. package/scripts/experiment/stage3/refactored/02_operator_setup.ts +65 -0
  765. package/scripts/experiment/stage3/refactored/03_user_onboarding.ts +68 -0
  766. package/scripts/experiment/stage3/refactored/05_multi_op_setup.ts +63 -0
  767. package/scripts/experiment/stage3/refactored/README.md +71 -0
  768. package/scripts/extract-docs.sh +72 -0
  769. package/scripts/generate_env_from_deployment.ts +109 -0
  770. package/scripts/publish_all.sh +39 -0
  771. package/scripts/quick_setup.ts +124 -0
  772. package/scripts/run_automated_experiment.sh +121 -0
  773. package/scripts/run_daily_experiment.ts +70 -0
  774. package/scripts/security_audit.sh +172 -0
  775. package/scripts/sync_config_to_env.ts +88 -0
  776. package/scripts/test_groups.ts +267 -0
  777. package/scripts/test_multi_community_anvil.ts +276 -0
  778. package/scripts/test_new_sdk_apis_sepolia.ts +115 -0
  779. package/scripts/test_sdk_join_idempotent.ts +233 -0
  780. package/scripts/test_simple_sepolia.ts +44 -0
  781. package/scripts/v2_regression/00_validate_env.ts +77 -0
  782. package/scripts/v2_regression/01_setup_and_fund.ts +132 -0
  783. package/scripts/v2_regression/02_operator_onboarding.ts +300 -0
  784. package/scripts/v2_regression/03_community_registry.ts +173 -0
  785. package/scripts/v2_regression/04_enduser_flow.ts +174 -0
  786. package/scripts/v2_regression/05_admin_audit.ts +157 -0
  787. package/scripts/v2_regression/README.md +161 -0
  788. package/scripts/validate_env.ts +112 -0
  789. package/scripts/validate_environment.ts +140 -0
  790. package/sdk_experiment_data.csv +2 -0
  791. package/surgical_harmonize.py +83 -0
  792. package/tsconfig.json +15 -0
  793. package/typedoc.json +25 -0
  794. package/dist/clients/admin.d.ts +0 -12
  795. package/dist/clients/admin.d.ts.map +0 -1
  796. package/dist/clients/admin.js +0 -20
  797. package/dist/clients/admin.js.map +0 -1
  798. package/dist/clients/community.d.ts +0 -12
  799. package/dist/clients/community.d.ts.map +0 -1
  800. package/dist/clients/community.js +0 -18
  801. package/dist/clients/community.js.map +0 -1
  802. package/dist/clients/endUser.d.ts +0 -12
  803. package/dist/clients/endUser.d.ts.map +0 -1
  804. package/dist/clients/endUser.js +0 -20
  805. package/dist/clients/endUser.js.map +0 -1
  806. package/dist/clients/operator.d.ts +0 -18
  807. package/dist/clients/operator.d.ts.map +0 -1
  808. package/dist/clients/operator.js +0 -65
  809. package/dist/clients/operator.js.map +0 -1
  810. package/dist/index.d.ts +0 -11
  811. package/dist/index.d.ts.map +0 -1
  812. package/dist/index.js.map +0 -1
@@ -0,0 +1,2714 @@
1
+ > **dvtActions**(): (`client`) => [`DVTActions`](../type-aliases/DVTActions.md)
2
+
3
+ Defined in: [packages/core/src/actions/dvt.ts:11](https://github.com/AAStarCommunity/aastar-sdk/blob/de58973e339aee27579a805788c7048e2d9099f3/packages/core/src/actions/dvt.ts#L11)
4
+
5
+ ## Returns
6
+
7
+ > (`client`): [`DVTActions`](../type-aliases/DVTActions.md)
8
+
9
+ ### Parameters
10
+
11
+ #### client
12
+
13
+ \{ `account`: `undefined`; `batch?`: \{ `multicall?`: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `call`: (`parameters`) => `Promise`\<[`CallReturnType`](https://viem.sh/docs/index.html)\>; `ccipRead?`: `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: [`Chain`](https://viem.sh/docs/index.html) \| `undefined`; `createAccessList`: (`parameters`) => `Promise`\<\{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `gasUsed`: `bigint`; \}\>; `createBlockFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>; `createContractEventFilter`: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`CreateContractEventFilterReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>; `createEventFilter`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>; `createPendingTransactionFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>; `estimateContractGas`: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>; `estimateFeesPerGas`: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<[`EstimateFeesPerGasReturnType`](https://viem.sh/docs/index.html)\<`type`\>\>; `estimateGas`: (`args`) => `Promise`\<`bigint`\>; `estimateMaxPriorityFeePerGas`: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>; `experimental_blockTag?`: [`BlockTag`](https://viem.sh/docs/index.html); `extend`: \<`client`\>(`fn`) => [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `undefined`, [`PublicRpcSchema`](https://viem.sh/docs/index.html), \{ \[K in string \| number \| symbol\]: client\[K\] \} & [`PublicActions`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>; `getBalance`: (`args`) => `Promise`\<`bigint`\>; `getBlobBaseFee`: () => `Promise`\<`bigint`\>; `getBlock`: \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? (\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId?`: ... \| ...; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"legacy"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip2930"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip1559"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly ...[]; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip4844"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList`: [`SignedAuthorizationList`](https://viem.sh/docs/index.html); `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip7702"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: [`Withdrawal`](https://viem.sh/docs/index.html)[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>; `getBlockNumber`: (`args?`) => `Promise`\<`bigint`\>; `getBlockTransactionCount`: (`args?`) => `Promise`\<`number`\>; `getBytecode`: (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>; `getChainId`: () => `Promise`\<`number`\>; `getCode`: (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>; `getContractEvents`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetContractEventsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getEip712Domain`: (`args`) => `Promise`\<[`GetEip712DomainReturnType`](https://viem.sh/docs/index.html)\>; `getEnsAddress`: (`args`) => `Promise`\<[`GetEnsAddressReturnType`](https://viem.sh/docs/index.html)\>; `getEnsAvatar`: (`args`) => `Promise`\<[`GetEnsAvatarReturnType`](https://viem.sh/docs/index.html)\>; `getEnsName`: (`args`) => `Promise`\<[`GetEnsNameReturnType`](https://viem.sh/docs/index.html)\>; `getEnsResolver`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `getEnsText`: (`args`) => `Promise`\<[`GetEnsTextReturnType`](https://viem.sh/docs/index.html)\>; `getFeeHistory`: (`args`) => `Promise`\<[`GetFeeHistoryReturnType`](https://viem.sh/docs/index.html)\>; `getFilterChanges`: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterChangesReturnType`](https://viem.sh/docs/index.html)\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getFilterLogs`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterLogsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getGasPrice`: () => `Promise`\<`bigint`\>; `getLogs`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<[`GetLogsReturnType`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>; `getProof`: (`args`) => `Promise`\<[`GetProofReturnType`](https://viem.sh/docs/index.html)\>; `getStorageAt`: (`args`) => `Promise`\<[`GetStorageAtReturnType`](https://viem.sh/docs/index.html)\>; `getTransaction`: \<`blockTag`\>(`args`) => `Promise`\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList`: [`SignedAuthorizationList`](https://viem.sh/docs/index.html); `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>; `getTransactionConfirmations`: (`args`) => `Promise`\<`bigint`\>; `getTransactionCount`: (`args`) => `Promise`\<`number`\>; `getTransactionReceipt`: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; `key`: `string`; `multicall`: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<[`MulticallReturnType`](https://viem.sh/docs/index.html)\<`contracts`, `allowFailure`\>\>; `name`: `string`; `pollingInterval`: `number`; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `readContract`: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<[`ReadContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`\>\>; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`PublicRpcSchema`](https://viem.sh/docs/index.html)\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; `simulate`: \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>; `simulateBlocks`: \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>; `simulateCalls`: \<`calls`\>(`args`) => `Promise`\<[`SimulateCallsReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>; `simulateContract`: \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`SimulateContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `accountOverride`\>\>; `transport`: [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `uninstallFilter`: (`args`) => `Promise`\<`boolean`\>; `verifyHash`: (`args`) => `Promise`\<`boolean`\>; `verifyMessage`: (`args`) => `Promise`\<`boolean`\>; `verifySiweMessage`: (`args`) => `Promise`\<`boolean`\>; `verifyTypedData`: (`args`) => `Promise`\<`boolean`\>; `waitForTransactionReceipt`: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; `watchBlockNumber`: (`args`) => [`WatchBlockNumberReturnType`](https://viem.sh/docs/index.html); `watchBlocks`: \<`includeTransactions`, `blockTag`\>(`args`) => [`WatchBlocksReturnType`](https://viem.sh/docs/index.html); `watchContractEvent`: \<`abi`, `eventName`, `strict`\>(`args`) => [`WatchContractEventReturnType`](https://viem.sh/docs/index.html); `watchEvent`: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => [`WatchEventReturnType`](https://viem.sh/docs/index.html); `watchPendingTransactions`: (`args`) => [`WatchPendingTransactionsReturnType`](https://viem.sh/docs/index.html); \}
14
+
15
+ ##### account
16
+
17
+ `undefined`
18
+
19
+ The Account of the Client.
20
+
21
+ ##### batch?
22
+
23
+ \{ `multicall?`: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}
24
+
25
+ Flags for batch settings.
26
+
27
+ ##### batch.multicall?
28
+
29
+ `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
30
+
31
+ Toggle to enable `eth_call` multicall aggregation.
32
+
33
+ ##### cacheTime
34
+
35
+ `number`
36
+
37
+ Time (in ms) that cached data will remain in memory.
38
+
39
+ ##### call
40
+
41
+ (`parameters`) => `Promise`\<[`CallReturnType`](https://viem.sh/docs/index.html)\>
42
+
43
+ Executes a new message call immediately without submitting a transaction to the network.
44
+
45
+ - Docs: https://viem.sh/docs/actions/public/call
46
+ - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call)
47
+
48
+ **Example**
49
+
50
+ ```ts
51
+ import { createPublicClient, http } from 'viem'
52
+ import { mainnet } from 'viem/chains'
53
+
54
+ const client = createPublicClient({
55
+ chain: mainnet,
56
+ transport: http(),
57
+ })
58
+ const data = await client.call({
59
+ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
60
+ data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
61
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
62
+ })
63
+ ```
64
+
65
+ ##### ccipRead?
66
+
67
+ `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
68
+
69
+ [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
70
+
71
+ ##### chain
72
+
73
+ [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
74
+
75
+ Chain for the client.
76
+
77
+ ##### createAccessList
78
+
79
+ (`parameters`) => `Promise`\<\{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `gasUsed`: `bigint`; \}\>
80
+
81
+ Creates an EIP-2930 access list that you can include in a transaction.
82
+
83
+ - Docs: https://viem.sh/docs/actions/public/createAccessList
84
+ - JSON-RPC Methods: `eth_createAccessList`
85
+
86
+ **Example**
87
+
88
+ ```ts
89
+ import { createPublicClient, http } from 'viem'
90
+ import { mainnet } from 'viem/chains'
91
+
92
+ const client = createPublicClient({
93
+ chain: mainnet,
94
+ transport: http(),
95
+ })
96
+
97
+ const data = await client.createAccessList({
98
+ data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
99
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
100
+ })
101
+ ```
102
+
103
+ ##### createBlockFilter
104
+
105
+ () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>
106
+
107
+ Creates a Filter to listen for new block hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
108
+
109
+ - Docs: https://viem.sh/docs/actions/public/createBlockFilter
110
+ - JSON-RPC Methods: [`eth_newBlockFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newBlockFilter)
111
+
112
+ **Example**
113
+
114
+ ```ts
115
+ import { createPublicClient, createBlockFilter, http } from 'viem'
116
+ import { mainnet } from 'viem/chains'
117
+
118
+ const client = createPublicClient({
119
+ chain: mainnet,
120
+ transport: http(),
121
+ })
122
+ const filter = await createBlockFilter(client)
123
+ // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
124
+ ```
125
+
126
+ ##### createContractEventFilter
127
+
128
+ \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`CreateContractEventFilterReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>
129
+
130
+ Creates a Filter to retrieve event logs that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges) or [`getFilterLogs`](https://viem.sh/docs/actions/public/getFilterLogs).
131
+
132
+ - Docs: https://viem.sh/docs/contract/createContractEventFilter
133
+
134
+ **Example**
135
+
136
+ ```ts
137
+ import { createPublicClient, http, parseAbi } from 'viem'
138
+ import { mainnet } from 'viem/chains'
139
+
140
+ const client = createPublicClient({
141
+ chain: mainnet,
142
+ transport: http(),
143
+ })
144
+ const filter = await client.createContractEventFilter({
145
+ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
146
+ })
147
+ ```
148
+
149
+ ##### createEventFilter
150
+
151
+ \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>
152
+
153
+ Creates a [`Filter`](https://viem.sh/docs/glossary/types#filter) to listen for new events that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
154
+
155
+ - Docs: https://viem.sh/docs/actions/public/createEventFilter
156
+ - JSON-RPC Methods: [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter)
157
+
158
+ **Example**
159
+
160
+ ```ts
161
+ import { createPublicClient, http } from 'viem'
162
+ import { mainnet } from 'viem/chains'
163
+
164
+ const client = createPublicClient({
165
+ chain: mainnet,
166
+ transport: http(),
167
+ })
168
+ const filter = await client.createEventFilter({
169
+ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
170
+ })
171
+ ```
172
+
173
+ ##### createPendingTransactionFilter
174
+
175
+ () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>
176
+
177
+ Creates a Filter to listen for new pending transaction hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
178
+
179
+ - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter
180
+ - JSON-RPC Methods: [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter)
181
+
182
+ **Example**
183
+
184
+ ```ts
185
+ import { createPublicClient, http } from 'viem'
186
+ import { mainnet } from 'viem/chains'
187
+
188
+ const client = createPublicClient({
189
+ chain: mainnet,
190
+ transport: http(),
191
+ })
192
+ const filter = await client.createPendingTransactionFilter()
193
+ // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
194
+ ```
195
+
196
+ ##### estimateContractGas
197
+
198
+ \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>
199
+
200
+ Estimates the gas required to successfully execute a contract write function call.
201
+
202
+ - Docs: https://viem.sh/docs/contract/estimateContractGas
203
+
204
+ **Remarks**
205
+
206
+ Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`estimateGas` action](https://viem.sh/docs/actions/public/estimateGas) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
207
+
208
+ **Example**
209
+
210
+ ```ts
211
+ import { createPublicClient, http, parseAbi } from 'viem'
212
+ import { mainnet } from 'viem/chains'
213
+
214
+ const client = createPublicClient({
215
+ chain: mainnet,
216
+ transport: http(),
217
+ })
218
+ const gas = await client.estimateContractGas({
219
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
220
+ abi: parseAbi(['function mint() public']),
221
+ functionName: 'mint',
222
+ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
223
+ })
224
+ ```
225
+
226
+ ##### estimateFeesPerGas
227
+
228
+ \<`chainOverride`, `type`\>(`args?`) => `Promise`\<[`EstimateFeesPerGasReturnType`](https://viem.sh/docs/index.html)\<`type`\>\>
229
+
230
+ Returns an estimate for the fees per gas for a transaction to be included
231
+ in the next block.
232
+
233
+ - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas
234
+
235
+ **Example**
236
+
237
+ ```ts
238
+ import { createPublicClient, http } from 'viem'
239
+ import { mainnet } from 'viem/chains'
240
+
241
+ const client = createPublicClient({
242
+ chain: mainnet,
243
+ transport: http(),
244
+ })
245
+ const maxPriorityFeePerGas = await client.estimateFeesPerGas()
246
+ // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
247
+ ```
248
+
249
+ ##### estimateGas
250
+
251
+ (`args`) => `Promise`\<`bigint`\>
252
+
253
+ Estimates the gas necessary to complete a transaction without submitting it to the network.
254
+
255
+ - Docs: https://viem.sh/docs/actions/public/estimateGas
256
+ - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
257
+
258
+ **Example**
259
+
260
+ ```ts
261
+ import { createPublicClient, http, parseEther } from 'viem'
262
+ import { mainnet } from 'viem/chains'
263
+
264
+ const client = createPublicClient({
265
+ chain: mainnet,
266
+ transport: http(),
267
+ })
268
+ const gasEstimate = await client.estimateGas({
269
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
270
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
271
+ value: parseEther('1'),
272
+ })
273
+ ```
274
+
275
+ ##### estimateMaxPriorityFeePerGas
276
+
277
+ \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>
278
+
279
+ Returns an estimate for the max priority fee per gas (in wei) for a transaction
280
+ to be included in the next block.
281
+
282
+ - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas
283
+
284
+ **Example**
285
+
286
+ ```ts
287
+ import { createPublicClient, http } from 'viem'
288
+ import { mainnet } from 'viem/chains'
289
+
290
+ const client = createPublicClient({
291
+ chain: mainnet,
292
+ transport: http(),
293
+ })
294
+ const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas()
295
+ // 10000000n
296
+ ```
297
+
298
+ ##### experimental_blockTag?
299
+
300
+ [`BlockTag`](https://viem.sh/docs/index.html)
301
+
302
+ Default block tag to use for RPC requests.
303
+
304
+ ##### extend
305
+
306
+ \<`client`\>(`fn`) => [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `undefined`, [`PublicRpcSchema`](https://viem.sh/docs/index.html), \{ \[K in string \| number \| symbol\]: client\[K\] \} & [`PublicActions`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>\>
307
+
308
+ ##### fillTransaction
309
+
310
+ \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>
311
+
312
+ Fills a transaction request with the necessary fields to be signed over.
313
+
314
+ - Docs: https://viem.sh/docs/actions/public/fillTransaction
315
+
316
+ **Example**
317
+
318
+ ```ts
319
+ import { createPublicClient, http } from 'viem'
320
+ import { mainnet } from 'viem/chains'
321
+
322
+ const client = createPublicClient({
323
+ chain: mainnet,
324
+ transport: http(),
325
+ })
326
+ const result = await client.fillTransaction({
327
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
328
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
329
+ value: parseEther('1'),
330
+ })
331
+ ```
332
+
333
+ ##### getBalance
334
+
335
+ (`args`) => `Promise`\<`bigint`\>
336
+
337
+ Returns the balance of an address in wei.
338
+
339
+ - Docs: https://viem.sh/docs/actions/public/getBalance
340
+ - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)
341
+
342
+ **Remarks**
343
+
344
+ You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther).
345
+
346
+ ```ts
347
+ const balance = await getBalance(client, {
348
+ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
349
+ blockTag: 'safe'
350
+ })
351
+ const balanceAsEther = formatEther(balance)
352
+ // "6.942"
353
+ ```
354
+
355
+ **Example**
356
+
357
+ ```ts
358
+ import { createPublicClient, http } from 'viem'
359
+ import { mainnet } from 'viem/chains'
360
+
361
+ const client = createPublicClient({
362
+ chain: mainnet,
363
+ transport: http(),
364
+ })
365
+ const balance = await client.getBalance({
366
+ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
367
+ })
368
+ // 10000000000000000000000n (wei)
369
+ ```
370
+
371
+ ##### getBlobBaseFee
372
+
373
+ () => `Promise`\<`bigint`\>
374
+
375
+ Returns the base fee per blob gas in wei.
376
+
377
+ - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee
378
+ - JSON-RPC Methods: [`eth_blobBaseFee`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blobBaseFee)
379
+
380
+ **Example**
381
+
382
+ ```ts
383
+ import { createPublicClient, http } from 'viem'
384
+ import { mainnet } from 'viem/chains'
385
+ import { getBlobBaseFee } from 'viem/public'
386
+
387
+ const client = createPublicClient({
388
+ chain: mainnet,
389
+ transport: http(),
390
+ })
391
+ const blobBaseFee = await client.getBlobBaseFee()
392
+ ```
393
+
394
+ ##### getBlock
395
+
396
+ \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? (\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId?`: ... \| ...; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"legacy"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip2930"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip1559"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly ...[]; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip4844"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList`: [`SignedAuthorizationList`](https://viem.sh/docs/index.html); `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip7702"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: [`Withdrawal`](https://viem.sh/docs/index.html)[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>
397
+
398
+ Returns information about a block at a block number, hash, or tag.
399
+
400
+ - Docs: https://viem.sh/docs/actions/public/getBlock
401
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
402
+ - JSON-RPC Methods:
403
+ - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
404
+ - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
405
+
406
+ **Example**
407
+
408
+ ```ts
409
+ import { createPublicClient, http } from 'viem'
410
+ import { mainnet } from 'viem/chains'
411
+
412
+ const client = createPublicClient({
413
+ chain: mainnet,
414
+ transport: http(),
415
+ })
416
+ const block = await client.getBlock()
417
+ ```
418
+
419
+ ##### getBlockNumber
420
+
421
+ (`args?`) => `Promise`\<`bigint`\>
422
+
423
+ Returns the number of the most recent block seen.
424
+
425
+ - Docs: https://viem.sh/docs/actions/public/getBlockNumber
426
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
427
+ - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
428
+
429
+ **Example**
430
+
431
+ ```ts
432
+ import { createPublicClient, http } from 'viem'
433
+ import { mainnet } from 'viem/chains'
434
+
435
+ const client = createPublicClient({
436
+ chain: mainnet,
437
+ transport: http(),
438
+ })
439
+ const blockNumber = await client.getBlockNumber()
440
+ // 69420n
441
+ ```
442
+
443
+ ##### getBlockTransactionCount
444
+
445
+ (`args?`) => `Promise`\<`number`\>
446
+
447
+ Returns the number of Transactions at a block number, hash, or tag.
448
+
449
+ - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount
450
+ - JSON-RPC Methods:
451
+ - Calls [`eth_getBlockTransactionCountByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber) for `blockNumber` & `blockTag`.
452
+ - Calls [`eth_getBlockTransactionCountByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash) for `blockHash`.
453
+
454
+ **Example**
455
+
456
+ ```ts
457
+ import { createPublicClient, http } from 'viem'
458
+ import { mainnet } from 'viem/chains'
459
+
460
+ const client = createPublicClient({
461
+ chain: mainnet,
462
+ transport: http(),
463
+ })
464
+ const count = await client.getBlockTransactionCount()
465
+ ```
466
+
467
+ ##### getBytecode
468
+
469
+ (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
470
+
471
+ **Deprecated**
472
+
473
+ Use `getCode` instead.
474
+
475
+ ##### getChainId
476
+
477
+ () => `Promise`\<`number`\>
478
+
479
+ Returns the chain ID associated with the current network.
480
+
481
+ - Docs: https://viem.sh/docs/actions/public/getChainId
482
+ - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
483
+
484
+ **Example**
485
+
486
+ ```ts
487
+ import { createPublicClient, http } from 'viem'
488
+ import { mainnet } from 'viem/chains'
489
+
490
+ const client = createPublicClient({
491
+ chain: mainnet,
492
+ transport: http(),
493
+ })
494
+ const chainId = await client.getChainId()
495
+ // 1
496
+ ```
497
+
498
+ ##### getCode
499
+
500
+ (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
501
+
502
+ Retrieves the bytecode at an address.
503
+
504
+ - Docs: https://viem.sh/docs/contract/getCode
505
+ - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
506
+
507
+ **Example**
508
+
509
+ ```ts
510
+ import { createPublicClient, http } from 'viem'
511
+ import { mainnet } from 'viem/chains'
512
+
513
+ const client = createPublicClient({
514
+ chain: mainnet,
515
+ transport: http(),
516
+ })
517
+ const code = await client.getCode({
518
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
519
+ })
520
+ ```
521
+
522
+ ##### getContractEvents
523
+
524
+ \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetContractEventsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
525
+
526
+ Returns a list of event logs emitted by a contract.
527
+
528
+ - Docs: https://viem.sh/docs/actions/public/getContractEvents
529
+ - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
530
+
531
+ **Example**
532
+
533
+ ```ts
534
+ import { createPublicClient, http } from 'viem'
535
+ import { mainnet } from 'viem/chains'
536
+ import { wagmiAbi } from './abi'
537
+
538
+ const client = createPublicClient({
539
+ chain: mainnet,
540
+ transport: http(),
541
+ })
542
+ const logs = await client.getContractEvents(client, {
543
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
544
+ abi: wagmiAbi,
545
+ eventName: 'Transfer'
546
+ })
547
+ ```
548
+
549
+ ##### getEip712Domain
550
+
551
+ (`args`) => `Promise`\<[`GetEip712DomainReturnType`](https://viem.sh/docs/index.html)\>
552
+
553
+ Reads the EIP-712 domain from a contract, based on the ERC-5267 specification.
554
+
555
+ **Example**
556
+
557
+ ```ts
558
+ import { createPublicClient, http } from 'viem'
559
+ import { mainnet } from 'viem/chains'
560
+
561
+ const client = createPublicClient({
562
+ chain: mainnet,
563
+ transport: http(),
564
+ })
565
+
566
+ const domain = await client.getEip712Domain({
567
+ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
568
+ })
569
+ // {
570
+ // domain: {
571
+ // name: 'ExampleContract',
572
+ // version: '1',
573
+ // chainId: 1,
574
+ // verifyingContract: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
575
+ // },
576
+ // fields: '0x0f',
577
+ // extensions: [],
578
+ // }
579
+ ```
580
+
581
+ ##### getEnsAddress
582
+
583
+ (`args`) => `Promise`\<[`GetEnsAddressReturnType`](https://viem.sh/docs/index.html)\>
584
+
585
+ Gets address for ENS name.
586
+
587
+ - Docs: https://viem.sh/docs/ens/actions/getEnsAddress
588
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
589
+
590
+ **Remarks**
591
+
592
+ Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
593
+
594
+ 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) function for this.
595
+
596
+ **Example**
597
+
598
+ ```ts
599
+ import { createPublicClient, http } from 'viem'
600
+ import { mainnet } from 'viem/chains'
601
+ import { normalize } from 'viem/ens'
602
+
603
+ const client = createPublicClient({
604
+ chain: mainnet,
605
+ transport: http(),
606
+ })
607
+ const ensAddress = await client.getEnsAddress({
608
+ name: normalize('wevm.eth'),
609
+ })
610
+ // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
611
+ ```
612
+
613
+ ##### getEnsAvatar
614
+
615
+ (`args`) => `Promise`\<[`GetEnsAvatarReturnType`](https://viem.sh/docs/index.html)\>
616
+
617
+ Gets the avatar of an ENS name.
618
+
619
+ - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar
620
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
621
+
622
+ **Remarks**
623
+
624
+ Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText) with `key` set to `'avatar'`.
625
+
626
+ 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) function for this.
627
+
628
+ **Example**
629
+
630
+ ```ts
631
+ import { createPublicClient, http } from 'viem'
632
+ import { mainnet } from 'viem/chains'
633
+ import { normalize } from 'viem/ens'
634
+
635
+ const client = createPublicClient({
636
+ chain: mainnet,
637
+ transport: http(),
638
+ })
639
+ const ensAvatar = await client.getEnsAvatar({
640
+ name: normalize('wevm.eth'),
641
+ })
642
+ // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
643
+ ```
644
+
645
+ ##### getEnsName
646
+
647
+ (`args`) => `Promise`\<[`GetEnsNameReturnType`](https://viem.sh/docs/index.html)\>
648
+
649
+ Gets primary name for specified address.
650
+
651
+ - Docs: https://viem.sh/docs/ens/actions/getEnsName
652
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
653
+
654
+ **Remarks**
655
+
656
+ Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
657
+
658
+ **Example**
659
+
660
+ ```ts
661
+ import { createPublicClient, http } from 'viem'
662
+ import { mainnet } from 'viem/chains'
663
+
664
+ const client = createPublicClient({
665
+ chain: mainnet,
666
+ transport: http(),
667
+ })
668
+ const ensName = await client.getEnsName({
669
+ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
670
+ })
671
+ // 'wevm.eth'
672
+ ```
673
+
674
+ ##### getEnsResolver
675
+
676
+ (`args`) => `Promise`\<`` `0x${string}` ``\>
677
+
678
+ Gets resolver for ENS name.
679
+
680
+ - Docs: https://viem.sh/docs/ens/actions/getEnsResolver
681
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
682
+
683
+ **Remarks**
684
+
685
+ Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
686
+
687
+ 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) function for this.
688
+
689
+ **Example**
690
+
691
+ ```ts
692
+ import { createPublicClient, http } from 'viem'
693
+ import { mainnet } from 'viem/chains'
694
+ import { normalize } from 'viem/ens'
695
+
696
+ const client = createPublicClient({
697
+ chain: mainnet,
698
+ transport: http(),
699
+ })
700
+ const resolverAddress = await client.getEnsResolver({
701
+ name: normalize('wevm.eth'),
702
+ })
703
+ // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
704
+ ```
705
+
706
+ ##### getEnsText
707
+
708
+ (`args`) => `Promise`\<[`GetEnsTextReturnType`](https://viem.sh/docs/index.html)\>
709
+
710
+ Gets a text record for specified ENS name.
711
+
712
+ - Docs: https://viem.sh/docs/ens/actions/getEnsResolver
713
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
714
+
715
+ **Remarks**
716
+
717
+ Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
718
+
719
+ 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) function for this.
720
+
721
+ **Example**
722
+
723
+ ```ts
724
+ import { createPublicClient, http } from 'viem'
725
+ import { mainnet } from 'viem/chains'
726
+ import { normalize } from 'viem/ens'
727
+
728
+ const client = createPublicClient({
729
+ chain: mainnet,
730
+ transport: http(),
731
+ })
732
+ const twitterRecord = await client.getEnsText({
733
+ name: normalize('wevm.eth'),
734
+ key: 'com.twitter',
735
+ })
736
+ // 'wevm_dev'
737
+ ```
738
+
739
+ ##### getFeeHistory
740
+
741
+ (`args`) => `Promise`\<[`GetFeeHistoryReturnType`](https://viem.sh/docs/index.html)\>
742
+
743
+ Returns a collection of historical gas information.
744
+
745
+ - Docs: https://viem.sh/docs/actions/public/getFeeHistory
746
+ - JSON-RPC Methods: [`eth_feeHistory`](https://docs.alchemy.com/reference/eth-feehistory)
747
+
748
+ **Example**
749
+
750
+ ```ts
751
+ import { createPublicClient, http } from 'viem'
752
+ import { mainnet } from 'viem/chains'
753
+
754
+ const client = createPublicClient({
755
+ chain: mainnet,
756
+ transport: http(),
757
+ })
758
+ const feeHistory = await client.getFeeHistory({
759
+ blockCount: 4,
760
+ rewardPercentiles: [25, 75],
761
+ })
762
+ ```
763
+
764
+ ##### getFilterChanges
765
+
766
+ \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterChangesReturnType`](https://viem.sh/docs/index.html)\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
767
+
768
+ Returns a list of logs or hashes based on a [Filter](/docs/glossary/terms#filter) since the last time it was called.
769
+
770
+ - Docs: https://viem.sh/docs/actions/public/getFilterChanges
771
+ - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges)
772
+
773
+ **Remarks**
774
+
775
+ A Filter can be created from the following actions:
776
+
777
+ - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
778
+ - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter)
779
+ - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
780
+ - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
781
+
782
+ Depending on the type of filter, the return value will be different:
783
+
784
+ - If the filter was created with `createContractEventFilter` or `createEventFilter`, it returns a list of logs.
785
+ - If the filter was created with `createPendingTransactionFilter`, it returns a list of transaction hashes.
786
+ - If the filter was created with `createBlockFilter`, it returns a list of block hashes.
787
+
788
+ **Examples**
789
+
790
+ ```ts
791
+ // Blocks
792
+ import { createPublicClient, http } from 'viem'
793
+ import { mainnet } from 'viem/chains'
794
+
795
+ const client = createPublicClient({
796
+ chain: mainnet,
797
+ transport: http(),
798
+ })
799
+ const filter = await client.createBlockFilter()
800
+ const hashes = await client.getFilterChanges({ filter })
801
+ ```
802
+
803
+ ```ts
804
+ // Contract Events
805
+ import { createPublicClient, http, parseAbi } from 'viem'
806
+ import { mainnet } from 'viem/chains'
807
+
808
+ const client = createPublicClient({
809
+ chain: mainnet,
810
+ transport: http(),
811
+ })
812
+ const filter = await client.createContractEventFilter({
813
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
814
+ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
815
+ eventName: 'Transfer',
816
+ })
817
+ const logs = await client.getFilterChanges({ filter })
818
+ ```
819
+
820
+ ```ts
821
+ // Raw Events
822
+ import { createPublicClient, http, parseAbiItem } from 'viem'
823
+ import { mainnet } from 'viem/chains'
824
+
825
+ const client = createPublicClient({
826
+ chain: mainnet,
827
+ transport: http(),
828
+ })
829
+ const filter = await client.createEventFilter({
830
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
831
+ event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
832
+ })
833
+ const logs = await client.getFilterChanges({ filter })
834
+ ```
835
+
836
+ ```ts
837
+ // Transactions
838
+ import { createPublicClient, http } from 'viem'
839
+ import { mainnet } from 'viem/chains'
840
+
841
+ const client = createPublicClient({
842
+ chain: mainnet,
843
+ transport: http(),
844
+ })
845
+ const filter = await client.createPendingTransactionFilter()
846
+ const hashes = await client.getFilterChanges({ filter })
847
+ ```
848
+
849
+ ##### getFilterLogs
850
+
851
+ \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterLogsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
852
+
853
+ Returns a list of event logs since the filter was created.
854
+
855
+ - Docs: https://viem.sh/docs/actions/public/getFilterLogs
856
+ - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs)
857
+
858
+ **Remarks**
859
+
860
+ `getFilterLogs` is only compatible with **event filters**.
861
+
862
+ **Example**
863
+
864
+ ```ts
865
+ import { createPublicClient, http, parseAbiItem } from 'viem'
866
+ import { mainnet } from 'viem/chains'
867
+
868
+ const client = createPublicClient({
869
+ chain: mainnet,
870
+ transport: http(),
871
+ })
872
+ const filter = await client.createEventFilter({
873
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
874
+ event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
875
+ })
876
+ const logs = await client.getFilterLogs({ filter })
877
+ ```
878
+
879
+ ##### getGasPrice
880
+
881
+ () => `Promise`\<`bigint`\>
882
+
883
+ Returns the current price of gas (in wei).
884
+
885
+ - Docs: https://viem.sh/docs/actions/public/getGasPrice
886
+ - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice)
887
+
888
+ **Example**
889
+
890
+ ```ts
891
+ import { createPublicClient, http } from 'viem'
892
+ import { mainnet } from 'viem/chains'
893
+
894
+ const client = createPublicClient({
895
+ chain: mainnet,
896
+ transport: http(),
897
+ })
898
+ const gasPrice = await client.getGasPrice()
899
+ ```
900
+
901
+ ##### getLogs
902
+
903
+ \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<[`GetLogsReturnType`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>
904
+
905
+ Returns a list of event logs matching the provided parameters.
906
+
907
+ - Docs: https://viem.sh/docs/actions/public/getLogs
908
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs
909
+ - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
910
+
911
+ **Example**
912
+
913
+ ```ts
914
+ import { createPublicClient, http, parseAbiItem } from 'viem'
915
+ import { mainnet } from 'viem/chains'
916
+
917
+ const client = createPublicClient({
918
+ chain: mainnet,
919
+ transport: http(),
920
+ })
921
+ const logs = await client.getLogs()
922
+ ```
923
+
924
+ ##### getProof
925
+
926
+ (`args`) => `Promise`\<[`GetProofReturnType`](https://viem.sh/docs/index.html)\>
927
+
928
+ Returns the account and storage values of the specified account including the Merkle-proof.
929
+
930
+ - Docs: https://viem.sh/docs/actions/public/getProof
931
+ - JSON-RPC Methods:
932
+ - Calls [`eth_getProof`](https://eips.ethereum.org/EIPS/eip-1186)
933
+
934
+ **Example**
935
+
936
+ ```ts
937
+ import { createPublicClient, http } from 'viem'
938
+ import { mainnet } from 'viem/chains'
939
+
940
+ const client = createPublicClient({
941
+ chain: mainnet,
942
+ transport: http(),
943
+ })
944
+ const block = await client.getProof({
945
+ address: '0x...',
946
+ storageKeys: ['0x...'],
947
+ })
948
+ ```
949
+
950
+ ##### getStorageAt
951
+
952
+ (`args`) => `Promise`\<[`GetStorageAtReturnType`](https://viem.sh/docs/index.html)\>
953
+
954
+ Returns the value from a storage slot at a given address.
955
+
956
+ - Docs: https://viem.sh/docs/contract/getStorageAt
957
+ - JSON-RPC Methods: [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat)
958
+
959
+ **Example**
960
+
961
+ ```ts
962
+ import { createPublicClient, http } from 'viem'
963
+ import { mainnet } from 'viem/chains'
964
+ import { getStorageAt } from 'viem/contract'
965
+
966
+ const client = createPublicClient({
967
+ chain: mainnet,
968
+ transport: http(),
969
+ })
970
+ const code = await client.getStorageAt({
971
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
972
+ slot: toHex(0),
973
+ })
974
+ ```
975
+
976
+ ##### getTransaction
977
+
978
+ \<`blockTag`\>(`args`) => `Promise`\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList`: [`SignedAuthorizationList`](https://viem.sh/docs/index.html); `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>
979
+
980
+ Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
981
+
982
+ - Docs: https://viem.sh/docs/actions/public/getTransaction
983
+ - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
984
+ - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
985
+
986
+ **Example**
987
+
988
+ ```ts
989
+ import { createPublicClient, http } from 'viem'
990
+ import { mainnet } from 'viem/chains'
991
+
992
+ const client = createPublicClient({
993
+ chain: mainnet,
994
+ transport: http(),
995
+ })
996
+ const transaction = await client.getTransaction({
997
+ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
998
+ })
999
+ ```
1000
+
1001
+ ##### getTransactionConfirmations
1002
+
1003
+ (`args`) => `Promise`\<`bigint`\>
1004
+
1005
+ Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
1006
+
1007
+ - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations
1008
+ - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
1009
+ - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
1010
+
1011
+ **Example**
1012
+
1013
+ ```ts
1014
+ import { createPublicClient, http } from 'viem'
1015
+ import { mainnet } from 'viem/chains'
1016
+
1017
+ const client = createPublicClient({
1018
+ chain: mainnet,
1019
+ transport: http(),
1020
+ })
1021
+ const confirmations = await client.getTransactionConfirmations({
1022
+ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
1023
+ })
1024
+ ```
1025
+
1026
+ ##### getTransactionCount
1027
+
1028
+ (`args`) => `Promise`\<`number`\>
1029
+
1030
+ Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent.
1031
+
1032
+ - Docs: https://viem.sh/docs/actions/public/getTransactionCount
1033
+ - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
1034
+
1035
+ **Example**
1036
+
1037
+ ```ts
1038
+ import { createPublicClient, http } from 'viem'
1039
+ import { mainnet } from 'viem/chains'
1040
+
1041
+ const client = createPublicClient({
1042
+ chain: mainnet,
1043
+ transport: http(),
1044
+ })
1045
+ const transactionCount = await client.getTransactionCount({
1046
+ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1047
+ })
1048
+ ```
1049
+
1050
+ ##### getTransactionReceipt
1051
+
1052
+ (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
1053
+
1054
+ Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
1055
+
1056
+ - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt
1057
+ - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
1058
+ - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
1059
+
1060
+ **Example**
1061
+
1062
+ ```ts
1063
+ import { createPublicClient, http } from 'viem'
1064
+ import { mainnet } from 'viem/chains'
1065
+
1066
+ const client = createPublicClient({
1067
+ chain: mainnet,
1068
+ transport: http(),
1069
+ })
1070
+ const transactionReceipt = await client.getTransactionReceipt({
1071
+ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
1072
+ })
1073
+ ```
1074
+
1075
+ ##### key
1076
+
1077
+ `string`
1078
+
1079
+ A key for the client.
1080
+
1081
+ ##### multicall
1082
+
1083
+ \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<[`MulticallReturnType`](https://viem.sh/docs/index.html)\<`contracts`, `allowFailure`\>\>
1084
+
1085
+ Similar to [`readContract`](https://viem.sh/docs/contract/readContract), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall).
1086
+
1087
+ - Docs: https://viem.sh/docs/contract/multicall
1088
+
1089
+ **Example**
1090
+
1091
+ ```ts
1092
+ import { createPublicClient, http, parseAbi } from 'viem'
1093
+ import { mainnet } from 'viem/chains'
1094
+
1095
+ const client = createPublicClient({
1096
+ chain: mainnet,
1097
+ transport: http(),
1098
+ })
1099
+ const abi = parseAbi([
1100
+ 'function balanceOf(address) view returns (uint256)',
1101
+ 'function totalSupply() view returns (uint256)',
1102
+ ])
1103
+ const result = await client.multicall({
1104
+ contracts: [
1105
+ {
1106
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1107
+ abi,
1108
+ functionName: 'balanceOf',
1109
+ args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
1110
+ },
1111
+ {
1112
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1113
+ abi,
1114
+ functionName: 'totalSupply',
1115
+ },
1116
+ ],
1117
+ })
1118
+ // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
1119
+ ```
1120
+
1121
+ ##### name
1122
+
1123
+ `string`
1124
+
1125
+ A name for the client.
1126
+
1127
+ ##### pollingInterval
1128
+
1129
+ `number`
1130
+
1131
+ Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
1132
+
1133
+ ##### prepareTransactionRequest
1134
+
1135
+ \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
1136
+
1137
+ Prepares a transaction request for signing.
1138
+
1139
+ - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest
1140
+
1141
+ **Examples**
1142
+
1143
+ ```ts
1144
+ import { createWalletClient, custom } from 'viem'
1145
+ import { mainnet } from 'viem/chains'
1146
+
1147
+ const client = createWalletClient({
1148
+ chain: mainnet,
1149
+ transport: custom(window.ethereum),
1150
+ })
1151
+ const request = await client.prepareTransactionRequest({
1152
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1153
+ to: '0x0000000000000000000000000000000000000000',
1154
+ value: 1n,
1155
+ })
1156
+ ```
1157
+
1158
+ ```ts
1159
+ // Account Hoisting
1160
+ import { createWalletClient, http } from 'viem'
1161
+ import { privateKeyToAccount } from 'viem/accounts'
1162
+ import { mainnet } from 'viem/chains'
1163
+
1164
+ const client = createWalletClient({
1165
+ account: privateKeyToAccount('0x…'),
1166
+ chain: mainnet,
1167
+ transport: custom(window.ethereum),
1168
+ })
1169
+ const request = await client.prepareTransactionRequest({
1170
+ to: '0x0000000000000000000000000000000000000000',
1171
+ value: 1n,
1172
+ })
1173
+ ```
1174
+
1175
+ ##### readContract
1176
+
1177
+ \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<[`ReadContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`\>\>
1178
+
1179
+ Calls a read-only function on a contract, and returns the response.
1180
+
1181
+ - Docs: https://viem.sh/docs/contract/readContract
1182
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts
1183
+
1184
+ **Remarks**
1185
+
1186
+ 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.
1187
+
1188
+ Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
1189
+
1190
+ **Example**
1191
+
1192
+ ```ts
1193
+ import { createPublicClient, http, parseAbi } from 'viem'
1194
+ import { mainnet } from 'viem/chains'
1195
+ import { readContract } from 'viem/contract'
1196
+
1197
+ const client = createPublicClient({
1198
+ chain: mainnet,
1199
+ transport: http(),
1200
+ })
1201
+ const result = await client.readContract({
1202
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1203
+ abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
1204
+ functionName: 'balanceOf',
1205
+ args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
1206
+ })
1207
+ // 424122n
1208
+ ```
1209
+
1210
+ ##### request
1211
+
1212
+ [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`PublicRpcSchema`](https://viem.sh/docs/index.html)\>
1213
+
1214
+ Request function wrapped with friendly error handling
1215
+
1216
+ ##### sendRawTransaction
1217
+
1218
+ (`args`) => `Promise`\<`` `0x${string}` ``\>
1219
+
1220
+ Sends a **signed** transaction to the network
1221
+
1222
+ - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction
1223
+ - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
1224
+
1225
+ **Example**
1226
+
1227
+ ```ts
1228
+ import { createWalletClient, custom } from 'viem'
1229
+ import { mainnet } from 'viem/chains'
1230
+ import { sendRawTransaction } from 'viem/wallet'
1231
+
1232
+ const client = createWalletClient({
1233
+ chain: mainnet,
1234
+ transport: custom(window.ethereum),
1235
+ })
1236
+
1237
+ const hash = await client.sendRawTransaction({
1238
+ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
1239
+ })
1240
+ ```
1241
+
1242
+ ##### sendRawTransactionSync
1243
+
1244
+ (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
1245
+
1246
+ Sends a **signed** transaction to the network
1247
+
1248
+ - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync
1249
+ - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966)
1250
+
1251
+ **Example**
1252
+
1253
+ ```ts
1254
+ import { createWalletClient, custom } from 'viem'
1255
+ import { mainnet } from 'viem/chains'
1256
+ import { sendRawTransactionSync } from 'viem/wallet'
1257
+
1258
+ const client = createWalletClient({
1259
+ chain: mainnet,
1260
+ transport: custom(window.ethereum),
1261
+ })
1262
+
1263
+ const receipt = await client.sendRawTransactionSync({
1264
+ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
1265
+ })
1266
+ ```
1267
+
1268
+ ##### simulate
1269
+
1270
+ \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
1271
+
1272
+ **Deprecated**
1273
+
1274
+ Use `simulateBlocks` instead.
1275
+
1276
+ ##### simulateBlocks
1277
+
1278
+ \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
1279
+
1280
+ Simulates a set of calls on block(s) with optional block and state overrides.
1281
+
1282
+ **Example**
1283
+
1284
+ ```ts
1285
+ import { createPublicClient, http, parseEther } from 'viem'
1286
+ import { mainnet } from 'viem/chains'
1287
+
1288
+ const client = createPublicClient({
1289
+ chain: mainnet,
1290
+ transport: http(),
1291
+ })
1292
+
1293
+ const result = await client.simulateBlocks({
1294
+ blocks: [{
1295
+ blockOverrides: {
1296
+ number: 69420n,
1297
+ },
1298
+ calls: [{
1299
+ {
1300
+ account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
1301
+ data: '0xdeadbeef',
1302
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1303
+ },
1304
+ {
1305
+ account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
1306
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1307
+ value: parseEther('1'),
1308
+ },
1309
+ }],
1310
+ stateOverrides: [{
1311
+ address: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
1312
+ balance: parseEther('10'),
1313
+ }],
1314
+ }]
1315
+ })
1316
+ ```
1317
+
1318
+ ##### simulateCalls
1319
+
1320
+ \<`calls`\>(`args`) => `Promise`\<[`SimulateCallsReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
1321
+
1322
+ Simulates a set of calls.
1323
+
1324
+ **Example**
1325
+
1326
+ ```ts
1327
+ import { createPublicClient, http, parseEther } from 'viem'
1328
+ import { mainnet } from 'viem/chains'
1329
+
1330
+ const client = createPublicClient({
1331
+ chain: mainnet,
1332
+ transport: http(),
1333
+ })
1334
+
1335
+ const result = await client.simulateCalls({
1336
+ account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
1337
+ calls: [{
1338
+ {
1339
+ data: '0xdeadbeef',
1340
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1341
+ },
1342
+ {
1343
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1344
+ value: parseEther('1'),
1345
+ },
1346
+ ]
1347
+ })
1348
+ ```
1349
+
1350
+ ##### simulateContract
1351
+
1352
+ \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`SimulateContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `accountOverride`\>\>
1353
+
1354
+ Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
1355
+
1356
+ - Docs: https://viem.sh/docs/contract/simulateContract
1357
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
1358
+
1359
+ **Remarks**
1360
+
1361
+ 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), but also supports contract write functions.
1362
+
1363
+ Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
1364
+
1365
+ **Example**
1366
+
1367
+ ```ts
1368
+ import { createPublicClient, http } from 'viem'
1369
+ import { mainnet } from 'viem/chains'
1370
+
1371
+ const client = createPublicClient({
1372
+ chain: mainnet,
1373
+ transport: http(),
1374
+ })
1375
+ const result = await client.simulateContract({
1376
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1377
+ abi: parseAbi(['function mint(uint32) view returns (uint32)']),
1378
+ functionName: 'mint',
1379
+ args: ['69420'],
1380
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1381
+ })
1382
+ ```
1383
+
1384
+ ##### transport
1385
+
1386
+ [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>
1387
+
1388
+ The RPC transport
1389
+
1390
+ ##### type
1391
+
1392
+ `string`
1393
+
1394
+ The type of client.
1395
+
1396
+ ##### uid
1397
+
1398
+ `string`
1399
+
1400
+ A unique ID for the client.
1401
+
1402
+ ##### uninstallFilter
1403
+
1404
+ (`args`) => `Promise`\<`boolean`\>
1405
+
1406
+ Destroys a Filter that was created from one of the following Actions:
1407
+
1408
+ - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
1409
+ - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
1410
+ - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
1411
+
1412
+ - Docs: https://viem.sh/docs/actions/public/uninstallFilter
1413
+ - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
1414
+
1415
+ **Example**
1416
+
1417
+ ```ts
1418
+ import { createPublicClient, http } from 'viem'
1419
+ import { mainnet } from 'viem/chains'
1420
+ import { createPendingTransactionFilter, uninstallFilter } from 'viem/public'
1421
+
1422
+ const filter = await client.createPendingTransactionFilter()
1423
+ const uninstalled = await client.uninstallFilter({ filter })
1424
+ // true
1425
+ ```
1426
+
1427
+ ##### verifyHash
1428
+
1429
+ (`args`) => `Promise`\<`boolean`\>
1430
+
1431
+ Verify that a hash was signed by the provided address.
1432
+
1433
+ - Docs [https://viem.sh/docs/actions/public/verifyHash](https://viem.sh/docs/actions/public/verifyHash)
1434
+
1435
+ ##### verifyMessage
1436
+
1437
+ (`args`) => `Promise`\<`boolean`\>
1438
+
1439
+ Verify that a message was signed by the provided address.
1440
+
1441
+ Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492).
1442
+
1443
+ - Docs [https://viem.sh/docs/actions/public/verifyMessage](https://viem.sh/docs/actions/public/verifyMessage)
1444
+
1445
+ ##### verifySiweMessage
1446
+
1447
+ (`args`) => `Promise`\<`boolean`\>
1448
+
1449
+ Verifies [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) formatted message was signed.
1450
+
1451
+ Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492).
1452
+
1453
+ - Docs [https://viem.sh/docs/siwe/actions/verifySiweMessage](https://viem.sh/docs/siwe/actions/verifySiweMessage)
1454
+
1455
+ ##### verifyTypedData
1456
+
1457
+ (`args`) => `Promise`\<`boolean`\>
1458
+
1459
+ Verify that typed data was signed by the provided address.
1460
+
1461
+ - Docs [https://viem.sh/docs/actions/public/verifyTypedData](https://viem.sh/docs/actions/public/verifyTypedData)
1462
+
1463
+ ##### waitForTransactionReceipt
1464
+
1465
+ (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
1466
+
1467
+ Waits for the [Transaction](https://viem.sh/docs/glossary/terms#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt). If the Transaction reverts, then the action will throw an error.
1468
+
1469
+ - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt
1470
+ - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
1471
+ - JSON-RPC Methods:
1472
+ - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
1473
+ - If a Transaction has been replaced:
1474
+ - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions
1475
+ - Checks if one of the Transactions is a replacement
1476
+ - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
1477
+
1478
+ **Remarks**
1479
+
1480
+ The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
1481
+
1482
+ Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce.
1483
+
1484
+ There are 3 types of Transaction Replacement reasons:
1485
+
1486
+ - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)
1487
+ - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)
1488
+ - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)
1489
+
1490
+ **Example**
1491
+
1492
+ ```ts
1493
+ import { createPublicClient, http } from 'viem'
1494
+ import { mainnet } from 'viem/chains'
1495
+
1496
+ const client = createPublicClient({
1497
+ chain: mainnet,
1498
+ transport: http(),
1499
+ })
1500
+ const transactionReceipt = await client.waitForTransactionReceipt({
1501
+ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
1502
+ })
1503
+ ```
1504
+
1505
+ ##### watchBlockNumber
1506
+
1507
+ (`args`) => [`WatchBlockNumberReturnType`](https://viem.sh/docs/index.html)
1508
+
1509
+ Watches and returns incoming block numbers.
1510
+
1511
+ - Docs: https://viem.sh/docs/actions/public/watchBlockNumber
1512
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
1513
+ - JSON-RPC Methods:
1514
+ - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
1515
+ - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
1516
+
1517
+ **Example**
1518
+
1519
+ ```ts
1520
+ import { createPublicClient, http } from 'viem'
1521
+ import { mainnet } from 'viem/chains'
1522
+
1523
+ const client = createPublicClient({
1524
+ chain: mainnet,
1525
+ transport: http(),
1526
+ })
1527
+ const unwatch = await client.watchBlockNumber({
1528
+ onBlockNumber: (blockNumber) => console.log(blockNumber),
1529
+ })
1530
+ ```
1531
+
1532
+ ##### watchBlocks
1533
+
1534
+ \<`includeTransactions`, `blockTag`\>(`args`) => [`WatchBlocksReturnType`](https://viem.sh/docs/index.html)
1535
+
1536
+ Watches and returns information for incoming blocks.
1537
+
1538
+ - Docs: https://viem.sh/docs/actions/public/watchBlocks
1539
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
1540
+ - JSON-RPC Methods:
1541
+ - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
1542
+ - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
1543
+
1544
+ **Example**
1545
+
1546
+ ```ts
1547
+ import { createPublicClient, http } from 'viem'
1548
+ import { mainnet } from 'viem/chains'
1549
+
1550
+ const client = createPublicClient({
1551
+ chain: mainnet,
1552
+ transport: http(),
1553
+ })
1554
+ const unwatch = await client.watchBlocks({
1555
+ onBlock: (block) => console.log(block),
1556
+ })
1557
+ ```
1558
+
1559
+ ##### watchContractEvent
1560
+
1561
+ \<`abi`, `eventName`, `strict`\>(`args`) => [`WatchContractEventReturnType`](https://viem.sh/docs/index.html)
1562
+
1563
+ Watches and returns emitted contract event logs.
1564
+
1565
+ - Docs: https://viem.sh/docs/contract/watchContractEvent
1566
+
1567
+ **Remarks**
1568
+
1569
+ This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent#onLogs).
1570
+
1571
+ `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
1572
+
1573
+ **Example**
1574
+
1575
+ ```ts
1576
+ import { createPublicClient, http, parseAbi } from 'viem'
1577
+ import { mainnet } from 'viem/chains'
1578
+
1579
+ const client = createPublicClient({
1580
+ chain: mainnet,
1581
+ transport: http(),
1582
+ })
1583
+ const unwatch = client.watchContractEvent({
1584
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1585
+ abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']),
1586
+ eventName: 'Transfer',
1587
+ args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
1588
+ onLogs: (logs) => console.log(logs),
1589
+ })
1590
+ ```
1591
+
1592
+ ##### watchEvent
1593
+
1594
+ \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => [`WatchEventReturnType`](https://viem.sh/docs/index.html)
1595
+
1596
+ Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms#event-log).
1597
+
1598
+ - Docs: https://viem.sh/docs/actions/public/watchEvent
1599
+ - JSON-RPC Methods:
1600
+ - **RPC Provider supports `eth_newFilter`:**
1601
+ - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize).
1602
+ - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges).
1603
+ - **RPC Provider does not support `eth_newFilter`:**
1604
+ - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
1605
+
1606
+ **Remarks**
1607
+
1608
+ This Action will batch up all the Event Logs found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchEvent#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/actions/public/watchEvent#onLogs).
1609
+
1610
+ `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/actions/public/createEventFilter) 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) instead.
1611
+
1612
+ **Example**
1613
+
1614
+ ```ts
1615
+ import { createPublicClient, http } from 'viem'
1616
+ import { mainnet } from 'viem/chains'
1617
+
1618
+ const client = createPublicClient({
1619
+ chain: mainnet,
1620
+ transport: http(),
1621
+ })
1622
+ const unwatch = client.watchEvent({
1623
+ onLogs: (logs) => console.log(logs),
1624
+ })
1625
+ ```
1626
+
1627
+ ##### watchPendingTransactions
1628
+
1629
+ (`args`) => [`WatchPendingTransactionsReturnType`](https://viem.sh/docs/index.html)
1630
+
1631
+ Watches and returns pending transaction hashes.
1632
+
1633
+ - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions
1634
+ - JSON-RPC Methods:
1635
+ - When `poll: true`
1636
+ - Calls [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) to initialize the filter.
1637
+ - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval.
1638
+ - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event.
1639
+
1640
+ **Remarks**
1641
+
1642
+ This Action will batch up all the pending transactions found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchPendingTransactions#pollinginterval-optional), and invoke them via [`onTransactions`](https://viem.sh/docs/actions/public/watchPendingTransactions#ontransactions).
1643
+
1644
+ **Example**
1645
+
1646
+ ```ts
1647
+ import { createPublicClient, http } from 'viem'
1648
+ import { mainnet } from 'viem/chains'
1649
+
1650
+ const client = createPublicClient({
1651
+ chain: mainnet,
1652
+ transport: http(),
1653
+ })
1654
+ const unwatch = await client.watchPendingTransactions({
1655
+ onTransactions: (hashes) => console.log(hashes),
1656
+ })
1657
+ ```
1658
+
1659
+ |
1660
+
1661
+ \{ `account`: [`Account`](https://viem.sh/docs/index.html) \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: [`Chain`](https://viem.sh/docs/index.html) \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: [`BlockTag`](https://viem.sh/docs/index.html); `extend`: \<`client`\>(`fn`) => [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, [`WalletRpcSchema`](https://viem.sh/docs/index.html), \{ \[K in string \| number \| symbol\]: client\[K\] \} & [`WalletActions`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<[`GetAddressesReturnType`](https://viem.sh/docs/index.html)\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: ...; paymasterService?: ...; unstable\_addSubAccount?: ...; \[key: ...\]: ... \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<[`GetPermissionsReturnType`](https://viem.sh/docs/index.html)\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<[`PrepareAuthorizationReturnType`](https://viem.sh/docs/index.html)\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`WalletRpcSchema`](https://viem.sh/docs/index.html)\>; `requestAddresses`: () => `Promise`\<[`RequestAddressesReturnType`](https://viem.sh/docs/index.html)\>; `requestPermissions`: (`args`) => `Promise`\<[`RequestPermissionsReturnType`](https://viem.sh/docs/index.html)\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{\[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<[`SignAuthorizationReturnType`](https://viem.sh/docs/index.html)\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<[`TransactionSerialized`](https://viem.sh/docs/index.html)\<[`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, `request` *extends* [`LegacyProperties`](https://viem.sh/docs/index.html) ? `"legacy"` : `never` \| `request` *extends* [`EIP1559Properties`](https://viem.sh/docs/index.html) ? `"eip1559"` : `never` \| `request` *extends* [`EIP2930Properties`](https://viem.sh/docs/index.html) ? `"eip2930"` : `never` \| `request` *extends* [`EIP4844Properties`](https://viem.sh/docs/index.html) ? `"eip4844"` : `never` \| `request` *extends* [`EIP7702Properties`](https://viem.sh/docs/index.html) ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"legacy"` ? [`TransactionSerializedLegacy`](https://viem.sh/docs/index.html) : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>; \}
1662
+
1663
+ ##### account
1664
+
1665
+ [`Account`](https://viem.sh/docs/index.html) \| `undefined`
1666
+
1667
+ The Account of the Client.
1668
+
1669
+ ##### addChain
1670
+
1671
+ (`args`) => `Promise`\<`void`\>
1672
+
1673
+ Adds an EVM chain to the wallet.
1674
+
1675
+ - Docs: https://viem.sh/docs/actions/wallet/addChain
1676
+ - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
1677
+
1678
+ **Example**
1679
+
1680
+ ```ts
1681
+ import { createWalletClient, custom } from 'viem'
1682
+ import { optimism } from 'viem/chains'
1683
+
1684
+ const client = createWalletClient({
1685
+ transport: custom(window.ethereum),
1686
+ })
1687
+ await client.addChain({ chain: optimism })
1688
+ ```
1689
+
1690
+ ##### batch?
1691
+
1692
+ \{ `multicall?`: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}
1693
+
1694
+ Flags for batch settings.
1695
+
1696
+ ##### batch.multicall?
1697
+
1698
+ `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
1699
+
1700
+ Toggle to enable `eth_call` multicall aggregation.
1701
+
1702
+ ##### cacheTime
1703
+
1704
+ `number`
1705
+
1706
+ Time (in ms) that cached data will remain in memory.
1707
+
1708
+ ##### ccipRead?
1709
+
1710
+ `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
1711
+
1712
+ [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
1713
+
1714
+ ##### chain
1715
+
1716
+ [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
1717
+
1718
+ Chain for the client.
1719
+
1720
+ ##### deployContract
1721
+
1722
+ \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
1723
+
1724
+ Deploys a contract to the network, given bytecode and constructor arguments.
1725
+
1726
+ - Docs: https://viem.sh/docs/contract/deployContract
1727
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
1728
+
1729
+ **Example**
1730
+
1731
+ ```ts
1732
+ import { createWalletClient, http } from 'viem'
1733
+ import { privateKeyToAccount } from 'viem/accounts'
1734
+ import { mainnet } from 'viem/chains'
1735
+
1736
+ const client = createWalletClient({
1737
+ account: privateKeyToAccount('0x…'),
1738
+ chain: mainnet,
1739
+ transport: http(),
1740
+ })
1741
+ const hash = await client.deployContract({
1742
+ abi: [],
1743
+ account: '0x…,
1744
+ bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
1745
+ })
1746
+ ```
1747
+
1748
+ ##### experimental_blockTag?
1749
+
1750
+ [`BlockTag`](https://viem.sh/docs/index.html)
1751
+
1752
+ Default block tag to use for RPC requests.
1753
+
1754
+ ##### extend
1755
+
1756
+ \<`client`\>(`fn`) => [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, [`WalletRpcSchema`](https://viem.sh/docs/index.html), \{ \[K in string \| number \| symbol\]: client\[K\] \} & [`WalletActions`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`\>\>
1757
+
1758
+ ##### fillTransaction
1759
+
1760
+ \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>
1761
+
1762
+ Fills a transaction request with the necessary fields to be signed over.
1763
+
1764
+ - Docs: https://viem.sh/docs/actions/public/fillTransaction
1765
+
1766
+ **Example**
1767
+
1768
+ ```ts
1769
+ import { createWalletClient, custom } from 'viem'
1770
+ import { mainnet } from 'viem/chains'
1771
+
1772
+ const client = createWalletClient({
1773
+ chain: mainnet,
1774
+ transport: custom(window.ethereum),
1775
+ })
1776
+ const result = await client.fillTransaction({
1777
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1778
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1779
+ value: parseEther('1'),
1780
+ })
1781
+ ```
1782
+
1783
+ ##### getAddresses
1784
+
1785
+ () => `Promise`\<[`GetAddressesReturnType`](https://viem.sh/docs/index.html)\>
1786
+
1787
+ Returns a list of account addresses owned by the wallet or client.
1788
+
1789
+ - Docs: https://viem.sh/docs/actions/wallet/getAddresses
1790
+ - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
1791
+
1792
+ **Example**
1793
+
1794
+ ```ts
1795
+ import { createWalletClient, custom } from 'viem'
1796
+ import { mainnet } from 'viem/chains'
1797
+
1798
+ const client = createWalletClient({
1799
+ chain: mainnet,
1800
+ transport: custom(window.ethereum),
1801
+ })
1802
+ const accounts = await client.getAddresses()
1803
+ ```
1804
+
1805
+ ##### getCallsStatus
1806
+
1807
+ (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>
1808
+
1809
+ Returns the status of a call batch that was sent via `sendCalls`.
1810
+
1811
+ - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus
1812
+ - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
1813
+
1814
+ **Example**
1815
+
1816
+ ```ts
1817
+ import { createWalletClient, custom } from 'viem'
1818
+ import { mainnet } from 'viem/chains'
1819
+
1820
+ const client = createWalletClient({
1821
+ chain: mainnet,
1822
+ transport: custom(window.ethereum),
1823
+ })
1824
+
1825
+ const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })
1826
+ ```
1827
+
1828
+ ##### getCapabilities
1829
+
1830
+ \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: ...; paymasterService?: ...; unstable\_addSubAccount?: ...; \[key: ...\]: ... \}\>, number\>)\[K\] \}\>
1831
+
1832
+ Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc).
1833
+
1834
+ - Docs: https://viem.sh/docs/actions/wallet/getCapabilities
1835
+ - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792)
1836
+
1837
+ **Example**
1838
+
1839
+ ```ts
1840
+ import { createWalletClient, custom } from 'viem'
1841
+ import { mainnet } from 'viem/chains'
1842
+
1843
+ const client = createWalletClient({
1844
+ chain: mainnet,
1845
+ transport: custom(window.ethereum),
1846
+ })
1847
+
1848
+ const capabilities = await client.getCapabilities({
1849
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1850
+ })
1851
+ ```
1852
+
1853
+ ##### getChainId
1854
+
1855
+ () => `Promise`\<`number`\>
1856
+
1857
+ Returns the chain ID associated with the current network.
1858
+
1859
+ - Docs: https://viem.sh/docs/actions/public/getChainId
1860
+ - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
1861
+
1862
+ **Example**
1863
+
1864
+ ```ts
1865
+ import { createWalletClient, http } from 'viem'
1866
+ import { mainnet } from 'viem/chains'
1867
+
1868
+ const client = createWalletClient({
1869
+ chain: mainnet,
1870
+ transport: custom(window.ethereum),
1871
+ })
1872
+ const chainId = await client.getChainId()
1873
+ // 1
1874
+ ```
1875
+
1876
+ ##### getPermissions
1877
+
1878
+ () => `Promise`\<[`GetPermissionsReturnType`](https://viem.sh/docs/index.html)\>
1879
+
1880
+ Gets the wallets current permissions.
1881
+
1882
+ - Docs: https://viem.sh/docs/actions/wallet/getPermissions
1883
+ - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
1884
+
1885
+ **Example**
1886
+
1887
+ ```ts
1888
+ import { createWalletClient, custom } from 'viem'
1889
+ import { mainnet } from 'viem/chains'
1890
+
1891
+ const client = createWalletClient({
1892
+ chain: mainnet,
1893
+ transport: custom(window.ethereum),
1894
+ })
1895
+ const permissions = await client.getPermissions()
1896
+ ```
1897
+
1898
+ ##### key
1899
+
1900
+ `string`
1901
+
1902
+ A key for the client.
1903
+
1904
+ ##### name
1905
+
1906
+ `string`
1907
+
1908
+ A name for the client.
1909
+
1910
+ ##### pollingInterval
1911
+
1912
+ `number`
1913
+
1914
+ Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
1915
+
1916
+ ##### prepareAuthorization
1917
+
1918
+ (`parameters`) => `Promise`\<[`PrepareAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
1919
+
1920
+ Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing.
1921
+ This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`).
1922
+
1923
+ With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object.
1924
+
1925
+ **Examples**
1926
+
1927
+ ```ts
1928
+ import { createWalletClient, http } from 'viem'
1929
+ import { privateKeyToAccount } from 'viem/accounts'
1930
+ import { mainnet } from 'viem/chains'
1931
+
1932
+ const client = createWalletClient({
1933
+ chain: mainnet,
1934
+ transport: http(),
1935
+ })
1936
+
1937
+ const authorization = await client.prepareAuthorization({
1938
+ account: privateKeyToAccount('0x..'),
1939
+ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1940
+ })
1941
+ ```
1942
+
1943
+ ```ts
1944
+ // Account Hoisting
1945
+ import { createWalletClient, http } from 'viem'
1946
+ import { privateKeyToAccount } from 'viem/accounts'
1947
+ import { mainnet } from 'viem/chains'
1948
+
1949
+ const client = createWalletClient({
1950
+ account: privateKeyToAccount('0x…'),
1951
+ chain: mainnet,
1952
+ transport: http(),
1953
+ })
1954
+
1955
+ const authorization = await client.prepareAuthorization({
1956
+ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1957
+ })
1958
+ ```
1959
+
1960
+ ##### prepareTransactionRequest
1961
+
1962
+ \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
1963
+
1964
+ Prepares a transaction request for signing.
1965
+
1966
+ - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest
1967
+
1968
+ **Examples**
1969
+
1970
+ ```ts
1971
+ import { createWalletClient, custom } from 'viem'
1972
+ import { mainnet } from 'viem/chains'
1973
+
1974
+ const client = createWalletClient({
1975
+ chain: mainnet,
1976
+ transport: custom(window.ethereum),
1977
+ })
1978
+ const request = await client.prepareTransactionRequest({
1979
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1980
+ to: '0x0000000000000000000000000000000000000000',
1981
+ value: 1n,
1982
+ })
1983
+ ```
1984
+
1985
+ ```ts
1986
+ // Account Hoisting
1987
+ import { createWalletClient, http } from 'viem'
1988
+ import { privateKeyToAccount } from 'viem/accounts'
1989
+ import { mainnet } from 'viem/chains'
1990
+
1991
+ const client = createWalletClient({
1992
+ account: privateKeyToAccount('0x…'),
1993
+ chain: mainnet,
1994
+ transport: custom(window.ethereum),
1995
+ })
1996
+ const request = await client.prepareTransactionRequest({
1997
+ to: '0x0000000000000000000000000000000000000000',
1998
+ value: 1n,
1999
+ })
2000
+ ```
2001
+
2002
+ ##### request
2003
+
2004
+ [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`WalletRpcSchema`](https://viem.sh/docs/index.html)\>
2005
+
2006
+ Request function wrapped with friendly error handling
2007
+
2008
+ ##### requestAddresses
2009
+
2010
+ () => `Promise`\<[`RequestAddressesReturnType`](https://viem.sh/docs/index.html)\>
2011
+
2012
+ Requests a list of accounts managed by a wallet.
2013
+
2014
+ - Docs: https://viem.sh/docs/actions/wallet/requestAddresses
2015
+ - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
2016
+
2017
+ 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).
2018
+
2019
+ 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.
2020
+
2021
+ **Example**
2022
+
2023
+ ```ts
2024
+ import { createWalletClient, custom } from 'viem'
2025
+ import { mainnet } from 'viem/chains'
2026
+
2027
+ const client = createWalletClient({
2028
+ chain: mainnet,
2029
+ transport: custom(window.ethereum),
2030
+ })
2031
+ const accounts = await client.requestAddresses()
2032
+ ```
2033
+
2034
+ ##### requestPermissions
2035
+
2036
+ (`args`) => `Promise`\<[`RequestPermissionsReturnType`](https://viem.sh/docs/index.html)\>
2037
+
2038
+ Requests permissions for a wallet.
2039
+
2040
+ - Docs: https://viem.sh/docs/actions/wallet/requestPermissions
2041
+ - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
2042
+
2043
+ **Example**
2044
+
2045
+ ```ts
2046
+ import { createWalletClient, custom } from 'viem'
2047
+ import { mainnet } from 'viem/chains'
2048
+
2049
+ const client = createWalletClient({
2050
+ chain: mainnet,
2051
+ transport: custom(window.ethereum),
2052
+ })
2053
+ const permissions = await client.requestPermissions({
2054
+ eth_accounts: {}
2055
+ })
2056
+ ```
2057
+
2058
+ ##### sendCalls
2059
+
2060
+ \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{\[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>
2061
+
2062
+ Requests the connected wallet to send a batch of calls.
2063
+
2064
+ - Docs: https://viem.sh/docs/actions/wallet/sendCalls
2065
+ - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792)
2066
+
2067
+ **Example**
2068
+
2069
+ ```ts
2070
+ import { createWalletClient, custom } from 'viem'
2071
+ import { mainnet } from 'viem/chains'
2072
+
2073
+ const client = createWalletClient({
2074
+ chain: mainnet,
2075
+ transport: custom(window.ethereum),
2076
+ })
2077
+
2078
+ const id = await client.sendCalls({
2079
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2080
+ calls: [
2081
+ {
2082
+ data: '0xdeadbeef',
2083
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2084
+ },
2085
+ {
2086
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2087
+ value: 69420n,
2088
+ },
2089
+ ],
2090
+ })
2091
+ ```
2092
+
2093
+ ##### sendCallsSync
2094
+
2095
+ \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>
2096
+
2097
+ Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block.
2098
+
2099
+ - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync
2100
+ - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792)
2101
+
2102
+ **Example**
2103
+
2104
+ ```ts
2105
+ import { createWalletClient, custom } from 'viem'
2106
+ import { mainnet } from 'viem/chains'
2107
+
2108
+ const client = createWalletClient({
2109
+ chain: mainnet,
2110
+ transport: custom(window.ethereum),
2111
+ })
2112
+
2113
+ const status = await client.sendCallsSync({
2114
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2115
+ calls: [
2116
+ {
2117
+ data: '0xdeadbeef',
2118
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2119
+ },
2120
+ {
2121
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2122
+ value: 69420n,
2123
+ },
2124
+ ],
2125
+ })
2126
+ ```
2127
+
2128
+ ##### sendRawTransaction
2129
+
2130
+ (`args`) => `Promise`\<`` `0x${string}` ``\>
2131
+
2132
+ Sends a **signed** transaction to the network
2133
+
2134
+ - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction
2135
+ - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
2136
+
2137
+ **Example**
2138
+
2139
+ ```ts
2140
+ import { createWalletClient, custom } from 'viem'
2141
+ import { mainnet } from 'viem/chains'
2142
+ import { sendRawTransaction } from 'viem/wallet'
2143
+
2144
+ const client = createWalletClient({
2145
+ chain: mainnet,
2146
+ transport: custom(window.ethereum),
2147
+ })
2148
+
2149
+ const hash = await client.sendRawTransaction({
2150
+ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
2151
+ })
2152
+ ```
2153
+
2154
+ ##### sendRawTransactionSync
2155
+
2156
+ (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
2157
+
2158
+ Sends a **signed** transaction to the network synchronously,
2159
+ and waits for the transaction to be included in a block.
2160
+
2161
+ - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync
2162
+ - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966)
2163
+
2164
+ **Example**
2165
+
2166
+ ```ts
2167
+ import { createWalletClient, custom } from 'viem'
2168
+ import { mainnet } from 'viem/chains'
2169
+ import { sendRawTransactionSync } from 'viem/wallet'
2170
+
2171
+ const client = createWalletClient({
2172
+ chain: mainnet,
2173
+ transport: custom(window.ethereum),
2174
+ })
2175
+
2176
+ const receipt = await client.sendRawTransactionSync({
2177
+ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
2178
+ })
2179
+ ```
2180
+
2181
+ ##### sendTransaction
2182
+
2183
+ \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
2184
+
2185
+ Creates, signs, and sends a new transaction to the network.
2186
+
2187
+ - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
2188
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
2189
+ - JSON-RPC Methods:
2190
+ - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
2191
+ - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
2192
+
2193
+ **Examples**
2194
+
2195
+ ```ts
2196
+ import { createWalletClient, custom } from 'viem'
2197
+ import { mainnet } from 'viem/chains'
2198
+
2199
+ const client = createWalletClient({
2200
+ chain: mainnet,
2201
+ transport: custom(window.ethereum),
2202
+ })
2203
+ const hash = await client.sendTransaction({
2204
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2205
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2206
+ value: 1000000000000000000n,
2207
+ })
2208
+ ```
2209
+
2210
+ ```ts
2211
+ // Account Hoisting
2212
+ import { createWalletClient, http } from 'viem'
2213
+ import { privateKeyToAccount } from 'viem/accounts'
2214
+ import { mainnet } from 'viem/chains'
2215
+
2216
+ const client = createWalletClient({
2217
+ account: privateKeyToAccount('0x…'),
2218
+ chain: mainnet,
2219
+ transport: http(),
2220
+ })
2221
+ const hash = await client.sendTransaction({
2222
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2223
+ value: 1000000000000000000n,
2224
+ })
2225
+ ```
2226
+
2227
+ ##### sendTransactionSync
2228
+
2229
+ \<`request`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
2230
+
2231
+ Creates, signs, and sends a new transaction to the network synchronously.
2232
+ Returns the transaction receipt.
2233
+
2234
+ - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync
2235
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
2236
+ - JSON-RPC Methods:
2237
+ - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
2238
+ - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
2239
+
2240
+ **Examples**
2241
+
2242
+ ```ts
2243
+ import { createWalletClient, custom } from 'viem'
2244
+ import { mainnet } from 'viem/chains'
2245
+
2246
+ const client = createWalletClient({
2247
+ chain: mainnet,
2248
+ transport: custom(window.ethereum),
2249
+ })
2250
+ const receipt = await client.sendTransactionSync({
2251
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2252
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2253
+ value: 1000000000000000000n,
2254
+ })
2255
+ ```
2256
+
2257
+ ```ts
2258
+ // Account Hoisting
2259
+ import { createWalletClient, http } from 'viem'
2260
+ import { privateKeyToAccount } from 'viem/accounts'
2261
+ import { mainnet } from 'viem/chains'
2262
+
2263
+ const client = createWalletClient({
2264
+ account: privateKeyToAccount('0x…'),
2265
+ chain: mainnet,
2266
+ transport: http(),
2267
+ })
2268
+ const receipt = await client.sendTransactionSync({
2269
+ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2270
+ value: 1000000000000000000n,
2271
+ })
2272
+ ```
2273
+
2274
+ ##### showCallsStatus
2275
+
2276
+ (`parameters`) => `Promise`\<`void`\>
2277
+
2278
+ Requests for the wallet to show information about a call batch
2279
+ that was sent via `sendCalls`.
2280
+
2281
+ - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus
2282
+ - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
2283
+
2284
+ **Example**
2285
+
2286
+ ```ts
2287
+ import { createWalletClient, custom } from 'viem'
2288
+ import { mainnet } from 'viem/chains'
2289
+
2290
+ const client = createWalletClient({
2291
+ chain: mainnet,
2292
+ transport: custom(window.ethereum),
2293
+ })
2294
+
2295
+ await client.showCallsStatus({ id: '0xdeadbeef' })
2296
+ ```
2297
+
2298
+ ##### signAuthorization
2299
+
2300
+ (`parameters`) => `Promise`\<[`SignAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
2301
+
2302
+ Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object.
2303
+
2304
+ With the calculated signature, you can:
2305
+ - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object,
2306
+ - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object.
2307
+
2308
+ **Examples**
2309
+
2310
+ ```ts
2311
+ import { createWalletClient, http } from 'viem'
2312
+ import { privateKeyToAccount } from 'viem/accounts'
2313
+ import { mainnet } from 'viem/chains'
2314
+
2315
+ const client = createWalletClient({
2316
+ chain: mainnet,
2317
+ transport: http(),
2318
+ })
2319
+
2320
+ const signature = await client.signAuthorization({
2321
+ account: privateKeyToAccount('0x..'),
2322
+ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2323
+ })
2324
+ ```
2325
+
2326
+ ```ts
2327
+ // Account Hoisting
2328
+ import { createWalletClient, http } from 'viem'
2329
+ import { privateKeyToAccount } from 'viem/accounts'
2330
+ import { mainnet } from 'viem/chains'
2331
+
2332
+ const client = createWalletClient({
2333
+ account: privateKeyToAccount('0x…'),
2334
+ chain: mainnet,
2335
+ transport: http(),
2336
+ })
2337
+
2338
+ const signature = await client.signAuthorization({
2339
+ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2340
+ })
2341
+ ```
2342
+
2343
+ ##### signMessage
2344
+
2345
+ (`args`) => `Promise`\<`` `0x${string}` ``\>
2346
+
2347
+ Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
2348
+
2349
+ - Docs: https://viem.sh/docs/actions/wallet/signMessage
2350
+ - JSON-RPC Methods:
2351
+ - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign)
2352
+ - Local Accounts: Signs locally. No JSON-RPC request.
2353
+
2354
+ With the calculated signature, you can:
2355
+ - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature,
2356
+ - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature.
2357
+
2358
+ **Examples**
2359
+
2360
+ ```ts
2361
+ import { createWalletClient, custom } from 'viem'
2362
+ import { mainnet } from 'viem/chains'
2363
+
2364
+ const client = createWalletClient({
2365
+ chain: mainnet,
2366
+ transport: custom(window.ethereum),
2367
+ })
2368
+ const signature = await client.signMessage({
2369
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2370
+ message: 'hello world',
2371
+ })
2372
+ ```
2373
+
2374
+ ```ts
2375
+ // Account Hoisting
2376
+ import { createWalletClient, http } from 'viem'
2377
+ import { privateKeyToAccount } from 'viem/accounts'
2378
+ import { mainnet } from 'viem/chains'
2379
+
2380
+ const client = createWalletClient({
2381
+ account: privateKeyToAccount('0x…'),
2382
+ chain: mainnet,
2383
+ transport: http(),
2384
+ })
2385
+ const signature = await client.signMessage({
2386
+ message: 'hello world',
2387
+ })
2388
+ ```
2389
+
2390
+ ##### signTransaction
2391
+
2392
+ \<`chainOverride`, `request`\>(`args`) => `Promise`\<[`TransactionSerialized`](https://viem.sh/docs/index.html)\<[`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, `request` *extends* [`LegacyProperties`](https://viem.sh/docs/index.html) ? `"legacy"` : `never` \| `request` *extends* [`EIP1559Properties`](https://viem.sh/docs/index.html) ? `"eip1559"` : `never` \| `request` *extends* [`EIP2930Properties`](https://viem.sh/docs/index.html) ? `"eip2930"` : `never` \| `request` *extends* [`EIP4844Properties`](https://viem.sh/docs/index.html) ? `"eip4844"` : `never` \| `request` *extends* [`EIP7702Properties`](https://viem.sh/docs/index.html) ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| [`GetTransactionType`](https://viem.sh/docs/index.html)\<`request`, ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"legacy"` ? [`TransactionSerializedLegacy`](https://viem.sh/docs/index.html) : `never`\>\>
2393
+
2394
+ Signs a transaction.
2395
+
2396
+ - Docs: https://viem.sh/docs/actions/wallet/signTransaction
2397
+ - JSON-RPC Methods:
2398
+ - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
2399
+ - Local Accounts: Signs locally. No JSON-RPC request.
2400
+
2401
+ **Examples**
2402
+
2403
+ ```ts
2404
+ import { createWalletClient, custom } from 'viem'
2405
+ import { mainnet } from 'viem/chains'
2406
+
2407
+ const client = createWalletClient({
2408
+ chain: mainnet,
2409
+ transport: custom(window.ethereum),
2410
+ })
2411
+ const request = await client.prepareTransactionRequest({
2412
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2413
+ to: '0x0000000000000000000000000000000000000000',
2414
+ value: 1n,
2415
+ })
2416
+ const signature = await client.signTransaction(request)
2417
+ ```
2418
+
2419
+ ```ts
2420
+ // Account Hoisting
2421
+ import { createWalletClient, http } from 'viem'
2422
+ import { privateKeyToAccount } from 'viem/accounts'
2423
+ import { mainnet } from 'viem/chains'
2424
+
2425
+ const client = createWalletClient({
2426
+ account: privateKeyToAccount('0x…'),
2427
+ chain: mainnet,
2428
+ transport: custom(window.ethereum),
2429
+ })
2430
+ const request = await client.prepareTransactionRequest({
2431
+ to: '0x0000000000000000000000000000000000000000',
2432
+ value: 1n,
2433
+ })
2434
+ const signature = await client.signTransaction(request)
2435
+ ```
2436
+
2437
+ ##### signTypedData
2438
+
2439
+ \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
2440
+
2441
+ 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))`.
2442
+
2443
+ - Docs: https://viem.sh/docs/actions/wallet/signTypedData
2444
+ - JSON-RPC Methods:
2445
+ - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4)
2446
+ - Local Accounts: Signs locally. No JSON-RPC request.
2447
+
2448
+ **Examples**
2449
+
2450
+ ```ts
2451
+ import { createWalletClient, custom } from 'viem'
2452
+ import { mainnet } from 'viem/chains'
2453
+
2454
+ const client = createWalletClient({
2455
+ chain: mainnet,
2456
+ transport: custom(window.ethereum),
2457
+ })
2458
+ const signature = await client.signTypedData({
2459
+ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2460
+ domain: {
2461
+ name: 'Ether Mail',
2462
+ version: '1',
2463
+ chainId: 1,
2464
+ verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
2465
+ },
2466
+ types: {
2467
+ Person: [
2468
+ { name: 'name', type: 'string' },
2469
+ { name: 'wallet', type: 'address' },
2470
+ ],
2471
+ Mail: [
2472
+ { name: 'from', type: 'Person' },
2473
+ { name: 'to', type: 'Person' },
2474
+ { name: 'contents', type: 'string' },
2475
+ ],
2476
+ },
2477
+ primaryType: 'Mail',
2478
+ message: {
2479
+ from: {
2480
+ name: 'Cow',
2481
+ wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
2482
+ },
2483
+ to: {
2484
+ name: 'Bob',
2485
+ wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
2486
+ },
2487
+ contents: 'Hello, Bob!',
2488
+ },
2489
+ })
2490
+ ```
2491
+
2492
+ ```ts
2493
+ // Account Hoisting
2494
+ import { createWalletClient, http } from 'viem'
2495
+ import { privateKeyToAccount } from 'viem/accounts'
2496
+ import { mainnet } from 'viem/chains'
2497
+
2498
+ const client = createWalletClient({
2499
+ account: privateKeyToAccount('0x…'),
2500
+ chain: mainnet,
2501
+ transport: http(),
2502
+ })
2503
+ const signature = await client.signTypedData({
2504
+ domain: {
2505
+ name: 'Ether Mail',
2506
+ version: '1',
2507
+ chainId: 1,
2508
+ verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
2509
+ },
2510
+ types: {
2511
+ Person: [
2512
+ { name: 'name', type: 'string' },
2513
+ { name: 'wallet', type: 'address' },
2514
+ ],
2515
+ Mail: [
2516
+ { name: 'from', type: 'Person' },
2517
+ { name: 'to', type: 'Person' },
2518
+ { name: 'contents', type: 'string' },
2519
+ ],
2520
+ },
2521
+ primaryType: 'Mail',
2522
+ message: {
2523
+ from: {
2524
+ name: 'Cow',
2525
+ wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
2526
+ },
2527
+ to: {
2528
+ name: 'Bob',
2529
+ wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
2530
+ },
2531
+ contents: 'Hello, Bob!',
2532
+ },
2533
+ })
2534
+ ```
2535
+
2536
+ ##### switchChain
2537
+
2538
+ (`args`) => `Promise`\<`void`\>
2539
+
2540
+ Switch the target chain in a wallet.
2541
+
2542
+ - Docs: https://viem.sh/docs/actions/wallet/switchChain
2543
+ - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)
2544
+
2545
+ **Example**
2546
+
2547
+ ```ts
2548
+ import { createWalletClient, custom } from 'viem'
2549
+ import { mainnet, optimism } from 'viem/chains'
2550
+
2551
+ const client = createWalletClient({
2552
+ chain: mainnet,
2553
+ transport: custom(window.ethereum),
2554
+ })
2555
+ await client.switchChain({ id: optimism.id })
2556
+ ```
2557
+
2558
+ ##### transport
2559
+
2560
+ [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>
2561
+
2562
+ The RPC transport
2563
+
2564
+ ##### type
2565
+
2566
+ `string`
2567
+
2568
+ The type of client.
2569
+
2570
+ ##### uid
2571
+
2572
+ `string`
2573
+
2574
+ A unique ID for the client.
2575
+
2576
+ ##### waitForCallsStatus
2577
+
2578
+ (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \{\[`key`: `string`\]: `any`; \} \| \{\[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: [`WalletCallReceipt`](https://viem.sh/docs/index.html)\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"pending"` \| `"success"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>
2579
+
2580
+ Waits for the status & receipts of a call bundle that was sent via `sendCalls`.
2581
+
2582
+ - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus
2583
+ - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
2584
+
2585
+ **Example**
2586
+
2587
+ ```ts
2588
+ import { createWalletClient, custom } from 'viem'
2589
+ import { mainnet } from 'viem/chains'
2590
+
2591
+ const client = createWalletClient({
2592
+ chain: mainnet,
2593
+ transport: custom(window.ethereum),
2594
+ })
2595
+
2596
+ const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })
2597
+ ```
2598
+
2599
+ ##### watchAsset
2600
+
2601
+ (`args`) => `Promise`\<`boolean`\>
2602
+
2603
+ Adds an EVM chain to the wallet.
2604
+
2605
+ - Docs: https://viem.sh/docs/actions/wallet/watchAsset
2606
+ - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)
2607
+
2608
+ **Example**
2609
+
2610
+ ```ts
2611
+ import { createWalletClient, custom } from 'viem'
2612
+ import { mainnet } from 'viem/chains'
2613
+
2614
+ const client = createWalletClient({
2615
+ chain: mainnet,
2616
+ transport: custom(window.ethereum),
2617
+ })
2618
+ const success = await client.watchAsset({
2619
+ type: 'ERC20',
2620
+ options: {
2621
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2622
+ decimals: 18,
2623
+ symbol: 'WETH',
2624
+ },
2625
+ })
2626
+ ```
2627
+
2628
+ ##### writeContract
2629
+
2630
+ \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
2631
+
2632
+ Executes a write function on a contract.
2633
+
2634
+ - Docs: https://viem.sh/docs/contract/writeContract
2635
+ - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
2636
+
2637
+ 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.
2638
+
2639
+ 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).
2640
+
2641
+ __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#usage) before you execute it.__
2642
+
2643
+ **Examples**
2644
+
2645
+ ```ts
2646
+ import { createWalletClient, custom, parseAbi } from 'viem'
2647
+ import { mainnet } from 'viem/chains'
2648
+
2649
+ const client = createWalletClient({
2650
+ chain: mainnet,
2651
+ transport: custom(window.ethereum),
2652
+ })
2653
+ const hash = await client.writeContract({
2654
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2655
+ abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
2656
+ functionName: 'mint',
2657
+ args: [69420],
2658
+ })
2659
+ ```
2660
+
2661
+ ```ts
2662
+ // With Validation
2663
+ import { createWalletClient, custom, parseAbi } from 'viem'
2664
+ import { mainnet } from 'viem/chains'
2665
+
2666
+ const client = createWalletClient({
2667
+ chain: mainnet,
2668
+ transport: custom(window.ethereum),
2669
+ })
2670
+ const { request } = await client.simulateContract({
2671
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2672
+ abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
2673
+ functionName: 'mint',
2674
+ args: [69420],
2675
+ }
2676
+ const hash = await client.writeContract(request)
2677
+ ```
2678
+
2679
+ ##### writeContractSync
2680
+
2681
+ \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
2682
+
2683
+ Executes a write function on a contract synchronously.
2684
+ Returns the transaction receipt.
2685
+
2686
+ - Docs: https://viem.sh/docs/contract/writeContract
2687
+
2688
+ 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.
2689
+
2690
+ 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).
2691
+
2692
+ __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#usage) before you execute it.__
2693
+
2694
+ **Example**
2695
+
2696
+ ```ts
2697
+ import { createWalletClient, custom, parseAbi } from 'viem'
2698
+ import { mainnet } from 'viem/chains'
2699
+
2700
+ const client = createWalletClient({
2701
+ chain: mainnet,
2702
+ transport: custom(window.ethereum),
2703
+ })
2704
+ const receipt = await client.writeContractSync({
2705
+ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2706
+ abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
2707
+ functionName: 'mint',
2708
+ args: [69420],
2709
+ })
2710
+ ```
2711
+
2712
+ ### Returns
2713
+
2714
+ [`DVTActions`](../type-aliases/DVTActions.md)