viem 2.21.39 → 2.21.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +6 -0
  3. package/_cjs/actions/wallet/sendTransaction.js +15 -2
  4. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  5. package/_cjs/chains/definitions/aioz.js +26 -0
  6. package/_cjs/chains/definitions/aioz.js.map +1 -0
  7. package/_cjs/chains/definitions/enuls.js +24 -0
  8. package/_cjs/chains/definitions/enuls.js.map +1 -0
  9. package/_cjs/chains/definitions/godwoken.js +28 -0
  10. package/_cjs/chains/definitions/godwoken.js.map +1 -0
  11. package/_cjs/chains/definitions/polygonAmoy.js +1 -1
  12. package/_cjs/chains/definitions/polygonAmoy.js.map +1 -1
  13. package/_cjs/chains/definitions/sepolia.js +1 -1
  14. package/_cjs/chains/definitions/soneiumMinato.js +3 -3
  15. package/_cjs/chains/definitions/soneiumMinato.js.map +1 -1
  16. package/_cjs/chains/definitions/zeniq.js +22 -0
  17. package/_cjs/chains/definitions/zeniq.js.map +1 -0
  18. package/_cjs/chains/index.js +17 -9
  19. package/_cjs/chains/index.js.map +1 -1
  20. package/_cjs/errors/base.js +4 -1
  21. package/_cjs/errors/base.js.map +1 -1
  22. package/_cjs/errors/version.js +1 -1
  23. package/_esm/actions/public/getBlock.js +1 -1
  24. package/_esm/actions/public/getLogs.js +1 -1
  25. package/_esm/actions/public/getTransaction.js +1 -1
  26. package/_esm/actions/public/getTransactionConfirmations.js +1 -1
  27. package/_esm/actions/public/getTransactionReceipt.js +1 -1
  28. package/_esm/actions/public/readContract.js +1 -1
  29. package/_esm/actions/public/simulateContract.js +1 -1
  30. package/_esm/actions/public/waitForTransactionReceipt.js +1 -1
  31. package/_esm/actions/public/watchBlockNumber.js +1 -1
  32. package/_esm/actions/public/watchBlocks.js +1 -1
  33. package/_esm/actions/wallet/deployContract.js +1 -1
  34. package/_esm/actions/wallet/sendTransaction.js +16 -3
  35. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  36. package/_esm/actions/wallet/writeContract.js +1 -1
  37. package/_esm/chains/definitions/aioz.js +23 -0
  38. package/_esm/chains/definitions/aioz.js.map +1 -0
  39. package/_esm/chains/definitions/enuls.js +21 -0
  40. package/_esm/chains/definitions/enuls.js.map +1 -0
  41. package/_esm/chains/definitions/godwoken.js +25 -0
  42. package/_esm/chains/definitions/godwoken.js.map +1 -0
  43. package/_esm/chains/definitions/polygonAmoy.js +1 -1
  44. package/_esm/chains/definitions/polygonAmoy.js.map +1 -1
  45. package/_esm/chains/definitions/sepolia.js +1 -1
  46. package/_esm/chains/definitions/soneiumMinato.js +3 -3
  47. package/_esm/chains/definitions/soneiumMinato.js.map +1 -1
  48. package/_esm/chains/definitions/zeniq.js +19 -0
  49. package/_esm/chains/definitions/zeniq.js.map +1 -0
  50. package/_esm/chains/index.js +4 -0
  51. package/_esm/chains/index.js.map +1 -1
  52. package/_esm/errors/base.js +4 -1
  53. package/_esm/errors/base.js.map +1 -1
  54. package/_esm/errors/version.js +1 -1
  55. package/_types/actions/public/getBlock.d.ts +1 -1
  56. package/_types/actions/public/getLogs.d.ts +1 -1
  57. package/_types/actions/public/getTransaction.d.ts +1 -1
  58. package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
  59. package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
  60. package/_types/actions/public/readContract.d.ts +1 -1
  61. package/_types/actions/public/simulateContract.d.ts +1 -1
  62. package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
  63. package/_types/actions/public/watchBlockNumber.d.ts +1 -1
  64. package/_types/actions/public/watchBlocks.d.ts +1 -1
  65. package/_types/actions/wallet/deployContract.d.ts +1 -1
  66. package/_types/actions/wallet/sendTransaction.d.ts +1 -1
  67. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  68. package/_types/actions/wallet/writeContract.d.ts +1 -1
  69. package/_types/chains/definitions/aioz.d.ts +37 -0
  70. package/_types/chains/definitions/aioz.d.ts.map +1 -0
  71. package/_types/chains/definitions/enuls.d.ts +37 -0
  72. package/_types/chains/definitions/enuls.d.ts.map +1 -0
  73. package/_types/chains/definitions/godwoken.d.ts +33 -0
  74. package/_types/chains/definitions/godwoken.d.ts.map +1 -0
  75. package/_types/chains/definitions/polygonAmoy.d.ts +2 -2
  76. package/_types/chains/definitions/sepolia.d.ts +1 -1
  77. package/_types/chains/definitions/soneiumMinato.d.ts +3 -3
  78. package/_types/chains/definitions/zeniq.d.ts +37 -0
  79. package/_types/chains/definitions/zeniq.d.ts.map +1 -0
  80. package/_types/chains/index.d.ts +4 -0
  81. package/_types/chains/index.d.ts.map +1 -1
  82. package/_types/clients/decorators/public.d.ts +11 -11
  83. package/_types/clients/decorators/wallet.d.ts +3 -3
  84. package/_types/errors/version.d.ts +1 -1
  85. package/_types/zksync/decorators/eip712.d.ts +2 -2
  86. package/actions/public/getBlock.ts +1 -1
  87. package/actions/public/getLogs.ts +1 -1
  88. package/actions/public/getTransaction.ts +1 -1
  89. package/actions/public/getTransactionConfirmations.ts +1 -1
  90. package/actions/public/getTransactionReceipt.ts +1 -1
  91. package/actions/public/readContract.ts +1 -1
  92. package/actions/public/simulateContract.ts +1 -1
  93. package/actions/public/waitForTransactionReceipt.ts +1 -1
  94. package/actions/public/watchBlockNumber.ts +1 -1
  95. package/actions/public/watchBlocks.ts +1 -1
  96. package/actions/wallet/deployContract.ts +1 -1
  97. package/actions/wallet/sendTransaction.ts +20 -3
  98. package/actions/wallet/writeContract.ts +1 -1
  99. package/chains/definitions/aioz.ts +23 -0
  100. package/chains/definitions/enuls.ts +21 -0
  101. package/chains/definitions/godwoken.ts +25 -0
  102. package/chains/definitions/polygonAmoy.ts +1 -1
  103. package/chains/definitions/sepolia.ts +1 -1
  104. package/chains/definitions/soneiumMinato.ts +3 -3
  105. package/chains/definitions/zeniq.ts +19 -0
  106. package/chains/index.ts +4 -0
  107. package/clients/decorators/public.ts +11 -11
  108. package/clients/decorators/wallet.ts +3 -3
  109. package/errors/base.ts +6 -1
  110. package/errors/version.ts +1 -1
  111. package/package.json +1 -1
  112. package/zksync/decorators/eip712.ts +2 -2
