ox 1.7.5 → 1.8.1

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 (139) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/Frame.d.ts +290 -0
  3. package/dist/core/Frame.d.ts.map +1 -0
  4. package/dist/core/Frame.js +306 -0
  5. package/dist/core/Frame.js.map +1 -0
  6. package/dist/core/FrameReceipt.d.ts +92 -0
  7. package/dist/core/FrameReceipt.d.ts.map +1 -0
  8. package/dist/core/FrameReceipt.js +72 -0
  9. package/dist/core/FrameReceipt.js.map +1 -0
  10. package/dist/core/FrameSignature.d.ts +357 -0
  11. package/dist/core/FrameSignature.d.ts.map +1 -0
  12. package/dist/core/FrameSignature.js +411 -0
  13. package/dist/core/FrameSignature.js.map +1 -0
  14. package/dist/core/Transaction.d.ts +29 -4
  15. package/dist/core/Transaction.d.ts.map +1 -1
  16. package/dist/core/Transaction.js +25 -4
  17. package/dist/core/Transaction.js.map +1 -1
  18. package/dist/core/TransactionReceipt.d.ts +13 -4
  19. package/dist/core/TransactionReceipt.d.ts.map +1 -1
  20. package/dist/core/TransactionReceipt.js +14 -0
  21. package/dist/core/TransactionReceipt.js.map +1 -1
  22. package/dist/core/TransactionRequest.d.ts +15 -7
  23. package/dist/core/TransactionRequest.d.ts.map +1 -1
  24. package/dist/core/TransactionRequest.js +47 -1
  25. package/dist/core/TransactionRequest.js.map +1 -1
  26. package/dist/core/TxEnvelope.d.ts +35 -21
  27. package/dist/core/TxEnvelope.d.ts.map +1 -1
  28. package/dist/core/TxEnvelope.js +46 -6
  29. package/dist/core/TxEnvelope.js.map +1 -1
  30. package/dist/core/TxEnvelopeEip8141.d.ts +341 -0
  31. package/dist/core/TxEnvelopeEip8141.d.ts.map +1 -0
  32. package/dist/core/TxEnvelopeEip8141.js +484 -0
  33. package/dist/core/TxEnvelopeEip8141.js.map +1 -0
  34. package/dist/core/internal/curves.d.ts +2 -0
  35. package/dist/core/internal/curves.d.ts.map +1 -1
  36. package/dist/core/internal/curves.js +2 -0
  37. package/dist/core/internal/curves.js.map +1 -1
  38. package/dist/index.d.ts +73 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +73 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/tempo/Transaction.d.ts +2 -0
  43. package/dist/tempo/Transaction.d.ts.map +1 -1
  44. package/dist/tempo/TransactionReceipt.d.ts +2 -0
  45. package/dist/tempo/TransactionReceipt.d.ts.map +1 -1
  46. package/dist/zod/Block.d.ts +123 -0
  47. package/dist/zod/Block.d.ts.map +1 -1
  48. package/dist/zod/Frame.d.ts +73 -0
  49. package/dist/zod/Frame.d.ts.map +1 -0
  50. package/dist/zod/Frame.js +74 -0
  51. package/dist/zod/Frame.js.map +1 -0
  52. package/dist/zod/FrameReceipt.d.ts +50 -0
  53. package/dist/zod/FrameReceipt.d.ts.map +1 -0
  54. package/dist/zod/FrameReceipt.js +37 -0
  55. package/dist/zod/FrameReceipt.js.map +1 -0
  56. package/dist/zod/FrameSignature.d.ts +63 -0
  57. package/dist/zod/FrameSignature.d.ts.map +1 -0
  58. package/dist/zod/FrameSignature.js +66 -0
  59. package/dist/zod/FrameSignature.js.map +1 -0
  60. package/dist/zod/RpcSchema.d.ts +806 -11
  61. package/dist/zod/RpcSchema.d.ts.map +1 -1
  62. package/dist/zod/Transaction.d.ts +252 -0
  63. package/dist/zod/Transaction.d.ts.map +1 -1
  64. package/dist/zod/Transaction.js +54 -0
  65. package/dist/zod/Transaction.js.map +1 -1
  66. package/dist/zod/TransactionEnvelope.d.ts +233 -4
  67. package/dist/zod/TransactionEnvelope.d.ts.map +1 -1
  68. package/dist/zod/TransactionEnvelope.js +9 -0
  69. package/dist/zod/TransactionEnvelope.js.map +1 -1
  70. package/dist/zod/TransactionReceipt.d.ts +48 -0
  71. package/dist/zod/TransactionReceipt.d.ts.map +1 -1
  72. package/dist/zod/TransactionReceipt.js +8 -3
  73. package/dist/zod/TransactionReceipt.js.map +1 -1
  74. package/dist/zod/TransactionRequest.d.ts +50 -2
  75. package/dist/zod/TransactionRequest.d.ts.map +1 -1
  76. package/dist/zod/TransactionRequest.js +10 -4
  77. package/dist/zod/TransactionRequest.js.map +1 -1
  78. package/dist/zod/TxEnvelopeEip8141.d.ts +166 -0
  79. package/dist/zod/TxEnvelopeEip8141.d.ts.map +1 -0
  80. package/dist/zod/TxEnvelopeEip8141.js +76 -0
  81. package/dist/zod/TxEnvelopeEip8141.js.map +1 -0
  82. package/dist/zod/internal/Frame.d.ts +4 -0
  83. package/dist/zod/internal/Frame.d.ts.map +1 -0
  84. package/dist/zod/internal/Frame.js +17 -0
  85. package/dist/zod/internal/Frame.js.map +1 -0
  86. package/dist/zod/internal/rpcSchemas/Eth.d.ts +842 -11
  87. package/dist/zod/internal/rpcSchemas/Eth.d.ts.map +1 -1
  88. package/dist/zod/internal/rpcSchemas/Wallet.d.ts +56 -2
  89. package/dist/zod/internal/rpcSchemas/Wallet.d.ts.map +1 -1
  90. package/dist/zod/tempo/RpcSchemaTempo.d.ts +140 -0
  91. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  92. package/dist/zod/tempo/Transaction.d.ts +123 -0
  93. package/dist/zod/tempo/Transaction.d.ts.map +1 -1
  94. package/dist/zod/z.d.ts +4 -0
  95. package/dist/zod/z.d.ts.map +1 -1
  96. package/dist/zod/z.js +4 -0
  97. package/dist/zod/z.js.map +1 -1
  98. package/package.json +41 -1
  99. package/src/core/Frame.ts +442 -0
  100. package/src/core/FrameReceipt.ts +117 -0
  101. package/src/core/FrameSignature.ts +593 -0
  102. package/src/core/Transaction.ts +82 -5
  103. package/src/core/TransactionReceipt.ts +41 -3
  104. package/src/core/TransactionRequest.ts +71 -4
  105. package/src/core/TxEnvelope.ts +159 -90
  106. package/src/core/TxEnvelopeEip8141.ts +714 -0
  107. package/src/core/_test/Frame.test-d.ts +108 -0
  108. package/src/core/_test/Frame.test.ts +280 -0
  109. package/src/core/_test/FrameReceipt.test.ts +86 -0
  110. package/src/core/_test/FrameSignature.test-d.ts +93 -0
  111. package/src/core/_test/FrameSignature.test.ts +554 -0
  112. package/src/core/_test/Transaction.test.ts +33 -0
  113. package/src/core/_test/TransactionEnvelope.test-d.ts +74 -0
  114. package/src/core/_test/TransactionEnvelope.test.ts +107 -0
  115. package/src/core/_test/TransactionReceipt.test.ts +59 -0
  116. package/src/core/_test/TransactionRequest.test-d.ts +50 -0
  117. package/src/core/_test/TransactionRequest.test.ts +88 -1
  118. package/src/core/_test/TxEnvelopeEip8141.test-d.ts +44 -0
  119. package/src/core/_test/TxEnvelopeEip8141.test.ts +1775 -0
  120. package/src/core/_test/curves.test.ts +6 -1
  121. package/src/core/_test/index.test.ts +4 -0
  122. package/src/core/internal/curves.ts +4 -0
  123. package/src/index.ts +77 -0
  124. package/src/version.ts +1 -1
  125. package/src/zod/Frame.ts +82 -0
  126. package/src/zod/FrameReceipt.ts +48 -0
  127. package/src/zod/FrameSignature.ts +78 -0
  128. package/src/zod/Transaction.ts +63 -0
  129. package/src/zod/TransactionEnvelope.ts +33 -0
  130. package/src/zod/TransactionReceipt.ts +14 -3
  131. package/src/zod/TransactionRequest.ts +18 -3
  132. package/src/zod/TxEnvelopeEip8141.ts +102 -0
  133. package/src/zod/_test/Frame.test-d.ts +41 -0
  134. package/src/zod/_test/Frame.test.ts +57 -0
  135. package/src/zod/_test/FrameReceipt.test.ts +75 -0
  136. package/src/zod/_test/FrameSignature.test.ts +94 -0
  137. package/src/zod/_test/TxEnvelopeEip8141.test.ts +116 -0
  138. package/src/zod/internal/Frame.ts +26 -0
  139. package/src/zod/z.ts +4 -0
