viem 2.9.22 → 2.9.23

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 (178) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/accounts/privateKeyToAccount.js +4 -0
  3. package/_cjs/accounts/privateKeyToAccount.js.map +1 -1
  4. package/_cjs/accounts/toAccount.js +1 -0
  5. package/_cjs/accounts/toAccount.js.map +1 -1
  6. package/_cjs/chains/definitions/dreyerxMainnet.js +25 -0
  7. package/_cjs/chains/definitions/dreyerxMainnet.js.map +1 -0
  8. package/_cjs/chains/index.js +7 -5
  9. package/_cjs/chains/index.js.map +1 -1
  10. package/_cjs/errors/version.js +1 -1
  11. package/_cjs/experimental/eip3074/actions/signAuthMessage.js +18 -0
  12. package/_cjs/experimental/eip3074/actions/signAuthMessage.js.map +1 -0
  13. package/_cjs/experimental/eip3074/decorators/eip3074.js +13 -0
  14. package/_cjs/experimental/eip3074/decorators/eip3074.js.map +1 -0
  15. package/_cjs/experimental/eip3074/utils/recoverAuthMessageAddress.js +12 -0
  16. package/_cjs/experimental/eip3074/utils/recoverAuthMessageAddress.js.map +1 -0
  17. package/_cjs/experimental/eip3074/utils/signAuthMessage.js +17 -0
  18. package/_cjs/experimental/eip3074/utils/signAuthMessage.js.map +1 -0
  19. package/_cjs/experimental/eip3074/utils/toAuthMessage.js +17 -0
  20. package/_cjs/experimental/eip3074/utils/toAuthMessage.js.map +1 -0
  21. package/_cjs/experimental/eip3074/utils/verifyAuthMessage.js +11 -0
  22. package/_cjs/experimental/eip3074/utils/verifyAuthMessage.js.map +1 -0
  23. package/_cjs/experimental/{actions → eip5792/actions}/getCallsStatus.js +2 -2
  24. package/_cjs/experimental/eip5792/actions/getCallsStatus.js.map +1 -0
  25. package/_cjs/experimental/{actions → eip5792/actions}/getCapabilities.js +2 -2
  26. package/_cjs/experimental/eip5792/actions/getCapabilities.js.map +1 -0
  27. package/_cjs/experimental/{actions → eip5792/actions}/sendCalls.js +6 -6
  28. package/_cjs/experimental/eip5792/actions/sendCalls.js.map +1 -0
  29. package/_cjs/experimental/eip5792/actions/showCallsStatus.js.map +1 -0
  30. package/_cjs/experimental/{actions → eip5792/actions}/writeContracts.js +1 -1
  31. package/_cjs/experimental/eip5792/actions/writeContracts.js.map +1 -0
  32. package/_cjs/experimental/eip5792/decorators/eip5792.js.map +1 -0
  33. package/_cjs/experimental/index.js +15 -7
  34. package/_cjs/experimental/index.js.map +1 -1
  35. package/_cjs/utils/signature/hexToSignature.js.map +1 -1
  36. package/_esm/accounts/privateKeyToAccount.js +4 -0
  37. package/_esm/accounts/privateKeyToAccount.js.map +1 -1
  38. package/_esm/accounts/toAccount.js +1 -0
  39. package/_esm/accounts/toAccount.js.map +1 -1
  40. package/_esm/actions/public/verifyHash.js +1 -1
  41. package/_esm/chains/definitions/dreyerxMainnet.js +22 -0
  42. package/_esm/chains/definitions/dreyerxMainnet.js.map +1 -0
  43. package/_esm/chains/index.js +1 -0
  44. package/_esm/chains/index.js.map +1 -1
  45. package/_esm/errors/version.js +1 -1
  46. package/_esm/experimental/eip3074/actions/signAuthMessage.js +69 -0
  47. package/_esm/experimental/eip3074/actions/signAuthMessage.js.map +1 -0
  48. package/_esm/experimental/eip3074/decorators/eip3074.js +26 -0
  49. package/_esm/experimental/eip3074/decorators/eip3074.js.map +1 -0
  50. package/_esm/experimental/eip3074/utils/recoverAuthMessageAddress.js +8 -0
  51. package/_esm/experimental/eip3074/utils/recoverAuthMessageAddress.js.map +1 -0
  52. package/_esm/experimental/eip3074/utils/signAuthMessage.js +16 -0
  53. package/_esm/experimental/eip3074/utils/signAuthMessage.js.map +1 -0
  54. package/_esm/experimental/eip3074/utils/toAuthMessage.js +17 -0
  55. package/_esm/experimental/eip3074/utils/toAuthMessage.js.map +1 -0
  56. package/_esm/experimental/eip3074/utils/verifyAuthMessage.js +13 -0
  57. package/_esm/experimental/eip3074/utils/verifyAuthMessage.js.map +1 -0
  58. package/_esm/experimental/{actions → eip5792/actions}/getCallsStatus.js +3 -3
  59. package/_esm/experimental/eip5792/actions/getCallsStatus.js.map +1 -0
  60. package/_esm/experimental/{actions → eip5792/actions}/getCapabilities.js +3 -3
  61. package/_esm/experimental/eip5792/actions/getCapabilities.js.map +1 -0
  62. package/_esm/experimental/{actions → eip5792/actions}/sendCalls.js +7 -7
  63. package/_esm/experimental/eip5792/actions/sendCalls.js.map +1 -0
  64. package/_esm/experimental/{actions → eip5792/actions}/showCallsStatus.js +1 -1
  65. package/_esm/experimental/eip5792/actions/showCallsStatus.js.map +1 -0
  66. package/_esm/experimental/{actions → eip5792/actions}/writeContracts.js +2 -2
  67. package/_esm/experimental/eip5792/actions/writeContracts.js.map +1 -0
  68. package/_esm/experimental/eip5792/decorators/eip5792.js.map +1 -0
  69. package/_esm/experimental/index.js +10 -6
  70. package/_esm/experimental/index.js.map +1 -1
  71. package/_esm/utils/signature/hexToSignature.js.map +1 -1
  72. package/_types/accounts/privateKeyToAccount.d.ts.map +1 -1
  73. package/_types/accounts/toAccount.d.ts.map +1 -1
  74. package/_types/accounts/types.d.ts +5 -3
  75. package/_types/accounts/types.d.ts.map +1 -1
  76. package/_types/actions/public/verifyHash.d.ts +1 -1
  77. package/_types/celo/chainConfig.d.ts +114 -114
  78. package/_types/celo/formatters.d.ts +57 -57
  79. package/_types/chains/definitions/ancient8.d.ts +45 -45
  80. package/_types/chains/definitions/ancient8Sepolia.d.ts +45 -45
  81. package/_types/chains/definitions/base.d.ts +45 -45
  82. package/_types/chains/definitions/baseGoerli.d.ts +45 -45
  83. package/_types/chains/definitions/baseSepolia.d.ts +45 -45
  84. package/_types/chains/definitions/celo.d.ts +114 -114
  85. package/_types/chains/definitions/celoAlfajores.d.ts +114 -114
  86. package/_types/chains/definitions/dreyerxMainnet.d.ts +35 -0
  87. package/_types/chains/definitions/dreyerxMainnet.d.ts.map +1 -0
  88. package/_types/chains/definitions/fraxtal.d.ts +45 -45
  89. package/_types/chains/definitions/fraxtalTestnet.d.ts +45 -45
  90. package/_types/chains/definitions/liskSepolia.d.ts +45 -45
  91. package/_types/chains/definitions/optimism.d.ts +45 -45
  92. package/_types/chains/definitions/optimismGoerli.d.ts +45 -45
  93. package/_types/chains/definitions/optimismSepolia.d.ts +45 -45
  94. package/_types/chains/definitions/pgn.d.ts +45 -45
  95. package/_types/chains/definitions/pgnTestnet.d.ts +45 -45
  96. package/_types/chains/definitions/rss3.d.ts +45 -45
  97. package/_types/chains/definitions/rss3Sepolia.d.ts +45 -45
  98. package/_types/chains/definitions/zora.d.ts +45 -45
  99. package/_types/chains/definitions/zoraSepolia.d.ts +45 -45
  100. package/_types/chains/definitions/zoraTestnet.d.ts +45 -45
  101. package/_types/chains/index.d.ts +1 -0
  102. package/_types/chains/index.d.ts.map +1 -1
  103. package/_types/errors/version.d.ts +1 -1
  104. package/_types/experimental/eip3074/actions/signAuthMessage.d.ts +72 -0
  105. package/_types/experimental/eip3074/actions/signAuthMessage.d.ts.map +1 -0
  106. package/_types/experimental/eip3074/decorators/eip3074.d.ts +27 -0
  107. package/_types/experimental/eip3074/decorators/eip3074.d.ts.map +1 -0
  108. package/_types/experimental/eip3074/utils/recoverAuthMessageAddress.d.ts +12 -0
  109. package/_types/experimental/eip3074/utils/recoverAuthMessageAddress.d.ts.map +1 -0
  110. package/_types/experimental/eip3074/utils/signAuthMessage.d.ts +16 -0
  111. package/_types/experimental/eip3074/utils/signAuthMessage.d.ts.map +1 -0
  112. package/_types/experimental/eip3074/utils/toAuthMessage.d.ts +20 -0
  113. package/_types/experimental/eip3074/utils/toAuthMessage.d.ts.map +1 -0
  114. package/_types/experimental/eip3074/utils/verifyAuthMessage.d.ts +19 -0
  115. package/_types/experimental/eip3074/utils/verifyAuthMessage.d.ts.map +1 -0
  116. package/_types/experimental/{actions → eip5792/actions}/getCallsStatus.d.ts +9 -9
  117. package/_types/experimental/eip5792/actions/getCallsStatus.d.ts.map +1 -0
  118. package/_types/experimental/{actions → eip5792/actions}/getCapabilities.d.ts +9 -9
  119. package/_types/experimental/eip5792/actions/getCapabilities.d.ts.map +1 -0
  120. package/_types/experimental/{actions → eip5792/actions}/sendCalls.d.ts +10 -10
  121. package/_types/experimental/eip5792/actions/sendCalls.d.ts.map +1 -0
  122. package/_types/experimental/{actions → eip5792/actions}/showCallsStatus.d.ts +7 -7
  123. package/_types/experimental/eip5792/actions/showCallsStatus.d.ts.map +1 -0
  124. package/_types/experimental/{actions → eip5792/actions}/writeContracts.d.ts +9 -9
  125. package/_types/experimental/eip5792/actions/writeContracts.d.ts.map +1 -0
  126. package/_types/experimental/{decorators → eip5792/decorators}/eip5792.d.ts +9 -9
  127. package/_types/experimental/eip5792/decorators/eip5792.d.ts.map +1 -0
  128. package/_types/experimental/index.d.ts +10 -6
  129. package/_types/experimental/index.d.ts.map +1 -1
  130. package/_types/op-stack/chainConfig.d.ts +45 -45
  131. package/_types/op-stack/formatters.d.ts +45 -45
  132. package/_types/utils/formatters/transaction.d.ts +1 -1
  133. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  134. package/_types/utils/signature/hexToSignature.d.ts +7 -2
  135. package/_types/utils/signature/hexToSignature.d.ts.map +1 -1
  136. package/accounts/privateKeyToAccount.ts +5 -1
  137. package/accounts/toAccount.ts +1 -0
  138. package/accounts/types.ts +12 -5
  139. package/actions/public/verifyHash.ts +1 -1
  140. package/chains/definitions/dreyerxMainnet.ts +22 -0
  141. package/chains/index.ts +1 -0
  142. package/errors/version.ts +1 -1
  143. package/experimental/eip3074/actions/signAuthMessage.ts +103 -0
  144. package/experimental/eip3074/decorators/eip3074.ts +51 -0
  145. package/experimental/eip3074/utils/recoverAuthMessageAddress.ts +29 -0
  146. package/experimental/eip3074/utils/signAuthMessage.ts +40 -0
  147. package/experimental/eip3074/utils/toAuthMessage.ts +50 -0
  148. package/experimental/eip3074/utils/verifyAuthMessage.ts +46 -0
  149. package/experimental/{actions → eip5792/actions}/getCallsStatus.ts +11 -11
  150. package/experimental/{actions → eip5792/actions}/getCapabilities.ts +11 -11
  151. package/experimental/{actions → eip5792/actions}/sendCalls.ts +17 -17
  152. package/experimental/{actions → eip5792/actions}/showCallsStatus.ts +7 -7
  153. package/experimental/{actions → eip5792/actions}/writeContracts.ts +9 -9
  154. package/experimental/{decorators → eip5792/decorators}/eip5792.ts +9 -9
  155. package/experimental/index.ts +29 -7
  156. package/package.json +1 -1
  157. package/utils/signature/hexToSignature.ts +2 -2
  158. package/_cjs/experimental/actions/getCallsStatus.js.map +0 -1
  159. package/_cjs/experimental/actions/getCapabilities.js.map +0 -1
  160. package/_cjs/experimental/actions/sendCalls.js.map +0 -1
  161. package/_cjs/experimental/actions/showCallsStatus.js.map +0 -1
  162. package/_cjs/experimental/actions/writeContracts.js.map +0 -1
  163. package/_cjs/experimental/decorators/eip5792.js.map +0 -1
  164. package/_esm/experimental/actions/getCallsStatus.js.map +0 -1
  165. package/_esm/experimental/actions/getCapabilities.js.map +0 -1
  166. package/_esm/experimental/actions/sendCalls.js.map +0 -1
  167. package/_esm/experimental/actions/showCallsStatus.js.map +0 -1
  168. package/_esm/experimental/actions/writeContracts.js.map +0 -1
  169. package/_esm/experimental/decorators/eip5792.js.map +0 -1
  170. package/_types/experimental/actions/getCallsStatus.d.ts.map +0 -1
  171. package/_types/experimental/actions/getCapabilities.d.ts.map +0 -1
  172. package/_types/experimental/actions/sendCalls.d.ts.map +0 -1
  173. package/_types/experimental/actions/showCallsStatus.d.ts.map +0 -1
  174. package/_types/experimental/actions/writeContracts.d.ts.map +0 -1
  175. package/_types/experimental/decorators/eip5792.d.ts.map +0 -1
  176. /package/_cjs/experimental/{actions → eip5792/actions}/showCallsStatus.js +0 -0
  177. /package/_cjs/experimental/{decorators → eip5792/decorators}/eip5792.js +0 -0
  178. /package/_esm/experimental/{decorators → eip5792/decorators}/eip5792.js +0 -0
