viem 2.58.4 → 2.58.7

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 (266) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +6 -1
  3. package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
  4. package/_cjs/account-abstraction/errors/bundler.js +38 -228
  5. package/_cjs/account-abstraction/errors/bundler.js.map +1 -1
  6. package/_cjs/account-abstraction/errors/userOperation.js +1 -6
  7. package/_cjs/account-abstraction/errors/userOperation.js.map +1 -1
  8. package/_cjs/account-abstraction/utils/formatters/userOperation.js +11 -1
  9. package/_cjs/account-abstraction/utils/formatters/userOperation.js.map +1 -1
  10. package/_cjs/actions/public/estimateContractGas.js +7 -1
  11. package/_cjs/actions/public/estimateContractGas.js.map +1 -1
  12. package/_cjs/actions/public/simulateBlocks.js +6 -1
  13. package/_cjs/actions/public/simulateBlocks.js.map +1 -1
  14. package/_cjs/actions/public/simulateContract.js +7 -1
  15. package/_cjs/actions/public/simulateContract.js.map +1 -1
  16. package/_cjs/actions/wallet/sendCalls.js +8 -1
  17. package/_cjs/actions/wallet/sendCalls.js.map +1 -1
  18. package/_cjs/actions/wallet/sendTransaction.js +8 -2
  19. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  20. package/_cjs/actions/wallet/sendTransactionSync.js +8 -2
  21. package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
  22. package/_cjs/chains/definitions/primiumTestnet.js +29 -0
  23. package/_cjs/chains/definitions/primiumTestnet.js.map +1 -0
  24. package/_cjs/chains/definitions/sevenChain.js +26 -0
  25. package/_cjs/chains/definitions/sevenChain.js.map +1 -0
  26. package/_cjs/chains/definitions/tsxBastion.js +33 -0
  27. package/_cjs/chains/definitions/tsxBastion.js.map +1 -0
  28. package/_cjs/chains/definitions/tsxHorizon.js +33 -0
  29. package/_cjs/chains/definitions/tsxHorizon.js.map +1 -0
  30. package/_cjs/chains/definitions/tsxTestnet.js +34 -0
  31. package/_cjs/chains/definitions/tsxTestnet.js.map +1 -0
  32. package/_cjs/chains/index.js +16 -6
  33. package/_cjs/chains/index.js.map +1 -1
  34. package/_cjs/constants/abis.js +50 -1
  35. package/_cjs/constants/abis.js.map +1 -1
  36. package/_cjs/errors/abi.js +9 -54
  37. package/_cjs/errors/abi.js.map +1 -1
  38. package/_cjs/errors/base.js +6 -36
  39. package/_cjs/errors/base.js.map +1 -1
  40. package/_cjs/errors/calls.js +1 -6
  41. package/_cjs/errors/calls.js.map +1 -1
  42. package/_cjs/errors/contract.js +14 -84
  43. package/_cjs/errors/contract.js.map +1 -1
  44. package/_cjs/errors/estimateGas.js +1 -6
  45. package/_cjs/errors/estimateGas.js.map +1 -1
  46. package/_cjs/errors/node.js +12 -72
  47. package/_cjs/errors/node.js.map +1 -1
  48. package/_cjs/errors/request.js +14 -84
  49. package/_cjs/errors/request.js.map +1 -1
  50. package/_cjs/errors/rpc.js +29 -174
  51. package/_cjs/errors/rpc.js.map +1 -1
  52. package/_cjs/errors/transaction.js +5 -30
  53. package/_cjs/errors/transaction.js.map +1 -1
  54. package/_cjs/errors/version.js +1 -1
  55. package/_cjs/experimental/erc7811/actions/getAssets.js +6 -1
  56. package/_cjs/experimental/erc7811/actions/getAssets.js.map +1 -1
  57. package/_cjs/tempo/Account.js +1 -6
  58. package/_cjs/tempo/Account.js.map +1 -1
  59. package/_cjs/tempo/Client.js.map +1 -1
  60. package/_cjs/tempo/Gateway.js +6 -36
  61. package/_cjs/tempo/Gateway.js.map +1 -1
  62. package/_cjs/tempo/actions/accessKey.js +17 -102
  63. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  64. package/_cjs/tempo/actions/accounts.js.map +1 -1
  65. package/_cjs/tempo/actions/amm.js +5 -30
  66. package/_cjs/tempo/actions/amm.js.map +1 -1
  67. package/_cjs/tempo/actions/channel.js +10 -60
  68. package/_cjs/tempo/actions/channel.js.map +1 -1
  69. package/_cjs/tempo/actions/dex.js +29 -174
  70. package/_cjs/tempo/actions/dex.js.map +1 -1
  71. package/_cjs/tempo/actions/earn/deployment.js +3 -18
  72. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  73. package/_cjs/tempo/actions/fee.js +3 -18
  74. package/_cjs/tempo/actions/fee.js.map +1 -1
  75. package/_cjs/tempo/actions/nonce.js +3 -18
  76. package/_cjs/tempo/actions/nonce.js.map +1 -1
  77. package/_cjs/tempo/actions/policy.js +1 -6
  78. package/_cjs/tempo/actions/policy.js.map +1 -1
  79. package/_cjs/tempo/actions/simulate.js +6 -1
  80. package/_cjs/tempo/actions/simulate.js.map +1 -1
  81. package/_cjs/tempo/actions/token.js +25 -150
  82. package/_cjs/tempo/actions/token.js.map +1 -1
  83. package/_cjs/tempo/chainConfig.js +20 -2
  84. package/_cjs/tempo/chainConfig.js.map +1 -1
  85. package/_cjs/tempo/errors.js +5 -30
  86. package/_cjs/tempo/errors.js.map +1 -1
  87. package/_cjs/types/eip1193.js +3 -18
  88. package/_cjs/types/eip1193.js.map +1 -1
  89. package/_cjs/utils/formatters/feeHistory.js +5 -0
  90. package/_cjs/utils/formatters/feeHistory.js.map +1 -1
  91. package/_cjs/utils/lru.js +1 -6
  92. package/_cjs/utils/lru.js.map +1 -1
  93. package/_cjs/utils/signature/serializeErc8010Signature.js +3 -1
  94. package/_cjs/utils/signature/serializeErc8010Signature.js.map +1 -1
  95. package/_cjs/utils/signature/toPrefixedMessage.js +3 -1
  96. package/_cjs/utils/signature/toPrefixedMessage.js.map +1 -1
  97. package/_cjs/utils/unit/Value.js +2 -12
  98. package/_cjs/utils/unit/Value.js.map +1 -1
  99. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +6 -1
  100. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
  101. package/_esm/account-abstraction/errors/bundler.js +38 -228
  102. package/_esm/account-abstraction/errors/bundler.js.map +1 -1
  103. package/_esm/account-abstraction/errors/userOperation.js +1 -6
  104. package/_esm/account-abstraction/errors/userOperation.js.map +1 -1
  105. package/_esm/account-abstraction/utils/formatters/userOperation.js +11 -1
  106. package/_esm/account-abstraction/utils/formatters/userOperation.js.map +1 -1
  107. package/_esm/actions/public/estimateContractGas.js +7 -1
  108. package/_esm/actions/public/estimateContractGas.js.map +1 -1
  109. package/_esm/actions/public/simulateBlocks.js +6 -1
  110. package/_esm/actions/public/simulateBlocks.js.map +1 -1
  111. package/_esm/actions/public/simulateContract.js +7 -1
  112. package/_esm/actions/public/simulateContract.js.map +1 -1
  113. package/_esm/actions/wallet/sendCalls.js +8 -1
  114. package/_esm/actions/wallet/sendCalls.js.map +1 -1
  115. package/_esm/actions/wallet/sendTransaction.js +8 -2
  116. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  117. package/_esm/actions/wallet/sendTransactionSync.js +8 -2
  118. package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
  119. package/_esm/chains/definitions/primiumTestnet.js +26 -0
  120. package/_esm/chains/definitions/primiumTestnet.js.map +1 -0
  121. package/_esm/chains/definitions/sevenChain.js +23 -0
  122. package/_esm/chains/definitions/sevenChain.js.map +1 -0
  123. package/_esm/chains/definitions/tsxBastion.js +30 -0
  124. package/_esm/chains/definitions/tsxBastion.js.map +1 -0
  125. package/_esm/chains/definitions/tsxHorizon.js +30 -0
  126. package/_esm/chains/definitions/tsxHorizon.js.map +1 -0
  127. package/_esm/chains/definitions/tsxTestnet.js +31 -0
  128. package/_esm/chains/definitions/tsxTestnet.js.map +1 -0
  129. package/_esm/chains/index.js +5 -0
  130. package/_esm/chains/index.js.map +1 -1
  131. package/_esm/constants/abis.js +50 -1
  132. package/_esm/constants/abis.js.map +1 -1
  133. package/_esm/errors/abi.js +9 -54
  134. package/_esm/errors/abi.js.map +1 -1
  135. package/_esm/errors/base.js +6 -36
  136. package/_esm/errors/base.js.map +1 -1
  137. package/_esm/errors/calls.js +1 -6
  138. package/_esm/errors/calls.js.map +1 -1
  139. package/_esm/errors/contract.js +14 -84
  140. package/_esm/errors/contract.js.map +1 -1
  141. package/_esm/errors/estimateGas.js +1 -6
  142. package/_esm/errors/estimateGas.js.map +1 -1
  143. package/_esm/errors/node.js +12 -72
  144. package/_esm/errors/node.js.map +1 -1
  145. package/_esm/errors/request.js +16 -86
  146. package/_esm/errors/request.js.map +1 -1
  147. package/_esm/errors/rpc.js +29 -174
  148. package/_esm/errors/rpc.js.map +1 -1
  149. package/_esm/errors/transaction.js +5 -30
  150. package/_esm/errors/transaction.js.map +1 -1
  151. package/_esm/errors/version.js +1 -1
  152. package/_esm/experimental/erc7811/actions/getAssets.js +6 -1
  153. package/_esm/experimental/erc7811/actions/getAssets.js.map +1 -1
  154. package/_esm/tempo/Account.js +2 -7
  155. package/_esm/tempo/Account.js.map +1 -1
  156. package/_esm/tempo/Client.js +2 -1
  157. package/_esm/tempo/Client.js.map +1 -1
  158. package/_esm/tempo/Gateway.js +12 -42
  159. package/_esm/tempo/Gateway.js.map +1 -1
  160. package/_esm/tempo/actions/accessKey.js +34 -119
  161. package/_esm/tempo/actions/accessKey.js.map +1 -1
  162. package/_esm/tempo/actions/accounts.js +1 -2
  163. package/_esm/tempo/actions/accounts.js.map +1 -1
  164. package/_esm/tempo/actions/amm.js +10 -35
  165. package/_esm/tempo/actions/amm.js.map +1 -1
  166. package/_esm/tempo/actions/channel.js +20 -70
  167. package/_esm/tempo/actions/channel.js.map +1 -1
  168. package/_esm/tempo/actions/dex.js +58 -203
  169. package/_esm/tempo/actions/dex.js.map +1 -1
  170. package/_esm/tempo/actions/earn/deployment.js +3 -18
  171. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  172. package/_esm/tempo/actions/fee.js +6 -21
  173. package/_esm/tempo/actions/fee.js.map +1 -1
  174. package/_esm/tempo/actions/nonce.js +6 -21
  175. package/_esm/tempo/actions/nonce.js.map +1 -1
  176. package/_esm/tempo/actions/policy.js +2 -7
  177. package/_esm/tempo/actions/policy.js.map +1 -1
  178. package/_esm/tempo/actions/simulate.js +6 -1
  179. package/_esm/tempo/actions/simulate.js.map +1 -1
  180. package/_esm/tempo/actions/token.js +50 -175
  181. package/_esm/tempo/actions/token.js.map +1 -1
  182. package/_esm/tempo/chainConfig.js +26 -2
  183. package/_esm/tempo/chainConfig.js.map +1 -1
  184. package/_esm/tempo/errors.js +10 -35
  185. package/_esm/tempo/errors.js.map +1 -1
  186. package/_esm/types/eip1193.js +3 -18
  187. package/_esm/types/eip1193.js.map +1 -1
  188. package/_esm/utils/formatters/feeHistory.js +5 -0
  189. package/_esm/utils/formatters/feeHistory.js.map +1 -1
  190. package/_esm/utils/lru.js +1 -6
  191. package/_esm/utils/lru.js.map +1 -1
  192. package/_esm/utils/signature/serializeErc8010Signature.js +3 -1
  193. package/_esm/utils/signature/serializeErc8010Signature.js.map +1 -1
  194. package/_esm/utils/signature/toPrefixedMessage.js +4 -1
  195. package/_esm/utils/signature/toPrefixedMessage.js.map +1 -1
  196. package/_esm/utils/unit/Value.js +2 -12
  197. package/_esm/utils/unit/Value.js.map +1 -1
  198. package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
  199. package/_types/account-abstraction/utils/formatters/userOperation.d.ts.map +1 -1
  200. package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
  201. package/_types/actions/public/simulateBlocks.d.ts.map +1 -1
  202. package/_types/actions/public/simulateContract.d.ts.map +1 -1
  203. package/_types/actions/wallet/sendCalls.d.ts.map +1 -1
  204. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  205. package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
  206. package/_types/chains/definitions/primiumTestnet.d.ts +52 -0
  207. package/_types/chains/definitions/primiumTestnet.d.ts.map +1 -0
  208. package/_types/chains/definitions/sevenChain.d.ts +54 -0
  209. package/_types/chains/definitions/sevenChain.d.ts.map +1 -0
  210. package/_types/chains/definitions/tsxBastion.d.ts +52 -0
  211. package/_types/chains/definitions/tsxBastion.d.ts.map +1 -0
  212. package/_types/chains/definitions/tsxHorizon.d.ts +52 -0
  213. package/_types/chains/definitions/tsxHorizon.d.ts.map +1 -0
  214. package/_types/chains/definitions/tsxTestnet.d.ts +52 -0
  215. package/_types/chains/definitions/tsxTestnet.d.ts.map +1 -0
  216. package/_types/chains/index.d.ts +5 -0
  217. package/_types/chains/index.d.ts.map +1 -1
  218. package/_types/constants/abis.d.ts +36 -1
  219. package/_types/constants/abis.d.ts.map +1 -1
  220. package/_types/errors/version.d.ts +1 -1
  221. package/_types/tempo/Account.d.ts +0 -1
  222. package/_types/tempo/Account.d.ts.map +1 -1
  223. package/_types/tempo/Client.d.ts +2 -1
  224. package/_types/tempo/Client.d.ts.map +1 -1
  225. package/_types/tempo/actions/accounts.d.ts +1 -2
  226. package/_types/tempo/actions/accounts.d.ts.map +1 -1
  227. package/_types/tempo/actions/simulate.d.ts.map +1 -1
  228. package/_types/tempo/chainConfig.d.ts.map +1 -1
  229. package/_types/types/block.d.ts +2 -0
  230. package/_types/types/block.d.ts.map +1 -1
  231. package/_types/types/eip1193.d.ts +1 -1
  232. package/_types/types/eip1193.d.ts.map +1 -1
  233. package/_types/types/fee.d.ts +7 -0
  234. package/_types/types/fee.d.ts.map +1 -1
  235. package/_types/utils/formatters/feeHistory.d.ts.map +1 -1
  236. package/_types/utils/signature/serializeErc8010Signature.d.ts.map +1 -1
  237. package/_types/utils/signature/toPrefixedMessage.d.ts.map +1 -1
  238. package/account-abstraction/actions/bundler/prepareUserOperation.ts +6 -1
  239. package/account-abstraction/utils/formatters/userOperation.ts +12 -1
  240. package/actions/public/estimateContractGas.ts +7 -1
  241. package/actions/public/simulateBlocks.ts +6 -1
  242. package/actions/public/simulateContract.ts +7 -1
  243. package/actions/wallet/sendCalls.ts +8 -1
  244. package/actions/wallet/sendTransaction.ts +8 -2
  245. package/actions/wallet/sendTransactionSync.ts +8 -2
  246. package/chains/definitions/primiumTestnet.ts +26 -0
  247. package/chains/definitions/sevenChain.ts +23 -0
  248. package/chains/definitions/tsxBastion.ts +30 -0
  249. package/chains/definitions/tsxHorizon.ts +30 -0
  250. package/chains/definitions/tsxTestnet.ts +31 -0
  251. package/chains/index.ts +5 -0
  252. package/constants/abis.ts +50 -1
  253. package/errors/version.ts +1 -1
  254. package/experimental/erc7811/actions/getAssets.ts +8 -1
  255. package/package.json +1 -1
  256. package/tempo/Account.ts +0 -1
  257. package/tempo/Client.ts +2 -1
  258. package/tempo/actions/accounts.ts +1 -2
  259. package/tempo/actions/simulate.ts +6 -1
  260. package/tempo/chainConfig.ts +41 -2
  261. package/types/block.ts +2 -0
  262. package/types/eip1193.ts +1 -1
  263. package/types/fee.ts +7 -0
  264. package/utils/formatters/feeHistory.ts +5 -0
  265. package/utils/signature/serializeErc8010Signature.ts +4 -1
  266. package/utils/signature/toPrefixedMessage.ts +5 -1