@@ -2,6 +2,8 @@ import type * as AccessList from './AccessList.js'
2
2
  import type * as Address from './Address.js'
3
3
  import * as Authorization from './Authorization.js'
4
4
  import type * as Errors from './Errors.js'
5
+ import * as Frame from './Frame.js'
6
+ import * as FrameSignature from './FrameSignature.js'
5
7
  import * as Hex from './Hex.js'
6
8
  import * as Quantity from './internal/quantity.js'
7
9
  import type { Compute, OneOf, UnionCompute } from './internal/types.js'
@@ -21,6 +23,7 @@ export type Transaction<
21
23
  | Eip2930<pending, bigintType, numberType>
22
24
  | Eip4844<pending, bigintType, numberType>
23
25
  | Eip7702<pending, bigintType, numberType>
26
+ | Eip8141<pending, bigintType, numberType>
24
27
  | (Base & { type: Hex.Hex })
25
28
  >
26
29
  >
@@ -35,6 +38,7 @@ export type Rpc<pending extends boolean = false> = UnionCompute<
35
38
  | Eip2930Rpc<pending>
36
39
  | Eip4844Rpc<pending>
37
40
  | Eip7702Rpc<pending>
41
+ | Eip8141Rpc<pending>
38
42
  | (BaseRpc & { type: Hex.Hex })