@@ -47,19 +47,19 @@ export declare const formatters: {
47
47
  maxFeePerBlobGas?: `0x${string}` | undefined;
48
48
  maxFeePerGas?: `0x${string}` | undefined;
49
49
  maxPriorityFeePerGas?: `0x${string}` | undefined;
50
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
50
51
  to?: `0x${string}` | null;
51
52
  from?: `0x${string}`;
52
53
  gas?: `0x${string}`;
53
54
  nonce?: `0x${string}`;
54
55
  value?: `0x${string}`;
55
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
56
- accessList?: undefined;
57
- blobVersionedHashes?: undefined;
58
56
  blockHash?: `0x${string}` | null;
59
57
  blockNumber?: `0x${string}` | null;
60
58
  hash?: `0x${string}`;
61
59
  input?: `0x${string}`;
62
60
  transactionIndex?: `0x${string}` | null;
61
+ accessList?: undefined;
62
+ blobVersionedHashes?: undefined;
63
63
  chainId?: `0x${string}` | undefined;
64
64
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
65
65
  r: `0x${string}`;
@@ -98,19 +98,19 @@ export declare const formatters: {
98
98
  maxFeePerBlobGas?: `0x${string}` | undefined;
99
99
  maxFeePerGas?: `0x${string}` | undefined;
100
100
  maxPriorityFeePerGas?: `0x${string}` | undefined;
101
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
101
102
  to?: `0x${string}` | null;
102
103
  from?: `0x${string}`;
103
104
  gas?: `0x${string}`;
104
105
  nonce?: `0x${string}`;
105
106
  value?: `0x${string}`;
106
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
107
- accessList?: undefined;
108
- blobVersionedHashes?: undefined;
109
107
  blockHash?: `0x${string}` | null;
110
108
  blockNumber?: `0x${string}` | null;
111
109
  hash?: `0x${string}`;
112
110
  input?: `0x${string}`;
113
111
  transactionIndex?: `0x${string}` | null;
112
+ accessList?: undefined;
113
+ blobVersionedHashes?: undefined;
114
114
  chainId?: `0x${string}` | undefined;
115
115
  } & Omit<import("../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean>, "typeHex"> & import("../index.js").FeeValuesEIP1559<`0x${string}`> & {
116
116
  isSystemTx?: boolean | undefined;
@@ -126,19 +126,19 @@ export declare const formatters: {
126
126
  maxFeePerBlobGas?: `0x${string}` | undefined;
127
127
  maxFeePerGas?: `0x${string}` | undefined;
128
128
  maxPriorityFeePerGas?: `0x${string}` | undefined;
129
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
129
130
  to?: `0x${string}` | null;
130
131
  from?: `0x${string}`;
131
132
  gas?: `0x${string}`;
132
133
  nonce?: `0x${string}`;
133
134
  value?: `0x${string}`;
134
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
135
- accessList?: import("../index.js").AccessList | undefined;
136
- blobVersionedHashes?: undefined;
137
135
  blockHash?: `0x${string}` | null;
138
136
  blockNumber?: `0x${string}` | null;
139
137
  hash?: `0x${string}`;
140
138
  input?: `0x${string}`;
141
139
  transactionIndex?: `0x${string}` | null;
140
+ accessList?: import("../index.js").AccessList | undefined;
141
+ blobVersionedHashes?: undefined;
142
142
  chainId?: `0x${string}` | undefined;
143
143
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
144
144
  r: `0x${string}`;
@@ -177,19 +177,19 @@ export declare const formatters: {
177
177
  maxFeePerBlobGas?: `0x${string}` | undefined;
178
178
  maxFeePerGas?: `0x${string}` | undefined;
179
179
  maxPriorityFeePerGas?: `0x${string}` | undefined;
180
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
180
181
  to?: `0x${string}` | null;
181
182
  from?: `0x${string}`;
182
183
  gas?: `0x${string}`;
183
184
  nonce?: `0x${string}`;
184
185
  value?: `0x${string}`;
185
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
186
- accessList?: import("../index.js").AccessList | undefined;
187
- blobVersionedHashes?: undefined;
188
186
  blockHash?: `0x${string}` | null;
189
187
  blockNumber?: `0x${string}` | null;
190
188
  hash?: `0x${string}`;
191
189
  input?: `0x${string}`;
192
190
  transactionIndex?: `0x${string}` | null;
191
+ accessList?: import("../index.js").AccessList | undefined;
192
+ blobVersionedHashes?: undefined;
193
193
  chainId?: `0x${string}` | undefined;
194
194
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
195
195
  blockHash: `0x${string}` | null;
@@ -228,19 +228,19 @@ export declare const formatters: {
228
228
  maxFeePerBlobGas?: `0x${string}` | undefined;
229
229
  maxFeePerGas?: `0x${string}` | undefined;
230
230
  maxPriorityFeePerGas?: `0x${string}` | undefined;
231
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
231
232
  to?: `0x${string}` | null;
232
233
  from?: `0x${string}`;
233
234
  gas?: `0x${string}`;
234
235
  nonce?: `0x${string}`;
235
236
  value?: `0x${string}`;
236
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
237
- accessList?: import("../index.js").AccessList | undefined;
238
- blobVersionedHashes?: undefined;
239
237
  blockHash?: `0x${string}` | null;
240
238
  blockNumber?: `0x${string}` | null;
241
239
  hash?: `0x${string}`;
242
240
  input?: `0x${string}`;
243
241
  transactionIndex?: `0x${string}` | null;
242
+ accessList?: import("../index.js").AccessList | undefined;
243
+ blobVersionedHashes?: undefined;
244
244
  chainId?: `0x${string}` | undefined;
245
245
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
246
246
  blockHash: `0x${string}` | null;
@@ -279,19 +279,19 @@ export declare const formatters: {
279
279
  maxFeePerBlobGas?: `0x${string}` | undefined;
280
280
  maxFeePerGas?: `0x${string}` | undefined;
281
281
  maxPriorityFeePerGas?: `0x${string}` | undefined;
282
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
282
283
  to?: `0x${string}` | null;
283
284
  from?: `0x${string}`;
284
285
  gas?: `0x${string}`;
285
286
  nonce?: `0x${string}`;
286
287
  value?: `0x${string}`;
287
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
288
- accessList?: import("../index.js").AccessList | undefined;
289
- blobVersionedHashes?: undefined;
290
288
  blockHash?: `0x${string}` | null;
291
289
  blockNumber?: `0x${string}` | null;
292
290
  hash?: `0x${string}`;
293
291
  input?: `0x${string}`;
294
292
  transactionIndex?: `0x${string}` | null;
293
+ accessList?: import("../index.js").AccessList | undefined;
294
+ blobVersionedHashes?: undefined;
295
295
  chainId?: `0x${string}` | undefined;
296
296
  } & Omit<import("../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean>, "typeHex"> & import("../index.js").FeeValuesEIP1559<`0x${string}`> & {
297
297
  isSystemTx?: boolean | undefined;
@@ -307,19 +307,19 @@ export declare const formatters: {
307
307
  maxFeePerBlobGas?: `0x${string}` | undefined;
308
308
  maxFeePerGas?: `0x${string}` | undefined;
309
309
  maxPriorityFeePerGas?: `0x${string}` | undefined;
310
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
310
311
  to?: `0x${string}` | null;
311
312
  from?: `0x${string}`;
312
313
  gas?: `0x${string}`;
313
314
  nonce?: `0x${string}`;
314
315
  value?: `0x${string}`;
315
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
316
- accessList?: import("../index.js").AccessList | undefined;
317
- blobVersionedHashes?: undefined;
318
316
  blockHash?: `0x${string}` | null;
319
317
  blockNumber?: `0x${string}` | null;
320
318
  hash?: `0x${string}`;
321
319
  input?: `0x${string}`;
322
320
  transactionIndex?: `0x${string}` | null;
321
+ accessList?: import("../index.js").AccessList | undefined;
322
+ blobVersionedHashes?: undefined;
323
323
  chainId?: `0x${string}` | undefined;
324
324
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
325
325
  r: `0x${string}`;
@@ -358,19 +358,19 @@ export declare const formatters: {
358
358
  maxFeePerBlobGas?: `0x${string}` | undefined;
359
359
  maxFeePerGas?: `0x${string}` | undefined;
360
360
  maxPriorityFeePerGas?: `0x${string}` | undefined;
361
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
361
362
  to?: `0x${string}` | null;
362
363
  from?: `0x${string}`;
363
364
  gas?: `0x${string}`;
364
365
  nonce?: `0x${string}`;
365
366
  value?: `0x${string}`;
366
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
367
- accessList?: import("../index.js").AccessList | undefined;
368
- blobVersionedHashes?: undefined;
369
367
  blockHash?: `0x${string}` | null;
370
368
  blockNumber?: `0x${string}` | null;
371
369
  hash?: `0x${string}`;
372
370
  input?: `0x${string}`;
373
371
  transactionIndex?: `0x${string}` | null;
372
+ accessList?: import("../index.js").AccessList | undefined;
373
+ blobVersionedHashes?: undefined;
374
374
  chainId?: `0x${string}` | undefined;
375
375
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
376
376
  blockHash: `0x${string}` | null;
@@ -409,19 +409,19 @@ export declare const formatters: {
409
409
  maxFeePerBlobGas?: `0x${string}` | undefined;
410
410
  maxFeePerGas?: `0x${string}` | undefined;
411
411
  maxPriorityFeePerGas?: `0x${string}` | undefined;
412
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
412
413
  to?: `0x${string}` | null;
413
414
  from?: `0x${string}`;
414
415
  gas?: `0x${string}`;
415
416
  nonce?: `0x${string}`;
416
417
  value?: `0x${string}`;
417
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
418
- accessList?: import("../index.js").AccessList | undefined;
419
- blobVersionedHashes?: undefined;
420
418
  blockHash?: `0x${string}` | null;
421
419
  blockNumber?: `0x${string}` | null;
422
420
  hash?: `0x${string}`;
423
421
  input?: `0x${string}`;
424
422
  transactionIndex?: `0x${string}` | null;
423
+ accessList?: import("../index.js").AccessList | undefined;
424
+ blobVersionedHashes?: undefined;
425
425
  chainId?: `0x${string}` | undefined;
426
426
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
427
427
  blockHash: `0x${string}` | null;
@@ -460,19 +460,19 @@ export declare const formatters: {
460
460
  maxFeePerBlobGas?: `0x${string}` | undefined;
461
461
  maxFeePerGas?: `0x${string}` | undefined;
462
462
  maxPriorityFeePerGas?: `0x${string}` | undefined;
463
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
463
464
  to?: `0x${string}` | null;
464
465
  from?: `0x${string}`;
465
466
  gas?: `0x${string}`;
466
467
  nonce?: `0x${string}`;
467
468
  value?: `0x${string}`;
468
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
469
- accessList?: import("../index.js").AccessList | undefined;
470
- blobVersionedHashes?: undefined;
471
469
  blockHash?: `0x${string}` | null;
472
470
  blockNumber?: `0x${string}` | null;
473
471
  hash?: `0x${string}`;
474
472
  input?: `0x${string}`;
475
473
  transactionIndex?: `0x${string}` | null;
474
+ accessList?: import("../index.js").AccessList | undefined;
475
+ blobVersionedHashes?: undefined;
476
476
  chainId?: `0x${string}` | undefined;
477
477
  } & Omit<import("../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean>, "typeHex"> & import("../index.js").FeeValuesEIP1559<`0x${string}`> & {
478
478
  isSystemTx?: boolean | undefined;
@@ -488,19 +488,19 @@ export declare const formatters: {
488
488
  maxFeePerBlobGas?: `0x${string}` | undefined;
489
489
  maxFeePerGas?: `0x${string}` | undefined;
490
490
  maxPriorityFeePerGas?: `0x${string}` | undefined;
491
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
491
492
  to?: `0x${string}` | null;
492
493
  from?: `0x${string}`;
493
494
  gas?: `0x${string}`;
494
495
  nonce?: `0x${string}`;
495
496
  value?: `0x${string}`;
496
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
497
- accessList?: import("../index.js").AccessList | undefined;
498
- blobVersionedHashes?: `0x${string}`[] | undefined;
499
497
  blockHash?: `0x${string}` | null;
500
498
  blockNumber?: `0x${string}` | null;
501
499
  hash?: `0x${string}`;
502
500
  input?: `0x${string}`;
503
501
  transactionIndex?: `0x${string}` | null;
502
+ accessList?: import("../index.js").AccessList | undefined;
503
+ blobVersionedHashes?: `0x${string}`[] | undefined;
504
504
  chainId?: `0x${string}` | undefined;
505
505
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
506
506
  r: `0x${string}`;
@@ -539,19 +539,19 @@ export declare const formatters: {
539
539
  maxFeePerBlobGas?: `0x${string}` | undefined;
540
540
  maxFeePerGas?: `0x${string}` | undefined;
541
541
  maxPriorityFeePerGas?: `0x${string}` | undefined;
542
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
542
543
  to?: `0x${string}` | null;
543
544
  from?: `0x${string}`;
544
545
  gas?: `0x${string}`;
545
546
  nonce?: `0x${string}`;
546
547
  value?: `0x${string}`;
547
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
548
- accessList?: import("../index.js").AccessList | undefined;
549
- blobVersionedHashes?: `0x${string}`[] | undefined;
550
548
  blockHash?: `0x${string}` | null;
551
549
  blockNumber?: `0x${string}` | null;
552
550
  hash?: `0x${string}`;
553
551
  input?: `0x${string}`;
554
552
  transactionIndex?: `0x${string}` | null;
553
+ accessList?: import("../index.js").AccessList | undefined;
554
+ blobVersionedHashes?: `0x${string}`[] | undefined;
555
555
  chainId?: `0x${string}` | undefined;
556
556
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
557
557
  blockHash: `0x${string}` | null;
@@ -590,19 +590,19 @@ export declare const formatters: {
590
590
  maxFeePerBlobGas?: `0x${string}` | undefined;
591
591
  maxFeePerGas?: `0x${string}` | undefined;
592
592
  maxPriorityFeePerGas?: `0x${string}` | undefined;
593
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
593
594
  to?: `0x${string}` | null;
594
595
  from?: `0x${string}`;
595
596
  gas?: `0x${string}`;
596
597
  nonce?: `0x${string}`;
597
598
  value?: `0x${string}`;
598
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
599
- accessList?: import("../index.js").AccessList | undefined;
600
- blobVersionedHashes?: `0x${string}`[] | undefined;
601
599
  blockHash?: `0x${string}` | null;
602
600
  blockNumber?: `0x${string}` | null;
603
601
  hash?: `0x${string}`;
604
602
  input?: `0x${string}`;
605
603
  transactionIndex?: `0x${string}` | null;
604
+ accessList?: import("../index.js").AccessList | undefined;
605
+ blobVersionedHashes?: `0x${string}`[] | undefined;
606
606
  chainId?: `0x${string}` | undefined;
607
607
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
608
608
  blockHash: `0x${string}` | null;
@@ -641,19 +641,19 @@ export declare const formatters: {
641
641
  maxFeePerBlobGas?: `0x${string}` | undefined;
642
642
  maxFeePerGas?: `0x${string}` | undefined;
643
643
  maxPriorityFeePerGas?: `0x${string}` | undefined;
644
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
644
645
  to?: `0x${string}` | null;
645
646
  from?: `0x${string}`;
646
647
  gas?: `0x${string}`;
647
648
  nonce?: `0x${string}`;
648
649
  value?: `0x${string}`;
649
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
650
- accessList?: import("../index.js").AccessList | undefined;
651
- blobVersionedHashes?: `0x${string}`[] | undefined;
652
650
  blockHash?: `0x${string}` | null;
653
651
  blockNumber?: `0x${string}` | null;
654
652
  hash?: `0x${string}`;
655
653
  input?: `0x${string}`;
656
654
  transactionIndex?: `0x${string}` | null;
655
+ accessList?: import("../index.js").AccessList | undefined;
656
+ blobVersionedHashes?: `0x${string}`[] | undefined;
657
657
  chainId?: `0x${string}` | undefined;
658
658
  } & import("../types/utils.js").Omit<import("../types/utils.js").PartialBy<{
659
659
  blockHash: `0x${string}` | null;
@@ -692,19 +692,19 @@ export declare const formatters: {
692
692
  maxFeePerBlobGas?: `0x${string}` | undefined;
693
693
  maxFeePerGas?: `0x${string}` | undefined;
694
694
  maxPriorityFeePerGas?: `0x${string}` | undefined;
695
+ type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
695
696
  to?: `0x${string}` | null;
696
697
  from?: `0x${string}`;
697
698
  gas?: `0x${string}`;
698
699
  nonce?: `0x${string}`;
699
700
  value?: `0x${string}`;
700
- type?: "0x0" | "0x1" | "0x2" | "0x3" | "0x7e";
701
- accessList?: import("../index.js").AccessList | undefined;
702
- blobVersionedHashes?: `0x${string}`[] | undefined;
703
701
  blockHash?: `0x${string}` | null;
704
702
  blockNumber?: `0x${string}` | null;
705
703
  hash?: `0x${string}`;
706
704
  input?: `0x${string}`;
707
705
  transactionIndex?: `0x${string}` | null;
706
+ accessList?: import("../index.js").AccessList | undefined;
707
+ blobVersionedHashes?: `0x${string}`[] | undefined;
708
708
  chainId?: `0x${string}` | undefined;
709
709
  } & Omit<import("../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean>, "typeHex"> & import("../index.js").FeeValuesEIP1559<`0x${string}`> & {
710
710
  isSystemTx?: boolean | undefined;
@@ -19,7 +19,7 @@ export declare const transactionType: {
19
19
  export type FormatTransactionErrorType = ErrorType;
20
20
  export declare function formatTransaction(transaction: ExactPartial<RpcTransaction>): Transaction;
21
21
  export type DefineTransactionErrorType = DefineFormatterErrorType | ErrorType;
22
- export declare const defineTransaction: <TOverrideParameters, TOverrideReturnType, TExclude extends ("r" | "s" | "v" | "yParity" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "from" | "gas" | "nonce" | "value" | "type" | "accessList" | "blobVersionedHashes" | "blockHash" | "blockNumber" | "hash" | "input" | "transactionIndex" | "chainId" | keyof TOverrideParameters)[] = []>({ exclude, format: overrides, }: {
22
+ export declare const defineTransaction: <TOverrideParameters, TOverrideReturnType, TExclude extends ("r" | "s" | "v" | "yParity" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "type" | "to" | "from" | "gas" | "nonce" | "value" | "blockHash" | "blockNumber" | "hash" | "input" | "transactionIndex" | "accessList" | "blobVersionedHashes" | "chainId" | keyof TOverrideParameters)[] = []>({ exclude, format: overrides, }: {
23
23
  exclude?: TExclude | undefined;
24
24
  format: (_: TOverrideParameters) => TOverrideReturnType;
25
25
  }) => {
@@ -14,7 +14,7 @@ export declare const rpcTransactionType: {
14
14
  export type FormatTransactionRequestErrorType = ErrorType;
15
15
  export declare function formatTransactionRequest(request: ExactPartial<TransactionRequest>): RpcTransactionRequest;
16
16
  export type DefineTransactionRequestErrorType = DefineFormatterErrorType | ErrorType;
17
- export declare const defineTransactionRequest: <TOverrideParameters, TOverrideReturnType, TExclude extends ("gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "data" | "from" | "gas" | "nonce" | "value" | "blobs" | "type" | "accessList" | "blobVersionedHashes" | "kzg" | "sidecars" | keyof TOverrideParameters)[] = []>({ exclude, format: overrides, }: {
17
+ export declare const defineTransactionRequest: <TOverrideParameters, TOverrideReturnType, TExclude extends ("gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "type" | "to" | "data" | "from" | "gas" | "nonce" | "value" | "blobs" | "accessList" | "blobVersionedHashes" | "kzg" | "sidecars" | keyof TOverrideParameters)[] = []>({ exclude, format: overrides, }: {
18
18
  exclude?: TExclude | undefined;
19
19
  format: (_: TOverrideParameters) => TOverrideReturnType;
20
20
  }) => {
@@ -1,5 +1,5 @@
1
1
  import type { ErrorType } from '../../errors/utils.js';
2
- import type { Hex, Signature } from '../../types/misc.js';
2
+ import type { Hex } from '../../types/misc.js';
3
3
  import { type NumberToHexErrorType } from '../../utils/encoding/toHex.js';
4
4
  export type HexToSignatureErrorType = NumberToHexErrorType | ErrorType;
5
5
  /**
@@ -12,5 +12,10 @@ export type HexToSignatureErrorType = NumberToHexErrorType | ErrorType;
12
12
  * hexToSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')
13
13
  * // { r: '0x...', s: '0x...', v: 28n }
14
14
  */
15
- export declare function hexToSignature(signatureHex: Hex): Signature;
15
+ export declare function hexToSignature(signatureHex: Hex): {
16
+ r: `0x${string}`;
17
+ s: `0x${string}`;
18
+ v: bigint;
19
+ yParity: number;
20
+ };
16
21
  //# sourceMappingURL=hexToSignature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hexToSignature.d.ts","sourceRoot":"","sources":["../../../utils/signature/hexToSignature.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG,SAAS,CAAA;AAEtE;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,CAS3D"}
1
+ {"version":3,"file":"hexToSignature.d.ts","sourceRoot":"","sources":["../../../utils/signature/hexToSignature.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,qBAAqB,CAAA;AACzD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG,SAAS,CAAA;AAEtE;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,GAAG;;;;;EAS/C"}
@@ -4,6 +4,7 @@ import type { Hex } from '../types/misc.js'
4
4
  import { type ToHexErrorType, toHex } from '../utils/encoding/toHex.js'
5
5
 
6
6
  import type { ErrorType } from '../errors/utils.js'
7
+ import { signAuthMessage } from '../experimental/eip3074/utils/signAuthMessage.js'
7
8
  import { type ToAccountErrorType, toAccount } from './toAccount.js'
8
9
  import type { PrivateKeyAccount } from './types.js'
9
10
  import {
@@ -40,6 +41,9 @@ export function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {
40
41
 
41
42
  const account = toAccount({
42
43
  address,
44
+ async experimental_signAuthMessage(parameters) {
45
+ return signAuthMessage({ ...parameters, privateKey })
46
+ },
43
47
  async signMessage({ message }) {
44
48
  return signMessage({ message, privateKey })
45
49
  },
@@ -55,5 +59,5 @@ export function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {
55
59
  ...account,
56
60
  publicKey,
57
61
  source: 'privateKey',
58
- }
62
+ } as PrivateKeyAccount
59
63
  }
@@ -47,6 +47,7 @@ export function toAccount<TAccountSource extends AccountSource>(
47
47
  throw new InvalidAddressError({ address: source.address })
48
48
  return {
49
49
  address: source.address,
50
+ experimental_signAuthMessage: source.experimental_signAuthMessage,
50
51
  signMessage: source.signMessage,
51
52
  signTransaction: source.signTransaction,
52
53
  signTypedData: source.signTypedData,
package/accounts/types.ts CHANGED
@@ -1,23 +1,27 @@
1
1
  import type { HDKey } from '@scure/bip32'
2
2
  import type { Address, TypedData } from 'abitype'
3
3
 
4
+ import type { ToAuthMessageParameters } from '../experimental/eip3074/utils/toAuthMessage.js'
4
5
  import type { Hash, Hex, SignableMessage } from '../types/misc.js'
5
6
  import type {
6
7
  TransactionSerializable,
7
8
  TransactionSerialized,
8
9
  } from '../types/transaction.js'
9
10
  import type { TypedDataDefinition } from '../types/typedData.js'
10
- import type { IsNarrowable } from '../types/utils.js'
11
+ import type { IsNarrowable, OneOf, RequiredBy } from '../types/utils.js'
11
12
  import type { GetTransactionType } from '../utils/transaction/getTransactionType.js'
12
13
  import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
13
14
 
14
- export type Account<TAddress extends Address = Address> =
15
- | JsonRpcAccount<TAddress>
16
- | LocalAccount<string, TAddress>
15
+ export type Account<TAddress extends Address = Address> = OneOf<
16
+ JsonRpcAccount<TAddress> | LocalAccount<string, TAddress>
17
+ >
17
18
 
18
19
  export type AccountSource = Address | CustomSource
19
20
  export type CustomSource = {
20
21
  address: Address
22
+ experimental_signAuthMessage?:
23
+ | ((parameters: ToAuthMessageParameters) => Promise<Hash>)
24
+ | undefined
21
25
  signMessage: ({ message }: { message: SignableMessage }) => Promise<Hash>
22
26
  signTransaction: <
23
27
  serializer extends
@@ -83,4 +87,7 @@ export type HDOptions =
83
87
  path: `m/44'/60'/${string}`
84
88
  }
85
89
 
86
- export type PrivateKeyAccount = LocalAccount<'privateKey'>
90
+ export type PrivateKeyAccount = RequiredBy<
91
+ LocalAccount<'privateKey'>,
92
+ 'experimental_signAuthMessage'
93
+ >
@@ -42,7 +42,7 @@ export type VerifyHashErrorType =
42
42
  | ErrorType
43
43
 
44
44
  /**
45
- * Verifies a message hash on chain using ERC-6492.
45
+ * Verifies a message hash onchain using ERC-6492.
46
46
  *
47
47
  * @param client - Client to use.
48
48
  * @param parameters - {@link VerifyHashParameters}
@@ -0,0 +1,22 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const dreyerxMainnet = /*#__PURE__*/ defineChain({
4
+ id: 23451,
5
+ name: 'DreyerX Mainnet',
6
+ nativeCurrency: {
7
+ name: 'DreyerX',
8
+ symbol: 'DRX',
9
+ decimals: 18,
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: ['https://rpc.dreyerx.com'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'DreyerX Scan',
19
+ url: 'https://scan.dreyerx.com',
20
+ },
21
+ },
22
+ })
package/chains/index.ts CHANGED
@@ -58,6 +58,7 @@ export { defichainEvmTestnet } from './definitions/defichainEvmTestnet.js'
58
58
  export { degen } from './definitions/degen.js'
59
59
  export { dfk } from './definitions/dfk.js'
60
60
  export { dogechain } from './definitions/dogechain.js'
61
+ export { dreyerxMainnet } from './definitions/dreyerxMainnet.js'
61
62
  export { edgeless } from './definitions/edgeless.js'
62
63
  export { edgelessTestnet } from './definitions/edgelessTestnet.js'
63
64
  export { edgeware } from './definitions/edgeware.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.9.22'
1
+ export const version = '2.9.23'
@@ -0,0 +1,103 @@
1
+ import type { Client } from '../../../clients/createClient.js'
2
+ import type { Transport } from '../../../clients/transports/createTransport.js'
3
+ import { AccountNotFoundError } from '../../../errors/account.js'
4
+ import type { ErrorType } from '../../../errors/utils.js'
5
+ import type { Account, PrivateKeyAccount } from '../../../types/account.js'
6
+ import type { Chain } from '../../../types/chain.js'
7
+ import type { Hex } from '../../../types/misc.js'
8
+ import type { IsUndefined } from '../../../types/utils.js'
9
+ import type { ToAuthMessageParameters } from '../utils/toAuthMessage.js'
10
+
11
+ export type SignAuthMessageParameters<
12
+ account extends Account | undefined = Account | undefined,
13
+ > = ToAuthMessageParameters &
14
+ // TODO: Use `GetAccountParameter` when JSON-RPC method for sign auth message exists.
15
+ (IsUndefined<account> extends true
16
+ ? { account: PrivateKeyAccount }
17
+ : account extends PrivateKeyAccount
18
+ ? { account?: PrivateKeyAccount | undefined }
19
+ : { account: PrivateKeyAccount })
20
+
21
+ export type SignAuthMessageReturnType = Hex
22
+
23
+ export type SignAuthMessageErrorType = ErrorType
24
+
25
+ /**
26
+ * Calculates an [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) auth signature.
27
+ *
28
+ * With the calculated signature, you can:
29
+ * - pass it to an EIP-3074 compatible invoker contract,
30
+ * - use [`verifyAuthMessage`](/experimental/eip3074/verifyAuthMessage) to verify the signature,
31
+ * - use [`recoverAuthMessageAddress`](/experimental/eip3074/recoverAuthMessageAddress) to recover the signing address from a signature.
32
+ *
33
+ * @param client - Client to use
34
+ * @param parameters - {@link SignAuthMessageParameters}
35
+ * @returns The signed auth message. {@link SignAuthMessageReturnType}
36
+ *
37
+ * @example
38
+ * import { createWalletClient, http } from 'viem'
39
+ * import { privateKeyToAccount } from 'viem/accounts'
40
+ * import { mainnet } from 'viem/chains'
41
+ * import { signAuthMessage } from 'viem/experimental'
42
+ *
43
+ * const account = privateKeyToAccount('0x...')
44
+ *
45
+ * const client = createWalletClient({
46
+ * chain: mainnet,
47
+ * transport: http(),
48
+ * })
49
+ *
50
+ * const signature = await signAuthMessage(client, {
51
+ * account,
52
+ * chainId: 1,
53
+ * commit: keccak256('0x1234'),
54
+ * invokerAddress: '0x0000000000000000000000000000000000000000',
55
+ * nonce: 69,
56
+ * })
57
+ *
58
+ * @example
59
+ * // Account Hoisting
60
+ * import { createWalletClient, http } from 'viem'
61
+ * import { privateKeyToAccount } from 'viem/accounts'
62
+ * import { mainnet } from 'viem/chains'
63
+ * import { signAuthMessage } from 'viem/experimental'
64
+ *
65
+ * const client = createWalletClient({
66
+ * account: privateKeyToAccount('0x…'),
67
+ * chain: mainnet,
68
+ * transport: http(),
69
+ * })
70
+ *
71
+ * const signature = await signAuthMessage(client, {
72
+ * chainId: 1,
73
+ * commit: keccak256('0x1234'),
74
+ * invokerAddress: '0x0000000000000000000000000000000000000000',
75
+ * nonce: 69,
76
+ * })
77
+ */
78
+ export async function signAuthMessage<
79
+ chain extends Chain | undefined,
80
+ // TODO: Use `Account` when JSON-RPC method for sign auth message exists.
81
+ account extends Account | undefined,
82
+ >(
83
+ client: Client<Transport, chain, account>,
84
+ {
85
+ // @ts-expect-error – TODO: Remove when JSON-RPC method for sign auth message exists.
86
+ account = client.account,
87
+ chainId,
88
+ commit,
89
+ invokerAddress,
90
+ nonce,
91
+ }: SignAuthMessageParameters<account>,
92
+ ): Promise<SignAuthMessageReturnType> {
93
+ if (!account)
94
+ throw new AccountNotFoundError({
95
+ docsPath: '/experimental/eip5792/signAuthMessage',
96
+ })
97
+ return account.experimental_signAuthMessage({
98
+ chainId,
99
+ commit,
100
+ invokerAddress,
101
+ nonce,
102
+ })
103
+ }