viem 1.19.9 → 1.19.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 (211) hide show
  1. package/CHANGELOG.md +425 -407
  2. package/README.md +46 -46
  3. package/_cjs/accounts/utils/signTransaction.js.map +1 -1
  4. package/_cjs/actions/public/createContractEventFilter.js.map +1 -1
  5. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
  6. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  7. package/_cjs/actions/public/waitForTransactionReceipt.js +8 -1
  8. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  9. package/_cjs/chains/celo/serializers.js +3 -7
  10. package/_cjs/chains/celo/serializers.js.map +1 -1
  11. package/_cjs/chains/definitions/confluxESpace.js +2 -0
  12. package/_cjs/chains/definitions/confluxESpace.js.map +1 -1
  13. package/_cjs/chains/definitions/confluxESpaceTestnet.js +34 -0
  14. package/_cjs/chains/definitions/confluxESpaceTestnet.js.map +1 -0
  15. package/_cjs/chains/definitions/sapphire.js +33 -0
  16. package/_cjs/chains/definitions/sapphire.js.map +1 -0
  17. package/_cjs/chains/definitions/sapphireTestnet.js +28 -0
  18. package/_cjs/chains/definitions/sapphireTestnet.js.map +1 -0
  19. package/_cjs/chains/index.js +10 -4
  20. package/_cjs/chains/index.js.map +1 -1
  21. package/_cjs/errors/base.js.map +1 -1
  22. package/_cjs/errors/version.js +1 -1
  23. package/_cjs/errors/version.js.map +1 -1
  24. package/_cjs/utils/abi/encodeEventTopics.js.map +1 -1
  25. package/_cjs/utils/ccip.js +3 -1
  26. package/_cjs/utils/ccip.js.map +1 -1
  27. package/_cjs/utils/encoding/toBytes.js +2 -2
  28. package/_cjs/utils/encoding/toBytes.js.map +1 -1
  29. package/_cjs/utils/ens/avatar/utils.js +1 -1
  30. package/_cjs/utils/ens/avatar/utils.js.map +1 -1
  31. package/_cjs/utils/errors/getContractError.js.map +1 -1
  32. package/_cjs/utils/errors/getNodeError.js +11 -11
  33. package/_cjs/utils/errors/getNodeError.js.map +1 -1
  34. package/_cjs/utils/transaction/getTransactionType.js.map +1 -1
  35. package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
  36. package/_esm/accounts/utils/signTransaction.js.map +1 -1
  37. package/_esm/actions/ens/getEnsAddress.js +2 -2
  38. package/_esm/actions/ens/getEnsAvatar.js +2 -2
  39. package/_esm/actions/ens/getEnsName.js +2 -2
  40. package/_esm/actions/ens/getEnsResolver.js +2 -2
  41. package/_esm/actions/ens/getEnsText.js +2 -2
  42. package/_esm/actions/public/createContractEventFilter.js.map +1 -1
  43. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
  44. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  45. package/_esm/actions/public/getBlock.js +1 -1
  46. package/_esm/actions/public/getBlockNumber.js +1 -1
  47. package/_esm/actions/public/getLogs.js +1 -1
  48. package/_esm/actions/public/getTransaction.js +1 -1
  49. package/_esm/actions/public/getTransactionConfirmations.js +1 -1
  50. package/_esm/actions/public/getTransactionReceipt.js +1 -1
  51. package/_esm/actions/public/readContract.js +1 -1
  52. package/_esm/actions/public/simulateContract.js +1 -1
  53. package/_esm/actions/public/waitForTransactionReceipt.js +12 -2
  54. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  55. package/_esm/actions/public/watchBlockNumber.js +1 -1
  56. package/_esm/actions/public/watchBlocks.js +1 -1
  57. package/_esm/actions/wallet/deployContract.js +1 -1
  58. package/_esm/actions/wallet/sendTransaction.js +1 -1
  59. package/_esm/actions/wallet/writeContract.js +1 -1
  60. package/_esm/chains/celo/serializers.js +3 -7
  61. package/_esm/chains/celo/serializers.js.map +1 -1
  62. package/_esm/chains/definitions/confluxESpace.js +2 -0
  63. package/_esm/chains/definitions/confluxESpace.js.map +1 -1
  64. package/_esm/chains/definitions/confluxESpaceTestnet.js +31 -0
  65. package/_esm/chains/definitions/confluxESpaceTestnet.js.map +1 -0
  66. package/_esm/chains/definitions/sapphire.js +30 -0
  67. package/_esm/chains/definitions/sapphire.js.map +1 -0
  68. package/_esm/chains/definitions/sapphireTestnet.js +25 -0
  69. package/_esm/chains/definitions/sapphireTestnet.js.map +1 -0
  70. package/_esm/chains/index.js +3 -0
  71. package/_esm/chains/index.js.map +1 -1
  72. package/_esm/errors/base.js.map +1 -1
  73. package/_esm/errors/version.js +1 -1
  74. package/_esm/errors/version.js.map +1 -1
  75. package/_esm/utils/abi/encodeEventTopics.js.map +1 -1
  76. package/_esm/utils/ccip.js +3 -1
  77. package/_esm/utils/ccip.js.map +1 -1
  78. package/_esm/utils/encoding/toBytes.js +2 -2
  79. package/_esm/utils/encoding/toBytes.js.map +1 -1
  80. package/_esm/utils/ens/avatar/utils.js +1 -1
  81. package/_esm/utils/ens/avatar/utils.js.map +1 -1
  82. package/_esm/utils/ens/namehash.js +1 -1
  83. package/_esm/utils/ens/normalize.js +2 -2
  84. package/_esm/utils/errors/getContractError.js.map +1 -1
  85. package/_esm/utils/errors/getNodeError.js +11 -11
  86. package/_esm/utils/errors/getNodeError.js.map +1 -1
  87. package/_esm/utils/transaction/getTransactionType.js.map +1 -1
  88. package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
  89. package/_types/accounts/utils/signTransaction.d.ts.map +1 -1
  90. package/_types/actions/ens/getEnsAddress.d.ts +2 -2
  91. package/_types/actions/ens/getEnsAvatar.d.ts +2 -2
  92. package/_types/actions/ens/getEnsName.d.ts +2 -2
  93. package/_types/actions/ens/getEnsResolver.d.ts +2 -2
  94. package/_types/actions/ens/getEnsText.d.ts +2 -2
  95. package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
  96. package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
  97. package/_types/actions/public/getBlock.d.ts +1 -1
  98. package/_types/actions/public/getBlockNumber.d.ts +1 -1
  99. package/_types/actions/public/getLogs.d.ts +1 -1
  100. package/_types/actions/public/getTransaction.d.ts +1 -1
  101. package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
  102. package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
  103. package/_types/actions/public/readContract.d.ts +1 -1
  104. package/_types/actions/public/simulateContract.d.ts +1 -1
  105. package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
  106. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  107. package/_types/actions/public/watchBlockNumber.d.ts +1 -1
  108. package/_types/actions/public/watchBlocks.d.ts +1 -1
  109. package/_types/actions/wallet/deployContract.d.ts +1 -1
  110. package/_types/actions/wallet/sendTransaction.d.ts +1 -1
  111. package/_types/actions/wallet/writeContract.d.ts +1 -1
  112. package/_types/chains/celo/serializers.d.ts.map +1 -1
  113. package/_types/chains/definitions/confluxESpace.d.ts +2 -0
  114. package/_types/chains/definitions/confluxESpace.d.ts.map +1 -1
  115. package/_types/chains/definitions/confluxESpaceTestnet.d.ts +34 -0
  116. package/_types/chains/definitions/confluxESpaceTestnet.d.ts.map +1 -0
  117. package/_types/chains/definitions/sapphire.d.ts +33 -0
  118. package/_types/chains/definitions/sapphire.d.ts.map +1 -0
  119. package/_types/chains/definitions/sapphireTestnet.d.ts +28 -0
  120. package/_types/chains/definitions/sapphireTestnet.d.ts.map +1 -0
  121. package/_types/chains/index.d.ts +3 -0
  122. package/_types/chains/index.d.ts.map +1 -1
  123. package/_types/clients/decorators/public.d.ts +21 -21
  124. package/_types/clients/decorators/wallet.d.ts +3 -3
  125. package/_types/errors/version.d.ts +1 -1
  126. package/_types/errors/version.d.ts.map +1 -1
  127. package/_types/types/contract.d.ts.map +1 -1
  128. package/_types/types/filter.d.ts.map +1 -1
  129. package/_types/types/log.d.ts.map +1 -1
  130. package/_types/types/multicall.d.ts.map +1 -1
  131. package/_types/types/transaction.d.ts.map +1 -1
  132. package/_types/types/typedData.d.ts.map +1 -1
  133. package/_types/types/utils.d.ts.map +1 -1
  134. package/_types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
  135. package/_types/utils/abi/encodeErrorResult.d.ts.map +1 -1
  136. package/_types/utils/abi/encodeEventTopics.d.ts.map +1 -1
  137. package/_types/utils/abi/encodeFunctionData.d.ts.map +1 -1
  138. package/_types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
  139. package/_types/utils/ccip.d.ts.map +1 -1
  140. package/_types/utils/encoding/fromBytes.d.ts.map +1 -1
  141. package/_types/utils/encoding/fromHex.d.ts.map +1 -1
  142. package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
  143. package/_types/utils/ens/namehash.d.ts +1 -1
  144. package/_types/utils/ens/normalize.d.ts +2 -2
  145. package/_types/utils/errors/getNodeError.d.ts.map +1 -1
  146. package/_types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -1
  147. package/_types/utils/transaction/getTransactionType.d.ts.map +1 -1
  148. package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
  149. package/accounts/utils/signTransaction.ts +4 -2
  150. package/actions/ens/getEnsAddress.ts +3 -3
  151. package/actions/ens/getEnsAvatar.ts +2 -2
  152. package/actions/ens/getEnsName.ts +2 -2
  153. package/actions/ens/getEnsResolver.ts +2 -2
  154. package/actions/ens/getEnsText.ts +2 -2
  155. package/actions/public/call.ts +1 -1
  156. package/actions/public/createContractEventFilter.ts +11 -9
  157. package/actions/public/estimateMaxPriorityFeePerGas.ts +3 -1
  158. package/actions/public/getBlock.ts +1 -1
  159. package/actions/public/getBlockNumber.ts +1 -1
  160. package/actions/public/getLogs.ts +1 -1
  161. package/actions/public/getTransaction.ts +1 -1
  162. package/actions/public/getTransactionConfirmations.ts +1 -1
  163. package/actions/public/getTransactionReceipt.ts +1 -1
  164. package/actions/public/readContract.ts +1 -1
  165. package/actions/public/simulateContract.ts +1 -1
  166. package/actions/public/verifyHash.ts +1 -1
  167. package/actions/public/verifyMessage.ts +1 -1
  168. package/actions/public/verifyTypedData.ts +1 -1
  169. package/actions/public/waitForTransactionReceipt.ts +24 -9
  170. package/actions/public/watchBlockNumber.ts +1 -1
  171. package/actions/public/watchBlocks.ts +1 -1
  172. package/actions/wallet/deployContract.ts +1 -1
  173. package/actions/wallet/sendRawTransaction.ts +1 -1
  174. package/actions/wallet/sendTransaction.ts +1 -1
  175. package/actions/wallet/writeContract.ts +1 -1
  176. package/chains/celo/serializers.ts +3 -7
  177. package/chains/definitions/confluxESpace.ts +2 -0
  178. package/chains/definitions/confluxESpaceTestnet.ts +31 -0
  179. package/chains/definitions/sapphire.ts +30 -0
  180. package/chains/definitions/sapphireTestnet.ts +25 -0
  181. package/chains/index.ts +3 -0
  182. package/clients/decorators/public.ts +21 -21
  183. package/clients/decorators/wallet.ts +3 -3
  184. package/errors/base.ts +2 -2
  185. package/errors/version.ts +1 -1
  186. package/package.json +3 -3
  187. package/types/contract.ts +63 -64
  188. package/types/filter.ts +12 -12
  189. package/types/log.ts +4 -4
  190. package/types/multicall.ts +65 -57
  191. package/types/transaction.ts +4 -4
  192. package/types/typedData.ts +12 -12
  193. package/types/utils.ts +6 -7
  194. package/utils/abi/decodeFunctionResult.ts +2 -2
  195. package/utils/abi/encodeErrorResult.ts +2 -2
  196. package/utils/abi/encodeEventTopics.ts +6 -6
  197. package/utils/abi/encodeFunctionData.ts +2 -2
  198. package/utils/abi/encodeFunctionResult.ts +5 -5
  199. package/utils/ccip.ts +4 -2
  200. package/utils/encoding/fromBytes.ts +8 -8
  201. package/utils/encoding/fromHex.ts +8 -8
  202. package/utils/encoding/toBytes.ts +2 -2
  203. package/utils/ens/avatar/utils.ts +3 -1
  204. package/utils/ens/namehash.ts +1 -1
  205. package/utils/ens/normalize.ts +2 -2
  206. package/utils/errors/getContractError.ts +2 -2
  207. package/utils/errors/getNodeError.ts +12 -11
  208. package/utils/rpc.ts +1 -1
  209. package/utils/transaction/getSerializedTransactionType.ts +2 -2
  210. package/utils/transaction/getTransactionType.ts +2 -1
  211. package/utils/transaction/serializeTransaction.ts +6 -3
