viem 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (304) hide show
  1. package/_cjs/{abi.js → abi/index.js} +9 -9
  2. package/_cjs/abi/index.js.map +1 -0
  3. package/_cjs/actions/getContract.js +16 -0
  4. package/_cjs/actions/getContract.js.map +1 -1
  5. package/_cjs/actions/public/estimateFeesPerGas.js +3 -2
  6. package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
  7. package/_cjs/actions/public/getContractEvents.js +26 -0
  8. package/_cjs/actions/public/getContractEvents.js.map +1 -0
  9. package/_cjs/actions/public/multicall.js.map +1 -1
  10. package/_cjs/actions/public/readContract.js.map +1 -1
  11. package/_cjs/actions/public/waitForTransactionReceipt.js +9 -4
  12. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  13. package/_cjs/actions/public/watchContractEvent.js +4 -7
  14. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  15. package/_cjs/actions/wallet/signTypedData.js.map +1 -1
  16. package/_cjs/actions/wallet/writeContract.js.map +1 -1
  17. package/_cjs/chains/definitions/holesky.js +21 -0
  18. package/_cjs/chains/definitions/holesky.js.map +1 -0
  19. package/_cjs/chains/definitions/kroma.js +26 -0
  20. package/_cjs/chains/definitions/kroma.js.map +1 -0
  21. package/_cjs/chains/definitions/kromaSepolia.js +26 -0
  22. package/_cjs/chains/definitions/kromaSepolia.js.map +1 -0
  23. package/_cjs/chains/definitions/moonbeamDev.js +25 -0
  24. package/_cjs/chains/definitions/moonbeamDev.js.map +1 -0
  25. package/_cjs/chains/definitions/optimismSepolia.js +39 -0
  26. package/_cjs/chains/definitions/optimismSepolia.js.map +1 -0
  27. package/_cjs/chains/definitions/sepolia.js +1 -1
  28. package/_cjs/chains/definitions/sepolia.js.map +1 -1
  29. package/_cjs/chains/index.js +12 -2
  30. package/_cjs/chains/index.js.map +1 -1
  31. package/_cjs/clients/decorators/public.js +2 -0
  32. package/_cjs/clients/decorators/public.js.map +1 -1
  33. package/_cjs/clients/decorators/wallet.js.map +1 -1
  34. package/_cjs/{contract.js → contract/index.js} +25 -25
  35. package/_cjs/contract/index.js.map +1 -0
  36. package/_cjs/{ens.js → ens/index.js} +9 -9
  37. package/_cjs/ens/index.js.map +1 -0
  38. package/_cjs/errors/version.js +1 -1
  39. package/_cjs/errors/version.js.map +1 -1
  40. package/_cjs/index.js +5 -1
  41. package/_cjs/index.js.map +1 -1
  42. package/_cjs/{public.js → public/index.js} +29 -29
  43. package/_cjs/public/index.js.map +1 -0
  44. package/_cjs/{test.js → test/index.js} +29 -29
  45. package/_cjs/test/index.js.map +1 -0
  46. package/_cjs/types/eip1193.js.map +1 -1
  47. package/_cjs/utils/hash/getEventSelector.js +5 -6
  48. package/_cjs/utils/hash/getEventSelector.js.map +1 -1
  49. package/_cjs/utils/hash/getEventSignature.js +9 -0
  50. package/_cjs/utils/hash/getEventSignature.js.map +1 -0
  51. package/_cjs/utils/hash/getFunctionSelector.js +5 -6
  52. package/_cjs/utils/hash/getFunctionSelector.js.map +1 -1
  53. package/_cjs/utils/hash/getFunctionSignature.js +15 -0
  54. package/_cjs/utils/hash/getFunctionSignature.js.map +1 -0
  55. package/_cjs/utils/hash/hashFunction.js +2 -4
  56. package/_cjs/utils/hash/hashFunction.js.map +1 -1
  57. package/_cjs/utils/rpc.js +6 -3
  58. package/_cjs/utils/rpc.js.map +1 -1
  59. package/_cjs/{wallet.js → wallet/index.js} +11 -11
  60. package/_cjs/wallet/index.js.map +1 -0
  61. package/_cjs/{window.js → window/index.js} +2 -2
  62. package/_cjs/window/index.js.map +1 -0
  63. package/_esm/abi/index.js +7 -0
  64. package/_esm/abi/index.js.map +1 -0
  65. package/_esm/actions/getContract.js +16 -0
  66. package/_esm/actions/getContract.js.map +1 -1
  67. package/_esm/actions/public/estimateFeesPerGas.js +3 -2
  68. package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
  69. package/_esm/actions/public/getContractEvents.js +48 -0
  70. package/_esm/actions/public/getContractEvents.js.map +1 -0
  71. package/_esm/actions/public/multicall.js.map +1 -1
  72. package/_esm/actions/public/readContract.js.map +1 -1
  73. package/_esm/actions/public/waitForTransactionReceipt.js +9 -4
  74. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  75. package/_esm/actions/public/watchContractEvent.js +4 -7
  76. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  77. package/_esm/actions/wallet/signTypedData.js.map +1 -1
  78. package/_esm/actions/wallet/writeContract.js.map +1 -1
  79. package/_esm/chains/definitions/holesky.js +18 -0
  80. package/_esm/chains/definitions/holesky.js.map +1 -0
  81. package/_esm/chains/definitions/kroma.js +23 -0
  82. package/_esm/chains/definitions/kroma.js.map +1 -0
  83. package/_esm/chains/definitions/kromaSepolia.js +23 -0
  84. package/_esm/chains/definitions/kromaSepolia.js.map +1 -0
  85. package/_esm/chains/definitions/moonbeamDev.js +22 -0
  86. package/_esm/chains/definitions/moonbeamDev.js.map +1 -0
  87. package/_esm/chains/definitions/optimismSepolia.js +36 -0
  88. package/_esm/chains/definitions/optimismSepolia.js.map +1 -0
  89. package/_esm/chains/definitions/sepolia.js +1 -1
  90. package/_esm/chains/definitions/sepolia.js.map +1 -1
  91. package/_esm/chains/index.js +5 -0
  92. package/_esm/chains/index.js.map +1 -1
  93. package/_esm/clients/decorators/public.js +2 -0
  94. package/_esm/clients/decorators/public.js.map +1 -1
  95. package/_esm/clients/decorators/wallet.js.map +1 -1
  96. package/_esm/contract/index.js +26 -0
  97. package/_esm/contract/index.js.map +1 -0
  98. package/_esm/ens/index.js +9 -0
  99. package/_esm/ens/index.js.map +1 -0
  100. package/_esm/errors/version.js +1 -1
  101. package/_esm/errors/version.js.map +1 -1
  102. package/_esm/index.js +2 -0
  103. package/_esm/index.js.map +1 -1
  104. package/_esm/public/index.js +30 -0
  105. package/_esm/public/index.js.map +1 -0
  106. package/_esm/test/index.js +30 -0
  107. package/_esm/test/index.js.map +1 -0
  108. package/_esm/types/eip1193.js.map +1 -1
  109. package/_esm/utils/hash/getEventSelector.js +5 -6
  110. package/_esm/utils/hash/getEventSelector.js.map +1 -1
  111. package/_esm/utils/hash/getEventSignature.js +5 -0
  112. package/_esm/utils/hash/getEventSignature.js.map +1 -0
  113. package/_esm/utils/hash/getFunctionSelector.js +5 -6
  114. package/_esm/utils/hash/getFunctionSelector.js.map +1 -1
  115. package/_esm/utils/hash/getFunctionSignature.js +11 -0
  116. package/_esm/utils/hash/getFunctionSignature.js.map +1 -0
  117. package/_esm/utils/hash/hashFunction.js +2 -4
  118. package/_esm/utils/hash/hashFunction.js.map +1 -1
  119. package/_esm/utils/rpc.js +6 -2
  120. package/_esm/utils/rpc.js.map +1 -1
  121. package/_esm/wallet/index.js +12 -0
  122. package/_esm/wallet/index.js.map +1 -0
  123. package/_esm/window/index.js +2 -0
  124. package/_esm/window/index.js.map +1 -0
  125. package/_types/{abi.d.ts → abi/index.d.ts} +5 -5
  126. package/_types/abi/index.d.ts.map +1 -0
  127. package/_types/actions/getContract.d.ts +29 -0
  128. package/_types/actions/getContract.d.ts.map +1 -1
  129. package/_types/actions/public/createContractEventFilter.d.ts +1 -1
  130. package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
  131. package/_types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
  132. package/_types/actions/public/getContractEvents.d.ts +62 -0
  133. package/_types/actions/public/getContractEvents.d.ts.map +1 -0
  134. package/_types/actions/public/multicall.d.ts +1 -1
  135. package/_types/actions/public/multicall.d.ts.map +1 -1
  136. package/_types/actions/public/readContract.d.ts +2 -1
  137. package/_types/actions/public/readContract.d.ts.map +1 -1
  138. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  139. package/_types/actions/public/watchContractEvent.d.ts +1 -1
  140. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  141. package/_types/actions/wallet/signTypedData.d.ts +1 -1
  142. package/_types/actions/wallet/signTypedData.d.ts.map +1 -1
  143. package/_types/actions/wallet/writeContract.d.ts +3 -3
  144. package/_types/actions/wallet/writeContract.d.ts.map +1 -1
  145. package/_types/chains/celo/formatters.d.ts +57 -57
  146. package/_types/chains/definitions/base.d.ts +171 -171
  147. package/_types/chains/definitions/baseGoerli.d.ts +171 -171
  148. package/_types/chains/definitions/celo.d.ts +171 -171
  149. package/_types/chains/definitions/celoAlfajores.d.ts +171 -171
  150. package/_types/chains/definitions/celoCannoli.d.ts +171 -171
  151. package/_types/chains/definitions/holesky.d.ts +24 -0
  152. package/_types/chains/definitions/holesky.d.ts.map +1 -0
  153. package/_types/chains/definitions/kroma.d.ts +29 -0
  154. package/_types/chains/definitions/kroma.d.ts.map +1 -0
  155. package/_types/chains/definitions/kromaSepolia.d.ts +29 -0
  156. package/_types/chains/definitions/kromaSepolia.d.ts.map +1 -0
  157. package/_types/chains/definitions/moonbeamDev.d.ts +24 -0
  158. package/_types/chains/definitions/moonbeamDev.d.ts.map +1 -0
  159. package/_types/chains/definitions/optimism.d.ts +171 -171
  160. package/_types/chains/definitions/optimismGoerli.d.ts +171 -171
  161. package/_types/chains/definitions/optimismSepolia.d.ts +1524 -0
  162. package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -0
  163. package/_types/chains/definitions/sepolia.d.ts +1 -1
  164. package/_types/chains/definitions/zora.d.ts +171 -171
  165. package/_types/chains/definitions/zoraTestnet.d.ts +171 -171
  166. package/_types/chains/index.d.ts +6 -1
  167. package/_types/chains/index.d.ts.map +1 -1
  168. package/_types/chains/optimism/formatters.d.ts +57 -57
  169. package/_types/clients/decorators/public.d.ts +27 -0
  170. package/_types/clients/decorators/public.d.ts.map +1 -1
  171. package/_types/clients/transports/webSocket.d.ts +2 -1
  172. package/_types/clients/transports/webSocket.d.ts.map +1 -1
  173. package/_types/{contract.d.ts → contract/index.d.ts} +26 -26
  174. package/_types/contract/index.d.ts.map +1 -0
  175. package/_types/ens/index.d.ts +9 -0
  176. package/_types/ens/index.d.ts.map +1 -0
  177. package/_types/errors/version.d.ts +1 -1
  178. package/_types/errors/version.d.ts.map +1 -1
  179. package/_types/index.d.ts +3 -1
  180. package/_types/index.d.ts.map +1 -1
  181. package/_types/public/index.d.ts +33 -0
  182. package/_types/public/index.d.ts.map +1 -0
  183. package/_types/test/index.d.ts +29 -0
  184. package/_types/test/index.d.ts.map +1 -0
  185. package/_types/types/contract.d.ts +1 -1
  186. package/_types/types/contract.d.ts.map +1 -1
  187. package/_types/types/eip1193.d.ts +2 -2
  188. package/_types/types/eip1193.d.ts.map +1 -1
  189. package/_types/types/multicall.d.ts +10 -4
  190. package/_types/types/multicall.d.ts.map +1 -1
  191. package/_types/types/typedData.d.ts +2 -2
  192. package/_types/types/typedData.d.ts.map +1 -1
  193. package/_types/types/utils.d.ts +12 -8
  194. package/_types/types/utils.d.ts.map +1 -1
  195. package/_types/utils/abi/decodeEventLog.d.ts +2 -2
  196. package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
  197. package/_types/utils/formatters/transaction.d.ts +3 -3
  198. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  199. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  200. package/_types/utils/hash/getEventSelector.d.ts +1 -2
  201. package/_types/utils/hash/getEventSelector.d.ts.map +1 -1
  202. package/_types/utils/hash/getEventSignature.d.ts +3 -0
  203. package/_types/utils/hash/getEventSignature.d.ts.map +1 -0
  204. package/_types/utils/hash/getFunctionSelector.d.ts.map +1 -1
  205. package/_types/utils/hash/getFunctionSignature.d.ts +3 -0
  206. package/_types/utils/hash/getFunctionSignature.d.ts.map +1 -0
  207. package/_types/utils/hash/hashFunction.d.ts.map +1 -1
  208. package/_types/utils/rpc.d.ts +3 -3
  209. package/_types/utils/rpc.d.ts.map +1 -1
  210. package/_types/wallet/index.d.ts +11 -0
  211. package/_types/wallet/index.d.ts.map +1 -0
  212. package/_types/window/index.d.ts +2 -0
  213. package/_types/window/index.d.ts.map +1 -0
  214. package/{abi.ts → abi/index.ts} +15 -13
  215. package/abi/package.json +6 -0
  216. package/accounts/package.json +6 -0
  217. package/actions/getContract.ts +95 -0
  218. package/actions/package.json +6 -0
  219. package/actions/public/createContractEventFilter.ts +1 -1
  220. package/actions/public/estimateFeesPerGas.ts +3 -2
  221. package/actions/public/getContractEvents.ts +155 -0
  222. package/actions/public/multicall.ts +2 -2
  223. package/actions/public/readContract.ts +4 -1
  224. package/actions/public/waitForTransactionReceipt.ts +13 -4
  225. package/actions/public/watchContractEvent.ts +10 -13
  226. package/actions/wallet/signTypedData.ts +4 -2
  227. package/actions/wallet/writeContract.ts +30 -23
  228. package/chains/definitions/holesky.ts +18 -0
  229. package/chains/definitions/kroma.ts +23 -0
  230. package/chains/definitions/kromaSepolia.ts +23 -0
  231. package/chains/definitions/moonbeamDev.ts +22 -0
  232. package/chains/definitions/optimismSepolia.ts +39 -0
  233. package/chains/definitions/sepolia.ts +1 -1
  234. package/chains/index.ts +6 -1
  235. package/chains/package.json +6 -0
  236. package/chains/utils/package.json +6 -0
  237. package/clients/decorators/public.ts +48 -0
  238. package/clients/decorators/wallet.ts +1 -1
  239. package/clients/package.json +6 -0
  240. package/clients/transports/webSocket.ts +1 -1
  241. package/{contract.ts → contract/index.ts} +27 -25
  242. package/contract/package.json +6 -0
  243. package/{ens.ts → ens/index.ts} +8 -8
  244. package/ens/package.json +6 -0
  245. package/errors/version.ts +1 -1
  246. package/index.ts +4 -0
  247. package/package.json +32 -31
  248. package/{public.ts → public/index.ts} +30 -28
  249. package/public/package.json +6 -0
  250. package/test/index.ts +85 -0
  251. package/test/package.json +6 -0
  252. package/types/contract.ts +1 -1
  253. package/types/eip1193.ts +5 -3
  254. package/types/multicall.ts +41 -22
  255. package/types/typedData.ts +3 -2
  256. package/types/utils.ts +32 -11
  257. package/utils/abi/decodeEventLog.ts +2 -2
  258. package/utils/formatters/transaction.ts +2 -2
  259. package/utils/hash/getEventSelector.ts +7 -6
  260. package/utils/hash/getEventSignature.ts +7 -0
  261. package/utils/hash/getFunctionSelector.ts +7 -5
  262. package/utils/hash/getFunctionSignature.ts +17 -0
  263. package/utils/hash/hashFunction.ts +2 -7
  264. package/utils/package.json +6 -0
  265. package/utils/rpc.ts +6 -3
  266. package/{wallet.ts → wallet/index.ts} +15 -10
  267. package/wallet/package.json +6 -0
  268. package/window/index.ts +1 -0
  269. package/window/package.json +6 -0
  270. package/_cjs/abi.js.map +0 -1
  271. package/_cjs/contract.js.map +0 -1
  272. package/_cjs/ens.js.map +0 -1
  273. package/_cjs/public.js.map +0 -1
  274. package/_cjs/test.js.map +0 -1
  275. package/_cjs/wallet.js.map +0 -1
  276. package/_cjs/window.js.map +0 -1
  277. package/_esm/abi.js +0 -6
  278. package/_esm/abi.js.map +0 -1
  279. package/_esm/contract.js +0 -25
  280. package/_esm/contract.js.map +0 -1
  281. package/_esm/ens.js +0 -9
  282. package/_esm/ens.js.map +0 -1
  283. package/_esm/public.js +0 -29
  284. package/_esm/public.js.map +0 -1
  285. package/_esm/test.js +0 -29
  286. package/_esm/test.js.map +0 -1
  287. package/_esm/wallet.js +0 -11
  288. package/_esm/wallet.js.map +0 -1
  289. package/_esm/window.js +0 -2
  290. package/_esm/window.js.map +0 -1
  291. package/_types/abi.d.ts.map +0 -1
  292. package/_types/contract.d.ts.map +0 -1
  293. package/_types/ens.d.ts +0 -9
  294. package/_types/ens.d.ts.map +0 -1
  295. package/_types/public.d.ts +0 -33
  296. package/_types/public.d.ts.map +0 -1
  297. package/_types/test.d.ts +0 -29
  298. package/_types/test.d.ts.map +0 -1
  299. package/_types/wallet.d.ts +0 -11
  300. package/_types/wallet.d.ts.map +0 -1
  301. package/_types/window.d.ts +0 -2
  302. package/_types/window.d.ts.map +0 -1
  303. package/test.ts +0 -83
  304. package/window.ts +0 -1
