@aastar/sdk 0.16.11 → 0.16.14

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 (981) hide show
  1. package/README.md +100 -128
  2. package/dist/clients/ExperimentClient.d.ts +34 -0
  3. package/{packages/sdk/src/clients/ExperimentClient.ts → dist/clients/ExperimentClient.js} +11 -33
  4. package/dist/clients/ExperimentClient.test.d.ts +1 -0
  5. package/dist/clients/ExperimentClient.test.js +53 -0
  6. package/dist/clients/admin.d.ts +11 -0
  7. package/dist/clients/admin.js +20 -0
  8. package/dist/clients/admin.test.d.ts +1 -0
  9. package/dist/clients/admin.test.js +79 -0
  10. package/dist/clients/clients.test.d.ts +1 -0
  11. package/dist/clients/clients.test.js +91 -0
  12. package/dist/clients/community.d.ts +40 -0
  13. package/{packages/sdk/src/clients/community.ts → dist/clients/community.js} +86 -189
  14. package/dist/clients/community.test.d.ts +1 -0
  15. package/dist/clients/community.test.js +99 -0
  16. package/dist/clients/endUser.d.ts +77 -0
  17. package/dist/clients/endUser.js +298 -0
  18. package/dist/clients/endUser.test.d.ts +1 -0
  19. package/dist/clients/endUser.test.js +188 -0
  20. package/dist/clients/operator.d.ts +66 -0
  21. package/{packages/sdk/src/clients/operator.ts → dist/clients/operator.js} +66 -137
  22. package/dist/clients/operator.test.d.ts +1 -0
  23. package/dist/clients/operator.test.js +139 -0
  24. package/dist/core/src/abis/BLSAggregator.json +686 -0
  25. package/dist/core/src/abis/BLSValidator.json +42 -0
  26. package/dist/core/src/abis/DVTValidator.json +368 -0
  27. package/dist/core/src/abis/EntryPoint.json +1382 -0
  28. package/dist/core/src/abis/GToken.json +513 -0
  29. package/dist/core/src/abis/GTokenStaking.json +949 -0
  30. package/dist/core/src/abis/MySBT.json +1518 -0
  31. package/dist/core/src/abis/Paymaster.json +1143 -0
  32. package/dist/core/src/abis/PaymasterFactory.json +640 -0
  33. package/dist/core/src/abis/Registry.json +1942 -0
  34. package/dist/core/src/abis/ReputationSystem.json +699 -0
  35. package/dist/core/src/abis/SimpleAccount.json +560 -0
  36. package/dist/core/src/abis/SimpleAccountFactory.json +111 -0
  37. package/dist/core/src/abis/SuperPaymaster.json +1781 -0
  38. package/dist/core/src/abis/xPNTsFactory.json +718 -0
  39. package/dist/core/src/abis/xPNTsToken.json +1280 -0
  40. package/dist/errors/AAStarError.d.ts +26 -0
  41. package/dist/errors/AAStarError.js +32 -0
  42. package/dist/errors/AAStarError.test.d.ts +1 -0
  43. package/dist/errors/AAStarError.test.js +74 -0
  44. package/dist/errors/decoder.d.ts +6 -0
  45. package/{packages/sdk/src/errors/decoder.ts → dist/errors/decoder.js} +15 -19
  46. package/dist/errors/decoder.test.d.ts +1 -0
  47. package/dist/errors/decoder.test.js +90 -0
  48. package/dist/index.d.ts +18 -0
  49. package/{packages/sdk/src/index.ts → dist/index.js} +0 -3
  50. package/dist/node/index.d.ts +7 -0
  51. package/dist/node/index.js +7 -0
  52. package/dist/types/result.d.ts +15 -0
  53. package/dist/types/result.js +23 -0
  54. package/dist/utils/errorHandler.d.ts +40 -0
  55. package/{packages/sdk/src/utils/errorHandler.ts → dist/utils/errorHandler.js} +22 -75
  56. package/dist/utils/errorHandler.test.d.ts +1 -0
  57. package/dist/utils/errorHandler.test.js +89 -0
  58. package/dist/utils/eventDecoder.d.ts +7 -0
  59. package/dist/utils/eventDecoder.js +54 -0
  60. package/dist/utils/eventDecoder.test.d.ts +1 -0
  61. package/dist/utils/eventDecoder.test.js +48 -0
  62. package/dist/utils/funding.d.ts +115 -0
  63. package/{packages/sdk/src/utils/funding.ts → dist/utils/funding.js} +27 -119
  64. package/dist/utils/funding.test.d.ts +1 -0
  65. package/dist/utils/funding.test.js +105 -0
  66. package/dist/utils/keys.d.ts +61 -0
  67. package/{packages/sdk/src/utils/keys.ts → dist/utils/keys.js} +15 -44
  68. package/dist/utils/keys.test.d.ts +1 -0
  69. package/dist/utils/keys.test.js +81 -0
  70. package/dist/utils/roleData.d.ts +66 -0
  71. package/{packages/sdk/src/utils/roleData.ts → dist/utils/roleData.js} +34 -57
  72. package/dist/utils/roleData.test.d.ts +1 -0
  73. package/dist/utils/roleData.test.js +74 -0
  74. package/dist/utils/testScenarios.d.ts +33 -0
  75. package/dist/utils/testScenarios.js +85 -0
  76. package/dist/utils/testScenarios.test.d.ts +1 -0
  77. package/dist/utils/testScenarios.test.js +68 -0
  78. package/dist/utils/userOp.d.ts +78 -0
  79. package/{packages/sdk/src/utils/userOp.ts → dist/utils/userOp.js} +59 -126
  80. package/dist/utils/userOp.test.d.ts +1 -0
  81. package/dist/utils/userOp.test.js +152 -0
  82. package/package.json +25 -61
  83. package/.github/workflows/gas-analytics-daily.yml +0 -52
  84. package/.gitmodules +0 -9
  85. package/CHANGELOG.md +0 -43
  86. package/aastar-sdk.code-workspace +0 -14
  87. package/abis/BLSAggregator.json +0 -572
  88. package/abis/BLSValidator.json +0 -39
  89. package/abis/DVTValidator.json +0 -383
  90. package/abis/Eip7702Support.json +0 -24
  91. package/abis/EntryPoint.json +0 -1379
  92. package/abis/GToken.json +0 -510
  93. package/abis/GTokenStaking.json +0 -918
  94. package/abis/LegacyAccount.json +0 -625
  95. package/abis/MySBT.json +0 -1547
  96. package/abis/Paymaster.json +0 -1192
  97. package/abis/PaymasterFactory.json +0 -637
  98. package/abis/PaymasterV4_2.json +0 -1193
  99. package/abis/Registry.json +0 -1677
  100. package/abis/ReputationSystem.json +0 -659
  101. package/abis/SenderCreator.json +0 -99
  102. package/abis/Simple7702Account.json +0 -395
  103. package/abis/SimpleAccount.json +0 -625
  104. package/abis/SimpleAccountFactory.json +0 -108
  105. package/abis/SimpleAccountFactoryV08.json +0 -87
  106. package/abis/SimpleAccountV08.json +0 -557
  107. package/abis/SuperPaymaster.json +0 -1568
  108. package/abis/UserOperationLib.json +0 -57
  109. package/abis/aPNTs.json +0 -1160
  110. package/abis/xPNTsFactory.json +0 -715
  111. package/abis/xPNTsToken.json +0 -1160
  112. package/backup/run_sdk_regression.sh +0 -135
  113. package/config/networks/README.md +0 -54
  114. package/config/networks/mainnet.env.example +0 -39
  115. package/config/networks/optimism-sepolia.env.example +0 -35
  116. package/config/networks/optimism.env.example +0 -36
  117. package/config/networks/sepolia.env.example +0 -36
  118. package/config.anvil.json +0 -1
  119. package/config.sepolia.json +0 -19
  120. package/config.test.json +0 -27
  121. package/data/experiment_data.csv +0 -36
  122. package/data/industry_baseline_2025-12-23.json +0 -154
  123. package/data/industry_baseline_latest.json +0 -154
  124. package/docs/ABI_MAINTENANCE_PLAN.md +0 -132
  125. package/docs/API_REFERENCE.md +0 -796
  126. package/docs/Configuration_Sync.md +0 -47
  127. package/docs/DAO_Mining_Distribution_Plan.md +0 -522
  128. package/docs/DEMO_REFACTOR_PLAN.md +0 -289
  129. package/docs/DOCUMENTATION_PLAN.md +0 -455
  130. package/docs/ENV_SEPOLIA_UPDATE.md +0 -68
  131. package/docs/L2_BUSINESS_CLIENTS_PLAN.md +0 -394
  132. package/docs/L4_Manual_Test_CheatSheet.md +0 -172
  133. package/docs/Plan.md +0 -266
  134. package/docs/Regression_Testing_Guide.md +0 -70
  135. package/docs/Reputation-to-Credit_Mapping_Whitepaper.md +0 -242
  136. package/docs/SDK_ABI_COVERAGE.md +0 -839
  137. package/docs/SDK_COVERAGE_STRATEGY.md +0 -397
  138. package/docs/SDK_Optimization_Evaluation_Plan.md +0 -51
  139. package/docs/SDK_REGRESSION_AND_API_PLAN.md +0 -98
  140. package/docs/SDK_STAGE3_PLAN.md +0 -151
  141. package/docs/SEPOLIA_ENV_REFERENCE.md +0 -51
  142. package/docs/STAGE3.md +0 -191
  143. package/docs/Script_Comparison_Report.md +0 -91
  144. package/docs/Sepolia_Latest_Deployment.md +0 -117
  145. package/docs/TESTER_GUIDE_GASLESS.md +0 -409
  146. package/docs/TEST_COVERAGE_MATRIX.md +0 -72
  147. package/docs/TODO_SDK_COVERAGE.md +0 -55
  148. package/docs/USER_CASE_DESIGN.md +0 -110
  149. package/docs/Verifier_L4_Gasless_Plan.md +0 -454
  150. package/docs/api/@aastar/account/README.md +0 -15
  151. package/docs/api/@aastar/account/classes/UserOpClient.md +0 -87
  152. package/docs/api/@aastar/account/functions/createEOAWalletClient.md +0 -21
  153. package/docs/api/@aastar/account/functions/getUserOpHash.md +0 -23
  154. package/docs/api/@aastar/account/functions/packUserOpLimits.md +0 -19
  155. package/docs/api/@aastar/account/functions/toSimpleSmartAccount.md +0 -83
  156. package/docs/api/@aastar/account/type-aliases/EOAWalletClient.md +0 -37
  157. package/docs/api/@aastar/account/type-aliases/SimpleSmartAccount.md +0 -39
  158. package/docs/api/@aastar/core/README.md +0 -211
  159. package/docs/api/@aastar/core/classes/BLSSigner.md +0 -147
  160. package/docs/api/@aastar/core/classes/BaseClient.md +0 -9657
  161. package/docs/api/@aastar/core/classes/ContractConfigManager.md +0 -25
  162. package/docs/api/@aastar/core/classes/RequirementChecker.md +0 -1837
  163. package/docs/api/@aastar/core/classes/SepoliaFaucetAPI.md +0 -13661
  164. package/docs/api/@aastar/core/classes/StateValidator.md +0 -133
  165. package/docs/api/@aastar/core/enumerations/EntryPointVersion.md +0 -17
  166. package/docs/api/@aastar/core/enumerations/NodeType.md +0 -33
  167. package/docs/api/@aastar/core/enumerations/RolePermissionLevel.md +0 -43
  168. package/docs/api/@aastar/core/functions/accountActions.md +0 -2720
  169. package/docs/api/@aastar/core/functions/accountFactoryActions.md +0 -2720
  170. package/docs/api/@aastar/core/functions/aggregatorActions.md +0 -2720
  171. package/docs/api/@aastar/core/functions/createAAStarPublicClient.md +0 -3105
  172. package/docs/api/@aastar/core/functions/dvtActions.md +0 -2720
  173. package/docs/api/@aastar/core/functions/entryPointActions.md +0 -2724
  174. package/docs/api/@aastar/core/functions/gTokenActions.md +0 -2714
  175. package/docs/api/@aastar/core/functions/gTokenExtendedActions.md +0 -2720
  176. package/docs/api/@aastar/core/functions/getAddressUrl.md +0 -32
  177. package/docs/api/@aastar/core/functions/getAllCommunityConfigs.md +0 -9
  178. package/docs/api/@aastar/core/functions/getAllV2Contracts.md +0 -20
  179. package/docs/api/@aastar/core/functions/getBlockExplorer.md +0 -26
  180. package/docs/api/@aastar/core/functions/getChainId.md +0 -26
  181. package/docs/api/@aastar/core/functions/getCommunities.md +0 -76
  182. package/docs/api/@aastar/core/functions/getCommunity.md +0 -32
  183. package/docs/api/@aastar/core/functions/getCommunityConfig.md +0 -15
  184. package/docs/api/@aastar/core/functions/getContract.md +0 -37
  185. package/docs/api/@aastar/core/functions/getContractNetworks.md +0 -18
  186. package/docs/api/@aastar/core/functions/getContracts.md +0 -194
  187. package/docs/api/@aastar/core/functions/getCoreContracts.md +0 -71
  188. package/docs/api/@aastar/core/functions/getDeploymentDate.md +0 -32
  189. package/docs/api/@aastar/core/functions/getEntryPoint.md +0 -25
  190. package/docs/api/@aastar/core/functions/getNetwork.md +0 -26
  191. package/docs/api/@aastar/core/functions/getPaymasterV4_1.md +0 -25
  192. package/docs/api/@aastar/core/functions/getRoleName.md +0 -15
  193. package/docs/api/@aastar/core/functions/getRpcUrl.md +0 -25
  194. package/docs/api/@aastar/core/functions/getSimpleAccountFactory.md +0 -25
  195. package/docs/api/@aastar/core/functions/getSuperPaymasterV2.md +0 -25
  196. package/docs/api/@aastar/core/functions/getTestAccounts.md +0 -30
  197. package/docs/api/@aastar/core/functions/getTestTokenContracts.md +0 -38
  198. package/docs/api/@aastar/core/functions/getTokenContracts.md +0 -31
  199. package/docs/api/@aastar/core/functions/getTxUrl.md +0 -32
  200. package/docs/api/@aastar/core/functions/getV2ContractByAddress.md +0 -28
  201. package/docs/api/@aastar/core/functions/getV2ContractByName.md +0 -28
  202. package/docs/api/@aastar/core/functions/getV2ContractsByDate.md +0 -26
  203. package/docs/api/@aastar/core/functions/isContractNetworkSupported.md +0 -27
  204. package/docs/api/@aastar/core/functions/isRegisteredCommunity.md +0 -15
  205. package/docs/api/@aastar/core/functions/isV2Contract.md +0 -27
  206. package/docs/api/@aastar/core/functions/paymasterActions.md +0 -2720
  207. package/docs/api/@aastar/core/functions/paymasterFactoryActions.md +0 -2720
  208. package/docs/api/@aastar/core/functions/registryActions.md +0 -2720
  209. package/docs/api/@aastar/core/functions/reputationActions.md +0 -2720
  210. package/docs/api/@aastar/core/functions/sbtActions.md +0 -2720
  211. package/docs/api/@aastar/core/functions/stakingActions.md +0 -2720
  212. package/docs/api/@aastar/core/functions/superPaymasterActions.md +0 -2720
  213. package/docs/api/@aastar/core/functions/tokenActions.md +0 -2714
  214. package/docs/api/@aastar/core/functions/xPNTsFactoryActions.md +0 -2720
  215. package/docs/api/@aastar/core/interfaces/AccountBalance.md +0 -41
  216. package/docs/api/@aastar/core/interfaces/BalanceValidationParams.md +0 -51
  217. package/docs/api/@aastar/core/interfaces/ClientConfig.md +0 -4841
  218. package/docs/api/@aastar/core/interfaces/CommunityConfig.md +0 -81
  219. package/docs/api/@aastar/core/interfaces/ContractVersion.md +0 -63
  220. package/docs/api/@aastar/core/interfaces/DeploymentValidationParams.md +0 -39
  221. package/docs/api/@aastar/core/interfaces/RoleConfig.md +0 -83
  222. package/docs/api/@aastar/core/interfaces/RoleRequirement.md +0 -43
  223. package/docs/api/@aastar/core/interfaces/RoleValidationParams.md +0 -55
  224. package/docs/api/@aastar/core/interfaces/SuperPaymasterConfig.md +0 -57
  225. package/docs/api/@aastar/core/interfaces/TokenBalanceValidationParams.md +0 -63
  226. package/docs/api/@aastar/core/interfaces/TransactionOptions.md +0 -24
  227. package/docs/api/@aastar/core/interfaces/ValidationParams.md +0 -25
  228. package/docs/api/@aastar/core/interfaces/ValidationResult.md +0 -25
  229. package/docs/api/@aastar/core/type-aliases/AccountActions.md +0 -151
  230. package/docs/api/@aastar/core/type-aliases/AccountFactoryActions.md +0 -55
  231. package/docs/api/@aastar/core/type-aliases/AggregatorActions.md +0 -471
  232. package/docs/api/@aastar/core/type-aliases/BusinessResult.md +0 -12
  233. package/docs/api/@aastar/core/type-aliases/ContractCategory.md +0 -5
  234. package/docs/api/@aastar/core/type-aliases/ContractNetwork.md +0 -5
  235. package/docs/api/@aastar/core/type-aliases/DVTActions.md +0 -319
  236. package/docs/api/@aastar/core/type-aliases/EntryPointActions.md +0 -103
  237. package/docs/api/@aastar/core/type-aliases/GTokenExtendedActions.md +0 -239
  238. package/docs/api/@aastar/core/type-aliases/NetworkContracts.md +0 -5
  239. package/docs/api/@aastar/core/type-aliases/PaymasterActions.md +0 -1087
  240. package/docs/api/@aastar/core/type-aliases/PaymasterFactoryActions.md +0 -263
  241. package/docs/api/@aastar/core/type-aliases/RegistryActions.md +0 -1543
  242. package/docs/api/@aastar/core/type-aliases/ReputationActions.md +0 -811
  243. package/docs/api/@aastar/core/type-aliases/SBTActions.md +0 -1199
  244. package/docs/api/@aastar/core/type-aliases/StakingActions.md +0 -703
  245. package/docs/api/@aastar/core/type-aliases/SuperPaymasterActions.md +0 -1311
  246. package/docs/api/@aastar/core/type-aliases/SupportedNetwork.md +0 -3
  247. package/docs/api/@aastar/core/type-aliases/TokenActions.md +0 -1227
  248. package/docs/api/@aastar/core/type-aliases/XPNTsFactoryActions.md +0 -395
  249. package/docs/api/@aastar/core/variables/AASTAR_COMMUNITY.md +0 -8
  250. package/docs/api/@aastar/core/variables/ALL_ADDRESSES.md +0 -75
  251. package/docs/api/@aastar/core/variables/ALL_ROLES.md +0 -5
  252. package/docs/api/@aastar/core/variables/APNTS_ADDRESS.md +0 -3
  253. package/docs/api/@aastar/core/variables/BLSAggregatorABI.md +0 -3
  254. package/docs/api/@aastar/core/variables/BLSAggregatorArtifact.md +0 -13
  255. package/docs/api/@aastar/core/variables/BLSHelpers.md +0 -101
  256. package/docs/api/@aastar/core/variables/BLSValidatorABI.md +0 -3
  257. package/docs/api/@aastar/core/variables/BLSValidatorArtifact.md +0 -13
  258. package/docs/api/@aastar/core/variables/BLS_AGGREGATOR_ADDRESS.md +0 -3
  259. package/docs/api/@aastar/core/variables/BLS_VALIDATOR_ADDRESS.md +0 -3
  260. package/docs/api/@aastar/core/variables/BPS_DENOMINATOR.md +0 -5
  261. package/docs/api/@aastar/core/variables/BRANDING.md +0 -67
  262. package/docs/api/@aastar/core/variables/BREAD_COMMUNITY.md +0 -8
  263. package/docs/api/@aastar/core/variables/CHAIN_MAINNET.md +0 -3
  264. package/docs/api/@aastar/core/variables/CHAIN_SEPOLIA.md +0 -5
  265. package/docs/api/@aastar/core/variables/COMMUNITIES.md +0 -5
  266. package/docs/api/@aastar/core/variables/COMMUNITY_OWNERS.md +0 -15
  267. package/docs/api/@aastar/core/variables/CONTRACTS.md +0 -179
  268. package/docs/api/@aastar/core/variables/CONTRACT_METADATA.md +0 -67
  269. package/docs/api/@aastar/core/variables/CONTRACT_SRC_HASH.md +0 -5
  270. package/docs/api/@aastar/core/variables/CORE_ADDRESSES.md +0 -51
  271. package/docs/api/@aastar/core/variables/DEFAULT_ADMIN_ROLE.md +0 -17
  272. package/docs/api/@aastar/core/variables/DEFAULT_APNTS_PRICE_USD.md +0 -5
  273. package/docs/api/@aastar/core/variables/DEFAULT_CALL_GAS_LIMIT.md +0 -3
  274. package/docs/api/@aastar/core/variables/DEFAULT_GAS_TOKEN_MINT_AMOUNT.md +0 -5
  275. package/docs/api/@aastar/core/variables/DEFAULT_PRE_VERIFICATION_GAS.md +0 -3
  276. package/docs/api/@aastar/core/variables/DEFAULT_TIMEOUT_MS.md +0 -5
  277. package/docs/api/@aastar/core/variables/DEFAULT_TOKEN_NAME.md +0 -3
  278. package/docs/api/@aastar/core/variables/DEFAULT_TOKEN_SYMBOL.md +0 -5
  279. package/docs/api/@aastar/core/variables/DEFAULT_USDT_MINT_AMOUNT.md +0 -5
  280. package/docs/api/@aastar/core/variables/DEFAULT_VERIFICATION_GAS_LIMIT.md +0 -5
  281. package/docs/api/@aastar/core/variables/DVTValidatorABI.md +0 -3
  282. package/docs/api/@aastar/core/variables/DVTValidatorArtifact.md +0 -13
  283. package/docs/api/@aastar/core/variables/DVT_VALIDATOR_ADDRESS.md +0 -3
  284. package/docs/api/@aastar/core/variables/ENTRY_POINT_0_8_ADDRESS.md +0 -3
  285. package/docs/api/@aastar/core/variables/ENTRY_POINT_0_9_ADDRESS.md +0 -3
  286. package/docs/api/@aastar/core/variables/ENTRY_POINT_ADDRESS.md +0 -3
  287. package/docs/api/@aastar/core/variables/EntryPointABI.md +0 -3
  288. package/docs/api/@aastar/core/variables/EntryPointArtifact.md +0 -13
  289. package/docs/api/@aastar/core/variables/FAUCET_API_URL.md +0 -5
  290. package/docs/api/@aastar/core/variables/GTOKEN_ADDRESS.md +0 -3
  291. package/docs/api/@aastar/core/variables/GTOKEN_STAKING_ADDRESS.md +0 -3
  292. package/docs/api/@aastar/core/variables/GTokenABI.md +0 -3
  293. package/docs/api/@aastar/core/variables/GTokenArtifact.md +0 -13
  294. package/docs/api/@aastar/core/variables/GTokenStakingABI.md +0 -3
  295. package/docs/api/@aastar/core/variables/GTokenStakingArtifact.md +0 -13
  296. package/docs/api/@aastar/core/variables/INITIAL_ROLE_STAKES.md +0 -13
  297. package/docs/api/@aastar/core/variables/LINKS.md +0 -33
  298. package/docs/api/@aastar/core/variables/MAX_SERVICE_FEE.md +0 -5
  299. package/docs/api/@aastar/core/variables/MONITORING_ADDRESSES.md +0 -15
  300. package/docs/api/@aastar/core/variables/MySBTABI.md +0 -3
  301. package/docs/api/@aastar/core/variables/MySBTArtifact.md +0 -13
  302. package/docs/api/@aastar/core/variables/NETWORKS.md +0 -79
  303. package/docs/api/@aastar/core/variables/NODE_STAKE_AMOUNTS.md +0 -31
  304. package/docs/api/@aastar/core/variables/OFFICIAL_ADDRESSES.md +0 -11
  305. package/docs/api/@aastar/core/variables/PAYMASTER_ADDRESSES.md +0 -15
  306. package/docs/api/@aastar/core/variables/PAYMASTER_FACTORY_ADDRESS.md +0 -3
  307. package/docs/api/@aastar/core/variables/PAYMASTER_V4_IMPL_ADDRESS.md +0 -3
  308. package/docs/api/@aastar/core/variables/PaymasterABI.md +0 -3
  309. package/docs/api/@aastar/core/variables/PaymasterArtifact.md +0 -13
  310. package/docs/api/@aastar/core/variables/PaymasterFactoryABI.md +0 -3
  311. package/docs/api/@aastar/core/variables/PaymasterFactoryArtifact.md +0 -13
  312. package/docs/api/@aastar/core/variables/PaymasterV4ABI.md +0 -3
  313. package/docs/api/@aastar/core/variables/PaymasterV4Artifact.md +0 -13
  314. package/docs/api/@aastar/core/variables/REGISTRY_ADDRESS.md +0 -3
  315. package/docs/api/@aastar/core/variables/REPUTATION_SYSTEM_ADDRESS.md +0 -3
  316. package/docs/api/@aastar/core/variables/ROLE_ANODE.md +0 -29
  317. package/docs/api/@aastar/core/variables/ROLE_COMMUNITY.md +0 -29
  318. package/docs/api/@aastar/core/variables/ROLE_DVT.md +0 -29
  319. package/docs/api/@aastar/core/variables/ROLE_ENDUSER.md +0 -33
  320. package/docs/api/@aastar/core/variables/ROLE_KMS.md +0 -29
  321. package/docs/api/@aastar/core/variables/ROLE_NAMES.md +0 -3
  322. package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_AOA.md +0 -29
  323. package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_SUPER.md +0 -33
  324. package/docs/api/@aastar/core/variables/ROLE_PERMISSION_LEVELS.md +0 -3
  325. package/docs/api/@aastar/core/variables/RegistryABI.md +0 -3
  326. package/docs/api/@aastar/core/variables/RegistryArtifact.md +0 -13
  327. package/docs/api/@aastar/core/variables/ReputationSystemABI.md +0 -3
  328. package/docs/api/@aastar/core/variables/ReputationSystemArtifact.md +0 -13
  329. package/docs/api/@aastar/core/variables/SBT_ADDRESS.md +0 -3
  330. package/docs/api/@aastar/core/variables/SEPOLIA_CONTRACTS.md +0 -175
  331. package/docs/api/@aastar/core/variables/SEPOLIA_V2_VERSIONS.md +0 -67
  332. package/docs/api/@aastar/core/variables/SERVICE_FEE_RATE.md +0 -5
  333. package/docs/api/@aastar/core/variables/SUPER_PAYMASTER_ADDRESS.md +0 -3
  334. package/docs/api/@aastar/core/variables/SimpleAccountABI.md +0 -3
  335. package/docs/api/@aastar/core/variables/SimpleAccountArtifact.md +0 -13
  336. package/docs/api/@aastar/core/variables/SimpleAccountFactoryABI.md +0 -3
  337. package/docs/api/@aastar/core/variables/SimpleAccountFactoryArtifact.md +0 -13
  338. package/docs/api/@aastar/core/variables/SuperPaymasterABI.md +0 -3
  339. package/docs/api/@aastar/core/variables/SuperPaymasterArtifact.md +0 -13
  340. package/docs/api/@aastar/core/variables/TEST_ACCOUNT_ADDRESSES.md +0 -11
  341. package/docs/api/@aastar/core/variables/TEST_ACCOUNT_POOL_SIZE.md +0 -5
  342. package/docs/api/@aastar/core/variables/TEST_COMMUNITIES.md +0 -19
  343. package/docs/api/@aastar/core/variables/TEST_TOKEN_ADDRESSES.md +0 -19
  344. package/docs/api/@aastar/core/variables/TOKEN_ADDRESSES.md +0 -11
  345. package/docs/api/@aastar/core/variables/V2_SUMMARY.md +0 -39
  346. package/docs/api/@aastar/core/variables/XPNTS_FACTORY_ADDRESS.md +0 -3
  347. package/docs/api/@aastar/core/variables/xPNTsFactoryABI.md +0 -3
  348. package/docs/api/@aastar/core/variables/xPNTsFactoryArtifact.md +0 -13
  349. package/docs/api/@aastar/core/variables/xPNTsTokenABI.md +0 -3
  350. package/docs/api/@aastar/core/variables/xPNTsTokenArtifact.md +0 -13
  351. package/docs/api/@aastar/paymaster/README.md +0 -23
  352. package/docs/api/@aastar/paymaster/classes/PaymasterClient.md +0 -388
  353. package/docs/api/@aastar/paymaster/classes/PaymasterOperator.md +0 -451
  354. package/docs/api/@aastar/paymaster/classes/SuperPaymasterAdminClient.md +0 -189
  355. package/docs/api/@aastar/paymaster/classes/SuperPaymasterClient.md +0 -55
  356. package/docs/api/@aastar/paymaster/functions/buildPaymasterData.md +0 -34
  357. package/docs/api/@aastar/paymaster/functions/buildSuperPaymasterData.md +0 -30
  358. package/docs/api/@aastar/paymaster/functions/checkEligibility.md +0 -28
  359. package/docs/api/@aastar/paymaster/functions/formatUserOpV07.md +0 -15
  360. package/docs/api/@aastar/paymaster/functions/getPaymasterV4Middleware.md +0 -32
  361. package/docs/api/@aastar/paymaster/functions/getSuperPaymasterMiddleware.md +0 -32
  362. package/docs/api/@aastar/paymaster/functions/getUserOpHashV07.md +0 -21
  363. package/docs/api/@aastar/paymaster/type-aliases/GaslessReadinessReport.md +0 -55
  364. package/docs/api/@aastar/paymaster/type-aliases/GaslessTransactionConfig.md +0 -59
  365. package/docs/api/@aastar/paymaster/type-aliases/PaymasterConfig.md +0 -43
  366. package/docs/api/@aastar/paymaster/type-aliases/PaymasterV4MiddlewareConfig.md +0 -35
  367. package/docs/api/@aastar/tokens/README.md +0 -3
  368. package/docs/api/@aastar/tokens/classes/FinanceClient.md +0 -10385
  369. package/docs/api/README.md +0 -6
  370. package/docs/examples/community-flow.md +0 -28
  371. package/docs/examples/enduser-flow.md +0 -24
  372. package/docs/examples/index.md +0 -18
  373. package/docs/examples/multi-chain.md +0 -31
  374. package/docs/examples/operator-flow.md +0 -28
  375. package/docs/guide/CLI_GUIDE.md +0 -65
  376. package/docs/guide/DOCUMENTATION_PLAN.md +0 -455
  377. package/docs/guide/Security-solution.md +0 -106
  378. package/docs/guide/TEST_COMMANDS.md +0 -320
  379. package/docs/guide/getting-started.md +0 -133
  380. package/docs/guide/installation.md +0 -40
  381. package/docs/guide/paper-data-collection.md +0 -69
  382. package/docs/guide/quick-start.md +0 -52
  383. package/docs/guide/task_breakdown.md +0 -121
  384. package/docs/old-solution.md +0 -1078
  385. package/docs/paper-data-collection.md +0 -69
  386. package/docs/technical_plan.md +0 -510
  387. package/docs/zh/examples/community-flow.md +0 -38
  388. package/docs/zh/examples/complete-workflow.md +0 -10
  389. package/docs/zh/examples/enduser-flow.md +0 -33
  390. package/docs/zh/examples/index.md +0 -18
  391. package/docs/zh/examples/multi-chain.md +0 -46
  392. package/docs/zh/examples/operator-flow.md +0 -37
  393. package/docs/zh/guide/CLI_GUIDE.md +0 -48
  394. package/docs/zh/guide/DOCUMENTATION_PLAN.md +0 -455
  395. package/docs/zh/guide/Plan.md +0 -266
  396. package/docs/zh/guide/SDK_Optimization_Evaluation_Plan.md +0 -51
  397. package/docs/zh/guide/Security-solution.md +0 -106
  398. package/docs/zh/guide/TEST_COMMANDS.md +0 -125
  399. package/docs/zh/guide/TEST_COVERAGE_MATRIX.md +0 -72
  400. package/docs/zh/guide/concepts/account-abstraction.md +0 -95
  401. package/docs/zh/guide/concepts/rainbow-bridge.md +0 -68
  402. package/docs/zh/guide/concepts/reputation.md +0 -95
  403. package/docs/zh/guide/concepts/superpaymaster.md +0 -141
  404. package/docs/zh/guide/getting-started.md +0 -133
  405. package/docs/zh/guide/installation.md +0 -107
  406. package/docs/zh/guide/old-solution.md +0 -1078
  407. package/docs/zh/guide/paper-data-collection.md +0 -69
  408. package/docs/zh/guide/quick-start.md +0 -134
  409. package/docs/zh/guide/sdk-readme.md +0 -253
  410. package/docs/zh/guide/task_breakdown.md +0 -76
  411. package/docs/zh/guide/technical_plan.md +0 -510
  412. package/docs/zh/guide/use-cases/community-management.md +0 -141
  413. package/docs/zh/guide/use-cases/gasless-transactions.md +0 -71
  414. package/docs/zh/guide/use-cases/operator-staking.md +0 -84
  415. package/docs/zh/guide/use-cases/yop.md +0 -72
  416. package/env.template +0 -30
  417. package/examples/l1-api-demo.ts +0 -273
  418. package/examples/l2-clients-demo.ts +0 -135
  419. package/examples/l3-community-launch.ts +0 -49
  420. package/examples/l3-user-onboarding.ts +0 -56
  421. package/examples/prepare-gasless.ts +0 -89
  422. package/examples/sdk-demo/DEVELOPER_GUIDE.md +0 -159
  423. package/examples/sdk-demo/README.md +0 -30
  424. package/examples/sdk-demo/usage.ts +0 -137
  425. package/examples/simple-gasless-demo.ts +0 -109
  426. package/examples/simple-superpaymaster-demo.ts +0 -96
  427. package/ext/aastar-shared-config/.env.example +0 -6
  428. package/ext/aastar-shared-config/.github/workflows/check-secrets.yml +0 -257
  429. package/ext/aastar-shared-config/AGENTS.md +0 -21
  430. package/ext/aastar-shared-config/CHANGELOG.md +0 -99
  431. package/ext/aastar-shared-config/LICENSE +0 -21
  432. package/ext/aastar-shared-config/QUICK_START.md +0 -215
  433. package/ext/aastar-shared-config/README.md +0 -412
  434. package/ext/aastar-shared-config/SHARED_CONFIG_SUMMARY.md +0 -273
  435. package/ext/aastar-shared-config/check-locker-status.mjs +0 -7
  436. package/ext/aastar-shared-config/favicon.ico +0 -0
  437. package/ext/aastar-shared-config/generate-comparison-table.sh +0 -67
  438. package/ext/aastar-shared-config/package.json +0 -46
  439. package/ext/aastar-shared-config/pnpm-lock.yaml +0 -1182
  440. package/ext/aastar-shared-config/src/abis/BLSAggregator.json +0 -1
  441. package/ext/aastar-shared-config/src/abis/DVTValidator.json +0 -1
  442. package/ext/aastar-shared-config/src/abis/GToken.json +0 -1
  443. package/ext/aastar-shared-config/src/abis/GTokenStaking.json +0 -1
  444. package/ext/aastar-shared-config/src/abis/MySBT.json +0 -1
  445. package/ext/aastar-shared-config/src/abis/PaymasterFactory.json +0 -1
  446. package/ext/aastar-shared-config/src/abis/PaymasterV4.json +0 -1098
  447. package/ext/aastar-shared-config/src/abis/Registry.json +0 -1
  448. package/ext/aastar-shared-config/src/abis/SimpleAccount.json +0 -557
  449. package/ext/aastar-shared-config/src/abis/SimpleAccountFactory.json +0 -87
  450. package/ext/aastar-shared-config/src/abis/SuperPaymasterV2.json +0 -1
  451. package/ext/aastar-shared-config/src/abis/index.ts +0 -45
  452. package/ext/aastar-shared-config/src/abis/xPNTsFactory.json +0 -1
  453. package/ext/aastar-shared-config/src/abis/xPNTsToken.json +0 -1
  454. package/ext/aastar-shared-config/src/branding.ts +0 -32
  455. package/ext/aastar-shared-config/src/communities.ts +0 -93
  456. package/ext/aastar-shared-config/src/constants.ts +0 -67
  457. package/ext/aastar-shared-config/src/contract-addresses.ts +0 -95
  458. package/ext/aastar-shared-config/src/contract-versions.ts +0 -374
  459. package/ext/aastar-shared-config/src/contracts.ts +0 -414
  460. package/ext/aastar-shared-config/src/index.ts +0 -14
  461. package/ext/aastar-shared-config/src/networks.ts +0 -117
  462. package/ext/aastar-shared-config/sync-abis.sh +0 -92
  463. package/ext/aastar-shared-config/sync-versions.mjs +0 -150
  464. package/ext/aastar-shared-config/tsconfig.json +0 -18
  465. package/ext/aastar-shared-config/tsup.config.ts +0 -10
  466. package/ext/aastar-shared-config/verify-all.sh +0 -207
  467. package/ext/aastar-shared-config/verify-contracts.sh +0 -85
  468. package/ext/aastar-shared-config/verify-mysbt-v243.mjs +0 -27
  469. package/ext/aastar-shared-config/verify-onchain-versions.mjs +0 -93
  470. package/l4-setup.sh +0 -1
  471. package/lib/SHARED_CONFIG_REFERENCE.md +0 -133
  472. package/lib/shared-config/.env.example +0 -6
  473. package/lib/shared-config/.github/workflows/check-secrets.yml +0 -257
  474. package/lib/shared-config/AGENTS.md +0 -21
  475. package/lib/shared-config/CHANGELOG.md +0 -99
  476. package/lib/shared-config/LICENSE +0 -21
  477. package/lib/shared-config/QUICK_START.md +0 -215
  478. package/lib/shared-config/README.md +0 -412
  479. package/lib/shared-config/SHARED_CONFIG_SUMMARY.md +0 -273
  480. package/lib/shared-config/check-locker-status.mjs +0 -7
  481. package/lib/shared-config/favicon.ico +0 -0
  482. package/lib/shared-config/generate-comparison-table.sh +0 -67
  483. package/lib/shared-config/package.json +0 -46
  484. package/lib/shared-config/pnpm-lock.yaml +0 -1182
  485. package/lib/shared-config/src/abis/BLSAggregator.json +0 -1
  486. package/lib/shared-config/src/abis/DVTValidator.json +0 -1
  487. package/lib/shared-config/src/abis/GToken.json +0 -1
  488. package/lib/shared-config/src/abis/GTokenStaking.json +0 -1
  489. package/lib/shared-config/src/abis/MySBT.json +0 -1
  490. package/lib/shared-config/src/abis/PaymasterFactory.json +0 -1
  491. package/lib/shared-config/src/abis/PaymasterV4.json +0 -1098
  492. package/lib/shared-config/src/abis/Registry.json +0 -1
  493. package/lib/shared-config/src/abis/SimpleAccount.json +0 -557
  494. package/lib/shared-config/src/abis/SimpleAccountFactory.json +0 -87
  495. package/lib/shared-config/src/abis/SuperPaymasterV2.json +0 -1
  496. package/lib/shared-config/src/abis/index.ts +0 -45
  497. package/lib/shared-config/src/abis/xPNTsFactory.json +0 -1
  498. package/lib/shared-config/src/abis/xPNTsToken.json +0 -1
  499. package/lib/shared-config/src/branding.ts +0 -32
  500. package/lib/shared-config/src/communities.ts +0 -93
  501. package/lib/shared-config/src/constants.ts +0 -67
  502. package/lib/shared-config/src/contract-addresses.ts +0 -95
  503. package/lib/shared-config/src/contract-versions.ts +0 -374
  504. package/lib/shared-config/src/contracts.ts +0 -414
  505. package/lib/shared-config/src/index.ts +0 -14
  506. package/lib/shared-config/src/networks.ts +0 -117
  507. package/lib/shared-config/sync-abis.sh +0 -92
  508. package/lib/shared-config/sync-versions.mjs +0 -150
  509. package/lib/shared-config/tsconfig.json +0 -18
  510. package/lib/shared-config/tsup.config.ts +0 -10
  511. package/lib/shared-config/verify-all.sh +0 -207
  512. package/lib/shared-config/verify-contracts.sh +0 -85
  513. package/lib/shared-config/verify-mysbt-v243.mjs +0 -27
  514. package/lib/shared-config/verify-onchain-versions.mjs +0 -93
  515. package/packages/account/__tests__/index.test.ts +0 -9
  516. package/packages/account/node_modules/.bin/tsc +0 -21
  517. package/packages/account/node_modules/.bin/tsserver +0 -21
  518. package/packages/account/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  519. package/packages/account/package.json +0 -21
  520. package/packages/account/src/accounts/simple.ts +0 -84
  521. package/packages/account/src/eoa.ts +0 -31
  522. package/packages/account/src/index.ts +0 -61
  523. package/packages/account/tsconfig.json +0 -12
  524. package/packages/analytics/README.md +0 -68
  525. package/packages/analytics/__tests__/index.test.ts +0 -25
  526. package/packages/analytics/data/attribution_dataset.csv +0 -29
  527. package/packages/analytics/data/complete_dataset.csv +0 -29
  528. package/packages/analytics/data/eth_price_cache.json +0 -4
  529. package/packages/analytics/data/full_dataset.csv +0 -11
  530. package/packages/analytics/data/full_dataset.json +0 -134
  531. package/packages/analytics/data/parsed_transactions.csv +0 -29
  532. package/packages/analytics/node_modules/.bin/tsc +0 -21
  533. package/packages/analytics/node_modules/.bin/tsserver +0 -21
  534. package/packages/analytics/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  535. package/packages/analytics/package.json +0 -25
  536. package/packages/analytics/reports/full/attribution_analysis_20260119.md +0 -42
  537. package/packages/analytics/reports/full/attribution_analysis_fresh_20260119.md +0 -67
  538. package/packages/analytics/reports/full/competitive_analysis_20260119.md +0 -103
  539. package/packages/analytics/reports/full/comprehensive_analysis_20260119.md +0 -107
  540. package/packages/analytics/reports/full/comprehensive_analysis_v4_1_20260119.md +0 -74
  541. package/packages/analytics/reports/full/economic_audit_v4_2_20260119.md +0 -74
  542. package/packages/analytics/reports/full/profit_audit_v4_3_20260119.md +0 -74
  543. package/packages/analytics/reports/full/profit_audit_v4_4_20260119.md +0 -74
  544. package/packages/analytics/reports/full/profit_audit_v4_5_20260119.md +0 -74
  545. package/packages/analytics/reports/full/profit_audit_v4_6_20260119.md +0 -74
  546. package/packages/analytics/reports/full/profit_audit_v4_final_20260119.md +0 -74
  547. package/packages/analytics/reports/full/profit_audit_v4_final_v2_20260119.md +0 -74
  548. package/packages/analytics/reports/full/profit_audit_v4_final_v3_20260119.md +0 -74
  549. package/packages/analytics/reports/full/profit_audit_v4_final_v4_20260119.md +0 -75
  550. package/packages/analytics/reports/full/profit_audit_v4_final_v5_20260119.md +0 -76
  551. package/packages/analytics/reports/full/two_layer_analysis_20260119.md +0 -81
  552. package/packages/analytics/reports/full/two_layer_analysis_academic_20260119.md +0 -81
  553. package/packages/analytics/reports/full/two_layer_analysis_dynamic_20260119.md +0 -81
  554. package/packages/analytics/reports/full/two_layer_analysis_final_20260119.md +0 -81
  555. package/packages/analytics/reports/full/two_layer_analysis_final_fixed_20260119.md +0 -81
  556. package/packages/analytics/reports/full/two_layer_analysis_fixed_20260119.md +0 -52
  557. package/packages/analytics/reports/full/two_layer_analysis_normalized_20260119.md +0 -81
  558. package/packages/analytics/reports/full/tx_0xc30cfcbb.md +0 -39
  559. package/packages/analytics/src/analyzers/AttributionAnalyzer.ts +0 -124
  560. package/packages/analytics/src/analyzers/ComparisonAnalyzer.ts +0 -89
  561. package/packages/analytics/src/analyzers/TransactionAnalyzer.ts +0 -111
  562. package/packages/analytics/src/analyzers/TrendAnalyzer.ts +0 -107
  563. package/packages/analytics/src/cli-analyze-tx.ts +0 -45
  564. package/packages/analytics/src/cli.ts +0 -39
  565. package/packages/analytics/src/core/BenchmarkLoader.ts +0 -163
  566. package/packages/analytics/src/core/CostCalculator.ts +0 -202
  567. package/packages/analytics/src/core/DataCollector.ts +0 -245
  568. package/packages/analytics/src/gas-analyzer-v4.ts +0 -118
  569. package/packages/analytics/src/gas-analyzer.ts +0 -184
  570. package/packages/analytics/src/index.ts +0 -145
  571. package/packages/analytics/src/test-logparser.ts +0 -63
  572. package/packages/analytics/src/utils/EventDecoder.ts +0 -152
  573. package/packages/analytics/src/utils/LogParser.ts +0 -220
  574. package/packages/analytics/src/utils/PriceOracle.ts +0 -117
  575. package/packages/analytics/test/AttributionAnalyzer.test.ts +0 -42
  576. package/packages/analytics/test/CostCalculator.test.ts +0 -75
  577. package/packages/analytics/tsconfig.json +0 -12
  578. package/packages/community/__tests__/index.test.ts +0 -9
  579. package/packages/community/node_modules/.bin/tsc +0 -21
  580. package/packages/community/node_modules/.bin/tsserver +0 -21
  581. package/packages/community/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  582. package/packages/community/package.json +0 -27
  583. package/packages/community/src/index.ts +0 -326
  584. package/packages/community/tsconfig.json +0 -8
  585. package/packages/core/__tests__/actions/account-comprehensive.test.ts +0 -92
  586. package/packages/core/__tests__/actions/aggregator.test.ts +0 -62
  587. package/packages/core/__tests__/actions/comprehensive-batch1.test.ts +0 -86
  588. package/packages/core/__tests__/actions/comprehensive-batch2.test.ts +0 -39
  589. package/packages/core/__tests__/actions/comprehensive-batch3.test.ts +0 -35
  590. package/packages/core/__tests__/actions/comprehensive-error.test.ts +0 -115
  591. package/packages/core/__tests__/actions/dvt.test.ts +0 -39
  592. package/packages/core/__tests__/actions/edge-cases.test.ts +0 -39
  593. package/packages/core/__tests__/actions/error-paths.test.ts +0 -82
  594. package/packages/core/__tests__/actions/factory.test.ts +0 -81
  595. package/packages/core/__tests__/actions/faucet.test.ts +0 -131
  596. package/packages/core/__tests__/actions/paymaster.test.ts +0 -116
  597. package/packages/core/__tests__/actions/registry.test.ts +0 -81
  598. package/packages/core/__tests__/actions/reputation.test.ts +0 -43
  599. package/packages/core/__tests__/actions/sbt.test.ts +0 -145
  600. package/packages/core/__tests__/actions/staking.test.ts +0 -30
  601. package/packages/core/__tests__/actions/superPaymaster.test.ts +0 -158
  602. package/packages/core/__tests__/actions/tokens-extended.test.ts +0 -18
  603. package/packages/core/__tests__/actions/tokens.test.ts +0 -122
  604. package/packages/core/__tests__/clients.test.ts +0 -77
  605. package/packages/core/__tests__/contracts-config.test.ts +0 -69
  606. package/packages/core/__tests__/index.test.ts +0 -9
  607. package/packages/core/__tests__/mocks/client.ts +0 -40
  608. package/packages/core/node_modules/.bin/tsc +0 -21
  609. package/packages/core/node_modules/.bin/tsserver +0 -21
  610. package/packages/core/node_modules/.bin/tsx +0 -21
  611. package/packages/core/node_modules/.bin/vite +0 -21
  612. package/packages/core/node_modules/.bin/vitest +0 -21
  613. package/packages/core/node_modules/.bin/yaml +0 -21
  614. package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  615. package/packages/core/package.json +0 -25
  616. package/packages/core/src/abis/BLSAggregator.json +0 -686
  617. package/packages/core/src/abis/BLSValidator.json +0 -42
  618. package/packages/core/src/abis/DVTValidator.json +0 -368
  619. package/packages/core/src/abis/Eip7702Support.json +0 -24
  620. package/packages/core/src/abis/EntryPoint.json +0 -1382
  621. package/packages/core/src/abis/GToken.json +0 -513
  622. package/packages/core/src/abis/GTokenStaking.json +0 -949
  623. package/packages/core/src/abis/LegacyAccount.json +0 -625
  624. package/packages/core/src/abis/MySBT.json +0 -1518
  625. package/packages/core/src/abis/Paymaster.json +0 -1143
  626. package/packages/core/src/abis/PaymasterFactory.json +0 -640
  627. package/packages/core/src/abis/Registry.json +0 -1942
  628. package/packages/core/src/abis/ReputationSystem.json +0 -699
  629. package/packages/core/src/abis/SenderCreator.json +0 -99
  630. package/packages/core/src/abis/Simple7702Account.json +0 -395
  631. package/packages/core/src/abis/SimpleAccount.json +0 -560
  632. package/packages/core/src/abis/SimpleAccountFactory.json +0 -111
  633. package/packages/core/src/abis/SimpleAccountFactoryV08.json +0 -87
  634. package/packages/core/src/abis/SimpleAccountV08.json +0 -557
  635. package/packages/core/src/abis/SuperPaymaster.json +0 -1781
  636. package/packages/core/src/abis/UserOperationLib.json +0 -57
  637. package/packages/core/src/abis/aPNTs.json +0 -1160
  638. package/packages/core/src/abis/abi.config.json +0 -24
  639. package/packages/core/src/abis/index.ts +0 -91
  640. package/packages/core/src/abis/xPNTsFactory.json +0 -718
  641. package/packages/core/src/abis/xPNTsToken.json +0 -1280
  642. package/packages/core/src/actions/StateValidator.ts +0 -253
  643. package/packages/core/src/actions/account.ts +0 -190
  644. package/packages/core/src/actions/aggregator.ts +0 -371
  645. package/packages/core/src/actions/dvt.ts +0 -269
  646. package/packages/core/src/actions/entryPoint.ts +0 -89
  647. package/packages/core/src/actions/factory.ts +0 -732
  648. package/packages/core/src/actions/faucet.ts +0 -280
  649. package/packages/core/src/actions/index.ts +0 -15
  650. package/packages/core/src/actions/paymaster.ts +0 -780
  651. package/packages/core/src/actions/registry.ts +0 -961
  652. package/packages/core/src/actions/reputation.ts +0 -668
  653. package/packages/core/src/actions/sbt.ts +0 -916
  654. package/packages/core/src/actions/staking.ts +0 -576
  655. package/packages/core/src/actions/superPaymaster.ts +0 -1093
  656. package/packages/core/src/actions/tokens.ts +0 -481
  657. package/packages/core/src/branding.ts +0 -32
  658. package/packages/core/src/clients/BaseClient.ts +0 -78
  659. package/packages/core/src/clients/BundlerClient.ts +0 -132
  660. package/packages/core/src/clients/types.ts +0 -69
  661. package/packages/core/src/clients.ts +0 -13
  662. package/packages/core/src/communities.ts +0 -93
  663. package/packages/core/src/config/ContractConfigManager.ts +0 -63
  664. package/packages/core/src/constants.ts +0 -114
  665. package/packages/core/src/contract-addresses.ts +0 -118
  666. package/packages/core/src/contract-versions.ts +0 -374
  667. package/packages/core/src/contracts.ts +0 -414
  668. package/packages/core/src/crypto/blsSigner.ts +0 -124
  669. package/packages/core/src/crypto/index.ts +0 -1
  670. package/packages/core/src/errors/index.ts +0 -173
  671. package/packages/core/src/index.ts +0 -23
  672. package/packages/core/src/networks.ts +0 -127
  673. package/packages/core/src/requirementChecker.ts +0 -225
  674. package/packages/core/src/roles.ts +0 -244
  675. package/packages/core/src/utils.ts +0 -23
  676. package/packages/core/src/validators/index.ts +0 -88
  677. package/packages/core/tsconfig.json +0 -13
  678. package/packages/dapp/__tests__/index.test.ts +0 -9
  679. package/packages/dapp/node_modules/.bin/tsc +0 -21
  680. package/packages/dapp/node_modules/.bin/tsserver +0 -21
  681. package/packages/dapp/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  682. package/packages/dapp/package.json +0 -28
  683. package/packages/dapp/src/index.ts +0 -4
  684. package/packages/dapp/src/ui/components/EvaluationPanel.tsx +0 -40
  685. package/packages/dapp/src/ui/hooks/useCreditScore.ts +0 -44
  686. package/packages/dapp/src/ui/hooks/useSuperPaymaster.ts +0 -31
  687. package/packages/dapp/src/ui/index.ts +0 -22
  688. package/packages/dapp/tsconfig.json +0 -13
  689. package/packages/enduser/__tests__/CommunityClient.test.ts +0 -205
  690. package/packages/enduser/__tests__/UserClient.test.ts +0 -294
  691. package/packages/enduser/__tests__/index.test.ts +0 -16
  692. package/packages/enduser/__tests__/mocks/client.ts +0 -22
  693. package/packages/enduser/node_modules/.bin/tsc +0 -21
  694. package/packages/enduser/node_modules/.bin/tsserver +0 -21
  695. package/packages/enduser/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  696. package/packages/enduser/package.json +0 -26
  697. package/packages/enduser/src/CommunityClient.ts +0 -235
  698. package/packages/enduser/src/UserClient.ts +0 -447
  699. package/packages/enduser/src/index.ts +0 -2
  700. package/packages/enduser/src/testAccountManager.ts +0 -374
  701. package/packages/enduser/tsconfig.json +0 -10
  702. package/packages/identity/__tests__/index.test.ts +0 -9
  703. package/packages/identity/node_modules/.bin/tsc +0 -21
  704. package/packages/identity/node_modules/.bin/tsserver +0 -21
  705. package/packages/identity/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  706. package/packages/identity/package.json +0 -23
  707. package/packages/identity/src/index.ts +0 -114
  708. package/packages/identity/src/mysbt.ts +0 -48
  709. package/packages/identity/tsconfig.json +0 -12
  710. package/packages/operator/__tests__/PaymasterOperatorClient.test.ts +0 -258
  711. package/packages/operator/__tests__/ProtocolClient.test.ts +0 -135
  712. package/packages/operator/__tests__/index.test.ts +0 -16
  713. package/packages/operator/__tests__/mocks/client.ts +0 -22
  714. package/packages/operator/node_modules/.bin/tsc +0 -21
  715. package/packages/operator/node_modules/.bin/tsserver +0 -21
  716. package/packages/operator/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  717. package/packages/operator/package.json +0 -26
  718. package/packages/operator/src/PaymasterOperatorClient.ts +0 -454
  719. package/packages/operator/src/ProtocolClient.ts +0 -154
  720. package/packages/operator/src/index.ts +0 -2
  721. package/packages/operator/tsconfig.json +0 -10
  722. package/packages/patterns/node_modules/.bin/tsc +0 -21
  723. package/packages/patterns/node_modules/.bin/tsserver +0 -21
  724. package/packages/paymaster/__tests__/PaymasterOperator.test.ts +0 -123
  725. package/packages/paymaster/__tests__/index.test.ts +0 -9
  726. package/packages/paymaster/node_modules/.bin/tsc +0 -21
  727. package/packages/paymaster/node_modules/.bin/tsserver +0 -21
  728. package/packages/paymaster/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  729. package/packages/paymaster/package.json +0 -23
  730. package/packages/paymaster/src/SuperPaymaster/index.ts +0 -168
  731. package/packages/paymaster/src/V4/BundlerCompat.ts +0 -47
  732. package/packages/paymaster/src/V4/PaymasterClient.ts +0 -490
  733. package/packages/paymaster/src/V4/PaymasterOperator.ts +0 -282
  734. package/packages/paymaster/src/V4/PaymasterUtils.ts +0 -199
  735. package/packages/paymaster/src/V4/SuperPaymasterClient.ts +0 -129
  736. package/packages/paymaster/src/V4/index.ts +0 -4
  737. package/packages/paymaster/src/index.ts +0 -5
  738. package/packages/paymaster/tsconfig.json +0 -16
  739. package/packages/sdk/README.md +0 -171
  740. package/packages/sdk/__tests__/index.test.ts +0 -9
  741. package/packages/sdk/aastar/package.json +0 -21
  742. package/packages/sdk/aastar/src/index.ts +0 -3
  743. package/packages/sdk/aastar/tsconfig.json +0 -8
  744. package/packages/sdk/examples/config.json +0 -1
  745. package/packages/sdk/examples/regression_test.ts +0 -106
  746. package/packages/sdk/node_modules/.bin/tsc +0 -21
  747. package/packages/sdk/node_modules/.bin/tsserver +0 -21
  748. package/packages/sdk/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  749. package/packages/sdk/package.json +0 -34
  750. package/packages/sdk/src/clients/admin.ts +0 -56
  751. package/packages/sdk/src/clients/endUser.ts +0 -428
  752. package/packages/sdk/src/utils/testScenarios.ts +0 -128
  753. package/packages/sdk/tests/scenarios/01_onboard_community.ts +0 -62
  754. package/packages/sdk/tests/scenarios/02_onboard_operator.ts +0 -109
  755. package/packages/sdk/tests/scenarios/03_onboard_user.ts +0 -53
  756. package/packages/sdk/tests/scenarios/04_gasless_tx_flow.ts +0 -68
  757. package/packages/sdk/tests/scenarios/check_entrypoint.ts +0 -19
  758. package/packages/sdk/tests/scenarios/check_initialization.ts +0 -65
  759. package/packages/sdk/tests/scenarios/debug_addresses.ts +0 -26
  760. package/packages/sdk/tests/scenarios/diagnose_scenario4.ts +0 -55
  761. package/packages/sdk/tests/scenarios/setup.ts +0 -33
  762. package/packages/sdk/tests/scenarios/test_entrypoint_nonce.ts +0 -46
  763. package/packages/sdk/tsconfig.json +0 -12
  764. package/packages/tokens/__tests__/index.test.ts +0 -9
  765. package/packages/tokens/node_modules/.bin/tsc +0 -21
  766. package/packages/tokens/node_modules/.bin/tsserver +0 -21
  767. package/packages/tokens/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  768. package/packages/tokens/package.json +0 -23
  769. package/packages/tokens/src/index.ts +0 -258
  770. package/packages/tokens/tsconfig.json +0 -12
  771. package/pnpm-workspace.yaml +0 -2
  772. package/publish.sh +0 -30
  773. package/run_l4_gasless_regression.sh +0 -109
  774. package/run_sdk_regression.sh +0 -232
  775. package/scripts/00_utils.ts +0 -59
  776. package/scripts/00_verify_phase1.ts +0 -130
  777. package/scripts/01_1_prep_gtoken.ts +0 -81
  778. package/scripts/01_2_register_sbt.ts +0 -88
  779. package/scripts/01_3_prep_tokens_paymaster.ts +0 -102
  780. package/scripts/01_prepare_all.ts +0 -271
  781. package/scripts/02_test_eoa.ts +0 -50
  782. package/scripts/03_test_standard_aa.ts +0 -173
  783. package/scripts/04_0_check_deploy.ts +0 -24
  784. package/scripts/04_1_check_allowance.ts +0 -44
  785. package/scripts/04_2_construct_verify.ts +0 -96
  786. package/scripts/04_3_verify_estimate.ts +0 -66
  787. package/scripts/04_4_verify_pack.ts +0 -74
  788. package/scripts/04_test_paymaster_v4.ts +0 -217
  789. package/scripts/05_1_deposit.ts +0 -48
  790. package/scripts/05_test_superpaymaster.ts +0 -380
  791. package/scripts/06_local_test_v3_admin.ts +0 -163
  792. package/scripts/06_local_test_v3_execution.ts +0 -132
  793. package/scripts/06_local_test_v3_full.ts +0 -490
  794. package/scripts/06_local_test_v3_funding.ts +0 -124
  795. package/scripts/06_local_test_v3_reputation.ts +0 -234
  796. package/scripts/07_local_test_v3_audit.ts +0 -181
  797. package/scripts/08_local_test_registry_lifecycle.ts +0 -382
  798. package/scripts/09_local_test_community_lifecycle.ts +0 -385
  799. package/scripts/09_local_test_community_simple.ts +0 -108
  800. package/scripts/09_scenario_bread_independent.ts +0 -247
  801. package/scripts/10_scenario_super_shared.ts +0 -196
  802. package/scripts/10_test_protocol_admin_full.ts +0 -173
  803. package/scripts/11_scenario_hacker_defense.ts +0 -104
  804. package/scripts/11_test_core_flows_full.ts +0 -279
  805. package/scripts/12_test_slash_mechanism.ts +0 -205
  806. package/scripts/12_test_slash_queries.ts +0 -83
  807. package/scripts/12_test_staking_exit.ts +0 -152
  808. package/scripts/12_test_staking_slash.ts +0 -301
  809. package/scripts/12_test_tier2_slash.ts +0 -139
  810. package/scripts/13_test_sbt_burn_linkage.ts +0 -266
  811. package/scripts/14_test_credit_redesign.ts +0 -266
  812. package/scripts/15_test_bls_full.ts +0 -148
  813. package/scripts/15_test_dvt_bls_full.ts +0 -140
  814. package/scripts/17_test_cross_role_collaboration.ts +0 -95
  815. package/scripts/18_sdk_e2e_verification.ts +0 -67
  816. package/scripts/18_test_dvt_sdk_flow.ts +0 -138
  817. package/scripts/18_test_lifecycle_completion.ts +0 -144
  818. package/scripts/19_sdk_experiment_runner.ts +0 -207
  819. package/scripts/19_sdk_experiment_runner.ts.backup +0 -391
  820. package/scripts/20_sdk_full_capability.ts +0 -95
  821. package/scripts/20_test_superpaymaster_new_apis.ts +0 -193
  822. package/scripts/21_test_paymasterv4_complete.ts +0 -341
  823. package/scripts/22_test_bls_signing.ts +0 -260
  824. package/scripts/23_test_middleware.ts +0 -197
  825. package/scripts/98_edge_reentrancy.ts +0 -85
  826. package/scripts/99_bug_hunting_fast.ts +0 -99
  827. package/scripts/analyze_abi_coverage.ts +0 -169
  828. package/scripts/analyze_missing_functions.ts +0 -136
  829. package/scripts/canary-bundler.ts +0 -47
  830. package/scripts/check-admin.ts +0 -95
  831. package/scripts/check-chainlink.ts +0 -28
  832. package/scripts/check-jason-status.ts +0 -85
  833. package/scripts/check-roles.ts +0 -36
  834. package/scripts/clear-nonce.ts +0 -47
  835. package/scripts/collect_industry_baseline.ts +0 -236
  836. package/scripts/complete-jack-superpaymaster.ts +0 -171
  837. package/scripts/complete_env_config.ts +0 -97
  838. package/scripts/deploy-sync.ts +0 -104
  839. package/scripts/deploy_and_init_v3.sh +0 -134
  840. package/scripts/deploy_anvil_accounts.ts +0 -144
  841. package/scripts/deploy_jason_pm.ts +0 -114
  842. package/scripts/deploy_paymaster_v4.ts +0 -139
  843. package/scripts/deploy_test_accounts.ts +0 -401
  844. package/scripts/deprecated/check_aa_entrypoint.ts +0 -29
  845. package/scripts/deprecated/check_paymaster_deposits.ts +0 -45
  846. package/scripts/deprecated/debug_aoa_function.ts +0 -28
  847. package/scripts/deprecated/debug_aoa_issue.ts +0 -16
  848. package/scripts/deprecated/debug_pimlico_aa23.ts +0 -40
  849. package/scripts/deprecated/debug_summary.ts +0 -34
  850. package/scripts/deprecated/deploy_v07_aa.ts +0 -99
  851. package/scripts/deprecated/fix_all_issues.ts +0 -61
  852. package/scripts/deprecated/fund_bpnts.ts +0 -52
  853. package/scripts/deprecated/get_factory_addresses.ts +0 -28
  854. package/scripts/deprecated/recheck_pim.ts +0 -34
  855. package/scripts/dev_tools/extract_abis.sh +0 -151
  856. package/scripts/dev_tools/extract_addresses_to_env.sh +0 -67
  857. package/scripts/dev_tools/final_safe_harmonize.py +0 -77
  858. package/scripts/dev_tools/safe_harmonize.py +0 -107
  859. package/scripts/dev_tools/surgical_harmonize.py +0 -83
  860. package/scripts/experiment/stage3/SETUP_GUIDE.md +0 -258
  861. package/scripts/experiment/stage3/archived_scripts/00_token_distribution.ts +0 -78
  862. package/scripts/experiment/stage3/archived_scripts/01_dao_launch.ts +0 -96
  863. package/scripts/experiment/stage3/archived_scripts/01b_bread_launch.ts +0 -112
  864. package/scripts/experiment/stage3/archived_scripts/02_operator_setup.ts +0 -84
  865. package/scripts/experiment/stage3/archived_scripts/02b_operator_b_setup.ts +0 -104
  866. package/scripts/experiment/stage3/archived_scripts/02c_finalize_operators.ts +0 -86
  867. package/scripts/experiment/stage3/archived_scripts/02d_operator_collateral.ts +0 -89
  868. package/scripts/experiment/stage3/archived_scripts/03_user_onboarding.ts +0 -83
  869. package/scripts/experiment/stage3/archived_scripts/03b_deploy_aa_account.ts +0 -61
  870. package/scripts/experiment/stage3/archived_scripts/03c_aa_onboarding.ts +0 -104
  871. package/scripts/experiment/stage3/archived_scripts/03d_mint_points.ts +0 -60
  872. package/scripts/experiment/stage3/archived_scripts/04_benchmarking.ts +0 -100
  873. package/scripts/experiment/stage3/archived_scripts/05_multi_op_setup.ts +0 -149
  874. package/scripts/experiment/stage3/archived_scripts/README.md +0 -58
  875. package/scripts/experiment/stage3/archived_scripts/check_roles.ts +0 -29
  876. package/scripts/experiment/stage3/archived_scripts/decode_error.ts +0 -23
  877. package/scripts/experiment/stage3/archived_scripts/fund_user.ts +0 -51
  878. package/scripts/experiment/stage3/archived_scripts/gen_b_key.ts +0 -3
  879. package/scripts/experiment/stage3/archived_scripts/gen_keys.ts +0 -4
  880. package/scripts/experiment/stage3/archived_scripts/setup.ts +0 -105
  881. package/scripts/experiment/stage3/archived_scripts/test_key.ts +0 -4
  882. package/scripts/experiment/stage3/archived_scripts/verify_state.ts +0 -59
  883. package/scripts/experiment/stage3/refactored/00_token_distribution.ts +0 -46
  884. package/scripts/experiment/stage3/refactored/02_operator_setup.ts +0 -65
  885. package/scripts/experiment/stage3/refactored/03_user_onboarding.ts +0 -68
  886. package/scripts/experiment/stage3/refactored/05_multi_op_setup.ts +0 -63
  887. package/scripts/experiment/stage3/refactored/README.md +0 -71
  888. package/scripts/extract-docs.sh +0 -72
  889. package/scripts/fund-jack.ts +0 -38
  890. package/scripts/generate_env_from_deployment.ts +0 -109
  891. package/scripts/inspect-anni-token.ts +0 -116
  892. package/scripts/inspect-factory.ts +0 -83
  893. package/scripts/l4-debug-bob.ts +0 -62
  894. package/scripts/l4-paymasterv4-transfer-test.ts +0 -220
  895. package/scripts/l4-setup.ts +0 -1347
  896. package/scripts/l4-state.json +0 -82
  897. package/scripts/manual-update-price.ts +0 -39
  898. package/scripts/phase1_verify_contracts.ts +0 -207
  899. package/scripts/pre_test_sync.ts +0 -83
  900. package/scripts/prepare_sepolia_resources.ts +0 -154
  901. package/scripts/publish_all.sh +0 -39
  902. package/scripts/query-jack-token.ts +0 -22
  903. package/scripts/quick_setup.ts +0 -124
  904. package/scripts/quick_setup_account.ts +0 -80
  905. package/scripts/run_automated_experiment.sh +0 -121
  906. package/scripts/run_daily_experiment.ts +0 -70
  907. package/scripts/run_full_regression.sh +0 -38
  908. package/scripts/run_l4_gasless_regression.sh +0 -32
  909. package/scripts/run_sdk_experiment.sh +0 -13
  910. package/scripts/run_sdk_regression-v2.sh +0 -38
  911. package/scripts/sdk_regression_v2.ts +0 -148
  912. package/scripts/security_audit.sh +0 -172
  913. package/scripts/setup-bbq-community.ts +0 -187
  914. package/scripts/setup-dancing-community.ts +0 -223
  915. package/scripts/setup_test_accounts.ts +0 -88
  916. package/scripts/setup_test_environment.ts +0 -147
  917. package/scripts/sync_anvil_config.cjs +0 -44
  918. package/scripts/sync_config_to_env.ts +0 -88
  919. package/scripts/sync_contract_addresses.ts +0 -186
  920. package/scripts/sync_sepolia_config.cjs +0 -90
  921. package/scripts/sync_sepolia_config.mjs +0 -74
  922. package/scripts/test-brown-v4-deploy.ts +0 -90
  923. package/scripts/test-faucet-and-gasless.ts +0 -150
  924. package/scripts/test-jack-gasless.ts +0 -119
  925. package/scripts/test-jack-registration.ts +0 -133
  926. package/scripts/test-jack-superpaymaster-api.ts +0 -112
  927. package/scripts/test-kms-gasless.ts +0 -352
  928. package/scripts/update-price-dvt.ts +0 -53
  929. package/scripts/update_env_from_config.ts +0 -83
  930. package/scripts/v2_regression/00_validate_env.ts +0 -101
  931. package/scripts/v2_regression/01_setup_and_fund.ts +0 -132
  932. package/scripts/v2_regression/02_operator_onboarding.ts +0 -300
  933. package/scripts/v2_regression/03_community_registry.ts +0 -173
  934. package/scripts/v2_regression/04_enduser_flow.ts +0 -174
  935. package/scripts/v2_regression/05_admin_audit.ts +0 -157
  936. package/scripts/v2_regression/README.md +0 -161
  937. package/scripts/validate_env.ts +0 -112
  938. package/scripts/verify-bob-token.ts +0 -41
  939. package/scripts/verify-tx-status.ts +0 -81
  940. package/scripts/verify_onchain_milestone.ts +0 -114
  941. package/scripts/verify_phase1.ts +0 -66
  942. package/scripts/verify_phase2.ts +0 -66
  943. package/sdk-abi-coverage.sh +0 -1
  944. package/sdk-build-and-test.sh +0 -1
  945. package/sdk-test-coverage.sh +0 -1
  946. package/sdk_experiment_data.csv +0 -4
  947. package/simple-test-paymaster.sh +0 -2
  948. package/simple-test-superpaymaster.sh +0 -3
  949. package/tests/check-aa-balance.ts +0 -31
  950. package/tests/l1-regression.test.ts +0 -437
  951. package/tests/l4-test-anni-gasless.ts +0 -517
  952. package/tests/l4-test-jason1-gasless.ts +0 -158
  953. package/tests/l4-test-jason2-gasless.ts +0 -180
  954. package/tests/l4-test-pmv4-deposit.ts +0 -111
  955. package/tests/l4-test-pmv4-gasless.ts +0 -166
  956. package/tests/l4-test-pmv4-submit.ts +0 -223
  957. package/tests/regression/README.md +0 -168
  958. package/tests/regression/config.ts +0 -217
  959. package/tests/regression/display-versions.ts +0 -85
  960. package/tests/regression/index.ts +0 -67
  961. package/tests/regression/l1-tests.ts +0 -248
  962. package/tests/regression/l2-tests.ts +0 -227
  963. package/tests/regression/l3-tests.ts +0 -28
  964. package/tests/regression/l4-comprehensive-gasless.ts +0 -478
  965. package/tests/regression/l4-gasless.ts +0 -999
  966. package/tests/regression/l4-reputation-tiers.ts +0 -102
  967. package/tests/regression/l4-runner.ts +0 -52
  968. package/tests/reports/phase1_contract_verification.md +0 -45
  969. package/tests/test-bundler-compat.ts +0 -132
  970. package/tests/test-candide-bundler.ts +0 -117
  971. package/tests/test-candide-paymaster.ts +0 -101
  972. package/tests/test-candide-sdk.ts +0 -116
  973. package/tests/test-candide-simple.ts +0 -204
  974. package/tests/test-pimlico-complete.ts +0 -134
  975. package/tests/utils/contractVerifier.ts +0 -237
  976. package/tests/utils/userOpHelper.ts +0 -194
  977. package/tsconfig.build.json +0 -23
  978. package/tsconfig.json +0 -27
  979. package/typedoc.json +0 -25
  980. package/update-version.sh +0 -20
  981. package/vitest.config.ts +0 -17