39
43
  >
40
44
  >
@@ -184,6 +188,48 @@ export type Eip7702Rpc<pending extends boolean = false> = Compute<
184
188
  Eip7702<pending, Hex.Hex, Hex.Hex, ToRpcType['eip7702']>
185
189
  >
186
190
 
191
+ /** An EIP-8141 frame transaction. */
192
+ export type Eip8141<
193
+ pending extends boolean = false,
194
+ bigintType = bigint,
195
+ numberType = number,
196
+ type extends string = 'eip8141',
197
+ > = Compute<
198
+ Omit<
199
+ Base<type, pending, bigintType, numberType>,
200
+ 'chainId' | 'r' | 's' | 'v' | 'yParity'
201
+ > & {
202
+ /** Versioned blob hashes. */
203
+ blobVersionedHashes: readonly Hex.Hex[]
204
+ /** Chain ID, retaining bigint precision when needed. */
205
+ chainId: numberType | bigintType
206
+ /** Frames in execution order. */
207
+ frames: readonly ([bigintType] extends [Hex.Hex]
208
+ ? Frame.Rpc
209
+ : Frame.Frame<bigintType>)[]
210
+ /** Effective gas price. */
211
+ gasPrice?: bigintType | undefined
212
+ /** Maximum fee per blob gas. */
213
+ maxFeePerBlobGas: bigintType
214
+ /** Maximum fee per gas. */
215
+ maxFeePerGas: bigintType
216
+ /** Maximum priority fee per gas. */
217
+ maxPriorityFeePerGas: bigintType
218
+ /** Frame signature entries. */
219
+ signatures: readonly ([bigintType] extends [Hex.Hex]
220
+ ? FrameSignature.Rpc
221
+ : FrameSignature.FrameSignature)[]
222
+ }
223
+ >
224
+
225
+ /** An EIP-8141 RPC transaction. */
226
+ export type Eip8141Rpc<pending extends boolean = false> = Eip8141<
227
+ pending,
228
+ Hex.Hex,
229
+ Hex.Hex,
230
+ '0x6'
231
+ >
232
+
187
233
  /** An legacy Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml). */