@@ -0,0 +1,18 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const holesky = /*#__PURE__*/ defineChain({
4
+ id: 17000,
5
+ network: 'holesky',
6
+ name: 'Holesky',
7
+ nativeCurrency: { name: 'Holesky Ether', symbol: 'ETH', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://rpc.holesky.ethpandaops.io'],
11
+ },
12
+ public: {
13
+ http: ['https://rpc.holesky.ethpandaops.io'],
14
+ },
15
+ },
16
+ contracts: {},
17
+ testnet: true,
18
+ })
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const kroma = /*#__PURE__*/ defineChain({
4
+ id: 255,
5
+ network: 'kroma',
6
+ name: 'Kroma',
7
+ nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://api.kroma.network'],
11
+ },
12
+ public: {
13
+ http: ['https://api.kroma.network'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'Kroma Explorer',
19
+ url: 'https://blockscout.kroma.network',
20
+ },
21
+ },
22
+ testnet: false,
23
+ })
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const kromaSepolia = /*#__PURE__*/ defineChain({
4
+ id: 2358,
5
+ network: 'kroma-sepolia',
6
+ name: 'Kroma Sepolia',
7
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://api.sepolia.kroma.network'],
11
+ },
12
+ public: {
13
+ http: ['https://api.sepolia.kroma.network'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'Kroma Sepolia Explorer',
19
+ url: 'https://blockscout.sepolia.kroma.network',
20
+ },
21
+ },
22
+ testnet: true,
23
+ })
@@ -0,0 +1,22 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const moonbeamDev = /*#__PURE__*/ defineChain({
4
+ id: 1281,
5
+ name: 'Moonbeam Development Node',
6
+ network: 'development',
7
+ nativeCurrency: {
8
+ decimals: 18,
9
+ name: 'DEV',
10
+ symbol: 'DEV',
11
+ },
12
+ rpcUrls: {
13
+ default: {
14
+ http: ['http://127.0.0.1:9944'],
15
+ webSocket: ['wss://127.0.0.1:9944'],
16
+ },
17
+ public: {
18
+ http: ['http://127.0.0.1:9944'],
19
+ webSocket: ['wss://127.0.0.1:9944'],
20
+ },
21
+ },
22
+ })
@@ -0,0 +1,39 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+ import { formattersOptimism } from '../optimism/formatters.js'
3
+
4
+ export const optimismSepolia = /*#__PURE__*/ defineChain(
5
+ {
6
+ id: 11155420,
7
+ name: 'Optimism Sepolia',
8
+ network: 'optimism-sepolia',
9
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
10
+ rpcUrls: {
11
+ default: {
12
+ http: ['https://sepolia.optimism.io'],
13
+ },
14
+ public: {
15
+ http: ['https://sepolia.optimism.io'],
16
+ },
17
+ },
18
+ blockExplorers: {
19
+ blockscout: {
20
+ name: 'Blockscout',
21
+ url: 'https://optimism-sepolia.blockscout.com',
22
+ },
23
+ default: {
24
+ name: 'Blockscout',
25
+ url: 'https://optimism-sepolia.blockscout.com',
26
+ },
27
+ },
28
+ contracts: {
29
+ multicall3: {
30
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
31
+ blockCreated: 1620204,
32
+ },
33
+ },
34
+ testnet: true,
35
+ },
36
+ {
37
+ formatters: formattersOptimism,
38
+ },
39
+ )
@@ -34,7 +34,7 @@ export const sepolia = /*#__PURE__*/ defineChain({
34
34
  contracts: {
35
35
  multicall3: {
36
36
  address: '0xca11bde05977b3631167028862be2a173976ca11',
37
- blockCreated: 6507670,
37
+ blockCreated: 751532,
38
38
  },
39
39
  ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' },
40
40
  ensUniversalResolver: {
package/chains/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { Chain } from '../types/chain.js'
2
2
 
3
3
  // required for type inference since in explicit return type
4
- export type { Assign } from '../types/utils.js'
4
+ export type { Assign, Omit } from '../types/utils.js'
5
5
 
6
6
  export { arbitrum } from './definitions/arbitrum.js'
7
7
  export { arbitrumGoerli } from './definitions/arbitrumGoerli.js'
@@ -61,7 +61,10 @@ export { hardhat } from './definitions/hardhat.js'
61
61
  export { harmonyOne } from './definitions/harmonyOne.js'
62
62
  export { haqqMainnet } from './definitions/haqqMainnet.js'
63
63
  export { haqqTestedge2 } from './definitions/haqqTestedge2.js'
64
+ export { holesky } from './definitions/holesky.js'
64
65
  export { klaytn } from './definitions/klaytn.js'
66
+ export { kroma } from './definitions/kroma.js'
67
+ export { kromaSepolia } from './definitions/kromaSepolia.js'
65
68
  export { linea } from './definitions/linea.js'
66
69
  export { lineaTestnet } from './definitions/lineaTestnet.js'
67
70
  export { localhost } from './definitions/localhost.js'
@@ -77,6 +80,7 @@ export { mevTestnet } from './definitions/mevTestnet.js'
77
80
  export { modeTestnet } from './definitions/modeTestnet.js'
78
81
  export { moonbaseAlpha } from './definitions/moonbaseAlpha.js'
79
82
  export { moonbeam } from './definitions/moonbeam.js'
83
+ export { moonbeamDev } from './definitions/moonbeamDev.js'
80
84
  export { moonriver } from './definitions/moonriver.js'
81
85
  export { neonDevnet } from './definitions/neonDevnet.js'
82
86
  export { nexi } from './definitions/nexi.js'
@@ -85,6 +89,7 @@ export { oasys } from './definitions/oasys.js'
85
89
  export { okc } from './definitions/okc.js'
86
90
  export { optimism } from './definitions/optimism.js'
87
91
  export { optimismGoerli } from './definitions/optimismGoerli.js'
92
+ export { optimismSepolia } from './definitions/optimismSepolia.js'
88
93
  export { opBNB } from './definitions/opBNB.js'
89
94
  export { opBNBTestnet } from './definitions/opBNBTestnet.js'
90
95
  export { plinga } from './definitions/plinga.js'
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/chains/index.d.ts",
4
+ "module": "../_esm/chains/index.js",
5
+ "main": "../_cjs/chains/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/chains/utils.d.ts",
4
+ "module": "../../_esm/chains/utils.js",
5
+ "main": "../../_cjs/chains/utils.js"
6
+ }
@@ -97,6 +97,11 @@ import {
97
97
  type GetChainIdReturnType,
98
98
  getChainId,
99
99
  } from '../../actions/public/getChainId.js'
100
+ import {
101
+ type GetContractEventsParameters,
102
+ type GetContractEventsReturnType,
103
+ getContractEvents,
104
+ } from '../../actions/public/getContractEvents.js'
100
105
  import {
101
106
  type GetFeeHistoryParameters,
102
107
  type GetFeeHistoryReturnType,
@@ -624,6 +629,48 @@ export type PublicActions<
624
629
  * // 1
625
630
  */
626
631
  getChainId: () => Promise<GetChainIdReturnType>
632
+ /**
633
+ * Returns a list of event logs emitted by a contract.
634
+ *
635
+ * - Docs: https://viem.sh/docs/actions/public/getContractEvents.html
636
+ * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
637
+ *
638
+ * @param client - Client to use
639
+ * @param parameters - {@link GetContractEventsParameters}
640
+ * @returns A list of event logs. {@link GetContractEventsReturnType}
641
+ *
642
+ * @example
643
+ * import { createPublicClient, http } from 'viem'
644
+ * import { mainnet } from 'viem/chains'
645
+ * import { wagmiAbi } from './abi'
646
+ *
647
+ * const client = createPublicClient({
648
+ * chain: mainnet,
649
+ * transport: http(),
650
+ * })
651
+ * const logs = await client.getContractEvents(client, {
652
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
653
+ * abi: wagmiAbi,
654
+ * eventName: 'Transfer'
655
+ * })
656
+ */
657
+ getContractEvents: <
658
+ const abi extends Abi | readonly unknown[],
659
+ eventName extends ContractEventName<abi> | undefined = undefined,
660
+ strict extends boolean | undefined = undefined,
661
+ fromBlock extends BlockNumber | BlockTag | undefined = undefined,
662
+ toBlock extends BlockNumber | BlockTag | undefined = undefined,
663
+ >(
664
+ args: GetContractEventsParameters<
665
+ abi,
666
+ eventName,
667
+ strict,
668
+ fromBlock,
669
+ toBlock
670
+ >,
671
+ ) => Promise<
672
+ GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>
673
+ >
627
674
  /**
628
675
  * Gets address for ENS name.
629
676
  *
@@ -1645,6 +1692,7 @@ export function publicActions<
1645
1692
  getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
1646
1693
  getBytecode: (args) => getBytecode(client, args),
1647
1694
  getChainId: () => getChainId(client),
1695
+ getContractEvents: (args) => getContractEvents(client, args),
1648
1696
  getEnsAddress: (args) => getEnsAddress(client, args),
1649
1697
  getEnsAvatar: (args) => getEnsAvatar(client, args),
1650
1698
  getEnsName: (args) => getEnsName(client, args),
@@ -682,6 +682,6 @@ export function walletActions<
682
682
  signTypedData: (args) => signTypedData(client, args),
683
683
  switchChain: (args) => switchChain(client, args),
684
684
  watchAsset: (args) => watchAsset(client, args),
685
- writeContract: (args) => writeContract(client, args),
685
+ writeContract: (args) => writeContract(client, args as any),
686
686
  }
687
687
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/clients/index.d.ts",
4
+ "module": "../_esm/clients/index.js",
5
+ "main": "../_cjs/clients/index.js"
6
+ }
@@ -1,4 +1,4 @@
1
- import type { WebSocket } from 'unws'
1
+ import type { WebSocket } from 'isomorphic-ws'
2
2
 
3
3
  import { RpcRequestError } from '../../errors/request.js'
4
4
  import { UrlRequiredError } from '../../errors/transport.js'
@@ -1,28 +1,30 @@
1
+ // TODO(v2): Remove this entrypoint. Favor importing from root entrypoint (`viem`).
2
+
1
3
  export {
2
4
  type CreateContractEventFilterParameters,
3
5
  type CreateContractEventFilterReturnType,
4
6
  createContractEventFilter,
5
- } from './actions/public/createContractEventFilter.js'
7
+ } from '../actions/public/createContractEventFilter.js'
6
8
  export {
7
9
  type EstimateContractGasParameters,
8
10
  type EstimateContractGasReturnType,
9
11
  estimateContractGas,
10
- } from './actions/public/estimateContractGas.js'
12
+ } from '../actions/public/estimateContractGas.js'
11
13
  export {
12
14
  type GetBytecodeParameters,
13
15
  type GetBytecodeReturnType,
14
16
  getBytecode,
15
- } from './actions/public/getBytecode.js'
17
+ } from '../actions/public/getBytecode.js'
16
18
  export {
17
19
  type GetStorageAtParameters,
18
20
  type GetStorageAtReturnType,
19
21
  getStorageAt,
20
- } from './actions/public/getStorageAt.js'
22
+ } from '../actions/public/getStorageAt.js'
21
23
  export {
22
24
  type MulticallParameters,
23
25
  type MulticallReturnType,
24
26
  multicall,
25
- } from './actions/public/multicall.js'
27
+ } from '../actions/public/multicall.js'
26
28
  export type {
27
29
  WatchEventOnLogsFn,
28
30
  /** @deprecated - use `WatchEventOnLogsFn` instead. */
@@ -30,81 +32,81 @@ export type {
30
32
  WatchEventOnLogsParameter,
31
33
  /** @deprecated - use `WatchEventOnLogsParameter` instead. */
32
34
  WatchEventOnLogsParameter as OnLogsParameter,
33
- } from './actions/public/watchEvent.js'
35
+ } from '../actions/public/watchEvent.js'
34
36
  export {
35
37
  type ReadContractParameters,
36
38
  type ReadContractReturnType,
37
39
  readContract,
38
- } from './actions/public/readContract.js'
40
+ } from '../actions/public/readContract.js'
39
41
  export {
40
42
  type SimulateContractParameters,
41
43
  type SimulateContractReturnType,
42
44
  simulateContract,
43
- } from './actions/public/simulateContract.js'
45
+ } from '../actions/public/simulateContract.js'
44
46
  export {
45
47
  type WatchContractEventParameters,
46
48
  watchContractEvent,
47
- } from './actions/public/watchContractEvent.js'
49
+ } from '../actions/public/watchContractEvent.js'
48
50
  export {
49
51
  type DeployContractParameters,
50
52
  type DeployContractReturnType,
51
53
  deployContract,
52
- } from './actions/wallet/deployContract.js'
54
+ } from '../actions/wallet/deployContract.js'
53
55
  export {
54
56
  type WriteContractParameters,
55
57
  type WriteContractReturnType,
56
58
  writeContract,
57
- } from './actions/wallet/writeContract.js'
59
+ } from '../actions/wallet/writeContract.js'
58
60
  export {
59
61
  type DecodeAbiParametersReturnType,
60
62
  decodeAbiParameters,
61
- } from './utils/abi/decodeAbiParameters.js'
63
+ } from '../utils/abi/decodeAbiParameters.js'
62
64
  export {
63
65
  type DecodeErrorResultParameters,
64
66
  type DecodeErrorResultReturnType,
65
67
  decodeErrorResult,
66
- } from './utils/abi/decodeErrorResult.js'
68
+ } from '../utils/abi/decodeErrorResult.js'
67
69
  export {
68
70
  type DecodeEventLogParameters,
69
71
  type DecodeEventLogReturnType,
70
72
  decodeEventLog,
71
- } from './utils/abi/decodeEventLog.js'
73
+ } from '../utils/abi/decodeEventLog.js'
72
74
  export {
73
75
  type DecodeFunctionDataParameters,
74
76
  decodeFunctionData,
75
- } from './utils/abi/decodeFunctionData.js'
77
+ } from '../utils/abi/decodeFunctionData.js'
76
78
  export {
77
79
  type DecodeFunctionResultParameters,
78
80
  type DecodeFunctionResultReturnType,
79
81
  decodeFunctionResult,
80
- } from './utils/abi/decodeFunctionResult.js'
82
+ } from '../utils/abi/decodeFunctionResult.js'
81
83
  export {
82
84
  type EncodeAbiParametersReturnType,
83
85
  encodeAbiParameters,
84
- } from './utils/abi/encodeAbiParameters.js'
86
+ } from '../utils/abi/encodeAbiParameters.js'
85
87
  export {
86
88
  type EncodeDeployDataParameters,
87
89
  encodeDeployData,
88
- } from './utils/abi/encodeDeployData.js'
90
+ } from '../utils/abi/encodeDeployData.js'
89
91
  export {
90
92
  type EncodeErrorResultParameters,
91
93
  encodeErrorResult,
92
- } from './utils/abi/encodeErrorResult.js'
94
+ } from '../utils/abi/encodeErrorResult.js'
93
95
  export {
94
96
  type EncodeEventTopicsParameters,
95
97
  encodeEventTopics,
96
- } from './utils/abi/encodeEventTopics.js'
98
+ } from '../utils/abi/encodeEventTopics.js'
97
99
  export {
98
100
  type EncodeFunctionDataParameters,
99
101
  encodeFunctionData,
100
- } from './utils/abi/encodeFunctionData.js'
102
+ } from '../utils/abi/encodeFunctionData.js'
101
103
  export {
102
104
  type EncodeFunctionResultParameters,
103
105
  encodeFunctionResult,
104
- } from './utils/abi/encodeFunctionResult.js'
106
+ } from '../utils/abi/encodeFunctionResult.js'
105
107
  export {
106
108
  type GetAbiItemParameters,
107
109
  getAbiItem,
108
- } from './utils/abi/getAbiItem.js'
109
- export { formatAbiItemWithArgs } from './utils/abi/formatAbiItemWithArgs.js'
110
- export { formatAbiItem } from './utils/abi/formatAbiItem.js'
110
+ } from '../utils/abi/getAbiItem.js'
111
+ export { formatAbiItemWithArgs } from '../utils/abi/formatAbiItemWithArgs.js'
112
+ export { formatAbiItem } from '../utils/abi/formatAbiItem.js'
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/contract/index.d.ts",
4
+ "module": "../_esm/contract/index.js",
5
+ "main": "../_cjs/contract/index.js"
6
+ }
@@ -1,28 +1,28 @@
1
- export { normalize } from './utils/ens/normalize.js'
1
+ export { normalize } from '../utils/ens/normalize.js'
2
2
  export {
3
3
  type GetEnsAddressParameters,
4
4
  type GetEnsAddressReturnType,
5
5
  getEnsAddress,
6
- } from './actions/ens/getEnsAddress.js'
6
+ } from '../actions/ens/getEnsAddress.js'
7
7
  export {
8
8
  type GetEnsAvatarParameters,
9
9
  type GetEnsAvatarReturnType,
10
10
  getEnsAvatar,
11
- } from './actions/ens/getEnsAvatar.js'
11
+ } from '../actions/ens/getEnsAvatar.js'
12
12
  export {
13
13
  type GetEnsNameParameters,
14
14
  type GetEnsNameReturnType,
15
15
  getEnsName,
16
- } from './actions/ens/getEnsName.js'
16
+ } from '../actions/ens/getEnsName.js'
17
17
  export {
18
18
  type GetEnsResolverParameters,
19
19
  type GetEnsResolverReturnType,
20
20
  getEnsResolver,
21
- } from './actions/ens/getEnsResolver.js'
21
+ } from '../actions/ens/getEnsResolver.js'
22
22
  export {
23
23
  type GetEnsTextParameters,
24
24
  type GetEnsTextReturnType,
25
25
  getEnsText,
26
- } from './actions/ens/getEnsText.js'
27
- export { labelhash } from './utils/ens/labelhash.js'
28
- export { namehash } from './utils/ens/namehash.js'
26
+ } from '../actions/ens/getEnsText.js'
27
+ export { labelhash } from '../utils/ens/labelhash.js'
28
+ export { namehash } from '../utils/ens/namehash.js'
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/ens/index.d.ts",
4
+ "module": "../_esm/ens/index.js",
5
+ "main": "../_cjs/ens/index.js"
6
+ }
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.0.0-alpha.1'
1
+ export const version = '2.0.0-alpha.11'
package/index.ts CHANGED
@@ -667,6 +667,8 @@ export type {
667
667
  } from './types/multicall.js'
