ox 1.7.4 → 1.8.0

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 (237) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/core/AbiEvent.d.ts.map +1 -1
  3. package/dist/core/AbiEvent.js +10 -9
  4. package/dist/core/AbiEvent.js.map +1 -1
  5. package/dist/core/Blobs.d.ts.map +1 -1
  6. package/dist/core/Blobs.js +6 -2
  7. package/dist/core/Blobs.js.map +1 -1
  8. package/dist/core/Frame.d.ts +290 -0
  9. package/dist/core/Frame.d.ts.map +1 -0
  10. package/dist/core/Frame.js +306 -0
  11. package/dist/core/Frame.js.map +1 -0
  12. package/dist/core/FrameReceipt.d.ts +92 -0
  13. package/dist/core/FrameReceipt.d.ts.map +1 -0
  14. package/dist/core/FrameReceipt.js +72 -0
  15. package/dist/core/FrameReceipt.js.map +1 -0
  16. package/dist/core/FrameSignature.d.ts +357 -0
  17. package/dist/core/FrameSignature.d.ts.map +1 -0
  18. package/dist/core/FrameSignature.js +411 -0
  19. package/dist/core/FrameSignature.js.map +1 -0
  20. package/dist/core/Signature.d.ts +6 -5
  21. package/dist/core/Signature.d.ts.map +1 -1
  22. package/dist/core/Signature.js +17 -7
  23. package/dist/core/Signature.js.map +1 -1
  24. package/dist/core/Siwe.d.ts.map +1 -1
  25. package/dist/core/Siwe.js +21 -1
  26. package/dist/core/Siwe.js.map +1 -1
  27. package/dist/core/Transaction.d.ts +29 -4
  28. package/dist/core/Transaction.d.ts.map +1 -1
  29. package/dist/core/Transaction.js +25 -4
  30. package/dist/core/Transaction.js.map +1 -1
  31. package/dist/core/TransactionReceipt.d.ts +13 -4
  32. package/dist/core/TransactionReceipt.d.ts.map +1 -1
  33. package/dist/core/TransactionReceipt.js +14 -0
  34. package/dist/core/TransactionReceipt.js.map +1 -1
  35. package/dist/core/TransactionRequest.d.ts +15 -7
  36. package/dist/core/TransactionRequest.d.ts.map +1 -1
  37. package/dist/core/TransactionRequest.js +47 -1
  38. package/dist/core/TransactionRequest.js.map +1 -1
  39. package/dist/core/TxEnvelope.d.ts +35 -21
  40. package/dist/core/TxEnvelope.d.ts.map +1 -1
  41. package/dist/core/TxEnvelope.js +46 -6
  42. package/dist/core/TxEnvelope.js.map +1 -1
  43. package/dist/core/TxEnvelopeEip8141.d.ts +341 -0
  44. package/dist/core/TxEnvelopeEip8141.d.ts.map +1 -0
  45. package/dist/core/TxEnvelopeEip8141.js +485 -0
  46. package/dist/core/TxEnvelopeEip8141.js.map +1 -0
  47. package/dist/core/internal/curves.d.ts +2 -0
  48. package/dist/core/internal/curves.d.ts.map +1 -1
  49. package/dist/core/internal/curves.js +2 -0
  50. package/dist/core/internal/curves.js.map +1 -1
  51. package/dist/index.d.ts +73 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +73 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/tempo/KeyAuthorization.d.ts +42 -38
  56. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  57. package/dist/tempo/KeyAuthorization.js +24 -4
  58. package/dist/tempo/KeyAuthorization.js.map +1 -1
  59. package/dist/tempo/MultisigConfig.d.ts +18 -15
  60. package/dist/tempo/MultisigConfig.d.ts.map +1 -1
  61. package/dist/tempo/MultisigConfig.js +49 -20
  62. package/dist/tempo/MultisigConfig.js.map +1 -1
  63. package/dist/tempo/MultisigOperation.d.ts +3 -2
  64. package/dist/tempo/MultisigOperation.d.ts.map +1 -1
  65. package/dist/tempo/MultisigOperation.js +20 -100
  66. package/dist/tempo/MultisigOperation.js.map +1 -1
  67. package/dist/tempo/MultisigSimulation.d.ts +2 -49
  68. package/dist/tempo/MultisigSimulation.d.ts.map +1 -1
  69. package/dist/tempo/MultisigSimulation.js +18 -46
  70. package/dist/tempo/MultisigSimulation.js.map +1 -1
  71. package/dist/tempo/SignatureEnvelope.d.ts +72 -140
  72. package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
  73. package/dist/tempo/SignatureEnvelope.js +130 -181
  74. package/dist/tempo/SignatureEnvelope.js.map +1 -1
  75. package/dist/tempo/Transaction.d.ts +2 -0
  76. package/dist/tempo/Transaction.d.ts.map +1 -1
  77. package/dist/tempo/TransactionReceipt.d.ts +2 -0
  78. package/dist/tempo/TransactionReceipt.d.ts.map +1 -1
  79. package/dist/tempo/TransactionRequest.d.ts +4 -2
  80. package/dist/tempo/TransactionRequest.d.ts.map +1 -1
  81. package/dist/tempo/TransactionRequest.js +6 -1
  82. package/dist/tempo/TransactionRequest.js.map +1 -1
  83. package/dist/tempo/index.d.ts +3 -1
  84. package/dist/tempo/index.d.ts.map +1 -1
  85. package/dist/tempo/index.js +3 -1
  86. package/dist/tempo/index.js.map +1 -1
  87. package/dist/zod/Block.d.ts +123 -0
  88. package/dist/zod/Block.d.ts.map +1 -1
  89. package/dist/zod/Frame.d.ts +73 -0
  90. package/dist/zod/Frame.d.ts.map +1 -0
  91. package/dist/zod/Frame.js +74 -0
  92. package/dist/zod/Frame.js.map +1 -0
  93. package/dist/zod/FrameReceipt.d.ts +50 -0
  94. package/dist/zod/FrameReceipt.d.ts.map +1 -0
  95. package/dist/zod/FrameReceipt.js +37 -0
  96. package/dist/zod/FrameReceipt.js.map +1 -0
  97. package/dist/zod/FrameSignature.d.ts +63 -0
  98. package/dist/zod/FrameSignature.d.ts.map +1 -0
  99. package/dist/zod/FrameSignature.js +66 -0
  100. package/dist/zod/FrameSignature.js.map +1 -0
  101. package/dist/zod/RpcSchema.d.ts +806 -11
  102. package/dist/zod/RpcSchema.d.ts.map +1 -1
  103. package/dist/zod/Transaction.d.ts +252 -0
  104. package/dist/zod/Transaction.d.ts.map +1 -1
  105. package/dist/zod/Transaction.js +54 -0
  106. package/dist/zod/Transaction.js.map +1 -1
  107. package/dist/zod/TransactionEnvelope.d.ts +233 -4
  108. package/dist/zod/TransactionEnvelope.d.ts.map +1 -1
  109. package/dist/zod/TransactionEnvelope.js +9 -0
  110. package/dist/zod/TransactionEnvelope.js.map +1 -1
  111. package/dist/zod/TransactionReceipt.d.ts +48 -0
  112. package/dist/zod/TransactionReceipt.d.ts.map +1 -1
  113. package/dist/zod/TransactionReceipt.js +8 -3
  114. package/dist/zod/TransactionReceipt.js.map +1 -1
  115. package/dist/zod/TransactionRequest.d.ts +50 -2
  116. package/dist/zod/TransactionRequest.d.ts.map +1 -1
  117. package/dist/zod/TransactionRequest.js +10 -4
  118. package/dist/zod/TransactionRequest.js.map +1 -1
  119. package/dist/zod/TxEnvelopeEip8141.d.ts +166 -0
  120. package/dist/zod/TxEnvelopeEip8141.d.ts.map +1 -0
  121. package/dist/zod/TxEnvelopeEip8141.js +76 -0
  122. package/dist/zod/TxEnvelopeEip8141.js.map +1 -0
  123. package/dist/zod/internal/Frame.d.ts +4 -0
  124. package/dist/zod/internal/Frame.d.ts.map +1 -0
  125. package/dist/zod/internal/Frame.js +17 -0
  126. package/dist/zod/internal/Frame.js.map +1 -0
  127. package/dist/zod/internal/rpcSchemas/Eth.d.ts +842 -11
  128. package/dist/zod/internal/rpcSchemas/Eth.d.ts.map +1 -1
  129. package/dist/zod/internal/rpcSchemas/Wallet.d.ts +56 -2
  130. package/dist/zod/internal/rpcSchemas/Wallet.d.ts.map +1 -1
  131. package/dist/zod/tempo/AuthorizationTempo.d.ts +350 -10
  132. package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
  133. package/dist/zod/tempo/KeyAuthorization.d.ts +242 -422
  134. package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
  135. package/dist/zod/tempo/KeyAuthorization.js +29 -31
  136. package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
  137. package/dist/zod/tempo/MultisigSimulation.d.ts +8 -76
  138. package/dist/zod/tempo/MultisigSimulation.d.ts.map +1 -1
  139. package/dist/zod/tempo/MultisigSimulation.js +3 -37
  140. package/dist/zod/tempo/MultisigSimulation.js.map +1 -1
  141. package/dist/zod/tempo/RpcSchemaTempo.d.ts +424 -228
  142. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  143. package/dist/zod/tempo/SignatureEnvelope.d.ts +105 -3
  144. package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
  145. package/dist/zod/tempo/SignatureEnvelope.js +21 -9
  146. package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
  147. package/dist/zod/tempo/Transaction.d.ts +783 -432
  148. package/dist/zod/tempo/Transaction.d.ts.map +1 -1
  149. package/dist/zod/tempo/TransactionRequest.d.ts +590 -473
  150. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  151. package/dist/zod/tempo/TransactionRequest.js +8 -0
  152. package/dist/zod/tempo/TransactionRequest.js.map +1 -1
  153. package/dist/zod/tempo/TxEnvelopeTempo.d.ts +327 -213
  154. package/dist/zod/tempo/TxEnvelopeTempo.d.ts.map +1 -1
  155. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +105 -3
  156. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts.map +1 -1
  157. package/dist/zod/z.d.ts +4 -0
  158. package/dist/zod/z.d.ts.map +1 -1
  159. package/dist/zod/z.js +4 -0
  160. package/dist/zod/z.js.map +1 -1
  161. package/package.json +41 -1
  162. package/src/core/AbiEvent.ts +11 -9
  163. package/src/core/Blobs.ts +6 -2
  164. package/src/core/Frame.ts +443 -0
  165. package/src/core/FrameReceipt.ts +117 -0
  166. package/src/core/FrameSignature.ts +593 -0
  167. package/src/core/Signature.ts +41 -11
  168. package/src/core/Siwe.ts +20 -1
  169. package/src/core/Transaction.ts +82 -5
  170. package/src/core/TransactionReceipt.ts +41 -3
  171. package/src/core/TransactionRequest.ts +71 -4
  172. package/src/core/TxEnvelope.ts +159 -90
  173. package/src/core/TxEnvelopeEip8141.ts +715 -0
  174. package/src/core/_test/AbiEvent.test.ts +45 -0
  175. package/src/core/_test/Blobs.test.ts +22 -0
  176. package/src/core/_test/Frame.test-d.ts +96 -0
  177. package/src/core/_test/Frame.test.ts +267 -0
  178. package/src/core/_test/FrameReceipt.test.ts +86 -0
  179. package/src/core/_test/FrameSignature.test-d.ts +93 -0
  180. package/src/core/_test/FrameSignature.test.ts +554 -0
  181. package/src/core/_test/Signature.test.ts +166 -0
  182. package/src/core/_test/Siwe.test.ts +100 -1
  183. package/src/core/_test/Transaction.test.ts +33 -0
  184. package/src/core/_test/TransactionEnvelope.test-d.ts +74 -0
  185. package/src/core/_test/TransactionEnvelope.test.ts +107 -0
  186. package/src/core/_test/TransactionReceipt.test.ts +59 -0
  187. package/src/core/_test/TransactionRequest.test-d.ts +50 -0
  188. package/src/core/_test/TransactionRequest.test.ts +88 -1
  189. package/src/core/_test/TxEnvelopeEip8141.test-d.ts +44 -0
  190. package/src/core/_test/TxEnvelopeEip8141.test.ts +1775 -0
  191. package/src/core/_test/curves.test.ts +6 -1
  192. package/src/core/_test/index.test.ts +4 -0
  193. package/src/core/internal/curves.ts +4 -0
  194. package/src/index.ts +77 -0
  195. package/src/tempo/AuthorizationTempo.test.ts +8 -4
  196. package/src/tempo/KeyAuthorization.test-d.ts +16 -63
  197. package/src/tempo/KeyAuthorization.test.ts +69 -11
  198. package/src/tempo/KeyAuthorization.ts +107 -63
  199. package/src/tempo/MultisigConfig.test.ts +44 -20
  200. package/src/tempo/MultisigConfig.ts +65 -23
  201. package/src/tempo/MultisigOperation.test.ts +79 -550
  202. package/src/tempo/MultisigOperation.ts +31 -146
  203. package/src/tempo/MultisigSimulation.test-d.ts +2 -2
  204. package/src/tempo/MultisigSimulation.test.ts +21 -110
  205. package/src/tempo/MultisigSimulation.ts +25 -99
  206. package/src/tempo/SignatureEnvelope.test-d.ts +29 -47
  207. package/src/tempo/SignatureEnvelope.test.ts +328 -541
  208. package/src/tempo/SignatureEnvelope.ts +196 -291
  209. package/src/tempo/Transaction.test.ts +4 -4
  210. package/src/tempo/TransactionRequest.test.ts +17 -80
  211. package/src/tempo/TransactionRequest.ts +19 -2
  212. package/src/tempo/index.ts +3 -1
  213. package/src/tempo/multisig.e2e.test.ts +321 -860
  214. package/src/version.ts +1 -1
  215. package/src/zod/Frame.ts +82 -0
  216. package/src/zod/FrameReceipt.ts +48 -0
  217. package/src/zod/FrameSignature.ts +78 -0
  218. package/src/zod/Transaction.ts +63 -0
  219. package/src/zod/TransactionEnvelope.ts +33 -0
  220. package/src/zod/TransactionReceipt.ts +14 -3
  221. package/src/zod/TransactionRequest.ts +18 -3
  222. package/src/zod/TxEnvelopeEip8141.ts +102 -0
  223. package/src/zod/_test/Frame.test-d.ts +41 -0
  224. package/src/zod/_test/Frame.test.ts +54 -0
  225. package/src/zod/_test/FrameReceipt.test.ts +75 -0
  226. package/src/zod/_test/FrameSignature.test.ts +94 -0
  227. package/src/zod/_test/TxEnvelopeEip8141.test.ts +116 -0
  228. package/src/zod/internal/Frame.ts +26 -0
  229. package/src/zod/tempo/KeyAuthorization.ts +50 -39
  230. package/src/zod/tempo/MultisigSimulation.ts +3 -48
  231. package/src/zod/tempo/SignatureEnvelope.ts +46 -35
  232. package/src/zod/tempo/TransactionRequest.ts +14 -0
  233. package/src/zod/tempo/_test/KeyAuthorization.test.ts +69 -20
  234. package/src/zod/tempo/_test/MultisigSimulation.test.ts +6 -31
  235. package/src/zod/tempo/_test/SignatureEnvelope.test.ts +118 -85
  236. package/src/zod/tempo/_test/TransactionRequest.test.ts +9 -19
  237. package/src/zod/z.ts +4 -0