@@ -40,7 +40,7 @@ export type VerifyMessageErrorType =
40
40
  * @param parameters - {@link VerifyMessageParameters}
41
41
  * @returns Whether or not the signature is valid. {@link VerifyMessageReturnType}
42
42
  */
43
- export async function verifyMessage<TChain extends Chain | undefined,>(
43
+ export async function verifyMessage<TChain extends Chain | undefined>(
44
44
  client: Client<Transport, TChain>,
45
45
  { address, message, signature, ...callRequest }: VerifyMessageParameters,
46
46
  ): Promise<VerifyMessageReturnType> {
@@ -43,7 +43,7 @@ export type VerifyTypedDataErrorType =
43
43
  * @param parameters - {@link VerifyTypedDataParameters}
44
44
  * @returns Whether or not the signature is valid. {@link VerifyTypedDataReturnType}
45
45
  */
46
- export async function verifyTypedData<TChain extends Chain | undefined,>(
46
+ export async function verifyTypedData<TChain extends Chain | undefined>(
47
47
  client: Client<Transport, TChain>,
48
48
  {
49
49
  address,
@@ -1,5 +1,6 @@
1
1
  import type { Client } from '../../clients/createClient.js'
2
2
  import type { Transport } from '../../clients/transports/createTransport.js'
3
+ import { BlockNotFoundError } from '../../errors/block.js'
3
4
  import {
4
5
  TransactionNotFoundError,
5
6
  TransactionReceiptNotFoundError,
@@ -77,7 +78,7 @@ export type WaitForTransactionReceiptErrorType =
77
78
  * Waits for the [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt). If the Transaction reverts, then the action will throw an error.
78
79
  *
79
80
  * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
80
- * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
81
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
81
82
  * - JSON-RPC Methods:
82
83
  * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
83
84
  * - If a Transaction has been replaced:
@@ -228,14 +229,28 @@ export async function waitForTransactionReceipt<
228
229
  replacedTransaction = transaction
229
230
 
230
231
  // Let's retrieve the transactions from the current block.
231
- const block = await getAction(
232
- client,
233
- getBlock,
234
- 'getBlock',
235
- )({
236
- blockNumber,
237
- includeTransactions: true,
238
- })
232
+ // We need to retry as some RPC Providers may be slow to sync
233
+ // up mined blocks.
234
+ retrying = true
235
+ const block = await withRetry(
236
+ () =>
237
+ getAction(
238
+ client,
239
+ getBlock,
240
+ 'getBlock',
241
+ )({
242
+ blockNumber,
243
+ includeTransactions: true,
244
+ }),
245
+ {
246
+ // exponential backoff
247
+ delay: ({ count }) => ~~(1 << count) * 200,
248
+ retryCount: 6,
249
+ shouldRetry: ({ error }) =>
250
+ error instanceof BlockNotFoundError,
251
+ },
252
+ )
253
+ retrying = false
239
254
 
240
255
  const replacementTransaction = (
241
256
  block.transactions as {} as Transaction[]
@@ -56,7 +56,7 @@ export type WatchBlockNumberErrorType = PollErrorType | ErrorType
56
56
  * Watches and returns incoming block numbers.
57
57
  *
58
58
  * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
59
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
59
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
60
60
  * - JSON-RPC Methods:
61
61
  * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
62
62
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -80,7 +80,7 @@ export type WatchBlocksErrorType =
80
80
  * Watches and returns information for incoming blocks.
81
81
  *
82
82
  * - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
83
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
83
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
84
84
  * - JSON-RPC Methods:
85
85
  * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
86
86
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -40,7 +40,7 @@ export type DeployContractErrorType = SendTransactionErrorType | ErrorType
40
40
  * Deploys a contract to the network, given bytecode and constructor arguments.
41
41
  *
42
42
  * - Docs: https://viem.sh/docs/contract/deployContract.html
43
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
43
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts
44
44
  *
45
45
  * @param client - Client to use
46
46
  * @param parameters - {@link DeployContractParameters}
@@ -41,7 +41,7 @@ export type SendRawTransactionErrorType = RequestErrorType | ErrorType
41
41
  * serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
42
42
  * })
43
43
  */
44
- export async function sendRawTransaction<TChain extends Chain | undefined,>(
44
+ export async function sendRawTransaction<TChain extends Chain | undefined>(
45
45
  client: Client<Transport, TChain>,
46
46
  { serializedTransaction }: SendRawTransactionParameters,
47
47
  ): Promise<SendRawTransactionReturnType> {
@@ -80,7 +80,7 @@ export type SendTransactionErrorType =
80
80
  * Creates, signs, and sends a new transaction to the network.
81
81
  *
82
82
  * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
83
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
83
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
84
84
  * - JSON-RPC Methods:
85
85
  * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
86
86
  * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
@@ -61,7 +61,7 @@ export type WriteContractErrorType =
61
61
  * Executes a write function on a contract.
62
62
  *
63
63
  * - Docs: https://viem.sh/docs/contract/writeContract.html
64
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
64
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
65
65
  *
66
66
  * 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.html) is needed to be broadcast in order to change the state.
67
67
  *
@@ -27,13 +27,9 @@ import { isCIP42, isCIP64, isEmpty, isPresent } from './utils.js'
27
27
  export const serializeTransactionCelo: SerializeTransactionFn<
28
28
  CeloTransactionSerializable | TransactionSerializable
29
29
  > = (tx, signature) => {
30
- if (isCIP64(tx)) {
31
- return serializeTransactionCIP64(tx, signature)
32
- } else if (isCIP42(tx)) {
33
- return serializeTransactionCIP42(tx, signature)
34
- } else {
35
- return serializeTransaction(tx as TransactionSerializable, signature)
36
- }
30
+ if (isCIP64(tx)) return serializeTransactionCIP64(tx, signature)
31
+ if (isCIP42(tx)) return serializeTransactionCIP42(tx, signature)
32
+ return serializeTransaction(tx as TransactionSerializable, signature)
37
33
  }
38
34
 
39
35
  export const serializersCelo = {
@@ -8,9 +8,11 @@ export const confluxESpace = /*#__PURE__*/ defineChain({
8
8
  rpcUrls: {
9
9
  default: {
10
10
  http: ['https://evm.confluxrpc.org'],
11
+ webSocket: ['wss://evm.confluxrpc.org/ws'],
11
12
  },
12
13
  public: {
13
14
  http: ['https://evm.confluxrpc.org'],
15
+ webSocket: ['wss://evm.confluxrpc.org/ws'],
14
16
  },
15
17
  },
16
18
  blockExplorers: {
@@ -0,0 +1,31 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const confluxESpaceTestnet = /*#__PURE__*/ defineChain({
4
+ id: 71,
5
+ name: 'Conflux eSpace Testnet',
6
+ network: 'cfx-espace-testnet',
7
+ testnet: true,
8
+ nativeCurrency: { name: 'Conflux', symbol: 'CFX', decimals: 18 },
9
+ rpcUrls: {
10
+ default: {
11
+ http: ['https://evmtestnet.confluxrpc.org'],
12
+ webSocket: ['wss://evmtestnet.confluxrpc.org/ws'],
13
+ },
14
+ public: {
15
+ http: ['https://evmtestnet.confluxrpc.org'],
16
+ webSocket: ['wss://evmtestnet.confluxrpc.org/ws'],
17
+ },
18
+ },
19
+ blockExplorers: {
20
+ default: {
21
+ name: 'ConfluxScan',
22
+ url: 'https://evmtestnet.confluxscan.io',
23
+ },
24
+ },
25
+ contracts: {
26
+ multicall3: {
27
+ address: '0xEFf0078910f638cd81996cc117bccD3eDf2B072F',
28
+ blockCreated: 117499050,
29
+ },
30
+ },
31
+ })
@@ -0,0 +1,30 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const sapphire = /*#__PURE__*/ defineChain({
4
+ id: 23294,
5
+ name: 'Oasis Sapphire',
6
+ network: 'sapphire',
7
+ nativeCurrency: { name: 'Sapphire Rose', symbol: 'ROSE', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://sapphire.oasis.io'],
11
+ webSocket: ['wss://sapphire.oasis.io/ws'],
12
+ },
13
+ public: {
14
+ http: ['https://sapphire.oasis.io'],
15
+ webSocket: ['wss://sapphire.oasis.io/ws'],
16
+ },
17
+ },
18
+ blockExplorers: {
19
+ default: {
20
+ name: 'Oasis Sapphire Explorer',
21
+ url: 'https://explorer.sapphire.oasis.io',
22
+ },
23
+ },
24
+ contracts: {
25
+ multicall3: {
26
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
27
+ blockCreated: 734531,
28
+ },
29
+ },
30
+ })
@@ -0,0 +1,25 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const sapphireTestnet = /*#__PURE__*/ defineChain({
4
+ id: 23295,
5
+ name: 'Oasis Sapphire Testnet',
6
+ network: 'sapphire-testnet',
7
+ nativeCurrency: { name: 'Sapphire Test Rose', symbol: 'TEST', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://testnet.sapphire.oasis.dev'],
11
+ webSocket: ['wss://testnet.sapphire.oasis.dev/ws'],
12
+ },
13
+ public: {
14
+ http: ['https://testnet.sapphire.oasis.dev'],
15
+ webSocket: ['wss://testnet.sapphire.oasis.dev/ws'],
16
+ },
17
+ },
18
+ blockExplorers: {
19
+ default: {
20
+ name: 'Oasis Sapphire Testnet Explorer',
21
+ url: 'https://testnet.explorer.sapphire.oasis.dev',
22
+ },
23
+ },
24
+ testnet: true,
25
+ })
package/chains/index.ts CHANGED
@@ -29,6 +29,7 @@ export { chiliz } from './definitions/chiliz.js'
29
29
  export { celoCannoli } from './definitions/celoCannoli.js'
30
30
  export { classic } from './definitions/classic.js'
31
31
  export { confluxESpace } from './definitions/confluxESpace.js'
32
+ export { confluxESpaceTestnet } from './definitions/confluxESpaceTestnet.js'
32
33
  export { coreDao } from './definitions/coreDao.js'
33
34
  export { cronos } from './definitions/cronos.js'
34
35
  export { cronosTestnet } from './definitions/cronosTestnet.js'
@@ -118,6 +119,8 @@ export { rolluxTestnet } from './definitions/rolluxTestnet.js'
118
119
  export { ronin } from './definitions/ronin.js'
119
120
  export { rootstock } from './definitions/rootstock.js'
120
121
  export { saigon } from './definitions/saigon.js'
122
+ export { sapphire } from './definitions/sapphire.js'
123
+ export { sapphireTestnet } from './definitions/sapphireTestnet.js'
121
124
  export { scroll } from './definitions/scroll.js'
122
125
  export { scrollSepolia } from './definitions/scrollSepolia.js'
123
126
  export { scrollTestnet } from './definitions/scrollTestnet.js'
@@ -507,7 +507,7 @@ export type PublicActions<
507
507
  * Returns information about a block at a block number, hash, or tag.
508
508
  *
509
509
  * - Docs: https://viem.sh/docs/actions/public/getBlock.html
510
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
510
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
511
511
  * - JSON-RPC Methods:
512
512
  * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
513
513
  * - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
@@ -535,7 +535,7 @@ export type PublicActions<
535
535
  * Returns the number of the most recent block seen.
536
536
  *
537
537
  * - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html
538
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
538
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
539
539
  * - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
540
540
  *
541
541
  * @param args - {@link GetBlockNumberParameters}
@@ -667,7 +667,7 @@ export type PublicActions<
667
667
  * Gets address for ENS name.
668
668
  *
669
669
  * - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html
670
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
670
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
671
671
  *
672
672
  * @remarks
673
673
  * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
@@ -687,7 +687,7 @@ export type PublicActions<
687
687
  * transport: http(),
688
688
  * })
689
689
  * const ensAddress = await client.getEnsAddress({
690
- * name: normalize('wagmi-dev.eth'),
690
+ * name: normalize('wevm.eth'),
691
691
  * })
692
692
  * // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
693
693
  */
@@ -698,7 +698,7 @@ export type PublicActions<
698
698
  * Gets the avatar of an ENS name.
699
699
  *
700
700
  * - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html
701
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
701
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
702
702
  *
703
703
  * @remarks
704
704
  * Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText.html) with `key` set to `'avatar'`.
@@ -718,7 +718,7 @@ export type PublicActions<
718
718
  * transport: http(),
719
719
  * })
720
720
  * const ensAvatar = await client.getEnsAvatar({
721
- * name: normalize('wagmi-dev.eth'),
721
+ * name: normalize('wevm.eth'),
722
722
  * })
723
723
  * // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
724
724
  */
@@ -729,7 +729,7 @@ export type PublicActions<
729
729
  * Gets primary name for specified address.
730
730
  *
731
731
  * - Docs: https://viem.sh/docs/ens/actions/getEnsName.html
732
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
732
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
733
733
  *
734
734
  * @remarks
735
735
  * Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
@@ -748,14 +748,14 @@ export type PublicActions<
748
748
  * const ensName = await client.getEnsName({
749
749
  * address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
750
750
  * })
751
- * // 'wagmi-dev.eth'
751
+ * // 'wevm.eth'
752
752
  */
753
753
  getEnsName: (args: GetEnsNameParameters) => Promise<GetEnsNameReturnType>
754
754
  /**
755
755
  * Gets resolver for ENS name.
756
756
  *
757
757
  * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
758
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
758
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
759
759
  *
760
760
  * @remarks
761
761
  * Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
@@ -775,7 +775,7 @@ export type PublicActions<
775
775
  * transport: http(),
776
776
  * })
777
777
  * const resolverAddress = await client.getEnsResolver({
778
- * name: normalize('wagmi-dev.eth'),
778
+ * name: normalize('wevm.eth'),
779
779
  * })
780
780
  * // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
781
781
  */
@@ -786,7 +786,7 @@ export type PublicActions<
786
786
  * Gets a text record for specified ENS name.
787
787
  *
788
788
  * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
789
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
789
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
790
790
  *
791
791
  * @remarks
792
792
  * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
@@ -806,7 +806,7 @@ export type PublicActions<
806
806
  * transport: http(),
807
807
  * })
808
808
  * const twitterRecord = await client.getEnsText({
809
- * name: normalize('wagmi-dev.eth'),
809
+ * name: normalize('wevm.eth'),
810
810
  * key: 'com.twitter',
811
811
  * })
812
812
  * // 'wagmi_sh'
@@ -1034,7 +1034,7 @@ export type PublicActions<
1034
1034
  * Returns a list of event logs matching the provided parameters.
1035
1035
  *
1036
1036
  * - Docs: https://viem.sh/docs/actions/public/getLogs.html
1037
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs
1037
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/filters-and-logs/event-logs
1038
1038
  * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
1039
1039
  *
1040
1040
  * @param args - {@link GetLogsParameters}
@@ -1150,7 +1150,7 @@ export type PublicActions<
1150
1150
  * Returns information about a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) given a hash or block identifier.