668
668
  export type { ParseAccount } from './types/account.js'
669
669
  export type {
670
+ Index,
671
+ Quantity,
670
672
  RpcBlock,
671
673
  RpcBlockIdentifier,
672
674
  RpcBlockNumber,
@@ -866,7 +868,9 @@ export { fromRlp } from './utils/encoding/fromRlp.js'
866
868
  export { getAddress } from './utils/address/getAddress.js'
867
869
  export { getContractError } from './utils/errors/getContractError.js'
868
870
  export { getEventSelector } from './utils/hash/getEventSelector.js'
871
+ export { getEventSignature } from './utils/hash/getEventSignature.js'
869
872
  export { getFunctionSelector } from './utils/hash/getFunctionSelector.js'
873
+ export { getFunctionSignature } from './utils/hash/getFunctionSignature.js'
870
874
  export { hashMessage } from './utils/signature/hashMessage.js'
871
875
  export { isAddress } from './utils/address/isAddress.js'
872
876
  export { isAddressEqual } from './utils/address/isAddressEqual.js'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.0.0-alpha.1",
4
+ "version": "2.0.0-alpha.11",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
7
7
  "module": "./_esm/index.js",
@@ -23,9 +23,9 @@
23
23
  "default": "./_cjs/index.js"
24
24
  },
