viem 2.31.3 → 2.31.4

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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/actions/public/watchBlockNumber.js +6 -3
  3. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  4. package/_cjs/actions/public/watchBlocks.js +6 -3
  5. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  6. package/_cjs/actions/public/watchContractEvent.js +6 -3
  7. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  8. package/_cjs/actions/public/watchEvent.js +6 -3
  9. package/_cjs/actions/public/watchEvent.js.map +1 -1
  10. package/_cjs/actions/public/watchPendingTransactions.js +3 -1
  11. package/_cjs/actions/public/watchPendingTransactions.js.map +1 -1
  12. package/_cjs/chains/definitions/chiliz.js +1 -1
  13. package/_cjs/chains/definitions/morph.js +6 -0
  14. package/_cjs/chains/definitions/morph.js.map +1 -1
  15. package/_cjs/chains/definitions/somniaTestnet.js +7 -1
  16. package/_cjs/chains/definitions/somniaTestnet.js.map +1 -1
  17. package/_cjs/chains/definitions/tac.js +33 -0
  18. package/_cjs/chains/definitions/tac.js.map +1 -0
  19. package/_cjs/chains/definitions/tacSPB.js +33 -0
  20. package/_cjs/chains/definitions/tacSPB.js.map +1 -0
  21. package/_cjs/chains/index.js +6 -2
  22. package/_cjs/chains/index.js.map +1 -1
  23. package/_cjs/clients/transports/ipc.js.map +1 -1
  24. package/_cjs/errors/version.js +1 -1
  25. package/_esm/actions/public/watchBlockNumber.js +6 -3
  26. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  27. package/_esm/actions/public/watchBlocks.js +6 -3
  28. package/_esm/actions/public/watchBlocks.js.map +1 -1
  29. package/_esm/actions/public/watchContractEvent.js +6 -3
  30. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  31. package/_esm/actions/public/watchEvent.js +6 -3
  32. package/_esm/actions/public/watchEvent.js.map +1 -1
  33. package/_esm/actions/public/watchPendingTransactions.js +3 -1
  34. package/_esm/actions/public/watchPendingTransactions.js.map +1 -1
  35. package/_esm/chains/definitions/chiliz.js +1 -1
  36. package/_esm/chains/definitions/morph.js +6 -0
  37. package/_esm/chains/definitions/morph.js.map +1 -1
  38. package/_esm/chains/definitions/somniaTestnet.js +7 -1
  39. package/_esm/chains/definitions/somniaTestnet.js.map +1 -1
  40. package/_esm/chains/definitions/tac.js +30 -0
  41. package/_esm/chains/definitions/tac.js.map +1 -0
  42. package/_esm/chains/definitions/tacSPB.js +30 -0
  43. package/_esm/chains/definitions/tacSPB.js.map +1 -0
  44. package/_esm/chains/index.js +2 -0
  45. package/_esm/chains/index.js.map +1 -1
  46. package/_esm/clients/transports/ipc.js.map +1 -1
  47. package/_esm/errors/version.js +1 -1
  48. package/_types/actions/public/watchBlockNumber.d.ts +1 -1
  49. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  50. package/_types/actions/public/watchBlocks.d.ts +1 -1
  51. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  52. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  53. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  54. package/_types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  55. package/_types/chains/definitions/chiliz.d.ts +1 -1
  56. package/_types/chains/definitions/morph.d.ts +6 -9
  57. package/_types/chains/definitions/morph.d.ts.map +1 -1
  58. package/_types/chains/definitions/somniaTestnet.d.ts +7 -10
  59. package/_types/chains/definitions/somniaTestnet.d.ts.map +1 -1
  60. package/_types/chains/definitions/tac.d.ts +41 -0
  61. package/_types/chains/definitions/tac.d.ts.map +1 -0
  62. package/_types/chains/definitions/tacSPB.d.ts +36 -0
  63. package/_types/chains/definitions/tacSPB.d.ts.map +1 -0
  64. package/_types/chains/index.d.ts +2 -0
  65. package/_types/chains/index.d.ts.map +1 -1
  66. package/_types/clients/transports/ipc.d.ts +16 -7
  67. package/_types/clients/transports/ipc.d.ts.map +1 -1
  68. package/_types/errors/version.d.ts +1 -1
  69. package/_types/types/calls.d.ts +1 -1
  70. package/_types/types/calls.d.ts.map +1 -1
  71. package/_types/types/eip1193.d.ts +6 -3
  72. package/_types/types/eip1193.d.ts.map +1 -1
  73. package/_types/types/transport.d.ts +1 -1
  74. package/_types/types/transport.d.ts.map +1 -1
  75. package/actions/public/watchBlockNumber.ts +10 -4
  76. package/actions/public/watchBlocks.ts +10 -4
  77. package/actions/public/watchContractEvent.ts +9 -3
  78. package/actions/public/watchEvent.ts +9 -3
  79. package/actions/public/watchPendingTransactions.ts +3 -1
  80. package/chains/definitions/chiliz.ts +1 -1
  81. package/chains/definitions/morph.ts +6 -0
  82. package/chains/definitions/somniaTestnet.ts +7 -1
  83. package/chains/definitions/tac.ts +30 -0
  84. package/chains/definitions/tacSPB.ts +30 -0
  85. package/chains/index.ts +2 -0
  86. package/clients/transports/ipc.ts +23 -8
  87. package/errors/version.ts +1 -1
  88. package/package.json +1 -1
  89. package/types/calls.ts +3 -1
  90. package/types/eip1193.ts +6 -3
  91. package/types/transport.ts +1 -1