1151
1151
  *
1152
1152
  * - Docs: https://viem.sh/docs/actions/public/getTransaction.html
1153
- * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
1153
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
1154
1154
  * - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
1155
1155
  *
1156
1156
  * @param args - {@link GetTransactionParameters}
@@ -1175,7 +1175,7 @@ export type PublicActions<
1175
1175
  * Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
1176
1176
  *
1177
1177
  * - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html
1178
- * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
1178
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
1179
1179
  * - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
1180
1180
  *
1181
1181
  * @param args - {@link GetTransactionConfirmationsParameters}
@@ -1224,7 +1224,7 @@ export type PublicActions<
1224
1224
  * Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
1225
1225
  *
1226
1226
  * - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html
1227
- * - Example: https://stackblitz.com/github/wagmi-dev/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_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
1229
1229
  *
1230
1230
  * @param args - {@link GetTransactionReceiptParameters}
@@ -1335,7 +1335,7 @@ export type PublicActions<
1335
1335
  * Calls a read-only function on a contract, and returns the response.
1336
1336
  *
1337
1337
  * - Docs: https://viem.sh/docs/contract/readContract.html
1338
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts
1338
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts
1339
1339
  *
1340
1340
  * @remarks
1341
1341
  * 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.
@@ -1399,7 +1399,7 @@ export type PublicActions<
1399
1399
  * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