25
25
  "./abi": {
26
- "types": "./_types/abi.d.ts",
27
- "import": "./_esm/abi.js",
28
- "default": "./_cjs/abi.js"
26
+ "types": "./_types/abi/index.d.ts",
27
+ "import": "./_esm/abi/index.js",
28
+ "default": "./_cjs/abi/index.js"
29
29
  },
30
30
  "./accounts": {
31
31
  "types": "./_types/accounts/index.d.ts",
@@ -48,24 +48,24 @@
48
48
  "default": "./_cjs/chains/utils.js"
49
49
  },
50
50
  "./contract": {
51
- "types": "./_types/contract.d.ts",
52
- "import": "./_esm/contract.js",
53
- "default": "./_cjs/contract.js"
51
+ "types": "./_types/contract/index.d.ts",
52
+ "import": "./_esm/contract/index.js",
53
+ "default": "./_cjs/contract/index.js"
54
54
  },
55
55
  "./ens": {
56
- "types": "./_types/ens.d.ts",
57
- "import": "./_esm/ens.js",
58
- "default": "./_cjs/ens.js"
56
+ "types": "./_types/ens/index.d.ts",
57
+ "import": "./_esm/ens/index.js",
58
+ "default": "./_cjs/ens/index.js"
59
59
  },
60
60
  "./public": {
61
- "types": "./_types/public.d.ts",
62
- "import": "./_esm/public.js",
63
- "default": "./_cjs/public.js"
61
+ "types": "./_types/public/index.d.ts",
62
+ "import": "./_esm/public/index.js",
63
+ "default": "./_cjs/public/index.js"
64
64
  },