@@ -1,4841 +0,0 @@
1
- Defined in: [packages/core/src/clients/types.ts:6](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L6)
2
-
3
- Base configuration for all L2 Business Clients
4
-
5
- ## Properties
6
-
7
- ### client
8
-
9
- > **client**: `object`
10
-
11
- Defined in: [packages/core/src/clients/types.ts:11](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L11)
12
-
13
- Viem WalletClient for write operations.
14
- Must have an account attached.
15
-
16
- #### account
17
-
18
- > **account**: [`Account`](https://viem.sh/docs/index.html)
19
-
20
- The Account of the Client.
21
-
22
- #### addChain()
23
-
24
- > **addChain**: (`args`) => `Promise`\<`void`\>
25
-
26
- Adds an EVM chain to the wallet.
27
-
28
- - Docs: https://viem.sh/docs/actions/wallet/addChain
29
- - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
30
-
31
- ##### Parameters
32
-
33
- ###### args
34
-
35
- [`AddChainParameters`](https://viem.sh/docs/index.html)
36
-
37
- [AddChainParameters](https://viem.sh/docs/index.html)
38
-
39
- ##### Returns
40
-
41
- `Promise`\<`void`\>
42
-
43
- ##### Example
44
-
45
- ```ts
46
- import { createWalletClient, custom } from 'viem'
47
- import { optimism } from 'viem/chains'
48
-
49
- const client = createWalletClient({
50
- transport: custom(window.ethereum),
51
- })
52
- await client.addChain({ chain: optimism })
53
- ```
54
-
55
- #### batch?
56
-
57
- > `optional` **batch**: `object`
58
-
59
- Flags for batch settings.
60
-
61
- ##### batch.multicall?
62
-
63
- > `optional` **multicall**: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
64
-
65
- Toggle to enable `eth_call` multicall aggregation.
66
-
67
- ###### Type Declaration
68
-
69
- `boolean`
70
-
71
- \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
72
-
73
- #### cacheTime
74
-
75
- > **cacheTime**: `number`
76
-
77
- Time (in ms) that cached data will remain in memory.
78
-
79
- #### ccipRead?
80
-
81
- > `optional` **ccipRead**: `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
82
-
83
- [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
84
-
85
- ##### Type Declaration
86
-
87
- `false`
88
-
89
- \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
90
-
91
- #### chain
92
-
93
- > **chain**: [`Chain`](https://viem.sh/docs/index.html)
94
-
95
- Chain for the client.
96
-
97
- #### deployContract()
98
-
99
- > **deployContract**: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
100
-
101
- Deploys a contract to the network, given bytecode and constructor arguments.
102
-
103
- - Docs: https://viem.sh/docs/contract/deployContract
104
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
105
-
106
- ##### Type Parameters
107
-
108
- ###### abi
109
-
110
- `abi` *extends* readonly `unknown`[] \| `Abi`
111
-
112
- ###### chainOverride
113
-
114
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
115
-
116
- ##### Parameters
117
-
118
- ###### args
119
-
120
- [`DeployContractParameters`](https://viem.sh/docs/index.html)\<`abi`, [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`\>
121
-
122
- [DeployContractParameters](https://viem.sh/docs/index.html)
123
-
124
- ##### Returns
125
-
126
- `Promise`\<`` `0x${string}` ``\>
127
-
128
- The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. [DeployContractReturnType](https://viem.sh/docs/index.html)
129
-
130
- ##### Example
131
-
132
- ```ts
133
- import { createWalletClient, http } from 'viem'
134
- import { privateKeyToAccount } from 'viem/accounts'
135
- import { mainnet } from 'viem/chains'
136
-
137
- const client = createWalletClient({
138
- account: privateKeyToAccount('0x…'),
139
- chain: mainnet,
140
- transport: http(),
141
- })
142
- const hash = await client.deployContract({
143
- abi: [],
144
- account: '0x…,
145
- bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
146
- })
147
- ```
148
-
149
- #### experimental\_blockTag?
150
-
151
- > `optional` **experimental\_blockTag**: [`BlockTag`](https://viem.sh/docs/index.html)
152
-
153
- Default block tag to use for RPC requests.
154
-
155
- #### extend()
156
-
157
- > **extend**: \<`client`\>(`fn`) => [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), [`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), [`Account`](https://viem.sh/docs/index.html)\>\>
158
-
159
- ##### Type Parameters
160
-
161
- ###### client
162
-
163
- `client` *extends* `object` & [`ExactPartial`](https://viem.sh/docs/index.html)\<[`ExtendableProtectedActions`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html)\>\>
164
-
165
- ##### Parameters
166
-
167
- ###### fn
168
-
169
- (`client`) => `client`
170
-
171
- ##### Returns
172
-
173
- [`Client`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), [`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), [`Account`](https://viem.sh/docs/index.html)\>\>
174
-
175
- #### fillTransaction()
176
-
177
- > **fillTransaction**: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), `chainOverride`\>\>
178
-
179
- Fills a transaction request with the necessary fields to be signed over.
180
-
181
- - Docs: https://viem.sh/docs/actions/public/fillTransaction
182
-
183
- ##### Type Parameters
184
-
185
- ###### chainOverride
186
-
187
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
188
-
189
- ###### accountOverride
190
-
191
- `accountOverride` *extends* `` `0x${string}` `` \| [`Account`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
192
-
193
- ##### Parameters
194
-
195
- ###### args
196
-
197
- [`FillTransactionParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `accountOverride`\>
198
-
199
- ##### Returns
200
-
201
- `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), `chainOverride`\>\>
202
-
203
- The filled transaction. [FillTransactionReturnType](https://viem.sh/docs/index.html)
204
-
205
- ##### Example
206
-
207
- ```ts
208
- import { createWalletClient, custom } from 'viem'
209
- import { mainnet } from 'viem/chains'
210
-
211
- const client = createWalletClient({
212
- chain: mainnet,
213
- transport: custom(window.ethereum),
214
- })
215
- const result = await client.fillTransaction({
216
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
217
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
218
- value: parseEther('1'),
219
- })
220
- ```
221
-
222
- #### getAddresses()
223
-
224
- > **getAddresses**: () => `Promise`\<[`GetAddressesReturnType`](https://viem.sh/docs/index.html)\>
225
-
226
- Returns a list of account addresses owned by the wallet or client.
227
-
228
- - Docs: https://viem.sh/docs/actions/wallet/getAddresses
229
- - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
230
-
231
- ##### Returns
232
-
233
- `Promise`\<[`GetAddressesReturnType`](https://viem.sh/docs/index.html)\>
234
-
235
- List of account addresses owned by the wallet or client. [GetAddressesReturnType](https://viem.sh/docs/index.html)
236
-
237
- ##### Example
238
-
239
- ```ts
240
- import { createWalletClient, custom } from 'viem'
241
- import { mainnet } from 'viem/chains'
242
-
243
- const client = createWalletClient({
244
- chain: mainnet,
245
- transport: custom(window.ethereum),
246
- })
247
- const accounts = await client.getAddresses()
248
- ```
249
-
250
- #### getCallsStatus()
251
-
252
- > **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`; \}\>
253
-
254
- Returns the status of a call batch that was sent via `sendCalls`.
255
-
256
- - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus
257
- - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
258
-
259
- ##### Parameters
260
-
261
- ###### parameters
262
-
263
- [`GetCallsStatusParameters`](https://viem.sh/docs/index.html)
264
-
265
- ##### Returns
266
-
267
- `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`; \}\>
268
-
269
- Status of the calls. [GetCallsStatusReturnType](https://viem.sh/docs/index.html)
270
-
271
- ##### Example
272
-
273
- ```ts
274
- import { createWalletClient, custom } from 'viem'
275
- import { mainnet } from 'viem/chains'
276
-
277
- const client = createWalletClient({
278
- chain: mainnet,
279
- transport: custom(window.ethereum),
280
- })
281
-
282
- const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })
283
- ```
284
-
285
- #### getCapabilities()
286
-
287
- > **getCapabilities**: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>
288
-
289
- Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc).
290
-
291
- - Docs: https://viem.sh/docs/actions/wallet/getCapabilities
292
- - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792)
293
-
294
- ##### Type Parameters
295
-
296
- ###### chainId
297
-
298
- `chainId` *extends* `number` \| `undefined`
299
-
300
- ##### Parameters
301
-
302
- ###### parameters?
303
-
304
- [`GetCapabilitiesParameters`](https://viem.sh/docs/index.html)\<`chainId`\>
305
-
306
- ##### Returns
307
-
308
- `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>
309
-
310
- The wallet's capabilities. [GetCapabilitiesReturnType](https://viem.sh/docs/index.html)
311
-
312
- ##### Example
313
-
314
- ```ts
315
- import { createWalletClient, custom } from 'viem'
316
- import { mainnet } from 'viem/chains'
317
-
318
- const client = createWalletClient({
319
- chain: mainnet,
320
- transport: custom(window.ethereum),
321
- })
322
-
323
- const capabilities = await client.getCapabilities({
324
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
325
- })
326
- ```
327
-
328
- #### getChainId()
329
-
330
- > **getChainId**: () => `Promise`\<`number`\>
331
-
332
- Returns the chain ID associated with the current network.
333
-
334
- - Docs: https://viem.sh/docs/actions/public/getChainId
335
- - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
336
-
337
- ##### Returns
338
-
339
- `Promise`\<`number`\>
340
-
341
- The current chain ID. [GetChainIdReturnType](https://viem.sh/docs/index.html)
342
-
343
- ##### Example
344
-
345
- ```ts
346
- import { createWalletClient, http } from 'viem'
347
- import { mainnet } from 'viem/chains'
348
-
349
- const client = createWalletClient({
350
- chain: mainnet,
351
- transport: custom(window.ethereum),
352
- })
353
- const chainId = await client.getChainId()
354
- // 1
355
- ```
356
-
357
- #### getPermissions()
358
-
359
- > **getPermissions**: () => `Promise`\<[`GetPermissionsReturnType`](https://viem.sh/docs/index.html)\>
360
-
361
- Gets the wallets current permissions.
362
-
363
- - Docs: https://viem.sh/docs/actions/wallet/getPermissions
364
- - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
365
-
366
- ##### Returns
367
-
368
- `Promise`\<[`GetPermissionsReturnType`](https://viem.sh/docs/index.html)\>
369
-
370
- The wallet permissions. [GetPermissionsReturnType](https://viem.sh/docs/index.html)
371
-
372
- ##### Example
373
-
374
- ```ts
375
- import { createWalletClient, custom } from 'viem'
376
- import { mainnet } from 'viem/chains'
377
-
378
- const client = createWalletClient({
379
- chain: mainnet,
380
- transport: custom(window.ethereum),
381
- })
382
- const permissions = await client.getPermissions()
383
- ```
384
-
385
- #### key
386
-
387
- > **key**: `string`
388
-
389
- A key for the client.
390
-
391
- #### name
392
-
393
- > **name**: `string`
394
-
395
- A name for the client.
396
-
397
- #### pollingInterval
398
-
399
- > **pollingInterval**: `number`
400
-
401
- Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
402
-
403
- #### prepareAuthorization()
404
-
405
- > **prepareAuthorization**: (`parameters`) => `Promise`\<[`PrepareAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
406
-
407
- Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing.
408
- This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`).
409
-
410
- With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object.
411
-
412
- ##### Parameters
413
-
414
- ###### parameters
415
-
416
- [`PrepareAuthorizationParameters`](https://viem.sh/docs/index.html)\<[`Account`](https://viem.sh/docs/index.html)\>
417
-
418
- [PrepareAuthorizationParameters](https://viem.sh/docs/index.html)
419
-
420
- ##### Returns
421
-
422
- `Promise`\<[`PrepareAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
423
-
424
- The prepared Authorization object. [PrepareAuthorizationReturnType](https://viem.sh/docs/index.html)
425
-
426
- ##### Examples
427
-
428
- ```ts
429
- import { createWalletClient, http } from 'viem'
430
- import { privateKeyToAccount } from 'viem/accounts'
431
- import { mainnet } from 'viem/chains'
432
-
433
- const client = createWalletClient({
434
- chain: mainnet,
435
- transport: http(),
436
- })
437
-
438
- const authorization = await client.prepareAuthorization({
439
- account: privateKeyToAccount('0x..'),
440
- contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
441
- })
442
- ```
443
-
444
- ```ts
445
- // Account Hoisting
446
- import { createWalletClient, http } from 'viem'
447
- import { privateKeyToAccount } from 'viem/accounts'
448
- import { mainnet } from 'viem/chains'
449
-
450
- const client = createWalletClient({
451
- account: privateKeyToAccount('0x…'),
452
- chain: mainnet,
453
- transport: http(),
454
- })
455
-
456
- const authorization = await client.prepareAuthorization({
457
- contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
458
- })
459
- ```
460
-
461
- #### prepareTransactionRequest()
462
-
463
- > **prepareTransactionRequest**: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "chainId" \| "gas" \| "nonce" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
464
-
465
- Prepares a transaction request for signing.
466
-
467
- - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest
468
-
469
- ##### Type Parameters
470
-
471
- ###### request
472
-
473
- `request` *extends* [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"legacy"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip2930"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip1559"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes?`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: [`Kzg`](https://viem.sh/docs/index.html); `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: [`AuthorizationList`](https://viem.sh/docs/index.html)\<`number`, `boolean`\>; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip7702"`; `value?`: `bigint`; \}, `"from"`\> & `object` & `object`
474
-
475
- ###### chainOverride
476
-
477
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
478
-
479
- ###### accountOverride
480
-
481
- `accountOverride` *extends* `` `0x${string}` `` \| [`Account`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
482
-
483
- ##### Parameters
484
-
485
- ###### args
486
-
487
- [`PrepareTransactionRequestParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `accountOverride`, `request`\>
488
-
489
- [PrepareTransactionRequestParameters](https://viem.sh/docs/index.html)
490
-
491
- ##### Returns
492
-
493
- `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "chainId" \| "gas" \| "nonce" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
494
-
495
- The transaction request. [PrepareTransactionRequestReturnType](https://viem.sh/docs/index.html)
496
-
497
- ##### Examples
498
-
499
- ```ts
500
- import { createWalletClient, custom } from 'viem'
501
- import { mainnet } from 'viem/chains'
502
-
503
- const client = createWalletClient({
504
- chain: mainnet,
505
- transport: custom(window.ethereum),
506
- })
507
- const request = await client.prepareTransactionRequest({
508
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
509
- to: '0x0000000000000000000000000000000000000000',
510
- value: 1n,
511
- })
512
- ```
513
-
514
- ```ts
515
- // Account Hoisting
516
- import { createWalletClient, http } from 'viem'
517
- import { privateKeyToAccount } from 'viem/accounts'
518
- import { mainnet } from 'viem/chains'
519
-
520
- const client = createWalletClient({
521
- account: privateKeyToAccount('0x…'),
522
- chain: mainnet,
523
- transport: custom(window.ethereum),
524
- })
525
- const request = await client.prepareTransactionRequest({
526
- to: '0x0000000000000000000000000000000000000000',
527
- value: 1n,
528
- })
529
- ```
530
-
531
- #### request
532
-
533
- > **request**: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`WalletRpcSchema`](https://viem.sh/docs/index.html)\>
534
-
535
- Request function wrapped with friendly error handling
536
-
537
- #### requestAddresses()
538
-
539
- > **requestAddresses**: () => `Promise`\<[`RequestAddressesReturnType`](https://viem.sh/docs/index.html)\>
540
-
541
- Requests a list of accounts managed by a wallet.
542
-
543
- - Docs: https://viem.sh/docs/actions/wallet/requestAddresses
544
- - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
545
-
546
- 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).
547
-
548
- 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.
549
-
550
- ##### Returns
551
-
552
- `Promise`\<[`RequestAddressesReturnType`](https://viem.sh/docs/index.html)\>
553
-
554
- List of accounts managed by a wallet [RequestAddressesReturnType](https://viem.sh/docs/index.html)
555
-
556
- ##### Example
557
-
558
- ```ts
559
- import { createWalletClient, custom } from 'viem'
560
- import { mainnet } from 'viem/chains'
561
-
562
- const client = createWalletClient({
563
- chain: mainnet,
564
- transport: custom(window.ethereum),
565
- })
566
- const accounts = await client.requestAddresses()
567
- ```
568
-
569
- #### requestPermissions()
570
-
571
- > **requestPermissions**: (`args`) => `Promise`\<[`RequestPermissionsReturnType`](https://viem.sh/docs/index.html)\>
572
-
573
- Requests permissions for a wallet.
574
-
575
- - Docs: https://viem.sh/docs/actions/wallet/requestPermissions
576
- - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
577
-
578
- ##### Parameters
579
-
580
- ###### args
581
-
582
- [RequestPermissionsParameters](https://viem.sh/docs/index.html)
583
-
584
- ###### eth_accounts
585
-
586
- `Record`\<`string`, `any`\>
587
-
588
- ##### Returns
589
-
590
- `Promise`\<[`RequestPermissionsReturnType`](https://viem.sh/docs/index.html)\>
591
-
592
- The wallet permissions. [RequestPermissionsReturnType](https://viem.sh/docs/index.html)
593
-
594
- ##### Example
595
-
596
- ```ts
597
- import { createWalletClient, custom } from 'viem'
598
- import { mainnet } from 'viem/chains'
599
-
600
- const client = createWalletClient({
601
- chain: mainnet,
602
- transport: custom(window.ethereum),
603
- })
604
- const permissions = await client.requestPermissions({
605
- eth_accounts: {}
606
- })
607
- ```
608
-
609
- #### sendCalls()
610
-
611
- > **sendCalls**: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{\[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>
612
-
613
- Requests the connected wallet to send a batch of calls.
614
-
615
- - Docs: https://viem.sh/docs/actions/wallet/sendCalls
616
- - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792)
617
-
618
- ##### Type Parameters
619
-
620
- ###### calls
621
-
622
- `calls` *extends* readonly `unknown`[]
623
-
624
- ###### chainOverride
625
-
626
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
627
-
628
- ##### Parameters
629
-
630
- ###### parameters
631
-
632
- [`SendCallsParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `calls`\>
633
-
634
- ##### Returns
635
-
636
- `Promise`\<\{ `capabilities?`: \{\[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>
637
-
638
- Transaction identifier. [SendCallsReturnType](https://viem.sh/docs/index.html)
639
-
640
- ##### Example
641
-
642
- ```ts
643
- import { createWalletClient, custom } from 'viem'
644
- import { mainnet } from 'viem/chains'
645
-
646
- const client = createWalletClient({
647
- chain: mainnet,
648
- transport: custom(window.ethereum),
649
- })
650
-
651
- const id = await client.sendCalls({
652
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
653
- calls: [
654
- {
655
- data: '0xdeadbeef',
656
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
657
- },
658
- {
659
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
660
- value: 69420n,
661
- },
662
- ],
663
- })
664
- ```
665
-
666
- #### sendCallsSync()
667
-
668
- > **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`; \}\>
669
-
670
- Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block.
671
-
672
- - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync
673
- - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792)
674
-
675
- ##### Type Parameters
676
-
677
- ###### calls
678
-
679
- `calls` *extends* readonly `unknown`[]
680
-
681
- ###### chainOverride
682
-
683
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
684
-
685
- ##### Parameters
686
-
687
- ###### parameters
688
-
689
- [`SendCallsSyncParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `calls`\>
690
-
691
- ##### Returns
692
-
693
- `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`; \}\>
694
-
695
- Calls status. [SendCallsSyncReturnType](https://viem.sh/docs/index.html)
696
-
697
- ##### Example
698
-
699
- ```ts
700
- import { createWalletClient, custom } from 'viem'
701
- import { mainnet } from 'viem/chains'
702
-
703
- const client = createWalletClient({
704
- chain: mainnet,
705
- transport: custom(window.ethereum),
706
- })
707
-
708
- const status = await client.sendCallsSync({
709
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
710
- calls: [
711
- {
712
- data: '0xdeadbeef',
713
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
714
- },
715
- {
716
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
717
- value: 69420n,
718
- },
719
- ],
720
- })
721
- ```
722
-
723
- #### sendRawTransaction()
724
-
725
- > **sendRawTransaction**: (`args`) => `Promise`\<`` `0x${string}` ``\>
726
-
727
- Sends a **signed** transaction to the network
728
-
729
- - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction
730
- - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
731
-
732
- ##### Parameters
733
-
734
- ###### args
735
-
736
- [`SendRawTransactionParameters`](https://viem.sh/docs/index.html)
737
-
738
- ##### Returns
739
-
740
- `Promise`\<`` `0x${string}` ``\>
741
-
742
- The transaction hash. [SendRawTransactionReturnType](https://viem.sh/docs/index.html)
743
-
744
- ##### Example
745
-
746
- ```ts
747
- import { createWalletClient, custom } from 'viem'
748
- import { mainnet } from 'viem/chains'
749
- import { sendRawTransaction } from 'viem/wallet'
750
-
751
- const client = createWalletClient({
752
- chain: mainnet,
753
- transport: custom(window.ethereum),
754
- })
755
-
756
- const hash = await client.sendRawTransaction({
757
- serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
758
- })
759
- ```
760
-
761
- #### sendRawTransactionSync()
762
-
763
- > **sendRawTransactionSync**: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
764
-
765
- Sends a **signed** transaction to the network synchronously,
766
- and waits for the transaction to be included in a block.
767
-
768
- - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync
769
- - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966)
770
-
771
- ##### Parameters
772
-
773
- ###### args
774
-
775
- [`SendRawTransactionSyncParameters`](https://viem.sh/docs/index.html)
776
-
777
- ##### Returns
778
-
779
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
780
-
781
- The transaction receipt. [SendRawTransactionSyncReturnType](https://viem.sh/docs/index.html)
782
-
783
- ##### Example
784
-
785
- ```ts
786
- import { createWalletClient, custom } from 'viem'
787
- import { mainnet } from 'viem/chains'
788
- import { sendRawTransactionSync } from 'viem/wallet'
789
-
790
- const client = createWalletClient({
791
- chain: mainnet,
792
- transport: custom(window.ethereum),
793
- })
794
-
795
- const receipt = await client.sendRawTransactionSync({
796
- serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
797
- })
798
- ```
799
-
800
- #### sendTransaction()
801
-
802
- > **sendTransaction**: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
803
-
804
- Creates, signs, and sends a new transaction to the network.
805
-
806
- - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
807
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
808
- - JSON-RPC Methods:
809
- - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
810
- - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
811
-
812
- ##### Type Parameters
813
-
814
- ###### request
815
-
816
- `request` *extends* [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"legacy"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip2930"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip1559"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes?`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: [`Kzg`](https://viem.sh/docs/index.html); `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: [`AuthorizationList`](https://viem.sh/docs/index.html)\<`number`, `boolean`\>; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip7702"`; `value?`: `bigint`; \}, `"from"`\> & `object`
817
-
818
- ###### chainOverride
819
-
820
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
821
-
822
- ##### Parameters
823
-
824
- ###### args
825
-
826
- [`SendTransactionParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `request`\>
827
-
828
- [SendTransactionParameters](https://viem.sh/docs/index.html)
829
-
830
- ##### Returns
831
-
832
- `Promise`\<`` `0x${string}` ``\>
833
-
834
- The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. [SendTransactionReturnType](https://viem.sh/docs/index.html)
835
-
836
- ##### Examples
837
-
838
- ```ts
839
- import { createWalletClient, custom } from 'viem'
840
- import { mainnet } from 'viem/chains'
841
-
842
- const client = createWalletClient({
843
- chain: mainnet,
844
- transport: custom(window.ethereum),
845
- })
846
- const hash = await client.sendTransaction({
847
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
848
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
849
- value: 1000000000000000000n,
850
- })
851
- ```
852
-
853
- ```ts
854
- // Account Hoisting
855
- import { createWalletClient, http } from 'viem'
856
- import { privateKeyToAccount } from 'viem/accounts'
857
- import { mainnet } from 'viem/chains'
858
-
859
- const client = createWalletClient({
860
- account: privateKeyToAccount('0x…'),
861
- chain: mainnet,
862
- transport: http(),
863
- })
864
- const hash = await client.sendTransaction({
865
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
866
- value: 1000000000000000000n,
867
- })
868
- ```
869
-
870
- #### sendTransactionSync()
871
-
872
- > **sendTransactionSync**: \<`request`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
873
-
874
- Creates, signs, and sends a new transaction to the network synchronously.
875
- Returns the transaction receipt.
876
-
877
- - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync
878
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
879
- - JSON-RPC Methods:
880
- - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
881
- - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
882
-
883
- ##### Type Parameters
884
-
885
- ###### request
886
-
887
- `request` *extends* [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"legacy"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip2930"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip1559"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes?`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: [`Kzg`](https://viem.sh/docs/index.html); `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: [`AuthorizationList`](https://viem.sh/docs/index.html)\<`number`, `boolean`\>; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip7702"`; `value?`: `bigint`; \}, `"from"`\> & `object`
888
-
889
- ###### chainOverride
890
-
891
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
892
-
893
- ##### Parameters
894
-
895
- ###### args
896
-
897
- [`SendTransactionSyncParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `request`\>
898
-
899
- [SendTransactionParameters](https://viem.sh/docs/index.html)
900
-
901
- ##### Returns
902
-
903
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
904
-
905
- The transaction receipt. [SendTransactionReturnType](https://viem.sh/docs/index.html)
906
-
907
- ##### Examples
908
-
909
- ```ts
910
- import { createWalletClient, custom } from 'viem'
911
- import { mainnet } from 'viem/chains'
912
-
913
- const client = createWalletClient({
914
- chain: mainnet,
915
- transport: custom(window.ethereum),
916
- })
917
- const receipt = await client.sendTransactionSync({
918
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
919
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
920
- value: 1000000000000000000n,
921
- })
922
- ```
923
-
924
- ```ts
925
- // Account Hoisting
926
- import { createWalletClient, http } from 'viem'
927
- import { privateKeyToAccount } from 'viem/accounts'
928
- import { mainnet } from 'viem/chains'
929
-
930
- const client = createWalletClient({
931
- account: privateKeyToAccount('0x…'),
932
- chain: mainnet,
933
- transport: http(),
934
- })
935
- const receipt = await client.sendTransactionSync({
936
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
937
- value: 1000000000000000000n,
938
- })
939
- ```
940
-
941
- #### showCallsStatus()
942
-
943
- > **showCallsStatus**: (`parameters`) => `Promise`\<`void`\>
944
-
945
- Requests for the wallet to show information about a call batch
946
- that was sent via `sendCalls`.
947
-
948
- - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus
949
- - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
950
-
951
- ##### Parameters
952
-
953
- ###### parameters
954
-
955
- [`ShowCallsStatusParameters`](https://viem.sh/docs/index.html)
956
-
957
- ##### Returns
958
-
959
- `Promise`\<`void`\>
960
-
961
- Displays status of the calls in wallet. [ShowCallsStatusReturnType](https://viem.sh/docs/index.html)
962
-
963
- ##### Example
964
-
965
- ```ts
966
- import { createWalletClient, custom } from 'viem'
967
- import { mainnet } from 'viem/chains'
968
-
969
- const client = createWalletClient({
970
- chain: mainnet,
971
- transport: custom(window.ethereum),
972
- })
973
-
974
- await client.showCallsStatus({ id: '0xdeadbeef' })
975
- ```
976
-
977
- #### signAuthorization()
978
-
979
- > **signAuthorization**: (`parameters`) => `Promise`\<[`SignAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
980
-
981
- Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object.
982
-
983
- With the calculated signature, you can:
984
- - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object,
985
- - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object.
986
-
987
- ##### Parameters
988
-
989
- ###### parameters
990
-
991
- [`SignAuthorizationParameters`](https://viem.sh/docs/index.html)\<[`Account`](https://viem.sh/docs/index.html)\>
992
-
993
- [SignAuthorizationParameters](https://viem.sh/docs/index.html)
994
-
995
- ##### Returns
996
-
997
- `Promise`\<[`SignAuthorizationReturnType`](https://viem.sh/docs/index.html)\>
998
-
999
- The signed Authorization object. [SignAuthorizationReturnType](https://viem.sh/docs/index.html)
1000
-
1001
- ##### Examples
1002
-
1003
- ```ts
1004
- import { createWalletClient, http } from 'viem'
1005
- import { privateKeyToAccount } from 'viem/accounts'
1006
- import { mainnet } from 'viem/chains'
1007
-
1008
- const client = createWalletClient({
1009
- chain: mainnet,
1010
- transport: http(),
1011
- })
1012
-
1013
- const signature = await client.signAuthorization({
1014
- account: privateKeyToAccount('0x..'),
1015
- contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1016
- })
1017
- ```
1018
-
1019
- ```ts
1020
- // Account Hoisting
1021
- import { createWalletClient, http } from 'viem'
1022
- import { privateKeyToAccount } from 'viem/accounts'
1023
- import { mainnet } from 'viem/chains'
1024
-
1025
- const client = createWalletClient({
1026
- account: privateKeyToAccount('0x…'),
1027
- chain: mainnet,
1028
- transport: http(),
1029
- })
1030
-
1031
- const signature = await client.signAuthorization({
1032
- contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1033
- })
1034
- ```
1035
-
1036
- #### signMessage()
1037
-
1038
- > **signMessage**: (`args`) => `Promise`\<`` `0x${string}` ``\>
1039
-
1040
- Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
1041
-
1042
- - Docs: https://viem.sh/docs/actions/wallet/signMessage
1043
- - JSON-RPC Methods:
1044
- - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign)
1045
- - Local Accounts: Signs locally. No JSON-RPC request.
1046
-
1047
- With the calculated signature, you can:
1048
- - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature,
1049
- - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature.
1050
-
1051
- ##### Parameters
1052
-
1053
- ###### args
1054
-
1055
- [`SignMessageParameters`](https://viem.sh/docs/index.html)\<[`Account`](https://viem.sh/docs/index.html)\>
1056
-
1057
- [SignMessageParameters](https://viem.sh/docs/index.html)
1058
-
1059
- ##### Returns
1060
-
1061
- `Promise`\<`` `0x${string}` ``\>
1062
-
1063
- The signed message. [SignMessageReturnType](https://viem.sh/docs/index.html)
1064
-
1065
- ##### Examples
1066
-
1067
- ```ts
1068
- import { createWalletClient, custom } from 'viem'
1069
- import { mainnet } from 'viem/chains'
1070
-
1071
- const client = createWalletClient({
1072
- chain: mainnet,
1073
- transport: custom(window.ethereum),
1074
- })
1075
- const signature = await client.signMessage({
1076
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1077
- message: 'hello world',
1078
- })
1079
- ```
1080
-
1081
- ```ts
1082
- // Account Hoisting
1083
- import { createWalletClient, http } from 'viem'
1084
- import { privateKeyToAccount } from 'viem/accounts'
1085
- import { mainnet } from 'viem/chains'
1086
-
1087
- const client = createWalletClient({
1088
- account: privateKeyToAccount('0x…'),
1089
- chain: mainnet,
1090
- transport: http(),
1091
- })
1092
- const signature = await client.signMessage({
1093
- message: 'hello world',
1094
- })
1095
- ```
1096
-
1097
- #### signTransaction()
1098
-
1099
- > **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`, `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`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| [`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`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| [`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`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| [`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`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| [`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`\> *extends* `"legacy"` ? [`TransactionSerializedLegacy`](https://viem.sh/docs/index.html) : `never`\>\>
1100
-
1101
- Signs a transaction.
1102
-
1103
- - Docs: https://viem.sh/docs/actions/wallet/signTransaction
1104
- - JSON-RPC Methods:
1105
- - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
1106
- - Local Accounts: Signs locally. No JSON-RPC request.
1107
-
1108
- ##### Type Parameters
1109
-
1110
- ###### chainOverride
1111
-
1112
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
1113
-
1114
- ###### request
1115
-
1116
- `request` *extends* [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"legacy"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip2930"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip1559"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes?`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: [`Kzg`](https://viem.sh/docs/index.html); `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${string}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: [`AuthorizationList`](https://viem.sh/docs/index.html)\<`number`, `boolean`\>; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip7702"`; `value?`: `bigint`; \}, `"from"`\> = [`UnionOmit`](https://viem.sh/docs/index.html)\<[`ExtractChainFormatterParameters`](https://viem.sh/docs/index.html)\<[`DeriveChain`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), `chainOverride`\>, `"transactionRequest"`, [`TransactionRequest`](https://viem.sh/docs/index.html)\>, `"from"`\>
1117
-
1118
- ##### Parameters
1119
-
1120
- ###### args
1121
-
1122
- [`SignTransactionParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`, `request`\>
1123
-
1124
- [SignTransactionParameters](https://viem.sh/docs/index.html)
1125
-
1126
- ##### Returns
1127
-
1128
- `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`, `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`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| [`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`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| [`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`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| [`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`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| [`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`\> *extends* `"legacy"` ? [`TransactionSerializedLegacy`](https://viem.sh/docs/index.html) : `never`\>\>
1129
-
1130
- The signed message. [SignTransactionReturnType](https://viem.sh/docs/index.html)
1131
-
1132
- ##### Examples
1133
-
1134
- ```ts
1135
- import { createWalletClient, custom } from 'viem'
1136
- import { mainnet } from 'viem/chains'
1137
-
1138
- const client = createWalletClient({
1139
- chain: mainnet,
1140
- transport: custom(window.ethereum),
1141
- })
1142
- const request = await client.prepareTransactionRequest({
1143
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1144
- to: '0x0000000000000000000000000000000000000000',
1145
- value: 1n,
1146
- })
1147
- const signature = await client.signTransaction(request)
1148
- ```
1149
-
1150
- ```ts
1151
- // Account Hoisting
1152
- import { createWalletClient, http } from 'viem'
1153
- import { privateKeyToAccount } from 'viem/accounts'
1154
- import { mainnet } from 'viem/chains'
1155
-
1156
- const client = createWalletClient({
1157
- account: privateKeyToAccount('0x…'),
1158
- chain: mainnet,
1159
- transport: custom(window.ethereum),
1160
- })
1161
- const request = await client.prepareTransactionRequest({
1162
- to: '0x0000000000000000000000000000000000000000',
1163
- value: 1n,
1164
- })
1165
- const signature = await client.signTransaction(request)
1166
- ```
1167
-
1168
- #### signTypedData()
1169
-
1170
- > **signTypedData**: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
1171
-
1172
- 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))`.
1173
-
1174
- - Docs: https://viem.sh/docs/actions/wallet/signTypedData
1175
- - JSON-RPC Methods:
1176
- - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4)
1177
- - Local Accounts: Signs locally. No JSON-RPC request.
1178
-
1179
- ##### Type Parameters
1180
-
1181
- ###### typedData
1182
-
1183
- `typedData` *extends* \{\[`key`: `string`\]: readonly `TypedDataParameter`[];
1184
- \[`key`: `` `string[${string}]` ``\]: `undefined`;
1185
- \[`key`: `` `function[${string}]` ``\]: `undefined`;
1186
- \[`key`: `` `address[${string}]` ``\]: `undefined`;
1187
- \[`key`: `` `bool[${string}]` ``\]: `undefined`;
1188
- \[`key`: `` `bytes[${string}]` ``\]: `undefined`;
1189
- \[`key`: `` `bytes2[${string}]` ``\]: `undefined`;
1190
- \[`key`: `` `bytes1[${string}]` ``\]: `undefined`;
1191
- \[`key`: `` `bytes10[${string}]` ``\]: `undefined`;
1192
- \[`key`: `` `bytes32[${string}]` ``\]: `undefined`;
1193
- \[`key`: `` `bytes16[${string}]` ``\]: `undefined`;
1194
- \[`key`: `` `bytes8[${string}]` ``\]: `undefined`;
1195
- \[`key`: `` `bytes4[${string}]` ``\]: `undefined`;
1196
- \[`key`: `` `bytes3[${string}]` ``\]: `undefined`;
1197
- \[`key`: `` `bytes15[${string}]` ``\]: `undefined`;
1198
- \[`key`: `` `bytes26[${string}]` ``\]: `undefined`;
1199
- \[`key`: `` `bytes18[${string}]` ``\]: `undefined`;
1200
- \[`key`: `` `bytes27[${string}]` ``\]: `undefined`;
1201
- \[`key`: `` `bytes28[${string}]` ``\]: `undefined`;
1202
- \[`key`: `` `bytes12[${string}]` ``\]: `undefined`;
1203
- \[`key`: `` `bytes6[${string}]` ``\]: `undefined`;
1204
- \[`key`: `` `bytes5[${string}]` ``\]: `undefined`;
1205
- \[`key`: `` `bytes31[${string}]` ``\]: `undefined`;
1206
- \[`key`: `` `bytes7[${string}]` ``\]: `undefined`;
1207
- \[`key`: `` `bytes22[${string}]` ``\]: `undefined`;
1208
- \[`key`: `` `bytes9[${string}]` ``\]: `undefined`;
1209
- \[`key`: `` `bytes11[${string}]` ``\]: `undefined`;
1210
- \[`key`: `` `bytes13[${string}]` ``\]: `undefined`;
1211
- \[`key`: `` `bytes14[${string}]` ``\]: `undefined`;
1212
- \[`key`: `` `bytes17[${string}]` ``\]: `undefined`;
1213
- \[`key`: `` `bytes19[${string}]` ``\]: `undefined`;
1214
- \[`key`: `` `bytes20[${string}]` ``\]: `undefined`;
1215
- \[`key`: `` `bytes21[${string}]` ``\]: `undefined`;
1216
- \[`key`: `` `bytes23[${string}]` ``\]: `undefined`;
1217
- \[`key`: `` `bytes24[${string}]` ``\]: `undefined`;
1218
- \[`key`: `` `bytes25[${string}]` ``\]: `undefined`;
1219
- \[`key`: `` `bytes29[${string}]` ``\]: `undefined`;
1220
- \[`key`: `` `bytes30[${string}]` ``\]: `undefined`;
1221
- \[`key`: `` `int[${string}]` ``\]: `undefined`;
1222
- \[`key`: `` `int48[${string}]` ``\]: `undefined`;
1223
- \[`key`: `` `int32[${string}]` ``\]: `undefined`;
1224
- \[`key`: `` `int256[${string}]` ``\]: `undefined`;
1225
- \[`key`: `` `int16[${string}]` ``\]: `undefined`;
1226
- \[`key`: `` `int8[${string}]` ``\]: `undefined`;
1227
- \[`key`: `` `int64[${string}]` ``\]: `undefined`;
1228
- \[`key`: `` `int40[${string}]` ``\]: `undefined`;
1229
- \[`key`: `` `int88[${string}]` ``\]: `undefined`;
1230
- \[`key`: `` `int160[${string}]` ``\]: `undefined`;
1231
- \[`key`: `` `int96[${string}]` ``\]: `undefined`;
1232
- \[`key`: `` `int128[${string}]` ``\]: `undefined`;
1233
- \[`key`: `` `int192[${string}]` ``\]: `undefined`;
1234
- \[`key`: `` `int24[${string}]` ``\]: `undefined`;
1235
- \[`key`: `` `int56[${string}]` ``\]: `undefined`;
1236
- \[`key`: `` `int72[${string}]` ``\]: `undefined`;
1237
- \[`key`: `` `int80[${string}]` ``\]: `undefined`;
1238
- \[`key`: `` `int104[${string}]` ``\]: `undefined`;
1239
- \[`key`: `` `int112[${string}]` ``\]: `undefined`;
1240
- \[`key`: `` `int120[${string}]` ``\]: `undefined`;
1241
- \[`key`: `` `int136[${string}]` ``\]: `undefined`;
1242
- \[`key`: `` `int144[${string}]` ``\]: `undefined`;
1243
- \[`key`: `` `int152[${string}]` ``\]: `undefined`;
1244
- \[`key`: `` `int168[${string}]` ``\]: `undefined`;
1245
- \[`key`: `` `int176[${string}]` ``\]: `undefined`;
1246
- \[`key`: `` `int184[${string}]` ``\]: `undefined`;
1247
- \[`key`: `` `int200[${string}]` ``\]: `undefined`;
1248
- \[`key`: `` `int208[${string}]` ``\]: `undefined`;
1249
- \[`key`: `` `int216[${string}]` ``\]: `undefined`;
1250
- \[`key`: `` `int224[${string}]` ``\]: `undefined`;
1251
- \[`key`: `` `int232[${string}]` ``\]: `undefined`;
1252
- \[`key`: `` `int240[${string}]` ``\]: `undefined`;
1253
- \[`key`: `` `int248[${string}]` ``\]: `undefined`;
1254
- \[`key`: `` `uint[${string}]` ``\]: `undefined`;
1255
- \[`key`: `` `uint48[${string}]` ``\]: `undefined`;
1256
- \[`key`: `` `uint32[${string}]` ``\]: `undefined`;
1257
- \[`key`: `` `uint256[${string}]` ``\]: `undefined`;
1258
- \[`key`: `` `uint16[${string}]` ``\]: `undefined`;
1259
- \[`key`: `` `uint8[${string}]` ``\]: `undefined`;
1260
- \[`key`: `` `uint64[${string}]` ``\]: `undefined`;
1261
- \[`key`: `` `uint40[${string}]` ``\]: `undefined`;
1262
- \[`key`: `` `uint88[${string}]` ``\]: `undefined`;
1263
- \[`key`: `` `uint160[${string}]` ``\]: `undefined`;
1264
- \[`key`: `` `uint96[${string}]` ``\]: `undefined`;
1265
- \[`key`: `` `uint128[${string}]` ``\]: `undefined`;
1266
- \[`key`: `` `uint192[${string}]` ``\]: `undefined`;
1267
- \[`key`: `` `uint24[${string}]` ``\]: `undefined`;
1268
- \[`key`: `` `uint56[${string}]` ``\]: `undefined`;
1269
- \[`key`: `` `uint72[${string}]` ``\]: `undefined`;
1270
- \[`key`: `` `uint80[${string}]` ``\]: `undefined`;
1271
- \[`key`: `` `uint104[${string}]` ``\]: `undefined`;
1272
- \[`key`: `` `uint112[${string}]` ``\]: `undefined`;
1273
- \[`key`: `` `uint120[${string}]` ``\]: `undefined`;
1274
- \[`key`: `` `uint136[${string}]` ``\]: `undefined`;
1275
- \[`key`: `` `uint144[${string}]` ``\]: `undefined`;
1276
- \[`key`: `` `uint152[${string}]` ``\]: `undefined`;
1277
- \[`key`: `` `uint168[${string}]` ``\]: `undefined`;
1278
- \[`key`: `` `uint176[${string}]` ``\]: `undefined`;
1279
- \[`key`: `` `uint184[${string}]` ``\]: `undefined`;
1280
- \[`key`: `` `uint200[${string}]` ``\]: `undefined`;
1281
- \[`key`: `` `uint208[${string}]` ``\]: `undefined`;
1282
- \[`key`: `` `uint216[${string}]` ``\]: `undefined`;
1283
- \[`key`: `` `uint224[${string}]` ``\]: `undefined`;
1284
- \[`key`: `` `uint232[${string}]` ``\]: `undefined`;
1285
- \[`key`: `` `uint240[${string}]` ``\]: `undefined`;
1286
- \[`key`: `` `uint248[${string}]` ``\]: `undefined`; `address?`: `undefined`; `bool?`: `undefined`; `bytes?`: `undefined`; `bytes1?`: `undefined`; `bytes10?`: `undefined`; `bytes11?`: `undefined`; `bytes12?`: `undefined`; `bytes13?`: `undefined`; `bytes14?`: `undefined`; `bytes15?`: `undefined`; `bytes16?`: `undefined`; `bytes17?`: `undefined`; `bytes18?`: `undefined`; `bytes19?`: `undefined`; `bytes2?`: `undefined`; `bytes20?`: `undefined`; `bytes21?`: `undefined`; `bytes22?`: `undefined`; `bytes23?`: `undefined`; `bytes24?`: `undefined`; `bytes25?`: `undefined`; `bytes26?`: `undefined`; `bytes27?`: `undefined`; `bytes28?`: `undefined`; `bytes29?`: `undefined`; `bytes3?`: `undefined`; `bytes30?`: `undefined`; `bytes31?`: `undefined`; `bytes32?`: `undefined`; `bytes4?`: `undefined`; `bytes5?`: `undefined`; `bytes6?`: `undefined`; `bytes7?`: `undefined`; `bytes8?`: `undefined`; `bytes9?`: `undefined`; `int104?`: `undefined`; `int112?`: `undefined`; `int120?`: `undefined`; `int128?`: `undefined`; `int136?`: `undefined`; `int144?`: `undefined`; `int152?`: `undefined`; `int16?`: `undefined`; `int160?`: `undefined`; `int168?`: `undefined`; `int176?`: `undefined`; `int184?`: `undefined`; `int192?`: `undefined`; `int200?`: `undefined`; `int208?`: `undefined`; `int216?`: `undefined`; `int224?`: `undefined`; `int232?`: `undefined`; `int24?`: `undefined`; `int240?`: `undefined`; `int248?`: `undefined`; `int256?`: `undefined`; `int32?`: `undefined`; `int40?`: `undefined`; `int48?`: `undefined`; `int56?`: `undefined`; `int64?`: `undefined`; `int72?`: `undefined`; `int8?`: `undefined`; `int80?`: `undefined`; `int88?`: `undefined`; `int96?`: `undefined`; `string?`: `undefined`; `uint104?`: `undefined`; `uint112?`: `undefined`; `uint120?`: `undefined`; `uint128?`: `undefined`; `uint136?`: `undefined`; `uint144?`: `undefined`; `uint152?`: `undefined`; `uint16?`: `undefined`; `uint160?`: `undefined`; `uint168?`: `undefined`; `uint176?`: `undefined`; `uint184?`: `undefined`; `uint192?`: `undefined`; `uint200?`: `undefined`; `uint208?`: `undefined`; `uint216?`: `undefined`; `uint224?`: `undefined`; `uint232?`: `undefined`; `uint24?`: `undefined`; `uint240?`: `undefined`; `uint248?`: `undefined`; `uint256?`: `undefined`; `uint32?`: `undefined`; `uint40?`: `undefined`; `uint48?`: `undefined`; `uint56?`: `undefined`; `uint64?`: `undefined`; `uint72?`: `undefined`; `uint8?`: `undefined`; `uint80?`: `undefined`; `uint88?`: `undefined`; `uint96?`: `undefined`; \} \| \{\[`key`: `string`\]: `unknown`; \}
1287
-
1288
- ###### primaryType
1289
-
1290
- `primaryType` *extends* `string`
1291
-
1292
- ##### Parameters
1293
-
1294
- ###### args
1295
-
1296
- [`SignTypedDataParameters`](https://viem.sh/docs/index.html)\<`typedData`, `primaryType`, [`Account`](https://viem.sh/docs/index.html)\>
1297
-
1298
- [SignTypedDataParameters](https://viem.sh/docs/index.html)
1299
-
1300
- ##### Returns
1301
-
1302
- `Promise`\<`` `0x${string}` ``\>
1303
-
1304
- The signed data. [SignTypedDataReturnType](https://viem.sh/docs/index.html)
1305
-
1306
- ##### Examples
1307
-
1308
- ```ts
1309
- import { createWalletClient, custom } from 'viem'
1310
- import { mainnet } from 'viem/chains'
1311
-
1312
- const client = createWalletClient({
1313
- chain: mainnet,
1314
- transport: custom(window.ethereum),
1315
- })
1316
- const signature = await client.signTypedData({
1317
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1318
- domain: {
1319
- name: 'Ether Mail',
1320
- version: '1',
1321
- chainId: 1,
1322
- verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
1323
- },
1324
- types: {
1325
- Person: [
1326
- { name: 'name', type: 'string' },
1327
- { name: 'wallet', type: 'address' },
1328
- ],
1329
- Mail: [
1330
- { name: 'from', type: 'Person' },
1331
- { name: 'to', type: 'Person' },
1332
- { name: 'contents', type: 'string' },
1333
- ],
1334
- },
1335
- primaryType: 'Mail',
1336
- message: {
1337
- from: {
1338
- name: 'Cow',
1339
- wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
1340
- },
1341
- to: {
1342
- name: 'Bob',
1343
- wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
1344
- },
1345
- contents: 'Hello, Bob!',
1346
- },
1347
- })
1348
- ```
1349
-
1350
- ```ts
1351
- // Account Hoisting
1352
- import { createWalletClient, http } from 'viem'
1353
- import { privateKeyToAccount } from 'viem/accounts'
1354
- import { mainnet } from 'viem/chains'
1355
-
1356
- const client = createWalletClient({
1357
- account: privateKeyToAccount('0x…'),
1358
- chain: mainnet,
1359
- transport: http(),
1360
- })
1361
- const signature = await client.signTypedData({
1362
- domain: {
1363
- name: 'Ether Mail',
1364
- version: '1',
1365
- chainId: 1,
1366
- verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
1367
- },
1368
- types: {
1369
- Person: [
1370
- { name: 'name', type: 'string' },
1371
- { name: 'wallet', type: 'address' },
1372
- ],
1373
- Mail: [
1374
- { name: 'from', type: 'Person' },
1375
- { name: 'to', type: 'Person' },
1376
- { name: 'contents', type: 'string' },
1377
- ],
1378
- },
1379
- primaryType: 'Mail',
1380
- message: {
1381
- from: {
1382
- name: 'Cow',
1383
- wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
1384
- },
1385
- to: {
1386
- name: 'Bob',
1387
- wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
1388
- },
1389
- contents: 'Hello, Bob!',
1390
- },
1391
- })
1392
- ```
1393
-
1394
- #### switchChain()
1395
-
1396
- > **switchChain**: (`args`) => `Promise`\<`void`\>
1397
-
1398
- Switch the target chain in a wallet.
1399
-
1400
- - Docs: https://viem.sh/docs/actions/wallet/switchChain
1401
- - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)
1402
-
1403
- ##### Parameters
1404
-
1405
- ###### args
1406
-
1407
- [`SwitchChainParameters`](https://viem.sh/docs/index.html)
1408
-
1409
- [SwitchChainParameters](https://viem.sh/docs/index.html)
1410
-
1411
- ##### Returns
1412
-
1413
- `Promise`\<`void`\>
1414
-
1415
- ##### Example
1416
-
1417
- ```ts
1418
- import { createWalletClient, custom } from 'viem'
1419
- import { mainnet, optimism } from 'viem/chains'
1420
-
1421
- const client = createWalletClient({
1422
- chain: mainnet,
1423
- transport: custom(window.ethereum),
1424
- })
1425
- await client.switchChain({ id: optimism.id })
1426
- ```
1427
-
1428
- #### transport
1429
-
1430
- > **transport**: [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>
1431
-
1432
- The RPC transport
1433
-
1434
- #### type
1435
-
1436
- > **type**: `string`
1437
-
1438
- The type of client.
1439
-
1440
- #### uid
1441
-
1442
- > **uid**: `string`
1443
-
1444
- A unique ID for the client.
1445
-
1446
- #### waitForCallsStatus()
1447
-
1448
- > **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`; \}\>
1449
-
1450
- Waits for the status & receipts of a call bundle that was sent via `sendCalls`.
1451
-
1452
- - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus
1453
- - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
1454
-
1455
- ##### Parameters
1456
-
1457
- ###### parameters
1458
-
1459
- [`WaitForCallsStatusParameters`](https://viem.sh/docs/index.html)
1460
-
1461
- [WaitForCallsStatusParameters](https://viem.sh/docs/index.html)
1462
-
1463
- ##### Returns
1464
-
1465
- `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`; \}\>
1466
-
1467
- Status & receipts of the call bundle. [WaitForCallsStatusReturnType](https://viem.sh/docs/index.html)
1468
-
1469
- ##### Example
1470
-
1471
- ```ts
1472
- import { createWalletClient, custom } from 'viem'
1473
- import { mainnet } from 'viem/chains'
1474
-
1475
- const client = createWalletClient({
1476
- chain: mainnet,
1477
- transport: custom(window.ethereum),
1478
- })
1479
-
1480
- const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })
1481
- ```
1482
-
1483
- #### watchAsset()
1484
-
1485
- > **watchAsset**: (`args`) => `Promise`\<`boolean`\>
1486
-
1487
- Adds an EVM chain to the wallet.
1488
-
1489
- - Docs: https://viem.sh/docs/actions/wallet/watchAsset
1490
- - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)
1491
-
1492
- ##### Parameters
1493
-
1494
- ###### args
1495
-
1496
- [`WatchAssetParams`](https://viem.sh/docs/index.html)
1497
-
1498
- [WatchAssetParameters](https://viem.sh/docs/index.html)
1499
-
1500
- ##### Returns
1501
-
1502
- `Promise`\<`boolean`\>
1503
-
1504
- Boolean indicating if the token was successfully added. [WatchAssetReturnType](https://viem.sh/docs/index.html)
1505
-
1506
- ##### Example
1507
-
1508
- ```ts
1509
- import { createWalletClient, custom } from 'viem'
1510
- import { mainnet } from 'viem/chains'
1511
-
1512
- const client = createWalletClient({
1513
- chain: mainnet,
1514
- transport: custom(window.ethereum),
1515
- })
1516
- const success = await client.watchAsset({
1517
- type: 'ERC20',
1518
- options: {
1519
- address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1520
- decimals: 18,
1521
- symbol: 'WETH',
1522
- },
1523
- })
1524
- ```
1525
-
1526
- #### writeContract()
1527
-
1528
- > **writeContract**: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>
1529
-
1530
- Executes a write function on a contract.
1531
-
1532
- - Docs: https://viem.sh/docs/contract/writeContract
1533
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
1534
-
1535
- 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.
1536
-
1537
- 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).
1538
-
1539
- __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.__
1540
-
1541
- ##### Type Parameters
1542
-
1543
- ###### abi
1544
-
1545
- `abi` *extends* readonly `unknown`[] \| `Abi`
1546
-
1547
- ###### functionName
1548
-
1549
- `functionName` *extends* `string`
1550
-
1551
- ###### args
1552
-
1553
- `args` *extends* `unknown`
1554
-
1555
- ###### chainOverride
1556
-
1557
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1558
-
1559
- ##### Parameters
1560
-
1561
- ###### args
1562
-
1563
- [`WriteContractParameters`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`\>
1564
-
1565
- [WriteContractParameters](https://viem.sh/docs/index.html)
1566
-
1567
- ##### Returns
1568
-
1569
- `Promise`\<`` `0x${string}` ``\>
1570
-
1571
- A [Transaction Hash](https://viem.sh/docs/glossary/terms#hash). [WriteContractReturnType](https://viem.sh/docs/index.html)
1572
-
1573
- ##### Examples
1574
-
1575
- ```ts
1576
- import { createWalletClient, custom, parseAbi } from 'viem'
1577
- import { mainnet } from 'viem/chains'
1578
-
1579
- const client = createWalletClient({
1580
- chain: mainnet,
1581
- transport: custom(window.ethereum),
1582
- })
1583
- const hash = await client.writeContract({
1584
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1585
- abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
1586
- functionName: 'mint',
1587
- args: [69420],
1588
- })
1589
- ```
1590
-
1591
- ```ts
1592
- // With Validation
1593
- import { createWalletClient, custom, parseAbi } from 'viem'
1594
- import { mainnet } from 'viem/chains'
1595
-
1596
- const client = createWalletClient({
1597
- chain: mainnet,
1598
- transport: custom(window.ethereum),
1599
- })
1600
- const { request } = await client.simulateContract({
1601
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1602
- abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
1603
- functionName: 'mint',
1604
- args: [69420],
1605
- }
1606
- const hash = await client.writeContract(request)
1607
- ```
1608
-
1609
- #### writeContractSync()
1610
-
1611
- > **writeContractSync**: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
1612
-
1613
- Executes a write function on a contract synchronously.
1614
- Returns the transaction receipt.
1615
-
1616
- - Docs: https://viem.sh/docs/contract/writeContract
1617
-
1618
- 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.
1619
-
1620
- 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).
1621
-
1622
- __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.__
1623
-
1624
- ##### Type Parameters
1625
-
1626
- ###### abi
1627
-
1628
- `abi` *extends* readonly `unknown`[] \| `Abi`
1629
-
1630
- ###### functionName
1631
-
1632
- `functionName` *extends* `string`
1633
-
1634
- ###### args
1635
-
1636
- `args` *extends* `unknown`
1637
-
1638
- ###### chainOverride
1639
-
1640
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1641
-
1642
- ##### Parameters
1643
-
1644
- ###### args
1645
-
1646
- [`WriteContractSyncParameters`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, [`Chain`](https://viem.sh/docs/index.html), [`Account`](https://viem.sh/docs/index.html), `chainOverride`\>
1647
-
1648
- [WriteContractSyncParameters](https://viem.sh/docs/index.html)
1649
-
1650
- ##### Returns
1651
-
1652
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
1653
-
1654
- A [Transaction Receipt](https://viem.sh/docs/glossary/terms#receipt). [WriteContractSyncReturnType](https://viem.sh/docs/index.html)
1655
-
1656
- ##### Example
1657
-
1658
- ```ts
1659
- import { createWalletClient, custom, parseAbi } from 'viem'
1660
- import { mainnet } from 'viem/chains'
1661
-
1662
- const client = createWalletClient({
1663
- chain: mainnet,
1664
- transport: custom(window.ethereum),
1665
- })
1666
- const receipt = await client.writeContractSync({
1667
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1668
- abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
1669
- functionName: 'mint',
1670
- args: [69420],
1671
- })
1672
- ```
1673
-
1674
- ***
1675
-
1676
- ### entryPointAddress?
1677
-
1678
- > `optional` **entryPointAddress**: `` `0x${string}` ``
1679
-
1680
- Defined in: [packages/core/src/clients/types.ts:46](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L46)
1681
-
1682
- ***
1683
-
1684
- ### ethUsdPriceFeedAddress?
1685
-
1686
- > `optional` **ethUsdPriceFeedAddress**: `` `0x${string}` ``
1687
-
1688
- Defined in: [packages/core/src/clients/types.ts:45](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L45)
1689
-
1690
- ***
1691
-
1692
- ### gTokenAddress?
1693
-
1694
- > `optional` **gTokenAddress**: `` `0x${string}` ``
1695
-
1696
- Defined in: [packages/core/src/clients/types.ts:31](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L31)
1697
-
1698
- GToken contract address.
1699
- Required for operations involving token approvals and transfers.
1700
-
1701
- ***
1702
-
1703
- ### gTokenStakingAddress?
1704
-
1705
- > `optional` **gTokenStakingAddress**: `` `0x${string}` ``
1706
-
1707
- Defined in: [packages/core/src/clients/types.ts:37](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L37)
1708
-
1709
- GTokenStaking contract address.
1710
- Required for role registration that involves staking.
1711
-
1712
- ***
1713
-
1714
- ### paymasterFactoryAddress?
1715
-
1716
- > `optional` **paymasterFactoryAddress**: `` `0x${string}` ``
1717
-
1718
- Defined in: [packages/core/src/clients/types.ts:43](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L43)
1719
-
1720
- PaymasterFactory contract address.
1721
- Required for deploying new PaymasterV4 instances.
1722
-
1723
- ***
1724
-
1725
- ### publicClient?
1726
-
1727
- > `optional` **publicClient**: `object`
1728
-
1729
- Defined in: [packages/core/src/clients/types.ts:19](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L19)
1730
-
1731
- Optional PublicClient for read operations.
1732
- If not provided, one will be derived from the WalletClient or created internally if possible (but usually explicit is better).
1733
- Currently L1 actions use PublicClient | WalletClient, so WalletClient is enough for both if it has a provider.
1734
- However, explicitly accepting PublicClient encourages separation.
1735
-
1736
- #### account
1737
-
1738
- > **account**: `undefined`
1739
-
1740
- The Account of the Client.
1741
-
1742
- #### batch?
1743
-
1744
- > `optional` **batch**: `object`
1745
-
1746
- Flags for batch settings.
1747
-
1748
- ##### batch.multicall?
1749
-
1750
- > `optional` **multicall**: `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
1751
-
1752
- Toggle to enable `eth_call` multicall aggregation.
1753
-
1754
- ###### Type Declaration
1755
-
1756
- `boolean`
1757
-
1758
- \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}
1759
-
1760
- #### cacheTime
1761
-
1762
- > **cacheTime**: `number`
1763
-
1764
- Time (in ms) that cached data will remain in memory.
1765
-
1766
- #### call()
1767
-
1768
- > **call**: (`parameters`) => `Promise`\<[`CallReturnType`](https://viem.sh/docs/index.html)\>
1769
-
1770
- Executes a new message call immediately without submitting a transaction to the network.
1771
-
1772
- - Docs: https://viem.sh/docs/actions/public/call
1773
- - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call)
1774
-
1775
- ##### Parameters
1776
-
1777
- ###### parameters
1778
-
1779
- [`CallParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>
1780
-
1781
- ##### Returns
1782
-
1783
- `Promise`\<[`CallReturnType`](https://viem.sh/docs/index.html)\>
1784
-
1785
- The call data. [CallReturnType](https://viem.sh/docs/index.html)
1786
-
1787
- ##### Example
1788
-
1789
- ```ts
1790
- import { createPublicClient, http } from 'viem'
1791
- import { mainnet } from 'viem/chains'
1792
-
1793
- const client = createPublicClient({
1794
- chain: mainnet,
1795
- transport: http(),
1796
- })
1797
- const data = await client.call({
1798
- account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1799
- data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1800
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1801
- })
1802
- ```
1803
-
1804
- #### ccipRead?
1805
-
1806
- > `optional` **ccipRead**: `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
1807
-
1808
- [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
1809
-
1810
- ##### Type Declaration
1811
-
1812
- `false`
1813
-
1814
- \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}
1815
-
1816
- #### chain
1817
-
1818
- > **chain**: [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
1819
-
1820
- Chain for the client.
1821
-
1822
- #### createAccessList()
1823
-
1824
- > **createAccessList**: (`parameters`) => `Promise`\<\{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `gasUsed`: `bigint`; \}\>
1825
-
1826
- Creates an EIP-2930 access list that you can include in a transaction.
1827
-
1828
- - Docs: https://viem.sh/docs/actions/public/createAccessList
1829
- - JSON-RPC Methods: `eth_createAccessList`
1830
-
1831
- ##### Parameters
1832
-
1833
- ###### parameters
1834
-
1835
- [`CreateAccessListParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>
1836
-
1837
- ##### Returns
1838
-
1839
- `Promise`\<\{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `gasUsed`: `bigint`; \}\>
1840
-
1841
- The call data. [CreateAccessListReturnType](https://viem.sh/docs/index.html)
1842
-
1843
- ##### Example
1844
-
1845
- ```ts
1846
- import { createPublicClient, http } from 'viem'
1847
- import { mainnet } from 'viem/chains'
1848
-
1849
- const client = createPublicClient({
1850
- chain: mainnet,
1851
- transport: http(),
1852
- })
1853
-
1854
- const data = await client.createAccessList({
1855
- data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1856
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1857
- })
1858
- ```
1859
-
1860
- #### createBlockFilter()
1861
-
1862
- > **createBlockFilter**: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${(...)}` ``[] \| [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>
1863
-
1864
- Creates a Filter to listen for new block hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
1865
-
1866
- - Docs: https://viem.sh/docs/actions/public/createBlockFilter
1867
- - JSON-RPC Methods: [`eth_newBlockFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newBlockFilter)
1868
-
1869
- ##### Returns
1870
-
1871
- `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${(...)}` ``[] \| [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>
1872
-
1873
- Filter. [CreateBlockFilterReturnType](https://viem.sh/docs/index.html)
1874
-
1875
- ##### Example
1876
-
1877
- ```ts
1878
- import { createPublicClient, createBlockFilter, http } from 'viem'
1879
- import { mainnet } from 'viem/chains'
1880
-
1881
- const client = createPublicClient({
1882
- chain: mainnet,
1883
- transport: http(),
1884
- })
1885
- const filter = await createBlockFilter(client)
1886
- // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
1887
- ```
1888
-
1889
- #### createContractEventFilter()
1890
-
1891
- > **createContractEventFilter**: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`CreateContractEventFilterReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>
1892
-
1893
- 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).
1894
-
1895
- - Docs: https://viem.sh/docs/contract/createContractEventFilter
1896
-
1897
- ##### Type Parameters
1898
-
1899
- ###### abi
1900
-
1901
- `abi` *extends* readonly `unknown`[] \| `Abi`
1902
-
1903
- ###### eventName
1904
-
1905
- `eventName` *extends* `string` \| `undefined`
1906
-
1907
- ###### args
1908
-
1909
- `args` *extends* readonly `unknown`[] \| `Record`\<`string`, `unknown`\> \| `undefined`
1910
-
1911
- ###### strict
1912
-
1913
- `strict` *extends* `boolean` \| `undefined` = `undefined`
1914
-
1915
- ###### fromBlock
1916
-
1917
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1918
-
1919
- ###### toBlock
1920
-
1921
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1922
-
1923
- ##### Parameters
1924
-
1925
- ###### args
1926
-
1927
- [`CreateContractEventFilterParameters`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>
1928
-
1929
- [CreateContractEventFilterParameters](https://viem.sh/docs/index.html)
1930
-
1931
- ##### Returns
1932
-
1933
- `Promise`\<[`CreateContractEventFilterReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>
1934
-
1935
- [`Filter`](https://viem.sh/docs/glossary/types#filter). [CreateContractEventFilterReturnType](https://viem.sh/docs/index.html)
1936
-
1937
- ##### Example
1938
-
1939
- ```ts
1940
- import { createPublicClient, http, parseAbi } from 'viem'
1941
- import { mainnet } from 'viem/chains'
1942
-
1943
- const client = createPublicClient({
1944
- chain: mainnet,
1945
- transport: http(),
1946
- })
1947
- const filter = await client.createContractEventFilter({
1948
- abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
1949
- })
1950
- ```
1951
-
1952
- #### createEventFilter()
1953
-
1954
- > **createEventFilter**: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>
1955
-
1956
- 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).
1957
-
1958
- - Docs: https://viem.sh/docs/actions/public/createEventFilter
1959
- - JSON-RPC Methods: [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter)
1960
-
1961
- ##### Type Parameters
1962
-
1963
- ###### abiEvent
1964
-
1965
- `abiEvent` *extends* `AbiEvent` \| `undefined` = `undefined`
1966
-
1967
- ###### abiEvents
1968
-
1969
- `abiEvents` *extends* readonly `unknown`[] \| readonly `AbiEvent`[] \| `undefined` = `abiEvent` *extends* `AbiEvent` ? \[`abiEvent`\<`abiEvent`\>\] : `undefined`
1970
-
1971
- ###### strict
1972
-
1973
- `strict` *extends* `boolean` \| `undefined` = `undefined`
1974
-
1975
- ###### fromBlock
1976
-
1977
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1978
-
1979
- ###### toBlock
1980
-
1981
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
1982
-
1983
- ###### _EventName
1984
-
1985
- `_EventName` *extends* `string` \| `undefined` = [`MaybeAbiEventName`](https://viem.sh/docs/index.html)\<`abiEvent`\>
1986
-
1987
- ###### _Args
1988
-
1989
- `_Args` *extends* readonly `unknown`[] \| `Record`\<`string`, `unknown`\> \| `undefined` = `undefined`
1990
-
1991
- ##### Parameters
1992
-
1993
- ###### args?
1994
-
1995
- [`CreateEventFilterParameters`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>
1996
-
1997
- [CreateEventFilterParameters](https://viem.sh/docs/index.html)
1998
-
1999
- ##### Returns
2000
-
2001
- `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>
2002
-
2003
- [`Filter`](https://viem.sh/docs/glossary/types#filter). [CreateEventFilterReturnType](https://viem.sh/docs/index.html)
2004
-
2005
- ##### Example
2006
-
2007
- ```ts
2008
- import { createPublicClient, http } from 'viem'
2009
- import { mainnet } from 'viem/chains'
2010
-
2011
- const client = createPublicClient({
2012
- chain: mainnet,
2013
- transport: http(),
2014
- })
2015
- const filter = await client.createEventFilter({
2016
- address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
2017
- })
2018
- ```
2019
-
2020
- #### createPendingTransactionFilter()
2021
-
2022
- > **createPendingTransactionFilter**: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${(...)}` ``[] \| [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>
2023
-
2024
- Creates a Filter to listen for new pending transaction hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
2025
-
2026
- - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter
2027
- - JSON-RPC Methods: [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter)
2028
-
2029
- ##### Returns
2030
-
2031
- `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${(...)}` ``[] \| [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: [`RpcLog`](https://viem.sh/docs/index.html)[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>
2032
-
2033
- [`Filter`](https://viem.sh/docs/glossary/types#filter). [CreateBlockFilterReturnType](https://viem.sh/docs/index.html)
2034
-
2035
- ##### Example
2036
-
2037
- ```ts
2038
- import { createPublicClient, http } from 'viem'
2039
- import { mainnet } from 'viem/chains'
2040
-
2041
- const client = createPublicClient({
2042
- chain: mainnet,
2043
- transport: http(),
2044
- })
2045
- const filter = await client.createPendingTransactionFilter()
2046
- // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
2047
- ```
2048
-
2049
- #### estimateContractGas()
2050
-
2051
- > **estimateContractGas**: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>
2052
-
2053
- Estimates the gas required to successfully execute a contract write function call.
2054
-
2055
- - Docs: https://viem.sh/docs/contract/estimateContractGas
2056
-
2057
- ##### Type Parameters
2058
-
2059
- ###### chain
2060
-
2061
- `chain` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
2062
-
2063
- ###### abi
2064
-
2065
- `abi` *extends* readonly `unknown`[] \| `Abi`
2066
-
2067
- ###### functionName
2068
-
2069
- `functionName` *extends* `string`
2070
-
2071
- ###### args
2072
-
2073
- `args` *extends* `unknown`
2074
-
2075
- ##### Parameters
2076
-
2077
- ###### args
2078
-
2079
- [`EstimateContractGasParameters`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, `chain`\>
2080
-
2081
- [EstimateContractGasParameters](https://viem.sh/docs/index.html)
2082
-
2083
- ##### Returns
2084
-
2085
- `Promise`\<`bigint`\>
2086
-
2087
- The gas estimate (in wei). [EstimateContractGasReturnType](https://viem.sh/docs/index.html)
2088
-
2089
- ##### Remarks
2090
-
2091
- 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).
2092
-
2093
- ##### Example
2094
-
2095
- ```ts
2096
- import { createPublicClient, http, parseAbi } from 'viem'
2097
- import { mainnet } from 'viem/chains'
2098
-
2099
- const client = createPublicClient({
2100
- chain: mainnet,
2101
- transport: http(),
2102
- })
2103
- const gas = await client.estimateContractGas({
2104
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2105
- abi: parseAbi(['function mint() public']),
2106
- functionName: 'mint',
2107
- account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
2108
- })
2109
- ```
2110
-
2111
- #### estimateFeesPerGas()
2112
-
2113
- > **estimateFeesPerGas**: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<[`EstimateFeesPerGasReturnType`](https://viem.sh/docs/index.html)\<`type`\>\>
2114
-
2115
- Returns an estimate for the fees per gas for a transaction to be included
2116
- in the next block.
2117
-
2118
- - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas
2119
-
2120
- ##### Type Parameters
2121
-
2122
- ###### chainOverride
2123
-
2124
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2125
-
2126
- ###### type
2127
-
2128
- `type` *extends* [`FeeValuesType`](https://viem.sh/docs/index.html) = `"eip1559"`
2129
-
2130
- ##### Parameters
2131
-
2132
- ###### args?
2133
-
2134
- [`EstimateFeesPerGasParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `type`\>
2135
-
2136
- ##### Returns
2137
-
2138
- `Promise`\<[`EstimateFeesPerGasReturnType`](https://viem.sh/docs/index.html)\<`type`\>\>
2139
-
2140
- An estimate (in wei) for the fees per gas. [EstimateFeesPerGasReturnType](https://viem.sh/docs/index.html)
2141
-
2142
- ##### Example
2143
-
2144
- ```ts
2145
- import { createPublicClient, http } from 'viem'
2146
- import { mainnet } from 'viem/chains'
2147
-
2148
- const client = createPublicClient({
2149
- chain: mainnet,
2150
- transport: http(),
2151
- })
2152
- const maxPriorityFeePerGas = await client.estimateFeesPerGas()
2153
- // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
2154
- ```
2155
-
2156
- #### estimateGas()
2157
-
2158
- > **estimateGas**: (`args`) => `Promise`\<`bigint`\>
2159
-
2160
- Estimates the gas necessary to complete a transaction without submitting it to the network.
2161
-
2162
- - Docs: https://viem.sh/docs/actions/public/estimateGas
2163
- - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
2164
-
2165
- ##### Parameters
2166
-
2167
- ###### args
2168
-
2169
- [`EstimateGasParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>
2170
-
2171
- [EstimateGasParameters](https://viem.sh/docs/index.html)
2172
-
2173
- ##### Returns
2174
-
2175
- `Promise`\<`bigint`\>
2176
-
2177
- The gas estimate (in wei). [EstimateGasReturnType](https://viem.sh/docs/index.html)
2178
-
2179
- ##### Example
2180
-
2181
- ```ts
2182
- import { createPublicClient, http, parseEther } from 'viem'
2183
- import { mainnet } from 'viem/chains'
2184
-
2185
- const client = createPublicClient({
2186
- chain: mainnet,
2187
- transport: http(),
2188
- })
2189
- const gasEstimate = await client.estimateGas({
2190
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2191
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2192
- value: parseEther('1'),
2193
- })
2194
- ```
2195
-
2196
- #### estimateMaxPriorityFeePerGas()
2197
-
2198
- > **estimateMaxPriorityFeePerGas**: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>
2199
-
2200
- Returns an estimate for the max priority fee per gas (in wei) for a transaction
2201
- to be included in the next block.
2202
-
2203
- - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas
2204
-
2205
- ##### Type Parameters
2206
-
2207
- ###### chainOverride
2208
-
2209
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2210
-
2211
- ##### Parameters
2212
-
2213
- ###### args?
2214
-
2215
- ###### chain
2216
-
2217
- `chainOverride` \| `null`
2218
-
2219
- ##### Returns
2220
-
2221
- `Promise`\<`bigint`\>
2222
-
2223
- An estimate (in wei) for the max priority fee per gas. [EstimateMaxPriorityFeePerGasReturnType](https://viem.sh/docs/index.html)
2224
-
2225
- ##### Example
2226
-
2227
- ```ts
2228
- import { createPublicClient, http } from 'viem'
2229
- import { mainnet } from 'viem/chains'
2230
-
2231
- const client = createPublicClient({
2232
- chain: mainnet,
2233
- transport: http(),
2234
- })
2235
- const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas()
2236
- // 10000000n
2237
- ```
2238
-
2239
- #### experimental\_blockTag?
2240
-
2241
- > `optional` **experimental\_blockTag**: [`BlockTag`](https://viem.sh/docs/index.html)
2242
-
2243
- Default block tag to use for RPC requests.
2244
-
2245
- #### extend()
2246
-
2247
- > **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`\>\>
2248
-
2249
- ##### Type Parameters
2250
-
2251
- ###### client
2252
-
2253
- `client` *extends* `object` & [`ExactPartial`](https://viem.sh/docs/index.html)\<[`ExtendableProtectedActions`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `undefined`\>\>
2254
-
2255
- ##### Parameters
2256
-
2257
- ###### fn
2258
-
2259
- (`client`) => `client`
2260
-
2261
- ##### Returns
2262
-
2263
- [`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`\>\>
2264
-
2265
- #### fillTransaction()
2266
-
2267
- > **fillTransaction**: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>
2268
-
2269
- Fills a transaction request with the necessary fields to be signed over.
2270
-
2271
- - Docs: https://viem.sh/docs/actions/public/fillTransaction
2272
-
2273
- ##### Type Parameters
2274
-
2275
- ###### chainOverride
2276
-
2277
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2278
-
2279
- ###### accountOverride
2280
-
2281
- `accountOverride` *extends* `` `0x${string}` `` \| [`Account`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2282
-
2283
- ##### Parameters
2284
-
2285
- ###### args
2286
-
2287
- [`FillTransactionParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `accountOverride`\>
2288
-
2289
- ##### Returns
2290
-
2291
- `Promise`\<[`FillTransactionReturnType`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`\>\>
2292
-
2293
- The filled transaction. [FillTransactionReturnType](https://viem.sh/docs/index.html)
2294
-
2295
- ##### Example
2296
-
2297
- ```ts
2298
- import { createPublicClient, http } from 'viem'
2299
- import { mainnet } from 'viem/chains'
2300
-
2301
- const client = createPublicClient({
2302
- chain: mainnet,
2303
- transport: http(),
2304
- })
2305
- const result = await client.fillTransaction({
2306
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2307
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
2308
- value: parseEther('1'),
2309
- })
2310
- ```
2311
-
2312
- #### getBalance()
2313
-
2314
- > **getBalance**: (`args`) => `Promise`\<`bigint`\>
2315
-
2316
- Returns the balance of an address in wei.
2317
-
2318
- - Docs: https://viem.sh/docs/actions/public/getBalance
2319
- - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)
2320
-
2321
- ##### Parameters
2322
-
2323
- ###### args
2324
-
2325
- [`GetBalanceParameters`](https://viem.sh/docs/index.html)
2326
-
2327
- [GetBalanceParameters](https://viem.sh/docs/index.html)
2328
-
2329
- ##### Returns
2330
-
2331
- `Promise`\<`bigint`\>
2332
-
2333
- The balance of the address in wei. [GetBalanceReturnType](https://viem.sh/docs/index.html)
2334
-
2335
- ##### Remarks
2336
-
2337
- You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther).
2338
-
2339
- ```ts
2340
- const balance = await getBalance(client, {
2341
- address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2342
- blockTag: 'safe'
2343
- })
2344
- const balanceAsEther = formatEther(balance)
2345
- // "6.942"
2346
- ```
2347
-
2348
- ##### Example
2349
-
2350
- ```ts
2351
- import { createPublicClient, http } from 'viem'
2352
- import { mainnet } from 'viem/chains'
2353
-
2354
- const client = createPublicClient({
2355
- chain: mainnet,
2356
- transport: http(),
2357
- })
2358
- const balance = await client.getBalance({
2359
- address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
2360
- })
2361
- // 10000000000000000000000n (wei)
2362
- ```
2363
-
2364
- #### getBlobBaseFee()
2365
-
2366
- > **getBlobBaseFee**: () => `Promise`\<`bigint`\>
2367
-
2368
- Returns the base fee per blob gas in wei.
2369
-
2370
- - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee
2371
- - JSON-RPC Methods: [`eth_blobBaseFee`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blobBaseFee)
2372
-
2373
- ##### Returns
2374
-
2375
- `Promise`\<`bigint`\>
2376
-
2377
- The blob base fee (in wei). [GetBlobBaseFeeReturnType](https://viem.sh/docs/index.html)
2378
-
2379
- ##### Example
2380
-
2381
- ```ts
2382
- import { createPublicClient, http } from 'viem'
2383
- import { mainnet } from 'viem/chains'
2384
- import { getBlobBaseFee } from 'viem/public'
2385
-
2386
- const client = createPublicClient({
2387
- chain: mainnet,
2388
- transport: http(),
2389
- })
2390
- const blobBaseFee = await client.getBlobBaseFee()
2391
- ```
2392
-
2393
- #### getBlock()
2394
-
2395
- > **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* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${(...)}` ``[]; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${(...)}` `` \| `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`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `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}` ``; \}\>
2396
-
2397
- Returns information about a block at a block number, hash, or tag.
2398
-
2399
- - Docs: https://viem.sh/docs/actions/public/getBlock
2400
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
2401
- - JSON-RPC Methods:
2402
- - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
2403
- - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
2404
-
2405
- ##### Type Parameters
2406
-
2407
- ###### includeTransactions
2408
-
2409
- `includeTransactions` *extends* `boolean` = `false`
2410
-
2411
- ###### blockTag
2412
-
2413
- `blockTag` *extends* [`BlockTag`](https://viem.sh/docs/index.html) = `"latest"`
2414
-
2415
- ##### Parameters
2416
-
2417
- ###### args?
2418
-
2419
- [`GetBlockParameters`](https://viem.sh/docs/index.html)\<`includeTransactions`, `blockTag`\>
2420
-
2421
- [GetBlockParameters](https://viem.sh/docs/index.html)
2422
-
2423
- ##### Returns
2424
-
2425
- `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* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${(...)}` ``[]; `blockHash`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${(...)}` `` \| `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`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `` `0x${(...)}` ``; `blockNumber`: ... *extends* ... ? ... : ... *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${(...)}` `` \| `null`; `transactionIndex`: ... *extends* ... ? ... : ... *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${(...)}` `` \| `null`; `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}` ``; \}\>
2426
-
2427
- Information about the block. [GetBlockReturnType](https://viem.sh/docs/index.html)
2428
-
2429
- ##### Example
2430
-
2431
- ```ts
2432
- import { createPublicClient, http } from 'viem'
2433
- import { mainnet } from 'viem/chains'
2434
-
2435
- const client = createPublicClient({
2436
- chain: mainnet,
2437
- transport: http(),
2438
- })
2439
- const block = await client.getBlock()
2440
- ```
2441
-
2442
- #### getBlockNumber()
2443
-
2444
- > **getBlockNumber**: (`args?`) => `Promise`\<`bigint`\>
2445
-
2446
- Returns the number of the most recent block seen.
2447
-
2448
- - Docs: https://viem.sh/docs/actions/public/getBlockNumber
2449
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
2450
- - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
2451
-
2452
- ##### Parameters
2453
-
2454
- ###### args?
2455
-
2456
- [`GetBlockNumberParameters`](https://viem.sh/docs/index.html)
2457
-
2458
- [GetBlockNumberParameters](https://viem.sh/docs/index.html)
2459
-
2460
- ##### Returns
2461
-
2462
- `Promise`\<`bigint`\>
2463
-
2464
- The number of the block. [GetBlockNumberReturnType](https://viem.sh/docs/index.html)
2465
-
2466
- ##### Example
2467
-
2468
- ```ts
2469
- import { createPublicClient, http } from 'viem'
2470
- import { mainnet } from 'viem/chains'
2471
-
2472
- const client = createPublicClient({
2473
- chain: mainnet,
2474
- transport: http(),
2475
- })
2476
- const blockNumber = await client.getBlockNumber()
2477
- // 69420n
2478
- ```
2479
-
2480
- #### getBlockTransactionCount()
2481
-
2482
- > **getBlockTransactionCount**: (`args?`) => `Promise`\<`number`\>
2483
-
2484
- Returns the number of Transactions at a block number, hash, or tag.
2485
-
2486
- - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount
2487
- - JSON-RPC Methods:
2488
- - Calls [`eth_getBlockTransactionCountByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber) for `blockNumber` & `blockTag`.
2489
- - Calls [`eth_getBlockTransactionCountByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash) for `blockHash`.
2490
-
2491
- ##### Parameters
2492
-
2493
- ###### args?
2494
-
2495
- [`GetBlockTransactionCountParameters`](https://viem.sh/docs/index.html)
2496
-
2497
- [GetBlockTransactionCountParameters](https://viem.sh/docs/index.html)
2498
-
2499
- ##### Returns
2500
-
2501
- `Promise`\<`number`\>
2502
-
2503
- The block transaction count. [GetBlockTransactionCountReturnType](https://viem.sh/docs/index.html)
2504
-
2505
- ##### Example
2506
-
2507
- ```ts
2508
- import { createPublicClient, http } from 'viem'
2509
- import { mainnet } from 'viem/chains'
2510
-
2511
- const client = createPublicClient({
2512
- chain: mainnet,
2513
- transport: http(),
2514
- })
2515
- const count = await client.getBlockTransactionCount()
2516
- ```
2517
-
2518
- #### ~~getBytecode()~~
2519
-
2520
- > **getBytecode**: (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
2521
-
2522
- ##### Parameters
2523
-
2524
- ###### args
2525
-
2526
- [`GetCodeParameters`](https://viem.sh/docs/index.html)
2527
-
2528
- ##### Returns
2529
-
2530
- `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
2531
-
2532
- ##### Deprecated
2533
-
2534
- Use `getCode` instead.
2535
-
2536
- #### getChainId()
2537
-
2538
- > **getChainId**: () => `Promise`\<`number`\>
2539
-
2540
- Returns the chain ID associated with the current network.
2541
-
2542
- - Docs: https://viem.sh/docs/actions/public/getChainId
2543
- - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
2544
-
2545
- ##### Returns
2546
-
2547
- `Promise`\<`number`\>
2548
-
2549
- The current chain ID. [GetChainIdReturnType](https://viem.sh/docs/index.html)
2550
-
2551
- ##### Example
2552
-
2553
- ```ts
2554
- import { createPublicClient, http } from 'viem'
2555
- import { mainnet } from 'viem/chains'
2556
-
2557
- const client = createPublicClient({
2558
- chain: mainnet,
2559
- transport: http(),
2560
- })
2561
- const chainId = await client.getChainId()
2562
- // 1
2563
- ```
2564
-
2565
- #### getCode()
2566
-
2567
- > **getCode**: (`args`) => `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
2568
-
2569
- Retrieves the bytecode at an address.
2570
-
2571
- - Docs: https://viem.sh/docs/contract/getCode
2572
- - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
2573
-
2574
- ##### Parameters
2575
-
2576
- ###### args
2577
-
2578
- [`GetCodeParameters`](https://viem.sh/docs/index.html)
2579
-
2580
- GetBytecodeParameters
2581
-
2582
- ##### Returns
2583
-
2584
- `Promise`\<[`GetCodeReturnType`](https://viem.sh/docs/index.html)\>
2585
-
2586
- The contract's bytecode. GetBytecodeReturnType
2587
-
2588
- ##### Example
2589
-
2590
- ```ts
2591
- import { createPublicClient, http } from 'viem'
2592
- import { mainnet } from 'viem/chains'
2593
-
2594
- const client = createPublicClient({
2595
- chain: mainnet,
2596
- transport: http(),
2597
- })
2598
- const code = await client.getCode({
2599
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2600
- })
2601
- ```
2602
-
2603
- #### getContractEvents()
2604
-
2605
- > **getContractEvents**: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetContractEventsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
2606
-
2607
- Returns a list of event logs emitted by a contract.
2608
-
2609
- - Docs: https://viem.sh/docs/actions/public/getContractEvents
2610
- - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
2611
-
2612
- ##### Type Parameters
2613
-
2614
- ###### abi
2615
-
2616
- `abi` *extends* readonly `unknown`[] \| `Abi`
2617
-
2618
- ###### eventName
2619
-
2620
- `eventName` *extends* `string` \| `undefined` = `undefined`
2621
-
2622
- ###### strict
2623
-
2624
- `strict` *extends* `boolean` \| `undefined` = `undefined`
2625
-
2626
- ###### fromBlock
2627
-
2628
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2629
-
2630
- ###### toBlock
2631
-
2632
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
2633
-
2634
- ##### Parameters
2635
-
2636
- ###### args
2637
-
2638
- [`GetContractEventsParameters`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>
2639
-
2640
- ##### Returns
2641
-
2642
- `Promise`\<[`GetContractEventsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
2643
-
2644
- A list of event logs. [GetContractEventsReturnType](https://viem.sh/docs/index.html)
2645
-
2646
- ##### Example
2647
-
2648
- ```ts
2649
- import { createPublicClient, http } from 'viem'
2650
- import { mainnet } from 'viem/chains'
2651
- import { wagmiAbi } from './abi'
2652
-
2653
- const client = createPublicClient({
2654
- chain: mainnet,
2655
- transport: http(),
2656
- })
2657
- const logs = await client.getContractEvents(client, {
2658
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
2659
- abi: wagmiAbi,
2660
- eventName: 'Transfer'
2661
- })
2662
- ```
2663
-
2664
- #### getEip712Domain()
2665
-
2666
- > **getEip712Domain**: (`args`) => `Promise`\<[`GetEip712DomainReturnType`](https://viem.sh/docs/index.html)\>
2667
-
2668
- Reads the EIP-712 domain from a contract, based on the ERC-5267 specification.
2669
-
2670
- ##### Parameters
2671
-
2672
- ###### args
2673
-
2674
- [`GetEip712DomainParameters`](https://viem.sh/docs/index.html)
2675
-
2676
- ##### Returns
2677
-
2678
- `Promise`\<[`GetEip712DomainReturnType`](https://viem.sh/docs/index.html)\>
2679
-
2680
- The EIP-712 domain, fields, and extensions. [GetEip712DomainReturnType](https://viem.sh/docs/index.html)
2681
-
2682
- ##### Example
2683
-
2684
- ```ts
2685
- import { createPublicClient, http } from 'viem'
2686
- import { mainnet } from 'viem/chains'
2687
-
2688
- const client = createPublicClient({
2689
- chain: mainnet,
2690
- transport: http(),
2691
- })
2692
-
2693
- const domain = await client.getEip712Domain({
2694
- address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
2695
- })
2696
- // {
2697
- // domain: {
2698
- // name: 'ExampleContract',
2699
- // version: '1',
2700
- // chainId: 1,
2701
- // verifyingContract: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
2702
- // },
2703
- // fields: '0x0f',
2704
- // extensions: [],
2705
- // }
2706
- ```
2707
-
2708
- #### getEnsAddress()
2709
-
2710
- > **getEnsAddress**: (`args`) => `Promise`\<[`GetEnsAddressReturnType`](https://viem.sh/docs/index.html)\>
2711
-
2712
- Gets address for ENS name.
2713
-
2714
- - Docs: https://viem.sh/docs/ens/actions/getEnsAddress
2715
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
2716
-
2717
- ##### Parameters
2718
-
2719
- ###### args
2720
-
2721
- [GetEnsAddressParameters](https://viem.sh/docs/index.html)
2722
-
2723
- ###### blockNumber?
2724
-
2725
- `bigint`
2726
-
2727
- The balance of the account at a block number.
2728
-
2729
- ###### blockTag?
2730
-
2731
- [`BlockTag`](https://viem.sh/docs/index.html)
2732
-
2733
- The balance of the account at a block tag.
2734
-
2735
- **Default**
2736
-
2737
- ```ts
2738
- 'latest'
2739
- ```
2740
-
2741
- ###### coinType?
2742
-
2743
- `bigint`
2744
-
2745
- ENSIP-9 compliant coinType (chain) to get ENS address for.
2746
-
2747
- To get the `coinType` for a chain id, use the `toCoinType` function:
2748
- ```ts
2749
- import { toCoinType } from 'viem'
2750
- import { base } from 'viem/chains'
2751
-
2752
- const coinType = toCoinType(base.id)
2753
- ```
2754
-
2755
- **Default**
2756
-
2757
- ```ts
2758
- 60n
2759
- ```
2760
-
2761
- ###### gatewayUrls?
2762
-
2763
- `string`[]
2764
-
2765
- Universal Resolver gateway URLs to use for resolving CCIP-read requests.
2766
-
2767
- ###### name
2768
-
2769
- `string`
2770
-
2771
- Name to get the address for.
2772
-
2773
- ###### strict?
2774
-
2775
- `boolean`
2776
-
2777
- Whether or not to throw errors propagated from the ENS Universal Resolver Contract.
2778
-
2779
- ###### universalResolverAddress?
2780
-
2781
- `` `0x${string}` ``
2782
-
2783
- Address of ENS Universal Resolver Contract.
2784
-
2785
- ##### Returns
2786
-
2787
- `Promise`\<[`GetEnsAddressReturnType`](https://viem.sh/docs/index.html)\>
2788
-
2789
- Address for ENS name or `null` if not found. [GetEnsAddressReturnType](https://viem.sh/docs/index.html)
2790
-
2791
- ##### Remarks
2792
-
2793
- Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
2794
-
2795
- 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.
2796
-
2797
- ##### Example
2798
-
2799
- ```ts
2800
- import { createPublicClient, http } from 'viem'
2801
- import { mainnet } from 'viem/chains'
2802
- import { normalize } from 'viem/ens'
2803
-
2804
- const client = createPublicClient({
2805
- chain: mainnet,
2806
- transport: http(),
2807
- })
2808
- const ensAddress = await client.getEnsAddress({
2809
- name: normalize('wevm.eth'),
2810
- })
2811
- // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
2812
- ```
2813
-
2814
- #### getEnsAvatar()
2815
-
2816
- > **getEnsAvatar**: (`args`) => `Promise`\<[`GetEnsAvatarReturnType`](https://viem.sh/docs/index.html)\>
2817
-
2818
- Gets the avatar of an ENS name.
2819
-
2820
- - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar
2821
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
2822
-
2823
- ##### Parameters
2824
-
2825
- ###### args
2826
-
2827
- [GetEnsAvatarParameters](https://viem.sh/docs/index.html)
2828
-
2829
- ###### assetGatewayUrls?
2830
-
2831
- [`AssetGatewayUrls`](https://viem.sh/docs/index.html)
2832
-
2833
- Gateway urls to resolve IPFS and/or Arweave assets.
2834
-
2835
- ###### blockNumber?
2836
-
2837
- `bigint`
2838
-
2839
- The balance of the account at a block number.
2840
-
2841
- ###### blockTag?
2842
-
2843
- [`BlockTag`](https://viem.sh/docs/index.html)
2844
-
2845
- The balance of the account at a block tag.
2846
-
2847
- **Default**
2848
-
2849
- ```ts
2850
- 'latest'
2851
- ```
2852
-
2853
- ###### gatewayUrls?
2854
-
2855
- `string`[]
2856
-
2857
- Universal Resolver gateway URLs to use for resolving CCIP-read requests.
2858
-
2859
- ###### name
2860
-
2861
- `string`
2862
-
2863
- ENS name to get Text for.
2864
-
2865
- ###### strict?
2866
-
2867
- `boolean`
2868
-
2869
- Whether or not to throw errors propagated from the ENS Universal Resolver Contract.
2870
-
2871
- ###### universalResolverAddress?
2872
-
2873
- `` `0x${string}` ``
2874
-
2875
- Address of ENS Universal Resolver Contract.
2876
-
2877
- ##### Returns
2878
-
2879
- `Promise`\<[`GetEnsAvatarReturnType`](https://viem.sh/docs/index.html)\>
2880
-
2881
- Avatar URI or `null` if not found. [GetEnsAvatarReturnType](https://viem.sh/docs/index.html)
2882
-
2883
- ##### Remarks
2884
-
2885
- Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText) with `key` set to `'avatar'`.
2886
-
2887
- 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.
2888
-
2889
- ##### Example
2890
-
2891
- ```ts
2892
- import { createPublicClient, http } from 'viem'
2893
- import { mainnet } from 'viem/chains'
2894
- import { normalize } from 'viem/ens'
2895
-
2896
- const client = createPublicClient({
2897
- chain: mainnet,
2898
- transport: http(),
2899
- })
2900
- const ensAvatar = await client.getEnsAvatar({
2901
- name: normalize('wevm.eth'),
2902
- })
2903
- // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
2904
- ```
2905
-
2906
- #### getEnsName()
2907
-
2908
- > **getEnsName**: (`args`) => `Promise`\<[`GetEnsNameReturnType`](https://viem.sh/docs/index.html)\>
2909
-
2910
- Gets primary name for specified address.
2911
-
2912
- - Docs: https://viem.sh/docs/ens/actions/getEnsName
2913
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
2914
-
2915
- ##### Parameters
2916
-
2917
- ###### args
2918
-
2919
- [GetEnsNameParameters](https://viem.sh/docs/index.html)
2920
-
2921
- ###### address
2922
-
2923
- `` `0x${string}` ``
2924
-
2925
- Address to get ENS name for.
2926
-
2927
- ###### blockNumber?
2928
-
2929
- `bigint`
2930
-
2931
- The balance of the account at a block number.
2932
-
2933
- ###### blockTag?
2934
-
2935
- [`BlockTag`](https://viem.sh/docs/index.html)
2936
-
2937
- The balance of the account at a block tag.
2938
-
2939
- **Default**
2940
-
2941
- ```ts
2942
- 'latest'
2943
- ```
2944
-
2945
- ###### coinType?
2946
-
2947
- `bigint`
2948
-
2949
- ENSIP-9 compliant coinType (chain) to get ENS name for.
2950
-
2951
- To get the `coinType` for a chain id, use the `toCoinType` function:
2952
- ```ts
2953
- import { toCoinType } from 'viem'
2954
- import { base } from 'viem/chains'
2955
-
2956
- const coinType = toCoinType(base.id)
2957
- ```
2958
-
2959
- **Default**
2960
-
2961
- ```ts
2962
- 60n
2963
- ```
2964
-
2965
- ###### gatewayUrls?
2966
-
2967
- `string`[]
2968
-
2969
- Universal Resolver gateway URLs to use for resolving CCIP-read requests.
2970
-
2971
- ###### strict?
2972
-
2973
- `boolean`
2974
-
2975
- Whether or not to throw errors propagated from the ENS Universal Resolver Contract.
2976
-
2977
- ###### universalResolverAddress?
2978
-
2979
- `` `0x${string}` ``
2980
-
2981
- Address of ENS Universal Resolver Contract.
2982
-
2983
- ##### Returns
2984
-
2985
- `Promise`\<[`GetEnsNameReturnType`](https://viem.sh/docs/index.html)\>
2986
-
2987
- Name or `null` if not found. [GetEnsNameReturnType](https://viem.sh/docs/index.html)
2988
-
2989
- ##### Remarks
2990
-
2991
- Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
2992
-
2993
- ##### Example
2994
-
2995
- ```ts
2996
- import { createPublicClient, http } from 'viem'
2997
- import { mainnet } from 'viem/chains'
2998
-
2999
- const client = createPublicClient({
3000
- chain: mainnet,
3001
- transport: http(),
3002
- })
3003
- const ensName = await client.getEnsName({
3004
- address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
3005
- })
3006
- // 'wevm.eth'
3007
- ```
3008
-
3009
- #### getEnsResolver()
3010
-
3011
- > **getEnsResolver**: (`args`) => `Promise`\<`` `0x${string}` ``\>
3012
-
3013
- Gets resolver for ENS name.
3014
-
3015
- - Docs: https://viem.sh/docs/ens/actions/getEnsResolver
3016
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
3017
-
3018
- ##### Parameters
3019
-
3020
- ###### args
3021
-
3022
- [GetEnsResolverParameters](https://viem.sh/docs/index.html)
3023
-
3024
- ###### blockNumber?
3025
-
3026
- `bigint`
3027
-
3028
- The balance of the account at a block number.
3029
-
3030
- ###### blockTag?
3031
-
3032
- [`BlockTag`](https://viem.sh/docs/index.html)
3033
-
3034
- The balance of the account at a block tag.
3035
-
3036
- **Default**
3037
-
3038
- ```ts
3039
- 'latest'
3040
- ```
3041
-
3042
- ###### name
3043
-
3044
- `string`
3045
-
3046
- Name to get the address for.
3047
-
3048
- ###### universalResolverAddress?
3049
-
3050
- `` `0x${string}` ``
3051
-
3052
- Address of ENS Universal Resolver Contract.
3053
-
3054
- ##### Returns
3055
-
3056
- `Promise`\<`` `0x${string}` ``\>
3057
-
3058
- Address for ENS resolver. [GetEnsResolverReturnType](https://viem.sh/docs/index.html)
3059
-
3060
- ##### Remarks
3061
-
3062
- Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
3063
-
3064
- 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.
3065
-
3066
- ##### Example
3067
-
3068
- ```ts
3069
- import { createPublicClient, http } from 'viem'
3070
- import { mainnet } from 'viem/chains'
3071
- import { normalize } from 'viem/ens'
3072
-
3073
- const client = createPublicClient({
3074
- chain: mainnet,
3075
- transport: http(),
3076
- })
3077
- const resolverAddress = await client.getEnsResolver({
3078
- name: normalize('wevm.eth'),
3079
- })
3080
- // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
3081
- ```
3082
-
3083
- #### getEnsText()
3084
-
3085
- > **getEnsText**: (`args`) => `Promise`\<[`GetEnsTextReturnType`](https://viem.sh/docs/index.html)\>
3086
-
3087
- Gets a text record for specified ENS name.
3088
-
3089
- - Docs: https://viem.sh/docs/ens/actions/getEnsResolver
3090
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
3091
-
3092
- ##### Parameters
3093
-
3094
- ###### args
3095
-
3096
- [GetEnsTextParameters](https://viem.sh/docs/index.html)
3097
-
3098
- ###### blockNumber?
3099
-
3100
- `bigint`
3101
-
3102
- The balance of the account at a block number.
3103
-
3104
- ###### blockTag?
3105
-
3106
- [`BlockTag`](https://viem.sh/docs/index.html)
3107
-
3108
- The balance of the account at a block tag.
3109
-
3110
- **Default**
3111
-
3112
- ```ts
3113
- 'latest'
3114
- ```
3115
-
3116
- ###### gatewayUrls?
3117
-
3118
- `string`[]
3119
-
3120
- Universal Resolver gateway URLs to use for resolving CCIP-read requests.
3121
-
3122
- ###### key
3123
-
3124
- `string`
3125
-
3126
- Text record to retrieve.
3127
-
3128
- ###### name
3129
-
3130
- `string`
3131
-
3132
- ENS name to get Text for.
3133
-
3134
- ###### strict?
3135
-
3136
- `boolean`
3137
-
3138
- Whether or not to throw errors propagated from the ENS Universal Resolver Contract.
3139
-
3140
- ###### universalResolverAddress?
3141
-
3142
- `` `0x${string}` ``
3143
-
3144
- Address of ENS Universal Resolver Contract.
3145
-
3146
- ##### Returns
3147
-
3148
- `Promise`\<[`GetEnsTextReturnType`](https://viem.sh/docs/index.html)\>
3149
-
3150
- Address for ENS resolver. [GetEnsTextReturnType](https://viem.sh/docs/index.html)
3151
-
3152
- ##### Remarks
3153
-
3154
- Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
3155
-
3156
- 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.
3157
-
3158
- ##### Example
3159
-
3160
- ```ts
3161
- import { createPublicClient, http } from 'viem'
3162
- import { mainnet } from 'viem/chains'
3163
- import { normalize } from 'viem/ens'
3164
-
3165
- const client = createPublicClient({
3166
- chain: mainnet,
3167
- transport: http(),
3168
- })
3169
- const twitterRecord = await client.getEnsText({
3170
- name: normalize('wevm.eth'),
3171
- key: 'com.twitter',
3172
- })
3173
- // 'wevm_dev'
3174
- ```
3175
-
3176
- #### getFeeHistory()
3177
-
3178
- > **getFeeHistory**: (`args`) => `Promise`\<[`GetFeeHistoryReturnType`](https://viem.sh/docs/index.html)\>
3179
-
3180
- Returns a collection of historical gas information.
3181
-
3182
- - Docs: https://viem.sh/docs/actions/public/getFeeHistory
3183
- - JSON-RPC Methods: [`eth_feeHistory`](https://docs.alchemy.com/reference/eth-feehistory)
3184
-
3185
- ##### Parameters
3186
-
3187
- ###### args
3188
-
3189
- [`GetFeeHistoryParameters`](https://viem.sh/docs/index.html)
3190
-
3191
- [GetFeeHistoryParameters](https://viem.sh/docs/index.html)
3192
-
3193
- ##### Returns
3194
-
3195
- `Promise`\<[`GetFeeHistoryReturnType`](https://viem.sh/docs/index.html)\>
3196
-
3197
- The gas estimate (in wei). [GetFeeHistoryReturnType](https://viem.sh/docs/index.html)
3198
-
3199
- ##### Example
3200
-
3201
- ```ts
3202
- import { createPublicClient, http } from 'viem'
3203
- import { mainnet } from 'viem/chains'
3204
-
3205
- const client = createPublicClient({
3206
- chain: mainnet,
3207
- transport: http(),
3208
- })
3209
- const feeHistory = await client.getFeeHistory({
3210
- blockCount: 4,
3211
- rewardPercentiles: [25, 75],
3212
- })
3213
- ```
3214
-
3215
- #### getFilterChanges()
3216
-
3217
- > **getFilterChanges**: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterChangesReturnType`](https://viem.sh/docs/index.html)\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
3218
-
3219
- Returns a list of logs or hashes based on a [Filter](/docs/glossary/terms#filter) since the last time it was called.
3220
-
3221
- - Docs: https://viem.sh/docs/actions/public/getFilterChanges
3222
- - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges)
3223
-
3224
- ##### Type Parameters
3225
-
3226
- ###### filterType
3227
-
3228
- `filterType` *extends* [`FilterType`](https://viem.sh/docs/index.html)
3229
-
3230
- ###### abi
3231
-
3232
- `abi` *extends* readonly `unknown`[] \| `Abi` \| `undefined`
3233
-
3234
- ###### eventName
3235
-
3236
- `eventName` *extends* `string` \| `undefined`
3237
-
3238
- ###### strict
3239
-
3240
- `strict` *extends* `boolean` \| `undefined` = `undefined`
3241
-
3242
- ###### fromBlock
3243
-
3244
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3245
-
3246
- ###### toBlock
3247
-
3248
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3249
-
3250
- ##### Parameters
3251
-
3252
- ###### args
3253
-
3254
- [`GetFilterChangesParameters`](https://viem.sh/docs/index.html)\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>
3255
-
3256
- [GetFilterChangesParameters](https://viem.sh/docs/index.html)
3257
-
3258
- ##### Returns
3259
-
3260
- `Promise`\<[`GetFilterChangesReturnType`](https://viem.sh/docs/index.html)\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
3261
-
3262
- Logs or hashes. [GetFilterChangesReturnType](https://viem.sh/docs/index.html)
3263
-
3264
- ##### Remarks
3265
-
3266
- A Filter can be created from the following actions:
3267
-
3268
- - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
3269
- - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter)
3270
- - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
3271
- - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
3272
-
3273
- Depending on the type of filter, the return value will be different:
3274
-
3275
- - If the filter was created with `createContractEventFilter` or `createEventFilter`, it returns a list of logs.
3276
- - If the filter was created with `createPendingTransactionFilter`, it returns a list of transaction hashes.
3277
- - If the filter was created with `createBlockFilter`, it returns a list of block hashes.
3278
-
3279
- ##### Examples
3280
-
3281
- ```ts
3282
- // Blocks
3283
- import { createPublicClient, http } from 'viem'
3284
- import { mainnet } from 'viem/chains'
3285
-
3286
- const client = createPublicClient({
3287
- chain: mainnet,
3288
- transport: http(),
3289
- })
3290
- const filter = await client.createBlockFilter()
3291
- const hashes = await client.getFilterChanges({ filter })
3292
- ```
3293
-
3294
- ```ts
3295
- // Contract Events
3296
- import { createPublicClient, http, parseAbi } from 'viem'
3297
- import { mainnet } from 'viem/chains'
3298
-
3299
- const client = createPublicClient({
3300
- chain: mainnet,
3301
- transport: http(),
3302
- })
3303
- const filter = await client.createContractEventFilter({
3304
- address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3305
- abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
3306
- eventName: 'Transfer',
3307
- })
3308
- const logs = await client.getFilterChanges({ filter })
3309
- ```
3310
-
3311
- ```ts
3312
- // Raw Events
3313
- import { createPublicClient, http, parseAbiItem } from 'viem'
3314
- import { mainnet } from 'viem/chains'
3315
-
3316
- const client = createPublicClient({
3317
- chain: mainnet,
3318
- transport: http(),
3319
- })
3320
- const filter = await client.createEventFilter({
3321
- address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3322
- event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
3323
- })
3324
- const logs = await client.getFilterChanges({ filter })
3325
- ```
3326
-
3327
- ```ts
3328
- // Transactions
3329
- import { createPublicClient, http } from 'viem'
3330
- import { mainnet } from 'viem/chains'
3331
-
3332
- const client = createPublicClient({
3333
- chain: mainnet,
3334
- transport: http(),
3335
- })
3336
- const filter = await client.createPendingTransactionFilter()
3337
- const hashes = await client.getFilterChanges({ filter })
3338
- ```
3339
-
3340
- #### getFilterLogs()
3341
-
3342
- > **getFilterLogs**: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<[`GetFilterLogsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
3343
-
3344
- Returns a list of event logs since the filter was created.
3345
-
3346
- - Docs: https://viem.sh/docs/actions/public/getFilterLogs
3347
- - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs)
3348
-
3349
- ##### Type Parameters
3350
-
3351
- ###### abi
3352
-
3353
- `abi` *extends* readonly `unknown`[] \| `Abi` \| `undefined`
3354
-
3355
- ###### eventName
3356
-
3357
- `eventName` *extends* `string` \| `undefined`
3358
-
3359
- ###### strict
3360
-
3361
- `strict` *extends* `boolean` \| `undefined` = `undefined`
3362
-
3363
- ###### fromBlock
3364
-
3365
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3366
-
3367
- ###### toBlock
3368
-
3369
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3370
-
3371
- ##### Parameters
3372
-
3373
- ###### args
3374
-
3375
- [`GetFilterLogsParameters`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>
3376
-
3377
- [GetFilterLogsParameters](https://viem.sh/docs/index.html)
3378
-
3379
- ##### Returns
3380
-
3381
- `Promise`\<[`GetFilterLogsReturnType`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>
3382
-
3383
- A list of event logs. [GetFilterLogsReturnType](https://viem.sh/docs/index.html)
3384
-
3385
- ##### Remarks
3386
-
3387
- `getFilterLogs` is only compatible with **event filters**.
3388
-
3389
- ##### Example
3390
-
3391
- ```ts
3392
- import { createPublicClient, http, parseAbiItem } from 'viem'
3393
- import { mainnet } from 'viem/chains'
3394
-
3395
- const client = createPublicClient({
3396
- chain: mainnet,
3397
- transport: http(),
3398
- })
3399
- const filter = await client.createEventFilter({
3400
- address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3401
- event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
3402
- })
3403
- const logs = await client.getFilterLogs({ filter })
3404
- ```
3405
-
3406
- #### getGasPrice()
3407
-
3408
- > **getGasPrice**: () => `Promise`\<`bigint`\>
3409
-
3410
- Returns the current price of gas (in wei).
3411
-
3412
- - Docs: https://viem.sh/docs/actions/public/getGasPrice
3413
- - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice)
3414
-
3415
- ##### Returns
3416
-
3417
- `Promise`\<`bigint`\>
3418
-
3419
- The gas price (in wei). [GetGasPriceReturnType](https://viem.sh/docs/index.html)
3420
-
3421
- ##### Example
3422
-
3423
- ```ts
3424
- import { createPublicClient, http } from 'viem'
3425
- import { mainnet } from 'viem/chains'
3426
-
3427
- const client = createPublicClient({
3428
- chain: mainnet,
3429
- transport: http(),
3430
- })
3431
- const gasPrice = await client.getGasPrice()
3432
- ```
3433
-
3434
- #### getLogs()
3435
-
3436
- > **getLogs**: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<[`GetLogsReturnType`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>
3437
-
3438
- Returns a list of event logs matching the provided parameters.
3439
-
3440
- - Docs: https://viem.sh/docs/actions/public/getLogs
3441
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs
3442
- - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
3443
-
3444
- ##### Type Parameters
3445
-
3446
- ###### abiEvent
3447
-
3448
- `abiEvent` *extends* `AbiEvent` \| `undefined` = `undefined`
3449
-
3450
- ###### abiEvents
3451
-
3452
- `abiEvents` *extends* readonly `unknown`[] \| readonly `AbiEvent`[] \| `undefined` = `abiEvent` *extends* `AbiEvent` ? \[`abiEvent`\<`abiEvent`\>\] : `undefined`
3453
-
3454
- ###### strict
3455
-
3456
- `strict` *extends* `boolean` \| `undefined` = `undefined`
3457
-
3458
- ###### fromBlock
3459
-
3460
- `fromBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3461
-
3462
- ###### toBlock
3463
-
3464
- `toBlock` *extends* `bigint` \| [`BlockTag`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3465
-
3466
- ##### Parameters
3467
-
3468
- ###### args?
3469
-
3470
- [`GetLogsParameters`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>
3471
-
3472
- [GetLogsParameters](https://viem.sh/docs/index.html)
3473
-
3474
- ##### Returns
3475
-
3476
- `Promise`\<[`GetLogsReturnType`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>
3477
-
3478
- A list of event logs. [GetLogsReturnType](https://viem.sh/docs/index.html)
3479
-
3480
- ##### Example
3481
-
3482
- ```ts
3483
- import { createPublicClient, http, parseAbiItem } from 'viem'
3484
- import { mainnet } from 'viem/chains'
3485
-
3486
- const client = createPublicClient({
3487
- chain: mainnet,
3488
- transport: http(),
3489
- })
3490
- const logs = await client.getLogs()
3491
- ```
3492
-
3493
- #### getProof()
3494
-
3495
- > **getProof**: (`args`) => `Promise`\<[`GetProofReturnType`](https://viem.sh/docs/index.html)\>
3496
-
3497
- Returns the account and storage values of the specified account including the Merkle-proof.
3498
-
3499
- - Docs: https://viem.sh/docs/actions/public/getProof
3500
- - JSON-RPC Methods:
3501
- - Calls [`eth_getProof`](https://eips.ethereum.org/EIPS/eip-1186)
3502
-
3503
- ##### Parameters
3504
-
3505
- ###### args
3506
-
3507
- [`GetProofParameters`](https://viem.sh/docs/index.html)
3508
-
3509
- ##### Returns
3510
-
3511
- `Promise`\<[`GetProofReturnType`](https://viem.sh/docs/index.html)\>
3512
-
3513
- Proof data. [GetProofReturnType](https://viem.sh/docs/index.html)
3514
-
3515
- ##### Example
3516
-
3517
- ```ts
3518
- import { createPublicClient, http } from 'viem'
3519
- import { mainnet } from 'viem/chains'
3520
-
3521
- const client = createPublicClient({
3522
- chain: mainnet,
3523
- transport: http(),
3524
- })
3525
- const block = await client.getProof({
3526
- address: '0x...',
3527
- storageKeys: ['0x...'],
3528
- })
3529
- ```
3530
-
3531
- #### getStorageAt()
3532
-
3533
- > **getStorageAt**: (`args`) => `Promise`\<[`GetStorageAtReturnType`](https://viem.sh/docs/index.html)\>
3534
-
3535
- Returns the value from a storage slot at a given address.
3536
-
3537
- - Docs: https://viem.sh/docs/contract/getStorageAt
3538
- - JSON-RPC Methods: [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat)
3539
-
3540
- ##### Parameters
3541
-
3542
- ###### args
3543
-
3544
- [`GetStorageAtParameters`](https://viem.sh/docs/index.html)
3545
-
3546
- [GetStorageAtParameters](https://viem.sh/docs/index.html)
3547
-
3548
- ##### Returns
3549
-
3550
- `Promise`\<[`GetStorageAtReturnType`](https://viem.sh/docs/index.html)\>
3551
-
3552
- The value of the storage slot. [GetStorageAtReturnType](https://viem.sh/docs/index.html)
3553
-
3554
- ##### Example
3555
-
3556
- ```ts
3557
- import { createPublicClient, http } from 'viem'
3558
- import { mainnet } from 'viem/chains'
3559
- import { getStorageAt } from 'viem/contract'
3560
-
3561
- const client = createPublicClient({
3562
- chain: mainnet,
3563
- transport: http(),
3564
- })
3565
- const code = await client.getStorageAt({
3566
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
3567
- slot: toHex(0),
3568
- })
3569
- ```
3570
-
3571
- #### getTransaction()
3572
-
3573
- > **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`; \}\>
3574
-
3575
- Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
3576
-
3577
- - Docs: https://viem.sh/docs/actions/public/getTransaction
3578
- - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
3579
- - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
3580
-
3581
- ##### Type Parameters
3582
-
3583
- ###### blockTag
3584
-
3585
- `blockTag` *extends* [`BlockTag`](https://viem.sh/docs/index.html) = `"latest"`
3586
-
3587
- ##### Parameters
3588
-
3589
- ###### args
3590
-
3591
- [`GetTransactionParameters`](https://viem.sh/docs/index.html)\<`blockTag`\>
3592
-
3593
- [GetTransactionParameters](https://viem.sh/docs/index.html)
3594
-
3595
- ##### Returns
3596
-
3597
- `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`; \}\>
3598
-
3599
- The transaction information. [GetTransactionReturnType](https://viem.sh/docs/index.html)
3600
-
3601
- ##### Example
3602
-
3603
- ```ts
3604
- import { createPublicClient, http } from 'viem'
3605
- import { mainnet } from 'viem/chains'
3606
-
3607
- const client = createPublicClient({
3608
- chain: mainnet,
3609
- transport: http(),
3610
- })
3611
- const transaction = await client.getTransaction({
3612
- hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
3613
- })
3614
- ```
3615
-
3616
- #### getTransactionConfirmations()
3617
-
3618
- > **getTransactionConfirmations**: (`args`) => `Promise`\<`bigint`\>
3619
-
3620
- Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
3621
-
3622
- - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations
3623
- - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
3624
- - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
3625
-
3626
- ##### Parameters
3627
-
3628
- ###### args
3629
-
3630
- [`GetTransactionConfirmationsParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>
3631
-
3632
- [GetTransactionConfirmationsParameters](https://viem.sh/docs/index.html)
3633
-
3634
- ##### Returns
3635
-
3636
- `Promise`\<`bigint`\>
3637
-
3638
- The number of blocks passed since the transaction was processed. If confirmations is 0, then the Transaction has not been confirmed & processed yet. [GetTransactionConfirmationsReturnType](https://viem.sh/docs/index.html)
3639
-
3640
- ##### Example
3641
-
3642
- ```ts
3643
- import { createPublicClient, http } from 'viem'
3644
- import { mainnet } from 'viem/chains'
3645
-
3646
- const client = createPublicClient({
3647
- chain: mainnet,
3648
- transport: http(),
3649
- })
3650
- const confirmations = await client.getTransactionConfirmations({
3651
- hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
3652
- })
3653
- ```
3654
-
3655
- #### getTransactionCount()
3656
-
3657
- > **getTransactionCount**: (`args`) => `Promise`\<`number`\>
3658
-
3659
- Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent.
3660
-
3661
- - Docs: https://viem.sh/docs/actions/public/getTransactionCount
3662
- - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
3663
-
3664
- ##### Parameters
3665
-
3666
- ###### args
3667
-
3668
- [`GetTransactionCountParameters`](https://viem.sh/docs/index.html)
3669
-
3670
- [GetTransactionCountParameters](https://viem.sh/docs/index.html)
3671
-
3672
- ##### Returns
3673
-
3674
- `Promise`\<`number`\>
3675
-
3676
- The number of transactions an account has sent. [GetTransactionCountReturnType](https://viem.sh/docs/index.html)
3677
-
3678
- ##### Example
3679
-
3680
- ```ts
3681
- import { createPublicClient, http } from 'viem'
3682
- import { mainnet } from 'viem/chains'
3683
-
3684
- const client = createPublicClient({
3685
- chain: mainnet,
3686
- transport: http(),
3687
- })
3688
- const transactionCount = await client.getTransactionCount({
3689
- address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
3690
- })
3691
- ```
3692
-
3693
- #### getTransactionReceipt()
3694
-
3695
- > **getTransactionReceipt**: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
3696
-
3697
- Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
3698
-
3699
- - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt
3700
- - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
3701
- - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
3702
-
3703
- ##### Parameters
3704
-
3705
- ###### args
3706
-
3707
- [`GetTransactionReceiptParameters`](https://viem.sh/docs/index.html)
3708
-
3709
- [GetTransactionReceiptParameters](https://viem.sh/docs/index.html)
3710
-
3711
- ##### Returns
3712
-
3713
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
3714
-
3715
- The transaction receipt. [GetTransactionReceiptReturnType](https://viem.sh/docs/index.html)
3716
-
3717
- ##### Example
3718
-
3719
- ```ts
3720
- import { createPublicClient, http } from 'viem'
3721
- import { mainnet } from 'viem/chains'
3722
-
3723
- const client = createPublicClient({
3724
- chain: mainnet,
3725
- transport: http(),
3726
- })
3727
- const transactionReceipt = await client.getTransactionReceipt({
3728
- hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
3729
- })
3730
- ```
3731
-
3732
- #### key
3733
-
3734
- > **key**: `string`
3735
-
3736
- A key for the client.
3737
-
3738
- #### multicall()
3739
-
3740
- > **multicall**: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<[`MulticallReturnType`](https://viem.sh/docs/index.html)\<`contracts`, `allowFailure`\>\>
3741
-
3742
- 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).
3743
-
3744
- - Docs: https://viem.sh/docs/contract/multicall
3745
-
3746
- ##### Type Parameters
3747
-
3748
- ###### contracts
3749
-
3750
- `contracts` *extends* readonly `unknown`[]
3751
-
3752
- ###### allowFailure
3753
-
3754
- `allowFailure` *extends* `boolean` = `true`
3755
-
3756
- ##### Parameters
3757
-
3758
- ###### args
3759
-
3760
- [`MulticallParameters`](https://viem.sh/docs/index.html)\<`contracts`, `allowFailure`\>
3761
-
3762
- [MulticallParameters](https://viem.sh/docs/index.html)
3763
-
3764
- ##### Returns
3765
-
3766
- `Promise`\<[`MulticallReturnType`](https://viem.sh/docs/index.html)\<`contracts`, `allowFailure`\>\>
3767
-
3768
- An array of results with accompanying status. [MulticallReturnType](https://viem.sh/docs/index.html)
3769
-
3770
- ##### Example
3771
-
3772
- ```ts
3773
- import { createPublicClient, http, parseAbi } from 'viem'
3774
- import { mainnet } from 'viem/chains'
3775
-
3776
- const client = createPublicClient({
3777
- chain: mainnet,
3778
- transport: http(),
3779
- })
3780
- const abi = parseAbi([
3781
- 'function balanceOf(address) view returns (uint256)',
3782
- 'function totalSupply() view returns (uint256)',
3783
- ])
3784
- const result = await client.multicall({
3785
- contracts: [
3786
- {
3787
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
3788
- abi,
3789
- functionName: 'balanceOf',
3790
- args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
3791
- },
3792
- {
3793
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
3794
- abi,
3795
- functionName: 'totalSupply',
3796
- },
3797
- ],
3798
- })
3799
- // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
3800
- ```
3801
-
3802
- #### name
3803
-
3804
- > **name**: `string`
3805
-
3806
- A name for the client.
3807
-
3808
- #### pollingInterval
3809
-
3810
- > **pollingInterval**: `number`
3811
-
3812
- Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
3813
-
3814
- #### prepareTransactionRequest()
3815
-
3816
- > **prepareTransactionRequest**: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...) & (...) & (...), (...) extends (...) ? (...) : (...)\> & \{ chainId?: (...) \| (...) \}, ParameterTypeToParameters\<(...)\[(...)\] extends readonly (...)\[\] ? (...)\[(...)\] : (...) \| (...) \| (...) \| (...) \| (...) \| (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
3817
-
3818
- Prepares a transaction request for signing.
3819
-
3820
- - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest
3821
-
3822
- ##### Type Parameters
3823
-
3824
- ###### request
3825
-
3826
- `request` *extends* [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"legacy"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `bigint`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip2930"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip1559"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs?`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${(...)}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: `undefined`; `blobs`: readonly `` `0x${string}` ``[] \| readonly [`ByteArray`](https://viem.sh/docs/index.html)[]; `blobVersionedHashes?`: readonly `` `0x${string}` ``[]; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: [`Kzg`](https://viem.sh/docs/index.html); `maxFeePerBlobGas?`: `bigint`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: readonly [`BlobSidecar`](https://viem.sh/docs/index.html)\<`` `0x${(...)}` ``\>[]; `to`: `` `0x${string}` `` \| `null`; `type?`: `"eip4844"`; `value?`: `bigint`; \}, `"from"`\> \| [`Omit`](https://viem.sh/docs/index.html)\<\{ `accessList?`: [`AccessList`](https://viem.sh/docs/index.html); `authorizationList?`: [`AuthorizationList`](https://viem.sh/docs/index.html)\<`number`, `boolean`\>; `blobs?`: `undefined`; `blobVersionedHashes?`: `undefined`; `data?`: `` `0x${string}` ``; `from?`: `` `0x${string}` ``; `gas?`: `bigint`; `gasPrice?`: `undefined`; `kzg?`: `undefined`; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `bigint`; `maxPriorityFeePerGas?`: `bigint`; `nonce?`: `number`; `sidecars?`: `undefined`; `to?`: `` `0x${string}` `` \| `null`; `type?`: `"eip7702"`; `value?`: `bigint`; \}, `"from"`\> & `object` & `object`
3827
-
3828
- ###### chainOverride
3829
-
3830
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3831
-
3832
- ###### accountOverride
3833
-
3834
- `accountOverride` *extends* `` `0x${string}` `` \| [`Account`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
3835
-
3836
- ##### Parameters
3837
-
3838
- ###### args
3839
-
3840
- [`PrepareTransactionRequestParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`, [`Account`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `accountOverride`, `request`\>
3841
-
3842
- [PrepareTransactionRequestParameters](https://viem.sh/docs/index.html)
3843
-
3844
- ##### Returns
3845
-
3846
- `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...) & (...) & (...), (...) extends (...) ? (...) : (...)\> & \{ chainId?: (...) \| (...) \}, ParameterTypeToParameters\<(...)\[(...)\] extends readonly (...)\[\] ? (...)\[(...)\] : (...) \| (...) \| (...) \| (...) \| (...) \| (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>
3847
-
3848
- The transaction request. [PrepareTransactionRequestReturnType](https://viem.sh/docs/index.html)
3849
-
3850
- ##### Examples
3851
-
3852
- ```ts
3853
- import { createWalletClient, custom } from 'viem'
3854
- import { mainnet } from 'viem/chains'
3855
-
3856
- const client = createWalletClient({
3857
- chain: mainnet,
3858
- transport: custom(window.ethereum),
3859
- })
3860
- const request = await client.prepareTransactionRequest({
3861
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
3862
- to: '0x0000000000000000000000000000000000000000',
3863
- value: 1n,
3864
- })
3865
- ```
3866
-
3867
- ```ts
3868
- // Account Hoisting
3869
- import { createWalletClient, http } from 'viem'
3870
- import { privateKeyToAccount } from 'viem/accounts'
3871
- import { mainnet } from 'viem/chains'
3872
-
3873
- const client = createWalletClient({
3874
- account: privateKeyToAccount('0x…'),
3875
- chain: mainnet,
3876
- transport: custom(window.ethereum),
3877
- })
3878
- const request = await client.prepareTransactionRequest({
3879
- to: '0x0000000000000000000000000000000000000000',
3880
- value: 1n,
3881
- })
3882
- ```
3883
-
3884
- #### readContract()
3885
-
3886
- > **readContract**: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<[`ReadContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`\>\>
3887
-
3888
- Calls a read-only function on a contract, and returns the response.
3889
-
3890
- - Docs: https://viem.sh/docs/contract/readContract
3891
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts
3892
-
3893
- ##### Type Parameters
3894
-
3895
- ###### abi
3896
-
3897
- `abi` *extends* readonly `unknown`[] \| `Abi`
3898
-
3899
- ###### functionName
3900
-
3901
- `functionName` *extends* `string`
3902
-
3903
- ###### args
3904
-
3905
- `args` *extends* `unknown`
3906
-
3907
- ##### Parameters
3908
-
3909
- ###### args
3910
-
3911
- [`ReadContractParameters`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`\>
3912
-
3913
- [ReadContractParameters](https://viem.sh/docs/index.html)
3914
-
3915
- ##### Returns
3916
-
3917
- `Promise`\<[`ReadContractReturnType`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`\>\>
3918
-
3919
- The response from the contract. Type is inferred. [ReadContractReturnType](https://viem.sh/docs/index.html)
3920
-
3921
- ##### Remarks
3922
-
3923
- 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.
3924
-
3925
- 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).
3926
-
3927
- ##### Example
3928
-
3929
- ```ts
3930
- import { createPublicClient, http, parseAbi } from 'viem'
3931
- import { mainnet } from 'viem/chains'
3932
- import { readContract } from 'viem/contract'
3933
-
3934
- const client = createPublicClient({
3935
- chain: mainnet,
3936
- transport: http(),
3937
- })
3938
- const result = await client.readContract({
3939
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
3940
- abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
3941
- functionName: 'balanceOf',
3942
- args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
3943
- })
3944
- // 424122n
3945
- ```
3946
-
3947
- #### request
3948
-
3949
- > **request**: [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\<[`PublicRpcSchema`](https://viem.sh/docs/index.html)\>
3950
-
3951
- Request function wrapped with friendly error handling
3952
-
3953
- #### sendRawTransaction()
3954
-
3955
- > **sendRawTransaction**: (`args`) => `Promise`\<`` `0x${string}` ``\>
3956
-
3957
- Sends a **signed** transaction to the network
3958
-
3959
- - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction
3960
- - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
3961
-
3962
- ##### Parameters
3963
-
3964
- ###### args
3965
-
3966
- [`SendRawTransactionParameters`](https://viem.sh/docs/index.html)
3967
-
3968
- ##### Returns
3969
-
3970
- `Promise`\<`` `0x${string}` ``\>
3971
-
3972
- The transaction hash. [SendRawTransactionReturnType](https://viem.sh/docs/index.html)
3973
-
3974
- ##### Example
3975
-
3976
- ```ts
3977
- import { createWalletClient, custom } from 'viem'
3978
- import { mainnet } from 'viem/chains'
3979
- import { sendRawTransaction } from 'viem/wallet'
3980
-
3981
- const client = createWalletClient({
3982
- chain: mainnet,
3983
- transport: custom(window.ethereum),
3984
- })
3985
-
3986
- const hash = await client.sendRawTransaction({
3987
- serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
3988
- })
3989
- ```
3990
-
3991
- #### sendRawTransactionSync()
3992
-
3993
- > **sendRawTransactionSync**: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
3994
-
3995
- Sends a **signed** transaction to the network
3996
-
3997
- - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync
3998
- - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966)
3999
-
4000
- ##### Parameters
4001
-
4002
- ###### args
4003
-
4004
- [`SendRawTransactionSyncParameters`](https://viem.sh/docs/index.html)
4005
-
4006
- ##### Returns
4007
-
4008
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
4009
-
4010
- The transaction receipt. [SendRawTransactionSyncReturnType](https://viem.sh/docs/index.html)
4011
-
4012
- ##### Example
4013
-
4014
- ```ts
4015
- import { createWalletClient, custom } from 'viem'
4016
- import { mainnet } from 'viem/chains'
4017
- import { sendRawTransactionSync } from 'viem/wallet'
4018
-
4019
- const client = createWalletClient({
4020
- chain: mainnet,
4021
- transport: custom(window.ethereum),
4022
- })
4023
-
4024
- const receipt = await client.sendRawTransactionSync({
4025
- serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
4026
- })
4027
- ```
4028
-
4029
- #### ~~simulate()~~
4030
-
4031
- > **simulate**: \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4032
-
4033
- ##### Type Parameters
4034
-
4035
- ###### calls
4036
-
4037
- `calls` *extends* readonly `unknown`[]
4038
-
4039
- ##### Parameters
4040
-
4041
- ###### args
4042
-
4043
- [`SimulateBlocksParameters`](https://viem.sh/docs/index.html)\<`calls`\>
4044
-
4045
- ##### Returns
4046
-
4047
- `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4048
-
4049
- ##### Deprecated
4050
-
4051
- Use `simulateBlocks` instead.
4052
-
4053
- #### simulateBlocks()
4054
-
4055
- > **simulateBlocks**: \<`calls`\>(`args`) => `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4056
-
4057
- Simulates a set of calls on block(s) with optional block and state overrides.
4058
-
4059
- ##### Type Parameters
4060
-
4061
- ###### calls
4062
-
4063
- `calls` *extends* readonly `unknown`[]
4064
-
4065
- ##### Parameters
4066
-
4067
- ###### args
4068
-
4069
- [`SimulateBlocksParameters`](https://viem.sh/docs/index.html)\<`calls`\>
4070
-
4071
- ##### Returns
4072
-
4073
- `Promise`\<[`SimulateBlocksReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4074
-
4075
- Simulated blocks. SimulateReturnType
4076
-
4077
- ##### Example
4078
-
4079
- ```ts
4080
- import { createPublicClient, http, parseEther } from 'viem'
4081
- import { mainnet } from 'viem/chains'
4082
-
4083
- const client = createPublicClient({
4084
- chain: mainnet,
4085
- transport: http(),
4086
- })
4087
-
4088
- const result = await client.simulateBlocks({
4089
- blocks: [{
4090
- blockOverrides: {
4091
- number: 69420n,
4092
- },
4093
- calls: [{
4094
- {
4095
- account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
4096
- data: '0xdeadbeef',
4097
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
4098
- },
4099
- {
4100
- account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
4101
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
4102
- value: parseEther('1'),
4103
- },
4104
- }],
4105
- stateOverrides: [{
4106
- address: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
4107
- balance: parseEther('10'),
4108
- }],
4109
- }]
4110
- })
4111
- ```
4112
-
4113
- #### simulateCalls()
4114
-
4115
- > **simulateCalls**: \<`calls`\>(`args`) => `Promise`\<[`SimulateCallsReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4116
-
4117
- Simulates a set of calls.
4118
-
4119
- ##### Type Parameters
4120
-
4121
- ###### calls
4122
-
4123
- `calls` *extends* readonly `unknown`[]
4124
-
4125
- ##### Parameters
4126
-
4127
- ###### args
4128
-
4129
- [`SimulateCallsParameters`](https://viem.sh/docs/index.html)\<`calls`\>
4130
-
4131
- ##### Returns
4132
-
4133
- `Promise`\<[`SimulateCallsReturnType`](https://viem.sh/docs/index.html)\<`calls`\>\>
4134
-
4135
- Results. [SimulateCallsReturnType](https://viem.sh/docs/index.html)
4136
-
4137
- ##### Example
4138
-
4139
- ```ts
4140
- import { createPublicClient, http, parseEther } from 'viem'
4141
- import { mainnet } from 'viem/chains'
4142
-
4143
- const client = createPublicClient({
4144
- chain: mainnet,
4145
- transport: http(),
4146
- })
4147
-
4148
- const result = await client.simulateCalls({
4149
- account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929',
4150
- calls: [{
4151
- {
4152
- data: '0xdeadbeef',
4153
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
4154
- },
4155
- {
4156
- to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
4157
- value: parseEther('1'),
4158
- },
4159
- ]
4160
- })
4161
- ```
4162
-
4163
- #### simulateContract()
4164
-
4165
- > **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`\>\>
4166
-
4167
- Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
4168
-
4169
- - Docs: https://viem.sh/docs/contract/simulateContract
4170
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
4171
-
4172
- ##### Type Parameters
4173
-
4174
- ###### abi
4175
-
4176
- `abi` *extends* readonly `unknown`[] \| `Abi`
4177
-
4178
- ###### functionName
4179
-
4180
- `functionName` *extends* `string`
4181
-
4182
- ###### args
4183
-
4184
- `args` *extends* `unknown`
4185
-
4186
- ###### chainOverride
4187
-
4188
- `chainOverride` *extends* [`Chain`](https://viem.sh/docs/index.html) \| `undefined`
4189
-
4190
- ###### accountOverride
4191
-
4192
- `accountOverride` *extends* `` `0x${string}` `` \| [`Account`](https://viem.sh/docs/index.html) \| `undefined` = `undefined`
4193
-
4194
- ##### Parameters
4195
-
4196
- ###### args
4197
-
4198
- [`SimulateContractParameters`](https://viem.sh/docs/index.html)\<`abi`, `functionName`, `args`, [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `chainOverride`, `accountOverride`\>
4199
-
4200
- [SimulateContractParameters](https://viem.sh/docs/index.html)
4201
-
4202
- ##### Returns
4203
-
4204
- `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`\>\>
4205
-
4206
- The simulation result and write request. [SimulateContractReturnType](https://viem.sh/docs/index.html)
4207
-
4208
- ##### Remarks
4209
-
4210
- 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.
4211
-
4212
- 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).
4213
-
4214
- ##### Example
4215
-
4216
- ```ts
4217
- import { createPublicClient, http } from 'viem'
4218
- import { mainnet } from 'viem/chains'
4219
-
4220
- const client = createPublicClient({
4221
- chain: mainnet,
4222
- transport: http(),
4223
- })
4224
- const result = await client.simulateContract({
4225
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
4226
- abi: parseAbi(['function mint(uint32) view returns (uint32)']),
4227
- functionName: 'mint',
4228
- args: ['69420'],
4229
- account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
4230
- })
4231
- ```
4232
-
4233
- #### transport
4234
-
4235
- > **transport**: [`TransportConfig`](https://viem.sh/docs/index.html)\<`string`, [`EIP1193RequestFn`](https://viem.sh/docs/index.html)\> & `Record`\<`string`, `any`\>
4236
-
4237
- The RPC transport
4238
-
4239
- #### type
4240
-
4241
- > **type**: `string`
4242
-
4243
- The type of client.
4244
-
4245
- #### uid
4246
-
4247
- > **uid**: `string`
4248
-
4249
- A unique ID for the client.
4250
-
4251
- #### uninstallFilter()
4252
-
4253
- > **uninstallFilter**: (`args`) => `Promise`\<`boolean`\>
4254
-
4255
- Destroys a Filter that was created from one of the following Actions:
4256
-
4257
- - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
4258
- - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
4259
- - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
4260
-
4261
- - Docs: https://viem.sh/docs/actions/public/uninstallFilter
4262
- - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
4263
-
4264
- ##### Parameters
4265
-
4266
- ###### args
4267
-
4268
- [`UninstallFilterParameters`](https://viem.sh/docs/index.html)
4269
-
4270
- [UninstallFilterParameters](https://viem.sh/docs/index.html)
4271
-
4272
- ##### Returns
4273
-
4274
- `Promise`\<`boolean`\>
4275
-
4276
- A boolean indicating if the Filter was successfully uninstalled. [UninstallFilterReturnType](https://viem.sh/docs/index.html)
4277
-
4278
- ##### Example
4279
-
4280
- ```ts
4281
- import { createPublicClient, http } from 'viem'
4282
- import { mainnet } from 'viem/chains'
4283
- import { createPendingTransactionFilter, uninstallFilter } from 'viem/public'
4284
-
4285
- const filter = await client.createPendingTransactionFilter()
4286
- const uninstalled = await client.uninstallFilter({ filter })
4287
- // true
4288
- ```
4289
-
4290
- #### verifyHash()
4291
-
4292
- > **verifyHash**: (`args`) => `Promise`\<`boolean`\>
4293
-
4294
- Verify that a hash was signed by the provided address.
4295
-
4296
- - Docs [https://viem.sh/docs/actions/public/verifyHash](https://viem.sh/docs/actions/public/verifyHash)
4297
-
4298
- ##### Parameters
4299
-
4300
- ###### args
4301
-
4302
- [`VerifyHashParameters`](https://viem.sh/docs/index.html)
4303
-
4304
- ##### Returns
4305
-
4306
- `Promise`\<`boolean`\>
4307
-
4308
- Whether or not the signature is valid. [VerifyHashReturnType](https://viem.sh/docs/index.html)
4309
-
4310
- #### verifyMessage()
4311
-
4312
- > **verifyMessage**: (`args`) => `Promise`\<`boolean`\>
4313
-
4314
- Verify that a message was signed by the provided address.
4315
-
4316
- Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492).
4317
-
4318
- - Docs [https://viem.sh/docs/actions/public/verifyMessage](https://viem.sh/docs/actions/public/verifyMessage)
4319
-
4320
- ##### Parameters
4321
-
4322
- ###### args
4323
-
4324
- ###### address
4325
-
4326
- `` `0x${string}` ``
4327
-
4328
- The address that signed the original message.
4329
-
4330
- ###### blockNumber?
4331
-
4332
- `bigint`
4333
-
4334
- The balance of the account at a block number.
4335
-
4336
- ###### blockTag?
4337
-
4338
- [`BlockTag`](https://viem.sh/docs/index.html)
4339
-
4340
- The balance of the account at a block tag.
4341
-
4342
- **Default**
4343
-
4344
- ```ts
4345
- 'latest'
4346
- ```
4347
-
4348
- ###### chain?
4349
-
4350
- [`Chain`](https://viem.sh/docs/index.html) \| `null`
4351
-
4352
- The chain to use.
4353
-
4354
- ###### erc6492VerifierAddress?
4355
-
4356
- `` `0x${string}` ``
4357
-
4358
- The address of the ERC-6492 signature verifier contract.
4359
-
4360
- ###### factory?
4361
-
4362
- `` `0x${string}` ``
4363
-
4364
- ###### factoryData?
4365
-
4366
- `` `0x${string}` ``
4367
-
4368
- ###### message
4369
-
4370
- [`SignableMessage`](https://viem.sh/docs/index.html)
4371
-
4372
- The message to be verified.
4373
-
4374
- ###### multicallAddress?
4375
-
4376
- `` `0x${string}` ``
4377
-
4378
- Multicall3 address for ERC-8010 verification.
4379
-
4380
- ###### signature
4381
-
4382
- `` `0x${string}` `` \| [`Signature`](https://viem.sh/docs/index.html) \| [`ByteArray`](https://viem.sh/docs/index.html)
4383
-
4384
- The signature that was generated by signing the message with the address's private key.
4385
-
4386
- ###### universalSignatureVerifierAddress?
4387
-
4388
- `` `0x${string}` ``
4389
-
4390
- **Deprecated**
4391
-
4392
- use `erc6492VerifierAddress` instead.
4393
-
4394
- ##### Returns
4395
-
4396
- `Promise`\<`boolean`\>
4397
-
4398
- Whether or not the signature is valid. [VerifyMessageReturnType](https://viem.sh/docs/index.html)
4399
-
4400
- #### verifySiweMessage()
4401
-
4402
- > **verifySiweMessage**: (`args`) => `Promise`\<`boolean`\>
4403
-
4404
- Verifies [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) formatted message was signed.
4405
-
4406
- Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492).
4407
-
4408
- - Docs [https://viem.sh/docs/siwe/actions/verifySiweMessage](https://viem.sh/docs/siwe/actions/verifySiweMessage)
4409
-
4410
- ##### Parameters
4411
-
4412
- ###### args
4413
-
4414
- ###### address?
4415
-
4416
- `` `0x${string}` ``
4417
-
4418
- Ethereum address to check against.
4419
-
4420
- ###### blockNumber?
4421
-
4422
- `bigint`
4423
-
4424
- The balance of the account at a block number.
4425
-
4426
- ###### blockTag?
4427
-
4428
- [`BlockTag`](https://viem.sh/docs/index.html)
4429
-
4430
- The balance of the account at a block tag.
4431
-
4432
- **Default**
4433
-
4434
- ```ts
4435
- 'latest'
4436
- ```
4437
-
4438
- ###### domain?
4439
-
4440
- `string`
4441
-
4442
- [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) authority to check against.
4443
-
4444
- ###### message
4445
-
4446
- `string`
4447
-
4448
- EIP-4361 formatted message.
4449
-
4450
- ###### nonce?
4451
-
4452
- `string`
4453
-
4454
- Random string to check against.
4455
-
4456
- ###### scheme?
4457
-
4458
- `string`
4459
-
4460
- [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) URI scheme to check against.
4461
-
4462
- ###### signature
4463
-
4464
- `` `0x${string}` ``
4465
-
4466
- Signature to check against.
4467
-
4468
- ###### time?
4469
-
4470
- `Date`
4471
-
4472
- Current time to check optional `expirationTime` and `notBefore` fields.
4473
-
4474
- **Default**
4475
-
4476
- ```ts
4477
- new Date()
4478
- ```
4479
-
4480
- ##### Returns
4481
-
4482
- `Promise`\<`boolean`\>
4483
-
4484
- Whether or not the signature is valid. [VerifySiweMessageReturnType](https://viem.sh/docs/index.html)
4485
-
4486
- #### verifyTypedData()
4487
-
4488
- > **verifyTypedData**: (`args`) => `Promise`\<`boolean`\>
4489
-
4490
- Verify that typed data was signed by the provided address.
4491
-
4492
- - Docs [https://viem.sh/docs/actions/public/verifyTypedData](https://viem.sh/docs/actions/public/verifyTypedData)
4493
-
4494
- ##### Parameters
4495
-
4496
- ###### args
4497
-
4498
- [`VerifyTypedDataParameters`](https://viem.sh/docs/index.html)
4499
-
4500
- ##### Returns
4501
-
4502
- `Promise`\<`boolean`\>
4503
-
4504
- Whether or not the signature is valid. [VerifyTypedDataReturnType](https://viem.sh/docs/index.html)
4505
-
4506
- #### waitForTransactionReceipt()
4507
-
4508
- > **waitForTransactionReceipt**: (`args`) => `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
4509
-
4510
- 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.
4511
-
4512
- - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt
4513
- - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
4514
- - JSON-RPC Methods:
4515
- - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
4516
- - If a Transaction has been replaced:
4517
- - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions
4518
- - Checks if one of the Transactions is a replacement
4519
- - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
4520
-
4521
- ##### Parameters
4522
-
4523
- ###### args
4524
-
4525
- [`WaitForTransactionReceiptParameters`](https://viem.sh/docs/index.html)\<[`Chain`](https://viem.sh/docs/index.html) \| `undefined`\>
4526
-
4527
- [WaitForTransactionReceiptParameters](https://viem.sh/docs/index.html)
4528
-
4529
- ##### Returns
4530
-
4531
- `Promise`\<[`TransactionReceipt`](https://viem.sh/docs/index.html)\>
4532
-
4533
- The transaction receipt. [WaitForTransactionReceiptReturnType](https://viem.sh/docs/index.html)
4534
-
4535
- ##### Remarks
4536
-
4537
- The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
4538
-
4539
- 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.
4540
-
4541
- There are 3 types of Transaction Replacement reasons:
4542
-
4543
- - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)
4544
- - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)
4545
- - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)
4546
-
4547
- ##### Example
4548
-
4549
- ```ts
4550
- import { createPublicClient, http } from 'viem'
4551
- import { mainnet } from 'viem/chains'
4552
-
4553
- const client = createPublicClient({
4554
- chain: mainnet,
4555
- transport: http(),
4556
- })
4557
- const transactionReceipt = await client.waitForTransactionReceipt({
4558
- hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
4559
- })
4560
- ```
4561
-
4562
- #### watchBlockNumber()
4563
-
4564
- > **watchBlockNumber**: (`args`) => [`WatchBlockNumberReturnType`](https://viem.sh/docs/index.html)
4565
-
4566
- Watches and returns incoming block numbers.
4567
-
4568
- - Docs: https://viem.sh/docs/actions/public/watchBlockNumber
4569
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
4570
- - JSON-RPC Methods:
4571
- - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
4572
- - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
4573
-
4574
- ##### Parameters
4575
-
4576
- ###### args
4577
-
4578
- [`WatchBlockNumberParameters`](https://viem.sh/docs/index.html)
4579
-
4580
- [WatchBlockNumberParameters](https://viem.sh/docs/index.html)
4581
-
4582
- ##### Returns
4583
-
4584
- [`WatchBlockNumberReturnType`](https://viem.sh/docs/index.html)
4585
-
4586
- A function that can be invoked to stop watching for new block numbers. [WatchBlockNumberReturnType](https://viem.sh/docs/index.html)
4587
-
4588
- ##### Example
4589
-
4590
- ```ts
4591
- import { createPublicClient, http } from 'viem'
4592
- import { mainnet } from 'viem/chains'
4593
-
4594
- const client = createPublicClient({
4595
- chain: mainnet,
4596
- transport: http(),
4597
- })
4598
- const unwatch = await client.watchBlockNumber({
4599
- onBlockNumber: (blockNumber) => console.log(blockNumber),
4600
- })
4601
- ```
4602
-
4603
- #### watchBlocks()
4604
-
4605
- > **watchBlocks**: \<`includeTransactions`, `blockTag`\>(`args`) => [`WatchBlocksReturnType`](https://viem.sh/docs/index.html)
4606
-
4607
- Watches and returns information for incoming blocks.
4608
-
4609
- - Docs: https://viem.sh/docs/actions/public/watchBlocks
4610
- - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
4611
- - JSON-RPC Methods:
4612
- - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
4613
- - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
4614
-
4615
- ##### Type Parameters
4616
-
4617
- ###### includeTransactions
4618
-
4619
- `includeTransactions` *extends* `boolean` = `false`
4620
-
4621
- ###### blockTag
4622
-
4623
- `blockTag` *extends* [`BlockTag`](https://viem.sh/docs/index.html) = `"latest"`
4624
-
4625
- ##### Parameters
4626
-
4627
- ###### args
4628
-
4629
- [`WatchBlocksParameters`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html), [`Chain`](https://viem.sh/docs/index.html) \| `undefined`, `includeTransactions`, `blockTag`\>
4630
-
4631
- [WatchBlocksParameters](https://viem.sh/docs/index.html)
4632
-
4633
- ##### Returns
4634
-
4635
- [`WatchBlocksReturnType`](https://viem.sh/docs/index.html)
4636
-
4637
- A function that can be invoked to stop watching for new block numbers. [WatchBlocksReturnType](https://viem.sh/docs/index.html)
4638
-
4639
- ##### Example
4640
-
4641
- ```ts
4642
- import { createPublicClient, http } from 'viem'
4643
- import { mainnet } from 'viem/chains'
4644
-
4645
- const client = createPublicClient({
4646
- chain: mainnet,
4647
- transport: http(),
4648
- })
4649
- const unwatch = await client.watchBlocks({
4650
- onBlock: (block) => console.log(block),
4651
- })
4652
- ```
4653
-
4654
- #### watchContractEvent()
4655
-
4656
- > **watchContractEvent**: \<`abi`, `eventName`, `strict`\>(`args`) => [`WatchContractEventReturnType`](https://viem.sh/docs/index.html)
4657
-
4658
- Watches and returns emitted contract event logs.
4659
-
4660
- - Docs: https://viem.sh/docs/contract/watchContractEvent
4661
-
4662
- ##### Type Parameters
4663
-
4664
- ###### abi
4665
-
4666
- `abi` *extends* readonly `unknown`[] \| `Abi`
4667
-
4668
- ###### eventName
4669
-
4670
- `eventName` *extends* `string`
4671
-
4672
- ###### strict
4673
-
4674
- `strict` *extends* `boolean` \| `undefined` = `undefined`
4675
-
4676
- ##### Parameters
4677
-
4678
- ###### args
4679
-
4680
- [`WatchContractEventParameters`](https://viem.sh/docs/index.html)\<`abi`, `eventName`, `strict`, [`Transport`](https://viem.sh/docs/index.html)\>
4681
-
4682
- [WatchContractEventParameters](https://viem.sh/docs/index.html)
4683
-
4684
- ##### Returns
4685
-
4686
- [`WatchContractEventReturnType`](https://viem.sh/docs/index.html)
4687
-
4688
- A function that can be invoked to stop watching for new event logs. [WatchContractEventReturnType](https://viem.sh/docs/index.html)
4689
-
4690
- ##### Remarks
4691
-
4692
- 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).
4693
-
4694
- `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.
4695
-
4696
- ##### Example
4697
-
4698
- ```ts
4699
- import { createPublicClient, http, parseAbi } from 'viem'
4700
- import { mainnet } from 'viem/chains'
4701
-
4702
- const client = createPublicClient({
4703
- chain: mainnet,
4704
- transport: http(),
4705
- })
4706
- const unwatch = client.watchContractEvent({
4707
- address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
4708
- abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']),
4709
- eventName: 'Transfer',
4710
- args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
4711
- onLogs: (logs) => console.log(logs),
4712
- })
4713
- ```
4714
-
4715
- #### watchEvent()
4716
-
4717
- > **watchEvent**: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => [`WatchEventReturnType`](https://viem.sh/docs/index.html)
4718
-
4719
- Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms#event-log).
4720
-
4721
- - Docs: https://viem.sh/docs/actions/public/watchEvent
4722
- - JSON-RPC Methods:
4723
- - **RPC Provider supports `eth_newFilter`:**
4724
- - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize).
4725
- - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges).
4726
- - **RPC Provider does not support `eth_newFilter`:**
4727
- - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
4728
-
4729
- ##### Type Parameters
4730
-
4731
- ###### abiEvent
4732
-
4733
- `abiEvent` *extends* `AbiEvent` \| `undefined` = `undefined`
4734
-
4735
- ###### abiEvents
4736
-
4737
- `abiEvents` *extends* readonly `unknown`[] \| readonly `AbiEvent`[] \| `undefined` = `abiEvent` *extends* `AbiEvent` ? \[`abiEvent`\<`abiEvent`\>\] : `undefined`
4738
-
4739
- ###### strict
4740
-
4741
- `strict` *extends* `boolean` \| `undefined` = `undefined`
4742
-
4743
- ##### Parameters
4744
-
4745
- ###### args
4746
-
4747
- [`WatchEventParameters`](https://viem.sh/docs/index.html)\<`abiEvent`, `abiEvents`, `strict`, [`Transport`](https://viem.sh/docs/index.html)\>
4748
-
4749
- [WatchEventParameters](https://viem.sh/docs/index.html)
4750
-
4751
- ##### Returns
4752
-
4753
- [`WatchEventReturnType`](https://viem.sh/docs/index.html)
4754
-
4755
- A function that can be invoked to stop watching for new Event Logs. [WatchEventReturnType](https://viem.sh/docs/index.html)
4756
-
4757
- ##### Remarks
4758
-
4759
- 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).
4760
-
4761
- `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.
4762
-
4763
- ##### Example
4764
-
4765
- ```ts
4766
- import { createPublicClient, http } from 'viem'
4767
- import { mainnet } from 'viem/chains'
4768
-
4769
- const client = createPublicClient({
4770
- chain: mainnet,
4771
- transport: http(),
4772
- })
4773
- const unwatch = client.watchEvent({
4774
- onLogs: (logs) => console.log(logs),
4775
- })
4776
- ```
4777
-
4778
- #### watchPendingTransactions()
4779
-
4780
- > **watchPendingTransactions**: (`args`) => [`WatchPendingTransactionsReturnType`](https://viem.sh/docs/index.html)
4781
-
4782
- Watches and returns pending transaction hashes.
4783
-
4784
- - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions
4785
- - JSON-RPC Methods:
4786
- - When `poll: true`
4787
- - Calls [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) to initialize the filter.
4788
- - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval.
4789
- - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event.
4790
-
4791
- ##### Parameters
4792
-
4793
- ###### args
4794
-
4795
- [`WatchPendingTransactionsParameters`](https://viem.sh/docs/index.html)\<[`Transport`](https://viem.sh/docs/index.html)\>
4796
-
4797
- [WatchPendingTransactionsParameters](https://viem.sh/docs/index.html)
4798
-
4799
- ##### Returns
4800
-
4801
- [`WatchPendingTransactionsReturnType`](https://viem.sh/docs/index.html)
4802
-
4803
- A function that can be invoked to stop watching for new pending transaction hashes. [WatchPendingTransactionsReturnType](https://viem.sh/docs/index.html)
4804
-
4805
- ##### Remarks
4806
-
4807
- 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).
4808
-
4809
- ##### Example
4810
-
4811
- ```ts
4812
- import { createPublicClient, http } from 'viem'
4813
- import { mainnet } from 'viem/chains'
4814
-
4815
- const client = createPublicClient({
4816
- chain: mainnet,
4817
- transport: http(),
4818
- })
4819
- const unwatch = await client.watchPendingTransactions({
4820
- onTransactions: (hashes) => console.log(hashes),
4821
- })
4822
- ```
4823
-
4824
- ***
4825
-
4826
- ### registryAddress?
4827
-
4828
- > `optional` **registryAddress**: `` `0x${string}` ``
4829
-
4830
- Defined in: [packages/core/src/clients/types.ts:25](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L25)
4831
-
4832
- Registry contract address.
4833
- Essential for looking up other contracts if not provided explicitly.
4834
-
4835
- ***
4836
-
4837
- ### xpntsFactoryAddress?
4838
-
4839
- > `optional` **xpntsFactoryAddress**: `` `0x${string}` ``
4840
-
4841
- Defined in: [packages/core/src/clients/types.ts:44](https://github.com/AAStarCommunity/aastar-sdk/blob/f3911a6f6e88b2f77186db63ad0182c2cfe13b9d/packages/core/src/clients/types.ts#L44)