@@ -104,7 +104,7 @@ export type SendTransactionErrorType =
104
104
  * Creates, signs, and sends a new transaction to the network.
105
105
  *
106
106
  * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
107
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
107
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
108
108
  * - JSON-RPC Methods:
109
109
  * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
110
110
  * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
@@ -231,7 +231,8 @@ export async function sendTransaction<
231
231
  value,
232
232
  } as TransactionRequest)
233
233
 
234
- const method = supportsWalletNamespace.get(client.uid)
234
+ const isWalletNamespaceSupported = supportsWalletNamespace.get(client.uid)
235
+ const method = isWalletNamespaceSupported
235
236
  ? 'wallet_sendTransaction'
236
237
  : 'eth_sendTransaction'
237
238
 
@@ -244,6 +245,8 @@ export async function sendTransaction<
244
245
  { retryCount: 0 },
245
246
  )
246
247
  } catch (e) {
248
+ if (isWalletNamespaceSupported === false) throw e
249
+
247
250
  const error = e as BaseError
248
251
  // If the transport does not support the method or input, attempt to use the
249
252
  // `wallet_sendTransaction` method.
@@ -252,7 +255,7 @@ export async function sendTransaction<
252
255
  error.name === 'InvalidParamsRpcError' ||
253
256
  error.name === 'MethodNotFoundRpcError' ||
254
257
  error.name === 'MethodNotSupportedRpcError'
255
- )
258
+ ) {
256
259
  return await client
257
260
  .request(
258
261
  {
@@ -265,6 +268,20 @@ export async function sendTransaction<
265
268
  supportsWalletNamespace.set(client.uid, true)
266
269
  return hash
267
270
  })
271
+ .catch((e) => {
272
+ const walletNamespaceError = e as BaseError
273
+ if (
274
+ walletNamespaceError.name === 'MethodNotFoundRpcError' ||
275
+ walletNamespaceError.name === 'MethodNotSupportedRpcError'
276
+ ) {
277
+ supportsWalletNamespace.set(client.uid, false)
278
+ throw error
279
+ }
280
+
281
+ throw walletNamespaceError
282
+ })
283
+ }
284
+
268
285
  throw error