65
65
  "./test": {
66
- "types": "./_types/test.d.ts",
67
- "import": "./_esm/test.js",
68
- "default": "./_cjs/test.js"
66
+ "types": "./_types/test/index.d.ts",
67
+ "import": "./_esm/test/index.js",
68
+ "default": "./_cjs/test/index.js"
69
69
  },
70
70
  "./utils": {
71
71
  "types": "./_types/utils/index.d.ts",
@@ -73,30 +73,31 @@
73
73
  "default": "./_cjs/utils/index.js"
74
74
  },
75
75
  "./wallet": {
76
- "types": "./_types/wallet.d.ts",
77
- "import": "./_esm/wallet.js",
78
- "default": "./_cjs/wallet.js"
76
+ "types": "./_types/wallet/index.d.ts",
77
+ "import": "./_esm/wallet/index.js",
78
+ "default": "./_cjs/wallet/index.js"
79
79
  },
80
80
  "./window": {
81
- "types": "./_types/window.d.ts",
82
- "import": "./_esm/window.js",
83
- "default": "./_cjs/window.js"
81
+ "types": "./_types/window/index.d.ts",
82
+ "import": "./_esm/window/index.js",
83
+ "default": "./_cjs/window/index.js"
84
84
  },
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "typesVersions": {
88
88
  "*": {
89
- "abi": ["./_types/abi.d.ts"],
89
+ "abi": ["./_types/abi/index.d.ts"],
90
90
  "accounts": ["./_types/accounts/index.d.ts"],
91
91
  "actions": ["./_types/actions/index.d.ts"],
92
- "chains": ["./_types/chains.d.ts"],
93
- "contract": ["./_types/contract.d.ts"],
94
- "ens": ["./_types/ens.d.ts"],
95
- "public": ["./_types/public.d.ts"],
96
- "test": ["./_types/test.d.ts"],
92
+ "chains": ["./_types/chains/index.d.ts"],
93
+ "chains/utils": ["./_types/chains/utils.d.ts"],
94
+ "contract": ["./_types/contract/index.d.ts"],
95
+ "ens": ["./_types/ens/index.d.ts"],
96
+ "public": ["./_types/public/index.d.ts"],
97
+ "test": ["./_types/test/index.d.ts"],
97
98
  "utils": ["./_types/utils/index.d.ts"],
98
- "wallet": ["./_types/wallet.d.ts"],
99
- "window": ["./_types/window.d.ts"]
99
+ "wallet": ["./_types/wallet/index.d.ts"],
100
+ "window": ["./_types/window/index.d.ts"]
100
101
  }
101
102
  },
102
103
  "peerDependencies": {
@@ -115,7 +116,7 @@
115
116
  "@scure/bip39": "1.2.1",
116
117
  "@types/ws": "^8.5.5",
117
118
  "abitype": "0.9.8",
118
- "unws": "0.2.4",
119
+ "isomorphic-ws": "5.0.0",
119
120
  "ws": "8.13.0"
120
121
  },
121
122
  "license": "MIT",