@@ -2,7 +2,7 @@ import type * as Address from './Address.js'
2
2
  import * as Errors from './Errors.js'
3
3
  import type * as Hash from './Hash.js'
4
4
  import * as Hex from './Hex.js'
5
- import type { Compute, UnionPartialBy } from './internal/types.js'
5
+ import type { Compute, PartialBy, UnionPartialBy } from './internal/types.js'
6
6
  import type * as Signature from './Signature.js'
7
7
  import * as Transaction from './Transaction.js'
8
8
  import type * as TransactionRequest from './TransactionRequest.js'
@@ -10,6 +10,7 @@ import * as TxEnvelopeEip1559 from './TxEnvelopeEip1559.js'
10
10
  import * as TxEnvelopeEip2930 from './TxEnvelopeEip2930.js'
11
11
  import * as TxEnvelopeEip4844 from './TxEnvelopeEip4844.js'
12
12
  import * as TxEnvelopeEip7702 from './TxEnvelopeEip7702.js'
13
+ import * as TxEnvelopeEip8141 from './TxEnvelopeEip8141.js'
13
14
  import * as TxEnvelopeLegacy from './TxEnvelopeLegacy.js'
14
15
  import * as Value from './Value.js'
15
16
 
@@ -74,7 +75,8 @@ export type TxEnvelope<
74
75
  | TxEnvelopeEip2930.TxEnvelopeEip2930<signed, bigintType, numberType>