269
286
  }
270
287
  }
@@ -103,7 +103,7 @@ export type WriteContractErrorType =
103
103
  * Executes a write function on a contract.
104
104
  *
105
105
  * - Docs: https://viem.sh/docs/contract/writeContract
106
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
106
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
107
107
  *
108
108
  * 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.
109
109
  *
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const aioz = /*#__PURE__*/ defineChain({
4
+ id: 168,
5
+ name: 'AIOZ Network',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'AIOZ',
9
+ symbol: 'AIOZ',
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: ['https://eth-dataseed.aioz.network'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'AIOZ Explorer',
19
+ url: 'https://explorer.aioz.network',
20
+ },
21
+ },
22
+ testnet: false,
23
+ })
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const enuls = /*#__PURE__*/ defineChain({
4
+ id: 119,
5
+ name: 'ENULS Mainnet',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'NULS',
9
+ symbol: 'NULS',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://evmapi2.nuls.io'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'ENULS Explorer',
17
+ url: 'https://evmscan.nuls.io',
18
+ },
19
+ },
20
+ testnet: false,
21
+ })
@@ -0,0 +1,25 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const godwoken = /*#__PURE__*/ defineChain({
4
+ id: 71402,
5
+ name: 'Godwoken Mainnet',
6
+ nativeCurrency: { decimals: 18, name: 'pCKB', symbol: 'pCKB' },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://v1.mainnet.godwoken.io/rpc'],
10
+ },
11
+ },
12
+ blockExplorers: {
13
+ default: {
14
+ name: 'GW Scan',
15
+ url: 'https://v1.gwscan.com',
16
+ },
17
+ },
18
+ contracts: {
19
+ multicall3: {
20
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
21
+ blockCreated: 15034,
22
+ },
23
+ },
24
+ testnet: false,
25
+ })
@@ -3,7 +3,7 @@ import { defineChain } from '../../utils/chain/defineChain.js'
3
3
  export const polygonAmoy = /*#__PURE__*/ defineChain({
4
4
  id: 80_002,
5
5
  name: 'Polygon Amoy',
6
- nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 },
6
+ nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
7
7
  rpcUrls: {
8
8
  default: {
9
9
  http: ['https://rpc-amoy.polygon.technology'],
@@ -6,7 +6,7 @@ export const sepolia = /*#__PURE__*/ defineChain({
6
6
  nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
7
7
  rpcUrls: {
8
8
  default: {
9
- http: ['https://rpc2.sepolia.org'],
9
+ http: ['https://sepolia.drpc.org'],
10
10
  },
11
11
  },
12
12
  blockExplorers: {
@@ -16,15 +16,15 @@ export const soneiumMinato = /*#__PURE__*/ defineChain({
16
16
  blockExplorers: {
17
17
  default: {
18
18
  name: 'Blockscout',
19
- url: 'https://explorer-testnet.soneium.org',
20
- apiUrl: 'https://explorer-testnet.soneium.org/api',
19
+ url: 'https://soneium-minato.blockscout.com',
20
+ apiUrl: 'https://soneium-minato.blockscout.com/api',
21
21
  },
22
22
  },
23
23
  contracts: {
24
24
  ...chainConfig.contracts,
25
25
  disputeGameFactory: {
26
26
  [sourceId]: {
27
- address: '0xF69dB6cA559C52d9A4BB6e2B2901f490Ca35Fbf6',
27
+ address: '0xB3Ad2c38E6e0640d7ce6aA952AB3A60E81bf7a01',
28
28
  },
29
29
  },
30
30
  l2OutputOracle: {
@@ -0,0 +1,19 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const zeniq = /*#__PURE__*/ defineChain({
4
+ id: 383414847825,
5
+ name: 'Zeniq Mainnet',
6
+ nativeCurrency: { name: 'ZENIQ', symbol: 'ZENIQ', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://api.zeniq.network'],
10
+ },
11
+ },
12
+ blockExplorers: {
13
+ default: {
14
+ name: 'Zeniq Explorer',
15
+ url: 'https://zeniqscan.com',
16
+ },
17
+ },
18
+ testnet: false,
19
+ })
package/chains/index.ts CHANGED
@@ -3,6 +3,7 @@ export type { Chain } from '../types/chain.js'
3
3
  // biome-ignore lint/performance/noBarrelFile: entrypoint module
4
4
  export { abstractTestnet } from './definitions/abstractTestnet.js'
5
5
  export { acala } from './definitions/acala.js'
6
+ export { aioz } from './definitions/aioz.js'
6
7
  export { alienx } from './definitions/alienX.js'
7
8
  export { alienxHalTestnet } from './definitions/alienXHalTestnet.js'
8
9
  export { ancient8 } from './definitions/ancient8.js'
@@ -115,6 +116,7 @@ export { elastosTestnet } from './definitions/elastosTestnet.js'
115
116
  export { electroneum } from './definitions/electroneum.js'
116
117
  export { electroneumTestnet } from './definitions/electroneumTestnet.js'
117
118
  export { elysiumTestnet } from './definitions/elysiumTestnet.js'
119
+ export { enuls } from './definitions/enuls.js'
118
120
  export { eon } from './definitions/eon.js'
119
121
  export { eos } from './definitions/eos.js'
120
122
  export { eosTestnet } from './definitions/eosTestnet.js'
@@ -158,6 +160,7 @@ export { gnosis } from './definitions/gnosis.js'
158
160
  export { gnosisChiado } from './definitions/gnosisChiado.js'
159
161
  export { gobi } from './definitions/gobi.js'
160
162
  export { goChain } from './definitions/goChain.js'
163
+ export { godwoken } from './definitions/godwoken.js'
161
164
  export { goerli } from './definitions/goerli.js'
162
165
  export { gravity } from './definitions/gravity.js'
163
166
  export { guruTestnet } from './definitions/guruTestnet.js'
@@ -416,6 +419,7 @@ export { xrSepolia } from './definitions/xrSepolia.js'
416
419
  export { yooldoVerse } from './definitions/yooldoVerse.js'
417
420
  export { yooldoVerseTestnet } from './definitions/yooldoVerseTestnet.js'
418
421
  export { zenchainTestnet } from './definitions/zenchainTestnet.js'
422
+ export { zeniq } from './definitions/zeniq.js'
419
423
  export { zetachain } from './definitions/zetachain.js'
420
424
  export { zetachainAthensTestnet } from './definitions/zetachainAthensTestnet.js'
421
425
  export { zhejiang } from './definitions/zhejiang.js'
@@ -552,7 +552,7 @@ export type PublicActions<
552
552
  * Returns information about a block at a block number, hash, or tag.
553
553
  *
554
554
  * - Docs: https://viem.sh/docs/actions/public/getBlock
555
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
555
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
556
556
  * - JSON-RPC Methods:
557
557
  * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
558
558
  * - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
@@ -580,7 +580,7 @@ export type PublicActions<
580
580
  * Returns the number of the most recent block seen.
581
581
  *
582
582
  * - Docs: https://viem.sh/docs/actions/public/getBlockNumber
583
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
583
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
584
584
  * - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
585
585
  *
586
586
  * @param args - {@link GetBlockNumberParameters}
@@ -1110,7 +1110,7 @@ export type PublicActions<
1110
1110
  * Returns a list of event logs matching the provided parameters.
1111
1111
  *
1112
1112
  * - Docs: https://viem.sh/docs/actions/public/getLogs
1113
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/filters-and-logs/event-logs
1113
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs
1114
1114
  * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
1115
1115
  *
1116
1116
  * @param args - {@link GetLogsParameters}
@@ -1224,7 +1224,7 @@ export type PublicActions<
1224
1224
  * Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
1225
1225
  *
1226
1226
  * - Docs: https://viem.sh/docs/actions/public/getTransaction
1227
- * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
1227
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
1228
1228
  * - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
1229
1229
  *
1230
1230
  * @param args - {@link GetTransactionParameters}
@@ -1249,7 +1249,7 @@ export type PublicActions<
1249
1249
  * Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
1250
1250
  *
1251
1251
  * - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations
1252
- * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
1252
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
1253
1253
  * - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
1254
1254
  *
1255
1255
  * @param args - {@link GetTransactionConfirmationsParameters}
@@ -1298,7 +1298,7 @@ export type PublicActions<
1298
1298
  * Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
1299
1299
  *
1300
1300
  * - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt
1301
- * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
1301
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
1302
1302
  * - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
1303
1303
  *
1304
1304
  * @param args - {@link GetTransactionReceiptParameters}
@@ -1428,7 +1428,7 @@ export type PublicActions<
1428
1428
  * Calls a read-only function on a contract, and returns the response.
1429
1429
  *
1430
1430
  * - Docs: https://viem.sh/docs/contract/readContract
1431
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts
1431
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts
1432
1432
  *
1433
1433
  * @remarks
1434
1434
  * 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.
@@ -1493,7 +1493,7 @@ export type PublicActions<
1493
1493
  * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
1494
1494
  *
1495
1495
  * - Docs: https://viem.sh/docs/contract/simulateContract
1496
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
1496
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
1497
1497
  *
1498
1498
  * @remarks
1499
1499
  * 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.
@@ -1615,7 +1615,7 @@ export type PublicActions<
1615
1615
  * 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.
1616
1616
  *
1617
1617
  * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt
1618
- * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
1618
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
1619
1619
  * - JSON-RPC Methods:
1620
1620
  * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
1621
1621
  * - If a Transaction has been replaced:
@@ -1656,7 +1656,7 @@ export type PublicActions<
1656
1656
  * Watches and returns incoming block numbers.
1657
1657
  *
1658
1658
  * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber
1659
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
1659
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
1660
1660
  * - JSON-RPC Methods:
1661
1661
  * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
1662
1662
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -1683,7 +1683,7 @@ export type PublicActions<
1683
1683
  * Watches and returns information for incoming blocks.
1684
1684
  *
1685
1685
  * - Docs: https://viem.sh/docs/actions/public/watchBlocks
1686
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
1686
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
1687
1687
  * - JSON-RPC Methods:
1688
1688
  * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
1689
1689
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -112,7 +112,7 @@ export type WalletActions<
112
112
  * Deploys a contract to the network, given bytecode and constructor arguments.
113
113
  *
114
114
  * - Docs: https://viem.sh/docs/contract/deployContract
115
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts
115
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
116
116
  *
117
117
  * @param args - {@link DeployContractParameters}
118
118
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
@@ -337,7 +337,7 @@ export type WalletActions<
337
337
  * Creates, signs, and sends a new transaction to the network.
338
338
  *
339
339
  * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
340
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
340
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
341
341
  * - JSON-RPC Methods:
342
342
  * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
343
343
  * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
@@ -631,7 +631,7 @@ export type WalletActions<
631
631
  * Executes a write function on a contract.
632
632
  *
633
633
  * - Docs: https://viem.sh/docs/contract/writeContract
634
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
634
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
635
635
  *
636
636
  * 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.
637
637
  *
package/errors/base.ts CHANGED
@@ -87,7 +87,12 @@ function walk(
87
87
  fn?: ((err: unknown) => boolean) | undefined,
88
88
  ): unknown {
89
89
  if (fn?.(err)) return err
90
- if (err && typeof err === 'object' && 'cause' in err)
90
+ if (
91
+ err &&
92
+ typeof err === 'object' &&
93
+ 'cause' in err &&
94
+ err.cause !== undefined
95
+ )
91
96
  return walk(err.cause, fn)
92
97
  return fn ? null : err
93
98
  }
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.21.39'
1
+ export const version = '2.21.41'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.21.39",
4
+ "version": "2.21.41",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -127,7 +127,7 @@ export type Eip712WalletActions<
127
127
  * Deploys a contract to the network, given bytecode and constructor arguments using EIP712 transaction.
128
128
  *
129
129
  * - Docs: https://viem.sh/docs/contract/deployContract
130
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts
130
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
131
131
  *
132
132
  * @param args - {@link DeployContractParameters}
133
133
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
@@ -167,7 +167,7 @@ export type Eip712WalletActions<
167
167
  * Executes a write function on a contract.
168
168
  *
169
169
  * - Docs: https://viem.sh/docs/contract/writeContract
170
- * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
170
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
171
171
  *
172
172
  * 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.
173
173
  *