1400
1400
  *
1401
1401
  * - Docs: https://viem.sh/docs/contract/simulateContract.html
1402
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
1402
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
1403
1403
  *
1404
1404
  * @remarks
1405
1405
  * 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.html), but also supports contract write functions.
@@ -1474,7 +1474,7 @@ export type PublicActions<
1474
1474
  * Waits for the [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt). If the Transaction reverts, then the action will throw an error.
1475
1475
  *
1476
1476
  * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
1477
- * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
1477
+ * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
1478
1478
  * - JSON-RPC Methods:
1479
1479
  * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
1480
1480
  * - If a Transaction has been replaced:
@@ -1515,7 +1515,7 @@ export type PublicActions<
1515
1515
  * Watches and returns incoming block numbers.
1516
1516
  *
1517
1517
  * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
1518
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
1518
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
1519
1519
  * - JSON-RPC Methods:
1520
1520
  * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
1521
1521
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -1542,7 +1542,7 @@ export type PublicActions<
1542
1542
  * Watches and returns information for incoming blocks.
1543
1543
  *
1544
1544
  * - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
1545
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
1545
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
1546
1546
  * - JSON-RPC Methods:
1547
1547
  * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
1548
1548
  * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
@@ -105,7 +105,7 @@ export type WalletActions<
105
105
  * Deploys a contract to the network, given bytecode and constructor arguments.