75
76
  | TxEnvelopeEip1559.TxEnvelopeEip1559<signed, bigintType, numberType>
76
77
  | TxEnvelopeEip4844.TxEnvelopeEip4844<signed, bigintType, numberType>
77
- | TxEnvelopeEip7702.TxEnvelopeEip7702<signed, bigintType, numberType>,
78
+ | TxEnvelopeEip7702.TxEnvelopeEip7702<signed, bigintType, numberType>
79
+ | TxEnvelopeEip8141.TxEnvelopeEip8141,
78
80
  'type'
79
81
  >
80
82
 
@@ -85,6 +87,7 @@ export type Rpc<signed extends boolean = false> =
85
87
  | TxEnvelopeEip1559.Rpc<signed>
86
88
  | TxEnvelopeEip4844.Rpc<signed>
87
89
  | TxEnvelopeEip7702.Rpc<signed>
90
+ | TxEnvelopeEip8141.Rpc
88
91
 
89
92
  /** Serialized Transaction Envelope. */
90
93
  export type Serialized =
@@ -93,6 +96,7 @@ export type Serialized =
93
96
  | TxEnvelopeEip1559.Serialized
94
97
  | TxEnvelopeEip4844.Serialized
95
98
  | TxEnvelopeEip7702.Serialized
99
+ | TxEnvelopeEip8141.Serialized
96
100
 