@@ -37,7 +37,7 @@ export type WatchBlocksParameters<
37
37
  /** The callback to call when an error occurred when trying to get for a new block. */
38
38
  onError?: ((error: Error) => void) | undefined
39
39
  } & (
40
- | (HasTransportType<transport, 'webSocket'> extends true
40
+ | (HasTransportType<transport, 'webSocket' | 'ipc'> extends true
41
41
  ? {
42
42
  blockTag?: undefined
43
43
  emitMissed?: undefined
@@ -115,10 +115,15 @@ export function watchBlocks<
115
115
  ): WatchBlocksReturnType {
116
116
  const enablePolling = (() => {
117
117
  if (typeof poll_ !== 'undefined') return poll_
118
- if (client.transport.type === 'webSocket') return false
118
+ if (
119
+ client.transport.type === 'webSocket' ||
120
+ client.transport.type === 'ipc'
121
+ )
122
+ return false
119
123
  if (
120
124
  client.transport.type === 'fallback' &&
121
- client.transport.transports[0].config.type === 'webSocket'
125
+ (client.transport.transports[0].config.type === 'webSocket' ||
126
+ client.transport.transports[0].config.type === 'ipc')
122
127
  )
123
128
  return false
124
129
  return true
@@ -227,7 +232,8 @@ export function watchBlocks<
227
232
  if (client.transport.type === 'fallback') {
228
233
  const transport = client.transport.transports.find(
229
234
  (transport: ReturnType<Transport>) =>
230
- transport.config.type === 'webSocket',
235
+ transport.config.type === 'webSocket' ||
236
+ transport.config.type === 'ipc',
231
237
  )
232
238
  if (!transport) return client.transport
233
239
  return transport.value
@@ -157,10 +157,15 @@ export function watchContractEvent<
157
157
  const enablePolling = (() => {
158
158
  if (typeof poll_ !== 'undefined') return poll_
159
159
  if (typeof fromBlock === 'bigint') return true
160
- if (client.transport.type === 'webSocket') return false
160
+ if (
161
+ client.transport.type === 'webSocket' ||
162
+ client.transport.type === 'ipc'
163
+ )
164
+ return false
161
165
  if (
162
166
  client.transport.type === 'fallback' &&
163
- client.transport.transports[0].config.type === 'webSocket'
167
+ (client.transport.transports[0].config.type === 'webSocket' ||
168
+ client.transport.transports[0].config.type === 'ipc')
164
169
  )
165
170
  return false
166
171
  return true
@@ -300,7 +305,8 @@ export function watchContractEvent<
300
305
  if (client.transport.type === 'fallback') {
301
306
  const transport = client.transport.transports.find(
302
307
  (transport: ReturnType<Transport>) =>
303
- transport.config.type === 'webSocket',
308
+ transport.config.type === 'webSocket' ||
309
+ transport.config.type === 'ipc',
304
310
  )
305
311
  if (!transport) return client.transport
306
312
  return transport.value
@@ -177,10 +177,15 @@ export function watchEvent<
177
177
  const enablePolling = (() => {
178
178
  if (typeof poll_ !== 'undefined') return poll_
179
179
  if (typeof fromBlock === 'bigint') return true
180
- if (client.transport.type === 'webSocket') return false
180
+ if (
181
+ client.transport.type === 'webSocket' ||
182
+ client.transport.type === 'ipc'
183
+ )
184
+ return false
181
185
  if (
182
186
  client.transport.type === 'fallback' &&
183
- client.transport.transports[0].config.type === 'webSocket'
187
+ (client.transport.transports[0].config.type === 'webSocket' ||
188
+ client.transport.transports[0].config.type === 'ipc')
184
189
  )
185
190
  return false
186
191
  return true
@@ -309,7 +314,8 @@ export function watchEvent<
309
314
  if (client.transport.type === 'fallback') {
310
315
  const transport = client.transport.transports.find(
311
316
  (transport: ReturnType<Transport>) =>
312
- transport.config.type === 'webSocket',
317
+ transport.config.type === 'webSocket' ||
318
+ transport.config.type === 'ipc',
313
319
  )
314
320
  if (!transport) return client.transport
315
321
  return transport.value
@@ -76,7 +76,9 @@ export function watchPendingTransactions<
76
76
  }: WatchPendingTransactionsParameters<transport>,
77
77
  ) {
78
78
  const enablePolling =
79
- typeof poll_ !== 'undefined' ? poll_ : client.transport.type !== 'webSocket'
79
+ typeof poll_ !== 'undefined'
80
+ ? poll_
81
+ : client.transport.type !== 'webSocket' && client.transport.type !== 'ipc'
80
82
 
81
83
  const pollPendingTransactions = () => {
82
84
  const observerId = stringify([
@@ -23,7 +23,7 @@ export const chiliz = /*#__PURE__*/ defineChain({
23
23
  },
24
24
  contracts: {
25
25
  multicall3: {
26
- address: '0xca11bde05977b3631167028862be2a173976ca11',
26
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
27
27
  blockCreated: 8080847,
28
28
  },
29
29
  },
@@ -20,5 +20,11 @@ export const morph = /*#__PURE__*/ defineChain({
20
20
  url: 'https://explorer.morphl2.io',
21
21
  },
22
22
  },
23
+ contracts: {
24
+ multicall3: {
25
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
26
+ blockCreated: 3654913,
27
+ },
28
+ },
23
29
  testnet: false,
24
30
  })
@@ -12,9 +12,15 @@ export const somniaTestnet = /*#__PURE__*/ defineChain({
12
12
  blockExplorers: {
13
13
  default: {
14
14
  name: 'Somnia Testnet Explorer',
15
- url: 'https://somnia-testnet.socialscan.io',
15
+ url: 'https://shannon-explorer.somnia.network/',
16
16
  apiUrl: 'https://shannon-explorer.somnia.network/api',
17
17
  },
18
18
  },
19
+ contracts: {
20
+ multicall3: {
21
+ address: '0x841b8199E6d3Db3C6f264f6C2bd8848b3cA64223',
22
+ blockCreated: 71314235,
23
+ },
24
+ },
19
25
  testnet: true,
20
26
  })
@@ -0,0 +1,30 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const tac = /*#__PURE__*/ defineChain({
4
+ id: 239,
5
+ name: 'TAC',
6
+ nativeCurrency: { name: 'TAC', symbol: 'TAC', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://rpc.ankr.com/tac'],
10
+ },
11
+ },
12
+ blockExplorers: {
13
+ default: {
14
+ name: 'Blockscout',
15
+ url: 'https://tac.blockscout.com',
16
+ apiUrl: 'https://tac.blockscout.com/api',
17
+ },
18
+ native: {
19
+ name: 'TAC Explorer',
20
+ url: 'https://explorer.tac.build',
21
+ apiUrl: 'https://explorer.tac.build/api',
22
+ },
23
+ },
24
+ contracts: {
25
+ multicall3: {
26
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
27
+ blockCreated: 0,
28
+ },
29
+ },
30
+ })
@@ -0,0 +1,30 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const tacSPB = /*#__PURE__*/ defineChain({
4
+ id: 2_391,
5
+ name: 'TAC SPB Testnet',
6
+ nativeCurrency: {
7
+ name: 'TAC',
8
+ symbol: 'TAC',
9
+ decimals: 18,
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: ['https://spb.rpc.tac.build'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'TAC',
19
+ url: 'https://spb.explorer.tac.build',
20
+ apiUrl: 'https://spb.explorer.tac.build/api',
21
+ },
22
+ },
23
+ contracts: {
24
+ multicall3: {
25
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
26
+ blockCreated: 471429,
27
+ },
28
+ },
29
+ testnet: true,
30
+ })
package/chains/index.ts CHANGED
@@ -524,6 +524,8 @@ export { swellchainTestnet } from './definitions/swellchainTestnet.js'
524
524
  export { swissdlt } from './definitions/swissdlt.js'
525
525
  export { syscoin } from './definitions/syscoin.js'
526
526
  export { syscoinTestnet } from './definitions/syscoinTestnet.js'
527
+ export { tac } from './definitions/tac.js'
528
+ export { tacSPB } from './definitions/tacSPB.js'
527
529
  export { taiko } from './definitions/taiko.js'
528
530
  export { taikoHekla } from './definitions/taikoHekla.js'
529
531
  export { taikoJolnir } from './definitions/taikoJolnir.js'
@@ -1,7 +1,8 @@
1
+ import type { Address } from 'abitype'
1
2
  import { RpcRequestError } from '../../errors/request.js'
2
3
  import type { UrlRequiredErrorType } from '../../errors/transport.js'
3
4
  import type { ErrorType } from '../../errors/utils.js'
4
- import type { Hash } from '../../types/misc.js'
5
+ import type { Hash, LogTopic } from '../../types/misc.js'
5
6
  import type { RpcResponse } from '../../types/rpc.js'
6
7
  import {
7
8
  type GetIpcRpcClientOptions,
@@ -27,13 +28,27 @@ type IpcTransportSubscribeReturnType = {
27
28
 
28
29
  type IpcTransportSubscribe = {
29
30
  subscribe(
30
- args: IpcTransportSubscribeParameters & {
31
- /**
32
- * @description Add information about compiled contracts
33
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
34
- */
35
- params: ['newHeads']
36
- },
31
+ args: IpcTransportSubscribeParameters &
32
+ (
33
+ | {
34
+ params: ['newHeads']
35
+ }
36
+ | {
37
+ params: ['newPendingTransactions']
38
+ }
39
+ | {
40
+ params: [
41
+ 'logs',
42
+ {
43
+ address?: Address | Address[]
44
+ topics?: LogTopic[]
45
+ },
46
+ ]
47
+ }
48
+ | {
49
+ params: ['syncing']
50
+ }
51
+ ),
37
52
  ): Promise<IpcTransportSubscribeReturnType>
38
53
  }
39
54
 
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.31.3'
1
+ export const version = '2.31.4'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.31.3",
4
+ "version": "2.31.4",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
package/types/calls.ts CHANGED
@@ -48,7 +48,9 @@ export type Calls<
48
48
  ? calls
49
49
  : // If `calls` is *some* array but we couldn't assign `unknown[]` to it, then it must hold some known/homogenous type!
50
50
  // use this to infer the param types in the case of Array.map() argument
51
- calls extends readonly (infer call extends OneOf<Call>)[]
51
+ calls extends readonly (infer call extends OneOf<
52
+ Call<unknown, extraProperties>
53
+ >)[]
52
54
  ? readonly Prettify<call>[]
53
55
  : // Fallback
54
56
  readonly OneOf<Call>[]
package/types/eip1193.ts CHANGED
@@ -662,11 +662,14 @@ export type PublicRpcSchema = [
662
662
  ReturnType: Hex
663
663
  },
664
664
  /**
665
- * @description Executes a new message call immediately without submitting a transaction to the network
665
+ * @description Creates an EIP-2930 access list that can be included in a transaction.
666
666
  *
667
667
  * @example
668
- * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
669
- * // => '0x...'
668
+ * provider.request({ method: 'eth_createAccessList', params: [{ to: '0x...', data: '0x...' }] })
669
+ * // => {
670
+ * // accessList: ['0x...', '0x...'],
671
+ * // gasUsed: '0x123',
672
+ * // }
670
673
  */
671
674
  {
672
675
  Method: 'eth_createAccessList'
@@ -6,7 +6,7 @@ export type GetTransportConfig<transport extends Transport> =
6
6
  ReturnType<transport>['config']
7
7
 
8
8
  export type GetPollOptions<transport extends Transport> =
9
- | (HasTransportType<transport, 'webSocket'> extends true
9
+ | (HasTransportType<transport, 'webSocket' | 'ipc'> extends true
10
10
  ? {
11
11
  batch?: undefined
12
12
  /**