188
234
  export type Legacy<
189
235
  pending extends boolean = false,
@@ -217,6 +263,7 @@ export const toRpcType = {
217
263
  eip1559: '0x2',
218
264
  eip4844: '0x3',
219
265
  eip7702: '0x4',
266
+ eip8141: '0x6',
220
267
  } as const
221
268
 
222
269
  /** Type to RPC Type mapping. */
@@ -231,6 +278,7 @@ export const fromRpcType = {
231
278
  '0x2': 'eip1559',
232
279
  '0x3': 'eip4844',
233
280
  '0x4': 'eip7702',
281
+ '0x6': 'eip8141',
234
282
  } as const
235
283
 
236
284
  /** RPC Type to Type mapping. */
@@ -282,7 +330,8 @@ export function fromRpc<
282
330
  ): transaction extends Rpc<pending> ? Transaction<pending> : null {
283
331
  if (!transaction) return null as never
284
332
 
285
- const signature = Signature.extract(transaction)
333
+ const signature =
334
+ transaction.type === '0x6' ? undefined : Signature.extract(transaction)
286
335
 
287
336
  const transaction_ = {
288
337
  ...transaction,
@@ -310,7 +359,23 @@ export function fromRpc<
310
359
  transaction_.authorizationList = Authorization.fromRpcList(
311
360
  transaction.authorizationList,
312
361
  )
313
- if (transaction.chainId) transaction_.chainId = Number(transaction.chainId)
362
+ if (transaction.chainId) {
363
+ const chainId = BigInt(transaction.chainId)
364
+ transaction_.chainId =
365
+ transaction.type === '0x6' && chainId > BigInt(Number.MAX_SAFE_INTEGER)
366
+ ? chainId
367
+ : Number(chainId)
368
+ }
369
+ if (transaction.type === '0x6' && transaction.frames) {
370
+ transaction_.frames = transaction.frames.map(Frame.fromRpc)
371
+ transaction_.signatures = (transaction.signatures ?? []).map(
372
+ FrameSignature.fromRpc,
373
+ )
374
+ delete transaction_.r
375
+ delete transaction_.s
376
+ delete transaction_.v
377
+ delete transaction_.yParity
378
+ }
314
379
  if (transaction.gasPrice) transaction_.gasPrice = BigInt(transaction.gasPrice)
315
380
  if (transaction.maxFeePerBlobGas)
316
381
  transaction_.maxFeePerBlobGas = BigInt(transaction.maxFeePerBlobGas)
@@ -335,7 +400,11 @@ export declare namespace fromRpc {
335
400
  pending?: pending | boolean | undefined
336
401
  }
337
402
 
338
- type ErrorType = Signature.extract.ErrorType | Errors.GlobalErrorType
403
+ type ErrorType =
404
+ | Signature.extract.ErrorType
405
+ | Frame.fromRpc.ErrorType
406
+ | FrameSignature.fromRpc.ErrorType
407
+ | Errors.GlobalErrorType
339
408
  }
340
409
 
341
410
  /**
@@ -400,6 +469,10 @@ export function toRpc<pending extends boolean = false>(
400
469
  rpc.type = (toRpcType as any)[transaction.type] ?? transaction.type
401
470
  rpc.value = Quantity.fromNumberish(transaction.value ?? 0n)
402
471
 
472
+ if (transaction.type === 'eip8141' && transaction.frames) {
473
+ rpc.frames = transaction.frames.map(Frame.toRpc)
474
+ rpc.signatures = transaction.signatures.map(FrameSignature.toRpc)
475
+ }
403
476
  if (transaction.accessList) rpc.accessList = transaction.accessList
404
477
  if (transaction.authorizationList)
405
478
  rpc.authorizationList = Authorization.toRpcList(
@@ -407,7 +480,7 @@ export function toRpc<pending extends boolean = false>(
407
480
  )
408
481
  if (transaction.blobVersionedHashes)
409
482
  rpc.blobVersionedHashes = transaction.blobVersionedHashes
410
- if (transaction.chainId)
483
+ if (transaction.chainId !== undefined)
411
484
  rpc.chainId = Quantity.fromNumberish(transaction.chainId)
412
485
  if (transaction.gasPrice !== undefined)
413
486
  rpc.gasPrice = Quantity.fromNumberish(transaction.gasPrice)
@@ -441,5 +514,9 @@ export declare namespace toRpc {
441
514
  pending?: pending | boolean | undefined
442
515
  }
443
516
 
444
- type ErrorType = Signature.extract.ErrorType | Errors.GlobalErrorType
517
+ type ErrorType =
518
+ | Signature.extract.ErrorType
519
+ | Frame.toRpc.ErrorType
520
+ | FrameSignature.toRpc.ErrorType
521
+ | Errors.GlobalErrorType
445
522
  }
@@ -1,5 +1,6 @@
1
1
  import type * as Address from './Address.js'
2
2
  import type * as Errors from './Errors.js'
3
+ import * as FrameReceipt from './FrameReceipt.js'
3
4
  import * as Hex from './Hex.js'
4
5
  import * as Quantity from './internal/quantity.js'
5
6
  import type { Compute } from './internal/types.js'
@@ -26,6 +27,12 @@ export type TransactionReceipt<
26
27
  cumulativeGasUsed: bigintType
27
28
  /** Pre-London, it is equal to the transaction's gasPrice. Post-London, it is equal to the actual gas price paid for inclusion. */
28
29
  effectiveGasPrice: bigintType
30
+ /** Receipts for each EIP-8141 frame, in execution order. */
31
+ frameReceipts?:
32
+ | readonly ([bigintType] extends [Hex.Hex]
33
+ ? FrameReceipt.Rpc
34
+ : FrameReceipt.FrameReceipt<bigintType>)[]
35
+ | undefined
29
36
  /** Transaction sender */
30
37
  from: Address.Address
31
38
  /** Gas used by this transaction */
@@ -34,6 +41,8 @@ export type TransactionReceipt<
34
41
  logs: Log.Log<false, bigintType, numberType>[]
35
42
  /** Logs bloom filter */
36
43
  logsBloom: Hex.Hex
44
+ /** Account that paid the transaction fees. */
45
+ payer?: Address.Address | undefined
37
46
  /** The post-transaction state root. Only specified for transactions included before the Byzantium upgrade. */
38
47
  root?: Hex.Hex | undefined
39
48
  /** `success` if this transaction was successful or `reverted` if it failed */
@@ -75,6 +84,7 @@ export type RpcStatus = '0x0' | '0x1'
75
84
  * - `eip2930`
76
85
  * - `eip4844`
77
86
  * - `eip7702`
87
+ * - `eip8141`
78
88
  * - any other string
79
89
  */
80
90
  export type Type =
@@ -83,6 +93,7 @@ export type Type =
83
93
  | 'eip2930'
84
94
  | 'eip4844'
85
95
  | 'eip7702'
96
+ | 'eip8141'
86
97
  | (string & {})
87
98
 
88
99
  /**
@@ -93,9 +104,17 @@ export type Type =
93
104
  * - `0x2`: EIP-2930 transactions
94
105
  * - `0x3`: EIP-4844 transactions
95
106
  * - `0x4`: EIP-7702 transactions
107
+ * - `0x6`: EIP-8141 transactions
96
108
  * - any other string
97
109
  */
98
- export type RpcType = '0x0' | '0x1' | '0x2' | '0x3' | '0x4' | (string & {})
110
+ export type RpcType =
111
+ | '0x0'
112
+ | '0x1'
113
+ | '0x2'
114
+ | '0x3'
115
+ | '0x4'
116
+ | '0x6'
117
+ | (string & {})
99
118
 
100
119
  /** RPC status to status mapping. */
101
120
  export const fromRpcStatus = {
@@ -116,6 +135,7 @@ export const fromRpcType = {
116
135
  '0x2': 'eip1559',
117
136
  '0x3': 'eip4844',
118
137
  '0x4': 'eip7702',
138
+ '0x6': 'eip8141',
119
139
  } as const
120
140
 
121
141
  /** Type to RPC type mapping. */
@@ -125,6 +145,7 @@ export const toRpcType = {
125
145
  eip1559: '0x2',
126
146
  eip4844: '0x3',
127
147
  eip7702: '0x4',
148
+ eip8141: '0x6',
128
149
  } as const
129
150
 
130
151
  /**
@@ -231,6 +252,11 @@ export function fromRpc<const receipt extends Rpc | null>(
231
252
 
232
253
  return {
233
254
  ...receipt,
255
+ ...(receipt.frameReceipts
256
+ ? {
257
+ frameReceipts: receipt.frameReceipts.map(FrameReceipt.fromRpc),
258
+ }
259
+ : {}),
234
260
  blobGasPrice: receipt.blobGasPrice
235
261
  ? BigInt(receipt.blobGasPrice)
236
262
  : undefined,
@@ -247,7 +273,10 @@ export function fromRpc<const receipt extends Rpc | null>(
247
273
  }
248
274
 
249
275
  export declare namespace fromRpc {
250
- export type ErrorType = Log.fromRpc.ErrorType | Errors.GlobalErrorType
276
+ export type ErrorType =
277
+ | Log.fromRpc.ErrorType
278
+ | FrameReceipt.fromRpc.ErrorType
279
+ | Errors.GlobalErrorType
251
280
  }
252
281
 
253
282
  /**
@@ -316,10 +345,16 @@ export function toRpc(receipt: toRpc.Input): Rpc {
316
345
  contractAddress: receipt.contractAddress,
317
346
  cumulativeGasUsed: Quantity.fromNumberish(receipt.cumulativeGasUsed),
318
347
  effectiveGasPrice: Quantity.fromNumberish(receipt.effectiveGasPrice),
348
+ ...(receipt.frameReceipts
349
+ ? {
350
+ frameReceipts: receipt.frameReceipts.map(FrameReceipt.toRpc),
351
+ }
352
+ : {}),
319
353
  from: receipt.from,
320
354
  gasUsed: Quantity.fromNumberish(receipt.gasUsed),
321
355
  logs: receipt.logs.map(Log.toRpc as never),
322
356
  logsBloom: receipt.logsBloom,
357
+ ...(receipt.payer === undefined ? {} : { payer: receipt.payer }),
323
358
  root: receipt.root,
324
359
  status: toRpcStatus[receipt.status],
325
360
  to: receipt.to,
@@ -338,5 +373,8 @@ export declare namespace toRpc {
338
373
  Hex.Hex | number
339
374
  >
340
375
 
341
- export type ErrorType = Hex.fromNumber.ErrorType | Errors.GlobalErrorType
376
+ export type ErrorType =
377
+ | Hex.fromNumber.ErrorType
378
+ | FrameReceipt.toRpc.ErrorType
379
+ | Errors.GlobalErrorType
342
380
  }
@@ -3,12 +3,15 @@ import type * as Address from './Address.js'
3
3
  import * as Authorization from './Authorization.js'
4
4
  import * as Blobs from './Blobs.js'
5
5
  import * as Errors from './Errors.js'
6
+ import * as Frame from './Frame.js'
7
+ import * as FrameSignature from './FrameSignature.js'
6
8
  import * as Hex from './Hex.js'
7
9
  import * as Quantity from './internal/quantity.js'
8
10
  import type { Compute } from './internal/types.js'
9
11
  import type * as Kzg from './Kzg.js'
10
12
  import * as Transaction from './Transaction.js'
11
13
  import * as TxEnvelope from './TxEnvelope.js'
14
+ import * as TxEnvelopeEip8141 from './TxEnvelopeEip8141.js'
12
15
  import type * as TxEnvelopeEip4844 from './TxEnvelopeEip4844.js'
13
16
 
14
17
  /** A Transaction Request that is generic to all transaction types, as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/4aca1d7a3e5aab24c8f6437131289ad386944eaa/src/schemas/transaction.yaml#L358-L423). */
@@ -16,6 +19,10 @@ export type TransactionRequest<
16
19
  bigintType = bigint,
17
20
  numberType = number,
18
21
  type extends string = string,
22
+ frame = [bigintType] extends [Hex.Hex] ? Frame.Rpc : Frame.Frame<bigintType>,
23
+ signature = [bigintType] extends [Hex.Hex]
24
+ ? FrameSignature.Rpc
25
+ : FrameSignature.FrameSignature,
19
26
  > = Compute<{
20
27
  /** EIP-2930 Access List. */
21
28
  accessList?: AccessList.AccessList | undefined
@@ -31,14 +38,16 @@ export type TransactionRequest<
31
38
  chainId?: numberType | undefined
32
39
  /** Contract code or a hashed method call with encoded args */
33
40
  data?: Hex.Hex | undefined
34
- /** @alias `data` – added for TransactionEnvelope - Transaction compatibility. */
35
- input?: Hex.Hex | undefined
41
+ /** Frames in execution order for EIP-8141 transactions. */
42
+ frames?: readonly frame[] | undefined
36
43
  /** Sender of the transaction. */
37
44
  from?: Address.Address | undefined
38
45
  /** Gas provided for transaction execution */
39
46
  gas?: bigintType | undefined
40
47
  /** Base fee per gas. */
41
48
  gasPrice?: bigintType | undefined
49
+ /** @alias `data` – added for TransactionEnvelope - Transaction compatibility. */
50
+ input?: Hex.Hex | undefined
42
51
  /** Maximum total fee per gas sender is willing to pay for blob gas (in wei). */
43
52
  maxFeePerBlobGas?: bigintType | undefined
44
53
  /** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
@@ -47,6 +56,8 @@ export type TransactionRequest<
47
56
  maxPriorityFeePerGas?: bigintType | undefined
48
57
  /** Unique number identifying this transaction */
49
58
  nonce?: bigintType | undefined
59
+ /** Frame signature entries for EIP-8141 transactions. */
60
+ signatures?: readonly signature[] | undefined
50
61
  /** Transaction recipient */
51
62
  to?: Address.Address | null | undefined
52
63
  /** Transaction type */
@@ -64,7 +75,13 @@ export type TransactionRequest<
64
75
  }>
65
76
 
66
77
  /** RPC representation of a {@link ox#TransactionRequest.TransactionRequest}. */
67
- export type Rpc = TransactionRequest<Hex.Hex, Hex.Hex, string>
78
+ export type Rpc = TransactionRequest<
79
+ Hex.Hex,
80
+ Hex.Hex,
81
+ string,
82
+ Frame.Rpc,
83
+ FrameSignature.Rpc
84
+ >
68
85
 
69
86
  /**
70
87
  * Converts a {@link ox#TransactionRequest.Rpc} to a {@link ox#TransactionRequest.TransactionRequest}.
@@ -91,6 +108,10 @@ export function fromRpc(request: Rpc): TransactionRequest {
91
108
  )
92
109
  if (typeof request.chainId !== 'undefined')
93
110
  request_.chainId = Hex.toNumber(request.chainId)
111
+ if (request.frames !== undefined)
112
+ request_.frames = request.frames.map(Frame.fromRpc)
113
+ if (request.signatures !== undefined)
114
+ request_.signatures = request.signatures.map(FrameSignature.fromRpc)
94
115
  if (typeof request.gas !== 'undefined')
95
116
  request_.gas = Hex.toBigInt(request.gas)
96
117
  if (typeof request.gasPrice !== 'undefined')
@@ -120,6 +141,8 @@ export function fromRpc(request: Rpc): TransactionRequest {
120
141
  export declare namespace fromRpc {
121
142
  export type ErrorType =
122
143
  | Authorization.fromRpcList.ErrorType
144
+ | Frame.fromRpc.ErrorType
145
+ | FrameSignature.fromRpc.ErrorType
123
146
  | Hex.toNumber.ErrorType
124
147
  | Hex.toBigInt.ErrorType
125
148
  | Errors.GlobalErrorType
@@ -186,6 +209,10 @@ export function toRpc(request: toRpc.Input): Rpc {
186
209
  request_rpc.data = request.input
187
210
  request_rpc.input = request.input
188
211
  }
212
+ if (request.frames !== undefined)
213
+ request_rpc.frames = request.frames.map(Frame.toRpc)
214
+ if (request.signatures !== undefined)
215
+ request_rpc.signatures = request.signatures.map(FrameSignature.toRpc)
189
216
  if (typeof request.from !== 'undefined') request_rpc.from = request.from
190
217
  if (typeof request.gas !== 'undefined')
191
218
  request_rpc.gas = Quantity.fromNumberish(request.gas)
@@ -231,6 +258,8 @@ export declare namespace toRpc {
231
258
 
232
259
  export type ErrorType =
233
260
  | Authorization.toRpcList.ErrorType
261
+ | Frame.toRpc.ErrorType
262
+ | FrameSignature.toRpc.ErrorType
234
263
  | Hex.fromNumber.ErrorType
235
264
  | Errors.GlobalErrorType
236
265
  }
@@ -305,7 +334,7 @@ export function toEnvelope(
305
334
  : {}),
306
335
  }) as never
307
336
 
308
- if (type === 'eip4844') {
337
+ if (type === 'eip4844' || type === 'eip8141') {
309
338
  const { kzg } = options
310
339
  const blobs = request.blobs
311
340
  const hasSidecars =
@@ -331,6 +360,10 @@ export function toEnvelope(
331
360
  })()
332
361
 
333
362
  const blobVersionedHashes = (() => {
363
+ if (type === 'eip8141' && sidecars)
364
+ return Blobs.commitmentsToVersionedHashes(sidecars.commitments, {
365
+ as: 'Hex',
366
+ })
334
367
  if (request.blobVersionedHashes) return request.blobVersionedHashes
335
368
  if (sidecars) {
336
369
  if (!kzg) throw new MissingKzgError()
@@ -341,6 +374,38 @@ export function toEnvelope(
341
374
  return []
342
375
  })()
343
376
 
377
+ if (type === 'eip8141') {
378
+ if (request.chainId === undefined)
379
+ throw new Quantity.MissingFieldError({
380
+ container: 'TransactionRequest',
381
+ field: 'chainId',
382
+ })
383
+ if (request.frames === undefined)
384
+ throw new Quantity.MissingFieldError({
385
+ container: 'TransactionRequest',
386
+ field: 'frames',
387
+ })
388
+ if (request.from === undefined)
389
+ throw new Quantity.MissingFieldError({
390
+ container: 'TransactionRequest',
391
+ field: 'from',
392
+ })
393
+ return TxEnvelopeEip8141.from({
394
+ ...(request.blobVersionedHashes || sidecars
395
+ ? { blobVersionedHashes }
396
+ : {}),
397
+ chainId: request.chainId,
398
+ frames: request.frames,
399
+ maxFeePerBlobGas: request.maxFeePerBlobGas,
400
+ maxFeePerGas: request.maxFeePerGas,
401
+ maxPriorityFeePerGas: request.maxPriorityFeePerGas,
402
+ nonce: request.nonce,
403
+ sender: request.from,
404
+ sidecars,
405
+ signatures: request.signatures,
406
+ })
407
+ }
408
+
344
409
  return TxEnvelope.from({
345
410
  type: 'eip4844',
346
411
  ...pickBase(request),
@@ -411,6 +476,8 @@ export declare namespace toEnvelope {
411
476
  type ErrorType =
412
477
  | TxEnvelope.getType.ErrorType
413
478
  | TxEnvelope.from.ErrorType
479
+ | Quantity.MissingFieldError
480
+ | TxEnvelopeEip8141.from.ErrorType
414
481
  | Blobs.toCommitments.ErrorType
415
482
  | Blobs.toCellProofs.ErrorType
416
483
  | Blobs.commitmentsToVersionedHashes.ErrorType