@@ -208,7 +208,14 @@ function formatRequest(
208
208
 
209
209
  return {
210
210
  account: account.address,
211
- assetFilter: assets,
211
+ assetFilter: assets
212
+ ? Object.fromEntries(
213
+ Object.entries(assets).map(([chainId, filter]) => [
214
+ numberToHex(Number(chainId)),
215
+ filter,
216
+ ]),
217
+ )
218
+ : undefined,
212
219
  assetTypeFilter: assetTypes,
213
220
  chainFilter: chainIds?.map((chainId) => numberToHex(chainId)),
214
221
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.58.4",
4
+ "version": "2.58.7",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
package/tempo/Account.ts CHANGED
@@ -423,7 +423,6 @@ export declare namespace fromSecp256k1 {
423
423
  * import { Account } from 'viem/tempo'
424
424
  *
425
425
  * const account = Account.fromConfig({
426
- * address: 'infer',
427
426
  * owners: [owner_1, owner_2],
428
427
  * threshold: 2,
429
428
  * })
package/tempo/Client.ts CHANGED
@@ -107,7 +107,8 @@ export type CreateClientErrorType = ErrorType
107
107
  * client can be created with `createClient()`. Pass `testnet` to use the
108
108
  * Tempo testnet, or `chain` to override the chain entirely. Pass `feeToken`
109
109
  * to set a default fee token for every transaction. Use `withRelay` with a
110
- * `Relay.accounts` plugin to coordinate owner approvals.
110
+ * `Relay.accounts` plugin, or `http` to a relay that serves the `account_*`
111
+ * methods, to coordinate owner approvals.
111
112
  *
112
113
  * @example
113
114
  * ```ts
@@ -34,7 +34,7 @@ import type * as Transaction from '../Transaction.js'
34
34
  *
35
35
  * The precompile validates the config and derives the address from its hash.
36
36
  * To derive the address locally, use
37
- * `AccountConfig.getAddress` or `Account.fromConfig({ address: 'infer' })`.
37
+ * `AccountConfig.getAddress` or `Account.fromConfig` with an initial config.
38
38
  *
39
39
  * @example
40
40
  * ```ts
@@ -297,7 +297,6 @@ export declare namespace getOperation {
297
297
  * '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
298
298
  * )
299
299
  * const account = Account.fromConfig({
300
- * address: 'infer',
301
300
  * owners: [owner],
302
301
  * })
303
302
  * const client = createClient({
@@ -150,7 +150,12 @@ export async function simulateBlocks<
150
150
  ...call,
151
151
  account,
152
152
  data: call.dataSuffix
153
- ? concat([data || '0x', call.dataSuffix])
153
+ ? concat([
154
+ data || '0x',
155
+ call.dataSuffix.length % 2
156
+ ? `0x0${call.dataSuffix.slice(2)}`
157
+ : call.dataSuffix,
158
+ ])
154
159
  : data,
155
160
  from: call.from ?? account?.address,
156
161
  } as const
@@ -16,6 +16,10 @@ import type { Client } from '../clients/createClient.js'
16
16
  import { maxUint256 } from '../constants/number.js'
17
17
  import { BaseError } from '../errors/base.js'
18
18
  import { ContractFunctionRevertedError } from '../errors/contract.js'
19
+ import {
20
+ MethodNotFoundRpcError,
21
+ MethodNotSupportedRpcError,
22
+ } from '../errors/rpc.js'
19
23
  import type { Chain, ChainConfig as viem_ChainConfig } from '../types/chain.js'
20
24
  import type { RpcBlock } from '../types/rpc.js'
21
25
  import { isAddressEqual } from '../utils/address/isAddressEqual.js'
@@ -262,7 +266,10 @@ export const chainConfig = {
262
266
  const coordinated =
263
267
  (!!configurableIdentity || !!delegate) &&
264
268
  !!request.owner &&
265
- (client.transport as { accounts?: boolean }).accounts === true
269
+ (await supportsAccounts(
270
+ client,
271
+ configurableIdentity?.account ?? delegate!.address,
272
+ ))
266
273
  if (configurableIdentity) {
267
274
  const { account, local } = configurableIdentity
268
275
  if (!configurableIdentity.config && !coordinated)
@@ -289,7 +296,7 @@ export const chainConfig = {
289
296
  if (delegate) {
290
297
  const config =
291
298
  delegate.config ??
292
- ((client.transport as { accounts?: boolean }).accounts === true
299
+ ((await supportsAccounts(client, delegate.address))
293
300
  ? await getAction(
294
301
  client,
295
302
  getConfig,
@@ -657,6 +664,38 @@ async function isRegistered(client: Client, key: KeyAuthorizationManager.Key) {
657
664
  )
658
665
  }
659
666
 
667
+ /** Whether each transport serves the `account_*` methods, by transport. */
668
+ const accountsSupport = new WeakMap<object, Promise<boolean>>()
669
+
670
+ /**
671
+ * Whether the client's transport serves the `account_*` methods. Relay transports advertise
672
+ * them; other transports, such as `http` to a relay with `Relay.accounts`, answer one
673
+ * `account_getConfig` probe. Only a definitive answer is cached.
674
+ */
675
+ async function supportsAccounts(client: Client, address: Address) {
676
+ const { transport } = client
677
+ if ((transport as { accounts?: boolean }).accounts === true) return true
678
+ const cached = accountsSupport.get(transport)
679
+ if (cached) return cached
680
+ const supported = getAction(
681
+ client,
682
+ getConfig,
683
+ 'getConfig',
684
+ )({ address }).then(
685
+ () => true,
686
+ (error) => {
687
+ if (
688
+ !(error instanceof MethodNotFoundRpcError) &&
689
+ !(error instanceof MethodNotSupportedRpcError)
690
+ )
691
+ accountsSupport.delete(transport)
692
+ return false
693
+ },
694
+ )
695
+ accountsSupport.set(transport, supported)
696
+ return supported
697
+ }
698
+
660
699
  /**
661
700
  * Returns whether a request uses an expiring nonce: when asked for, when sponsored,
662
701
  * or when another request for the same sender is in flight.
package/types/block.ts CHANGED
@@ -46,6 +46,8 @@ export type Block<
46
46
  parentHash: Hash
47
47
  /** Root of the this block’s receipts trie */
48
48
  receiptsRoot: Hex
49
+ /** Hash of the execution layer requests ([EIP-7685](https://eips.ethereum.org/EIPS/eip-7685)) */
50
+ requestsHash?: Hash | undefined
49
51
  sealFields: Hex[]
50
52
  /** SHA3 of the uncles data in this block */
51
53
  sha3Uncles: Hash
package/types/eip1193.ts CHANGED
@@ -183,7 +183,7 @@ export type WalletGetAssetsParameters = {
183
183
  assetFilter?:
184
184
  | {
185
185
  [chainId: Hex]: readonly {
186
- address: Address
186
+ address: Address | 'native'
187
187
  type: 'native' | 'erc20' | 'erc721' | (string & {})
188
188
  }[]
189
189
  }
package/types/fee.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  import type { OneOf } from './utils.js'
2
2
 
3
3
  export type FeeHistory<quantity = bigint> = {
4
+ /**
5
+ * An array of block base fees per blob gas (in wei). This includes the next block after
6
+ * the newest of the returned range, because this value can be derived from the newest block.
7
+ * Zeroes are returned for pre-EIP-4844 blocks. */
8
+ baseFeePerBlobGas?: readonly quantity[] | undefined
4
9
  /**
5
10
  * An array of block base fees per gas (in wei). This includes the next block after
6
11
  * the newest of the returned range, because this value can be derived from the newest block.
7
12
  * Zeroes are returned for pre-EIP-1559 blocks. */
8
13
  baseFeePerGas: quantity[]
14
+ /** An array of block blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block. */
15
+ blobGasUsedRatio?: readonly number[] | undefined
9
16
  /** An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit. */
10
17
  gasUsedRatio: number[]
11
18
  /** Lowest number block of the returned range. */
@@ -5,8 +5,13 @@ import type { RpcFeeHistory } from '../../types/rpc.js'
5
5
  export type FormatFeeHistoryErrorType = ErrorType
6
6
 
7
7
  export function formatFeeHistory(feeHistory: RpcFeeHistory): FeeHistory {
8
+ const { baseFeePerBlobGas, blobGasUsedRatio } = feeHistory
8
9
  return {
10
+ ...(baseFeePerBlobGas && {
11
+ baseFeePerBlobGas: baseFeePerBlobGas.map((value) => BigInt(value)),
12
+ }),
9
13
  baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
14
+ ...(blobGasUsedRatio && { blobGasUsedRatio }),
10
15
  gasUsedRatio: feeHistory.gasUsedRatio,
11
16
  oldestBlock: BigInt(feeHistory.oldestBlock),
12
17
  reward: feeHistory.reward?.map((reward) =>
@@ -1,5 +1,6 @@
1
1
  import type { Address } from 'abitype'
2
2
  import { SignatureErc8010 } from 'ox/erc8010'
3
+ import * as Signature from 'ox/Signature'
3
4
  import type { ErrorType } from '../../errors/utils.js'
4
5
  import type { SignedAuthorization } from '../../types/authorization.js'
5
6
  import type { ByteArray, Hex } from '../../types/misc.js'
@@ -42,7 +43,9 @@ export function serializeErc8010Signature<to extends To = 'hex'>(
42
43
  nonce: BigInt(parameters.authorization.nonce),
43
44
  r: BigInt(parameters.authorization.r),
44
45
  s: BigInt(parameters.authorization.s),
45
- yParity: parameters.authorization.yParity!,
46
+ yParity:
47
+ parameters.authorization.yParity ??
48
+ Signature.vToYParity(Number(parameters.authorization.v)),
46
49
  },
47
50
  data,
48
51
  signature,
@@ -19,7 +19,11 @@ export type ToPrefixedMessageErrorType =
19
19
  export function toPrefixedMessage(message_: SignableMessage): Hex {
20
20
  const message = (() => {
21
21
  if (typeof message_ === 'string') return stringToHex(message_)
22
- if (typeof message_.raw === 'string') return message_.raw
22
+ // Odd-length hex is left-padded to whole bytes, matching `hexToBytes`.
23
+ if (typeof message_.raw === 'string')
24
+ return message_.raw.length % 2
25
+ ? (`0x0${message_.raw.slice(2)}` as Hex)
26
+ : message_.raw
23
27
  return bytesToHex(message_.raw)
24
28
  })()
25
29
  const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`)