106
106
  *
107
107
  * - Docs: https://viem.sh/docs/contract/deployContract.html
108
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
108
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts
109
109
  *
110
110
  * @param args - {@link DeployContractParameters}
111
111
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link DeployContractReturnType}
@@ -311,7 +311,7 @@ export type WalletActions<
311
311
  * Creates, signs, and sends a new transaction to the network.
312
312
  *
313
313
  * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
314
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
314
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
315
315
  * - JSON-RPC Methods:
316
316
  * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
317
317
  * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
@@ -596,7 +596,7 @@ export type WalletActions<
596
596
  * Executes a write function on a contract.
597
597
  *
598
598
  * - Docs: https://viem.sh/docs/contract/writeContract.html
599
- * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
599
+ * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
600
600
  *
601
601
  * 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.html) is needed to be broadcast in order to change the state.
602
602
  *
package/errors/base.ts CHANGED
@@ -32,8 +32,8 @@ export class BaseError extends Error {
32
32
  args.cause instanceof BaseError
33
33
  ? args.cause.details
34
34
  : args.cause?.message
35
- ? args.cause.message
36
- : args.details!
35
+ ? args.cause.message
36
+ : args.details!
37
37
  const docsPath =
38
38
  args.cause instanceof BaseError
39
39
  ? args.cause.docsPath || args.docsPath
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.19.9'
1
+ export const version = '1.19.10'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "1.19.9",
4
+ "version": "1.19.11",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -144,7 +144,7 @@
144
144
  },
145
145
  "license": "MIT",
146
146
  "homepage": "https://viem.sh",
147
- "repository": "wagmi-dev/viem",
147
+ "repository": "wevm/viem",
148
148
  "authors": [
149
149
  "awkweb.eth",
150
150
  "jxom.eth"
@@ -152,7 +152,7 @@
152
152
  "funding": [
153
153
  {
154
154
  "type": "github",
155
- "url": "https://github.com/sponsors/wagmi-dev"
155
+ "url": "https://github.com/sponsors/wevm"
156
156
  }
157
157
  ],
158
158
  "keywords": [