97
101
  /** Transaction Envelope type. */
98
102
  export type Type =
@@ -101,6 +105,7 @@ export type Type =
101
105
  | TxEnvelopeEip1559.Type
102
106
  | TxEnvelopeEip4844.Type
103
107
  | TxEnvelopeEip7702.Type
108
+ | TxEnvelopeEip8141.Type
104
109
 
105
110
  type Typeable =
106
111
  | TxEnvelope
@@ -135,6 +140,7 @@ type HasDefined<envelope, key extends string> = envelope extends {
135
140
  */
136
141
  export function assert(envelope: TxEnvelope) {
137
142
  const type = getType(envelope) as Type | string
143
+ if (type === 'eip8141') return TxEnvelopeEip8141.assert(envelope as never)
138
144
  if (type === 'legacy') return TxEnvelopeLegacy.assert(envelope as never)
139
145
  if (type === 'eip2930') return TxEnvelopeEip2930.assert(envelope as never)
140
146
  if (type === 'eip1559') return TxEnvelopeEip1559.assert(envelope as never)
@@ -150,6 +156,7 @@ export declare namespace assert {
150
156
  | TxEnvelopeEip1559.assert.ErrorType
151
157
  | TxEnvelopeEip4844.assert.ErrorType
152
158
  | TxEnvelopeEip7702.assert.ErrorType
159
+ | TxEnvelopeEip8141.assert.ErrorType
153
160
  | InvalidTypeError
154
161
  | Errors.GlobalErrorType
155
162
  }
@@ -173,6 +180,8 @@ export function deserialize<const serialized extends Serialized | Hex.Hex>(
173
180
  serialized: serialized | Serialized | Hex.Hex,
174
181
  ): deserialize.ReturnType<serialized> {
175
182
  const type = getSerializedType(serialized)
183
+ if (type === 'eip8141')
184
+ return TxEnvelopeEip8141.deserialize(serialized as never) as never
176
185
  if (type === 'legacy')
177
186
  return TxEnvelopeLegacy.deserialize(serialized) as never
178
187
  if (type === 'eip2930')
@@ -186,17 +195,19 @@ export function deserialize<const serialized extends Serialized | Hex.Hex>(
186
195
 
187
196
  export declare namespace deserialize {
188
197
  type ReturnType<serialized extends Serialized | Hex.Hex = Serialized> =
189
- serialized extends TxEnvelopeLegacy.Serialized
190
- ? TxEnvelopeLegacy.TxEnvelopeLegacy
191
- : serialized extends TxEnvelopeEip2930.Serialized
192
- ? TxEnvelopeEip2930.TxEnvelopeEip2930
193
- : serialized extends TxEnvelopeEip1559.Serialized
194
- ? TxEnvelopeEip1559.TxEnvelopeEip1559
195
- : serialized extends TxEnvelopeEip4844.Serialized
196
- ? TxEnvelopeEip4844.TxEnvelopeEip4844
197
- : serialized extends TxEnvelopeEip7702.Serialized
198
- ? TxEnvelopeEip7702.TxEnvelopeEip7702
199
- : TxEnvelope
198
+ serialized extends TxEnvelopeEip8141.Serialized
199
+ ? TxEnvelopeEip8141.TxEnvelopeEip8141
200
+ : serialized extends TxEnvelopeLegacy.Serialized
201
+ ? TxEnvelopeLegacy.TxEnvelopeLegacy
202
+ : serialized extends TxEnvelopeEip2930.Serialized
203
+ ? TxEnvelopeEip2930.TxEnvelopeEip2930
204
+ : serialized extends TxEnvelopeEip1559.Serialized
205
+ ? TxEnvelopeEip1559.TxEnvelopeEip1559
206
+ : serialized extends TxEnvelopeEip4844.Serialized
207
+ ? TxEnvelopeEip4844.TxEnvelopeEip4844
208
+ : serialized extends TxEnvelopeEip7702.Serialized
209
+ ? TxEnvelopeEip7702.TxEnvelopeEip7702
210
+ : TxEnvelope
200
211
 
201
212
  type ErrorType =
202
213
  | getSerializedType.ErrorType
@@ -205,6 +216,7 @@ export declare namespace deserialize {
205
216
  | TxEnvelopeEip1559.deserialize.ErrorType
206
217
  | TxEnvelopeEip4844.deserialize.ErrorType
207
218
  | TxEnvelopeEip7702.deserialize.ErrorType
219
+ | TxEnvelopeEip8141.deserialize.ErrorType
208
220
  | Errors.GlobalErrorType
209
221
  }
210
222
 
@@ -222,6 +234,19 @@ export declare namespace deserialize {
222
234
  * })
223
235
  * ```
224
236
  *
237
+ * @example
238
+ * ### Frame Transaction
239
+ *
240
+ * ```ts twoslash
241
+ * import { Frame, TransactionEnvelope } from 'ox'
242
+ *
243
+ * const envelope = TransactionEnvelope.from({
244
+ * chainId: 1,
245
+ * frames: [Frame.from({ gas: 50_000n, mode: 'sender' })],
246
+ * sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
247
+ * })
248
+ * ```
249
+ *
225
250
  * @param envelope - The transaction envelope.
226
251
  * @param options - Options.
227
252
  * @returns Transaction Envelope.
@@ -236,6 +261,8 @@ export function from<
236
261
  if (typeof envelope === 'string') return deserialize(envelope) as never
237
262
 
238
263
  const type = getType(envelope) as Type | string
264
+ if (type === 'eip8141')
265
+ return TxEnvelopeEip8141.from(envelope as never) as never
239
266
  if (type === 'legacy')
240
267
  return TxEnvelopeLegacy.from(envelope as never, options) as never
241
268
  if (type === 'eip2930')
@@ -252,7 +279,7 @@ export function from<
252
279
  export declare namespace from {
253
280
  type Options<signature extends Signature.Signature | undefined = undefined> =
254
281
  {
255
- /** Signature to append to the Transaction Envelope. */
282
+ /** Outer signature to append. EIP-8141 uses the envelope’s `signatures` list. */
256
283
  signature?: signature | Signature.Signature | undefined
257
284
  }
258
285
 
@@ -267,30 +294,34 @@ export declare namespace from {
267
294
  envelope extends Typeable,
268
295
  signature extends Signature.Signature | undefined = undefined,
269
296
  > =
270
- getType.ReturnType<envelope> extends 'legacy'
271
- ? TxEnvelopeLegacy.from.ReturnType<
272
- envelope & TxEnvelopeLegacy.TxEnvelopeLegacy,
273
- signature
274
- >
275
- : getType.ReturnType<envelope> extends 'eip2930'
276
- ? TxEnvelopeEip2930.from.ReturnType<
277
- envelope & TxEnvelopeEip2930.TxEnvelopeEip2930,
297
+ getType.ReturnType<envelope> extends 'eip8141'
298
+ ? envelope extends PartialBy<TxEnvelopeEip8141.TxEnvelopeEip8141, 'type'>
299
+ ? TxEnvelopeEip8141.from.ReturnType<envelope>
300
+ : never
301
+ : getType.ReturnType<envelope> extends 'legacy'
302
+ ? TxEnvelopeLegacy.from.ReturnType<
303
+ envelope & TxEnvelopeLegacy.TxEnvelopeLegacy,
278
304
  signature
279
305
  >
280
- : getType.ReturnType<envelope> extends 'eip4844'
281
- ? TxEnvelopeEip4844.from.ReturnType<
282
- envelope & TxEnvelopeEip4844.TxEnvelopeEip4844,
306
+ : getType.ReturnType<envelope> extends 'eip2930'
307
+ ? TxEnvelopeEip2930.from.ReturnType<
308
+ envelope & TxEnvelopeEip2930.TxEnvelopeEip2930,
283
309
  signature
284
310
  >
285
- : getType.ReturnType<envelope> extends 'eip7702'
286
- ? TxEnvelopeEip7702.from.ReturnType<
287
- envelope & TxEnvelopeEip7702.TxEnvelopeEip7702,
288
- signature
289
- >
290
- : TxEnvelopeEip1559.from.ReturnType<
291
- Omit<envelope, 'type'> & TxEnvelopeEip1559.TxEnvelopeEip1559,
311
+ : getType.ReturnType<envelope> extends 'eip4844'
312
+ ? TxEnvelopeEip4844.from.ReturnType<
313
+ envelope & TxEnvelopeEip4844.TxEnvelopeEip4844,
292
314
  signature
293
315
  >
316
+ : getType.ReturnType<envelope> extends 'eip7702'
317
+ ? TxEnvelopeEip7702.from.ReturnType<
318
+ envelope & TxEnvelopeEip7702.TxEnvelopeEip7702,
319
+ signature
320
+ >
321
+ : TxEnvelopeEip1559.from.ReturnType<
322
+ Omit<envelope, 'type'> & TxEnvelopeEip1559.TxEnvelopeEip1559,
323
+ signature
324
+ >
294
325
 
295
326
  type ErrorType =
296
327
  | deserialize.ErrorType
@@ -299,6 +330,7 @@ export declare namespace from {
299
330
  | TxEnvelopeEip1559.from.ErrorType
300
331
  | TxEnvelopeEip4844.from.ErrorType
301
332
  | TxEnvelopeEip7702.from.ErrorType
333
+ | TxEnvelopeEip8141.from.ErrorType
302
334
  | InvalidTypeError
303
335
  | Errors.GlobalErrorType
304
336
  }
@@ -322,6 +354,8 @@ export declare namespace from {
322
354
  */
323
355
  export function getSignPayload(envelope: TxEnvelope<false>): Hex.Hex {
324
356
  const type = getType(envelope) as Type | string
357
+ if (type === 'eip8141')
358
+ return TxEnvelopeEip8141.getSignPayload(envelope as never)
325
359
  if (type === 'legacy')
326
360
  return TxEnvelopeLegacy.getSignPayload(envelope as never)
327
361
  if (type === 'eip2930')
@@ -344,6 +378,7 @@ export declare namespace getSignPayload {
344
378
  | TxEnvelopeEip1559.getSignPayload.ErrorType
345
379
  | TxEnvelopeEip4844.getSignPayload.ErrorType
346
380
  | TxEnvelopeEip7702.getSignPayload.ErrorType
381
+ | TxEnvelopeEip8141.getSignPayload.ErrorType
347
382
  | InvalidTypeError
348
383
  | Errors.GlobalErrorType
349
384
  }
@@ -369,17 +404,14 @@ export function getType<const envelope extends Typeable>(
369
404
  ): getType.ReturnType<envelope> {
370
405
  const type = envelope.type
371
406
  if (type) {
372
- // Guard against accidental RPC-style type strings that map to a known
373
- // canonical envelope type ('0x0'…'0x4'). Canonical envelopes use
374
- // 'legacy' | 'eip2930' | 'eip1559' | 'eip4844' | 'eip7702'. RPC payloads
375
- // should be normalized through `TransactionRequest.fromRpc` (which
376
- // translates via `Transaction.fromRpcType`) before reaching the envelope
377
- // layer. Other custom `0x*` types (e.g. OP-Stack `0x7e`) pass through.
407
+ // Reject known RPC type strings at the envelope boundary. Custom transaction types still pass through.
378
408
  if (typeof type === 'string' && type in Transaction.fromRpcType)
379
409
  throw new InvalidTypeError({ type })
380
410
  return type as never
381
411
  }
382
412
 
413
+ if ('frames' in envelope && envelope.frames !== undefined)
414
+ return 'eip8141' as never
383
415
  if (
384
416
  'authorizationList' in envelope &&
385
417
  envelope.authorizationList !== undefined
@@ -412,25 +444,27 @@ export declare namespace getType {
412
444
  type: infer type extends string
413
445
  }
414
446
  ? type
415
- : HasDefined<envelope, 'authorizationList'> extends true
416
- ? TxEnvelopeEip7702.Type
417
- : HasDefined<envelope, 'blobs'> extends true
418
- ? TxEnvelopeEip4844.Type
419
- : HasDefined<envelope, 'blobVersionedHashes'> extends true
447
+ : HasDefined<envelope, 'frames'> extends true
448
+ ? TxEnvelopeEip8141.Type
449
+ : HasDefined<envelope, 'authorizationList'> extends true
450
+ ? TxEnvelopeEip7702.Type
451
+ : HasDefined<envelope, 'blobs'> extends true
420
452
  ? TxEnvelopeEip4844.Type
421
- : HasDefined<envelope, 'sidecars'> extends true
453
+ : HasDefined<envelope, 'blobVersionedHashes'> extends true
422
454
  ? TxEnvelopeEip4844.Type
423
- : HasDefined<envelope, 'maxFeePerBlobGas'> extends true
455
+ : HasDefined<envelope, 'sidecars'> extends true
424
456
  ? TxEnvelopeEip4844.Type
425
- : HasDefined<envelope, 'maxFeePerGas'> extends true
426
- ? TxEnvelopeEip1559.Type
427
- : HasDefined<envelope, 'maxPriorityFeePerGas'> extends true
457
+ : HasDefined<envelope, 'maxFeePerBlobGas'> extends true
458
+ ? TxEnvelopeEip4844.Type
459
+ : HasDefined<envelope, 'maxFeePerGas'> extends true
428
460
  ? TxEnvelopeEip1559.Type
429
- : HasDefined<envelope, 'gasPrice'> extends true
430
- ? HasDefined<envelope, 'accessList'> extends true
431
- ? TxEnvelopeEip2930.Type
432
- : TxEnvelopeLegacy.Type
433
- : TxEnvelopeEip1559.Type
461
+ : HasDefined<envelope, 'maxPriorityFeePerGas'> extends true
462
+ ? TxEnvelopeEip1559.Type
463
+ : HasDefined<envelope, 'gasPrice'> extends true
464
+ ? HasDefined<envelope, 'accessList'> extends true
465
+ ? TxEnvelopeEip2930.Type
466
+ : TxEnvelopeLegacy.Type
467
+ : TxEnvelopeEip1559.Type
434
468
 
435
469
  type ErrorType = InvalidTypeError | Errors.GlobalErrorType
436
470
  }
@@ -460,6 +494,8 @@ export function getSerializedType<
460
494
  throw new InvalidSerializedTypeError({ serialized })
461
495
 
462
496
  const serializedType = Hex.slice(serialized, 0, 1)
497
+ if (serializedType === TxEnvelopeEip8141.serializedType)
498
+ return 'eip8141' as never
463
499
  if (serializedType === TxEnvelopeEip2930.serializedType)
464
500
  return 'eip2930' as never
465
501
  if (serializedType === TxEnvelopeEip1559.serializedType)
@@ -474,17 +510,19 @@ export function getSerializedType<
474
510
 
475
511
  export declare namespace getSerializedType {
476
512
  type ReturnType<serialized extends Serialized | Hex.Hex = Serialized> =
477
- serialized extends TxEnvelopeEip2930.Serialized
478
- ? TxEnvelopeEip2930.Type
479
- : serialized extends TxEnvelopeEip1559.Serialized
480
- ? TxEnvelopeEip1559.Type
481
- : serialized extends TxEnvelopeEip4844.Serialized
482
- ? TxEnvelopeEip4844.Type
483
- : serialized extends TxEnvelopeEip7702.Serialized
484
- ? TxEnvelopeEip7702.Type
485
- : serialized extends TxEnvelopeLegacy.Serialized
486
- ? TxEnvelopeLegacy.Type
487
- : Type
513
+ serialized extends TxEnvelopeEip8141.Serialized
514
+ ? TxEnvelopeEip8141.Type
515
+ : serialized extends TxEnvelopeEip2930.Serialized
516
+ ? TxEnvelopeEip2930.Type
517
+ : serialized extends TxEnvelopeEip1559.Serialized
518
+ ? TxEnvelopeEip1559.Type
519
+ : serialized extends TxEnvelopeEip4844.Serialized
520
+ ? TxEnvelopeEip4844.Type
521
+ : serialized extends TxEnvelopeEip7702.Serialized
522
+ ? TxEnvelopeEip7702.Type
523
+ : serialized extends TxEnvelopeLegacy.Serialized
524
+ ? TxEnvelopeLegacy.Type
525
+ : Type
488
526
 
489
527
  type ErrorType =
490
528
  | Hex.size.ErrorType
@@ -520,6 +558,8 @@ export function hash<presign extends boolean = false>(
520
558
  options: hash.Options<presign> = {},
521
559
  ): hash.ReturnType {
522
560
  const type = getType(envelope) as Type | string
561
+ if (type === 'eip8141')
562
+ return TxEnvelopeEip8141.hash(envelope as never, options)
523
563
  if (type === 'legacy')
524
564
  return TxEnvelopeLegacy.hash(envelope as never, options)
525
565
  if (type === 'eip2930')
@@ -571,6 +611,11 @@ export function serialize<const envelope extends Typeable>(
571
611
  options: serialize.Options = {},
572
612
  ): serialize.ReturnType<envelope> {
573
613
  const type = getType(envelope) as Type | string
614
+ if (type === 'eip8141')
615
+ return TxEnvelopeEip8141.serialize({
616
+ ...envelope,
617
+ ...(options.sidecars ? { sidecars: options.sidecars } : {}),
618
+ } as never) as never
574
619
  if (type === 'legacy')
575
620
  return TxEnvelopeLegacy.serialize(envelope as never, options) as never
576
621
  if (type === 'eip2930')
@@ -586,22 +631,24 @@ export function serialize<const envelope extends Typeable>(
586
631
 
587
632
  export declare namespace serialize {
588
633
  type Options = {
589
- /** Signature to append to the serialized Transaction Envelope. */
634
+ /** Outer signature to append. EIP-8141 uses the envelope’s `signatures` list. */
590
635
  signature?: Signature.Signature | undefined
591
636
  /** PeerDAS sidecars to append, producing the 5-element network wrapper. */
592
637
  sidecars?: TxEnvelopeEip4844.Sidecars<Hex.Hex> | undefined
593
638
  }
594
639
 
595
640
  type ReturnType<envelope extends Typeable = TxEnvelope> =
596
- getType.ReturnType<envelope> extends 'legacy'
597
- ? TxEnvelopeLegacy.Serialized
598
- : getType.ReturnType<envelope> extends 'eip2930'
599
- ? TxEnvelopeEip2930.Serialized
600
- : getType.ReturnType<envelope> extends 'eip4844'
601
- ? TxEnvelopeEip4844.Serialized
602
- : getType.ReturnType<envelope> extends 'eip7702'
603
- ? TxEnvelopeEip7702.Serialized
604
- : TxEnvelopeEip1559.Serialized
641
+ getType.ReturnType<envelope> extends 'eip8141'
642
+ ? TxEnvelopeEip8141.Serialized
643
+ : getType.ReturnType<envelope> extends 'legacy'
644
+ ? TxEnvelopeLegacy.Serialized
645
+ : getType.ReturnType<envelope> extends 'eip2930'
646
+ ? TxEnvelopeEip2930.Serialized
647
+ : getType.ReturnType<envelope> extends 'eip4844'
648
+ ? TxEnvelopeEip4844.Serialized
649
+ : getType.ReturnType<envelope> extends 'eip7702'
650
+ ? TxEnvelopeEip7702.Serialized
651
+ : TxEnvelopeEip1559.Serialized
605
652
 
606
653
  type ErrorType =
607
654
  | TxEnvelopeLegacy.serialize.ErrorType
@@ -609,6 +656,7 @@ export declare namespace serialize {
609
656
  | TxEnvelopeEip1559.serialize.ErrorType
610
657
  | TxEnvelopeEip4844.serialize.ErrorType
611
658
  | TxEnvelopeEip7702.serialize.ErrorType
659
+ | TxEnvelopeEip8141.serialize.ErrorType
612
660
  | InvalidTypeError
613
661
  | Errors.GlobalErrorType
614
662
  }
@@ -634,6 +682,8 @@ export function toRpc<const envelope extends toRpc.Input>(
634
682
  envelope: envelope | toRpc.Input,
635
683
  ): toRpc.ReturnType<envelope> {
636
684
  const type = getType(envelope) as Type | string
685
+ if (type === 'eip8141')
686
+ return TxEnvelopeEip8141.toRpc(envelope as never) as never
637
687
  if (type === 'legacy')
638
688
  return TxEnvelopeLegacy.toRpc(envelope as never) as never
639
689
  if (type === 'eip2930')
@@ -649,22 +699,22 @@ export function toRpc<const envelope extends toRpc.Input>(
649
699
 
650
700
  export declare namespace toRpc {
651
701
  /** Numberish input accepted by {@link ox#(TransactionEnvelope:namespace).(toRpc:function)}. */
652
- export type Input = TxEnvelope<
653
- boolean,
654
- Hex.Hex | bigint | number,
655
- Hex.Hex | number
656
- >
702
+ export type Input =
703
+ | TxEnvelope<boolean, Hex.Hex | bigint | number, Hex.Hex | number>
704
+ | TxEnvelopeEip8141.toRpc.Input
657
705
 
658
706
  export type ReturnType<envelope extends Typeable = TxEnvelope> =
659
- getType.ReturnType<envelope> extends 'legacy'
660
- ? TxEnvelopeLegacy.Rpc
661
- : getType.ReturnType<envelope> extends 'eip2930'
662
- ? TxEnvelopeEip2930.Rpc
663
- : getType.ReturnType<envelope> extends 'eip4844'
664
- ? TxEnvelopeEip4844.Rpc
665
- : getType.ReturnType<envelope> extends 'eip7702'
666
- ? TxEnvelopeEip7702.Rpc
667
- : TxEnvelopeEip1559.Rpc
707
+ getType.ReturnType<envelope> extends 'eip8141'
708
+ ? TxEnvelopeEip8141.Rpc
709
+ : getType.ReturnType<envelope> extends 'legacy'
710
+ ? TxEnvelopeLegacy.Rpc
711
+ : getType.ReturnType<envelope> extends 'eip2930'
712
+ ? TxEnvelopeEip2930.Rpc
713
+ : getType.ReturnType<envelope> extends 'eip4844'
714
+ ? TxEnvelopeEip4844.Rpc
715
+ : getType.ReturnType<envelope> extends 'eip7702'
716
+ ? TxEnvelopeEip7702.Rpc
717
+ : TxEnvelopeEip1559.Rpc
668
718
 
669
719
  export type ErrorType =
670
720
  | TxEnvelopeLegacy.toRpc.ErrorType
@@ -672,6 +722,7 @@ export declare namespace toRpc {
672
722
  | TxEnvelopeEip1559.toRpc.ErrorType
673
723
  | TxEnvelopeEip4844.toRpc.ErrorType
674
724
  | TxEnvelopeEip7702.toRpc.ErrorType
725
+ | TxEnvelopeEip8141.toRpc.ErrorType
675
726
  | InvalidTypeError
676
727
  | Errors.GlobalErrorType
677
728
  }
@@ -720,12 +771,26 @@ export declare namespace toRpc {
720
771
  export function toTransactionRequest(
721
772
  envelope: TxEnvelope,
722
773
  ): TransactionRequest.TransactionRequest {
774
+ const type = getType(envelope) as Type | string
775
+ if (type === 'eip8141') {
776
+ const { sender, sidecars, ...rest } =
777
+ envelope as TxEnvelopeEip8141.TxEnvelopeEip8141
778
+ return {
779
+ ...rest,
780
+ ...(sidecars ? { blobs: sidecars.blobs } : {}),
781
+ chainId: Hex.toNumber(Hex.fromNumber(rest.chainId)),
782
+ from: sender,
783
+ }
784
+ }
723
785
  const {
724
786
  // Flatten sidecars; surface their `blobs` payload instead.
725
787
  sidecars,
726
788
  blobs,
727
789
  ...rest
728
- } = envelope as TxEnvelope & {
790
+ } = envelope as Exclude<
791
+ TxEnvelope,
792
+ { type?: TxEnvelopeEip8141.Type | undefined }
793
+ > & {
729
794
  sidecars?: TxEnvelopeEip4844.Sidecars<Hex.Hex> | undefined
730
795
  blobs?: readonly Hex.Hex[] | undefined
731
796
  }
@@ -739,7 +804,11 @@ export function toTransactionRequest(
739
804
  }
740
805
 
741
806
  export declare namespace toTransactionRequest {
742
- type ErrorType = Errors.GlobalErrorType
807
+ type ErrorType =
808
+ | getType.ErrorType
809
+ | Hex.fromNumber.ErrorType
810
+ | Hex.toNumber.ErrorType
811
+ | Errors.GlobalErrorType
743
812
  }
744
813
 
745
814
  /**