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