ox 0.14.45 → 0.14.47
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.
- package/CHANGELOG.md +16 -0
- package/Frame/package.json +6 -0
- package/FrameReceipt/package.json +6 -0
- package/FrameSignature/package.json +6 -0
- package/TxEnvelopeEip8141/package.json +6 -0
- package/_cjs/core/Frame.js +147 -0
- package/_cjs/core/Frame.js.map +1 -0
- package/_cjs/core/FrameReceipt.js +34 -0
- package/_cjs/core/FrameReceipt.js.map +1 -0
- package/_cjs/core/FrameSignature.js +203 -0
- package/_cjs/core/FrameSignature.js.map +1 -0
- package/_cjs/core/Transaction.js +18 -2
- package/_cjs/core/Transaction.js.map +1 -1
- package/_cjs/core/TransactionReceipt.js +10 -0
- package/_cjs/core/TransactionReceipt.js.map +1 -1
- package/_cjs/core/TransactionRequest.js +11 -1
- package/_cjs/core/TransactionRequest.js.map +1 -1
- package/_cjs/core/TxEnvelopeEip8141.js +282 -0
- package/_cjs/core/TxEnvelopeEip8141.js.map +1 -0
- package/_cjs/core/internal/curves.js +6 -0
- package/_cjs/core/internal/curves.js.map +1 -0
- package/_cjs/core/internal/quantity.js +10 -0
- package/_cjs/core/internal/quantity.js.map +1 -0
- package/_cjs/erc4337/UserOperationReceipt.js.map +1 -1
- package/_cjs/index.js +6 -2
- package/_cjs/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/core/Frame.js +311 -0
- package/_esm/core/Frame.js.map +1 -0
- package/_esm/core/FrameReceipt.js +72 -0
- package/_esm/core/FrameReceipt.js.map +1 -0
- package/_esm/core/FrameSignature.js +422 -0
- package/_esm/core/FrameSignature.js.map +1 -0
- package/_esm/core/Transaction.js +18 -2
- package/_esm/core/Transaction.js.map +1 -1
- package/_esm/core/TransactionReceipt.js +10 -0
- package/_esm/core/TransactionReceipt.js.map +1 -1
- package/_esm/core/TransactionRequest.js +11 -1
- package/_esm/core/TransactionRequest.js.map +1 -1
- package/_esm/core/TxEnvelopeEip8141.js +489 -0
- package/_esm/core/TxEnvelopeEip8141.js.map +1 -0
- package/_esm/core/internal/curves.js +19 -0
- package/_esm/core/internal/curves.js.map +1 -0
- package/_esm/core/internal/quantity.js +14 -0
- package/_esm/core/internal/quantity.js.map +1 -0
- package/_esm/erc4337/UserOperationReceipt.js.map +1 -1
- package/_esm/index.js +73 -0
- package/_esm/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/core/Frame.d.ts +290 -0
- package/_types/core/Frame.d.ts.map +1 -0
- package/_types/core/FrameReceipt.d.ts +92 -0
- package/_types/core/FrameReceipt.d.ts.map +1 -0
- package/_types/core/FrameSignature.d.ts +357 -0
- package/_types/core/FrameSignature.d.ts.map +1 -0
- package/_types/core/Transaction.d.ts +29 -4
- package/_types/core/Transaction.d.ts.map +1 -1
- package/_types/core/TransactionReceipt.d.ts +15 -6
- package/_types/core/TransactionReceipt.d.ts.map +1 -1
- package/_types/core/TransactionRequest.d.ts +10 -4
- package/_types/core/TransactionRequest.d.ts.map +1 -1
- package/_types/core/TxEnvelopeEip8141.d.ts +343 -0
- package/_types/core/TxEnvelopeEip8141.d.ts.map +1 -0
- package/_types/core/internal/curves.d.ts +19 -0
- package/_types/core/internal/curves.d.ts.map +1 -0
- package/_types/core/internal/quantity.d.ts +10 -0
- package/_types/core/internal/quantity.d.ts.map +1 -0
- package/_types/erc4337/UserOperationReceipt.d.ts +1 -1
- package/_types/erc4337/UserOperationReceipt.d.ts.map +1 -1
- package/_types/index.d.ts +73 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +2 -0
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/TransactionReceipt.d.ts +2 -0
- package/_types/tempo/TransactionReceipt.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/core/Frame.ts +442 -0
- package/core/FrameReceipt.ts +117 -0
- package/core/FrameSignature.ts +606 -0
- package/core/Transaction.ts +73 -4
- package/core/TransactionReceipt.ts +41 -4
- package/core/TransactionRequest.ts +26 -2
- package/core/TxEnvelopeEip8141.ts +716 -0
- package/core/internal/curves.ts +22 -0
- package/core/internal/quantity.ts +16 -0
- package/erc4337/UserOperationReceipt.ts +1 -6
- package/index.ts +73 -0
- package/package.json +21 -1
- package/version.ts +1 -1
package/core/Transaction.ts
CHANGED
|
@@ -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 type { Compute, OneOf, UnionCompute } from './internal/types.js'
|
|
7
9
|
import * as Signature from './Signature.js'
|
|
@@ -20,6 +22,7 @@ export type Transaction<
|
|
|
20
22
|
| Eip2930<pending, bigintType, numberType>
|
|
21
23
|
| Eip4844<pending, bigintType, numberType>
|
|
22
24
|
| Eip7702<pending, bigintType, numberType>
|
|
25
|
+
| Eip8141<pending, bigintType, numberType>
|
|
23
26
|
| (Base & { type: Hex.Hex })
|
|
24
27
|
>
|
|
25
28
|
>
|
|
@@ -34,6 +37,7 @@ export type Rpc<pending extends boolean = false> = UnionCompute<
|
|
|
34
37
|
| Eip2930Rpc<pending>
|
|
35
38
|
| Eip4844Rpc<pending>
|
|
36
39
|
| Eip7702Rpc<pending>
|
|
40
|
+
| Eip8141Rpc<pending>
|
|
37
41
|
| (BaseRpc & { type: Hex.Hex })
|
|
38
42
|
>
|
|
39
43
|
>
|
|
@@ -183,6 +187,48 @@ export type Eip7702Rpc<pending extends boolean = false> = Compute<
|
|
|
183
187
|
Eip7702<pending, Hex.Hex, Hex.Hex, ToRpcType['eip7702']>
|
|
184
188
|
>
|
|
185
189
|
|
|
190
|
+
/** An EIP-8141 frame transaction. */
|
|
191
|
+
export type Eip8141<
|
|
192
|
+
pending extends boolean = false,
|
|
193
|
+
bigintType = bigint,
|
|
194
|
+
numberType = number,
|
|
195
|
+
type extends string = 'eip8141',
|
|
196
|
+
> = Compute<
|
|
197
|
+
Omit<
|
|
198
|
+
Base<type, pending, bigintType, numberType>,
|
|
199
|
+
'chainId' | 'r' | 's' | 'v' | 'yParity'
|
|
200
|
+
> & {
|
|
201
|
+
/** Versioned blob hashes. */
|
|
202
|
+
blobVersionedHashes: readonly Hex.Hex[]
|
|
203
|
+
/** Chain ID, retaining bigint precision when needed. */
|
|
204
|
+
chainId: numberType | bigintType
|
|
205
|
+
/** Frames in execution order. */
|
|
206
|
+
frames: readonly ([bigintType] extends [Hex.Hex]
|
|
207
|
+
? Frame.Rpc
|
|
208
|
+
: Frame.Frame<bigintType>)[]
|
|
209
|
+
/** Effective gas price. */
|
|
210
|
+
gasPrice?: bigintType | undefined
|
|
211
|
+
/** Maximum fee per blob gas. */
|
|
212
|
+
maxFeePerBlobGas: bigintType
|
|
213
|
+
/** Maximum fee per gas. */
|
|
214
|
+
maxFeePerGas: bigintType
|
|
215
|
+
/** Maximum priority fee per gas. */
|
|
216
|
+
maxPriorityFeePerGas: bigintType
|
|
217
|
+
/** Frame signature entries. */
|
|
218
|
+
signatures: readonly ([bigintType] extends [Hex.Hex]
|
|
219
|
+
? FrameSignature.Rpc
|
|
220
|
+
: FrameSignature.FrameSignature)[]
|
|
221
|
+
}
|
|
222
|
+
>
|
|
223
|
+
|
|
224
|
+
/** An EIP-8141 RPC transaction. */
|
|
225
|
+
export type Eip8141Rpc<pending extends boolean = false> = Eip8141<
|
|
226
|
+
pending,
|
|
227
|
+
Hex.Hex,
|
|
228
|
+
Hex.Hex,
|
|
229
|
+
'0x6'
|
|
230
|
+
>
|
|
231
|
+
|
|
186
232
|
/** An legacy Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml). */
|
|
187
233
|
export type Legacy<
|
|
188
234
|
pending extends boolean = false,
|
|
@@ -216,6 +262,7 @@ export const toRpcType = {
|
|
|
216
262
|
eip1559: '0x2',
|
|
217
263
|
eip4844: '0x3',
|
|
218
264
|
eip7702: '0x4',
|
|
265
|
+
eip8141: '0x6',
|
|
219
266
|
} as const
|
|
220
267
|
|
|
221
268
|
/** Type to RPC Type mapping. */
|
|
@@ -230,6 +277,7 @@ export const fromRpcType = {
|
|
|
230
277
|
'0x2': 'eip1559',
|
|
231
278
|
'0x3': 'eip4844',
|
|
232
279
|
'0x4': 'eip7702',
|
|
280
|
+
'0x6': 'eip8141',
|
|
233
281
|
} as const
|
|
234
282
|
|
|
235
283
|
/** RPC Type to Type mapping. */
|
|
@@ -281,7 +329,8 @@ export function fromRpc<
|
|
|
281
329
|
): transaction extends Rpc<pending> ? Transaction<pending> : null {
|
|
282
330
|
if (!transaction) return null as never
|
|
283
331
|
|
|
284
|
-
const signature =
|
|
332
|
+
const signature =
|
|
333
|
+
transaction.type === '0x6' ? undefined : Signature.extract(transaction)
|
|
285
334
|
|
|
286
335
|
const transaction_ = {
|
|
287
336
|
...transaction,
|
|
@@ -305,11 +354,20 @@ export function fromRpc<
|
|
|
305
354
|
: null
|
|
306
355
|
transaction_.value = BigInt(transaction.value ?? 0n)
|
|
307
356
|
|
|
357
|
+
if (transaction.frames)
|
|
358
|
+
transaction_.frames = transaction.frames.map(Frame.fromRpc)
|
|
359
|
+
if (transaction.signatures)
|
|
360
|
+
transaction_.signatures = transaction.signatures.map(FrameSignature.fromRpc)
|
|
308
361
|
if (transaction.authorizationList)
|
|
309
362
|
transaction_.authorizationList = Authorization.fromRpcList(
|
|
310
363
|
transaction.authorizationList,
|
|
311
364
|
)
|
|
312
|
-
if (transaction.chainId)
|
|
365
|
+
if (transaction.chainId)
|
|
366
|
+
transaction_.chainId =
|
|
367
|
+
transaction.type === '0x6' &&
|
|
368
|
+
BigInt(transaction.chainId) > BigInt(Number.MAX_SAFE_INTEGER)
|
|
369
|
+
? BigInt(transaction.chainId)
|
|
370
|
+
: Number(transaction.chainId)
|
|
313
371
|
if (transaction.gasPrice) transaction_.gasPrice = BigInt(transaction.gasPrice)
|
|
314
372
|
if (transaction.maxFeePerBlobGas)
|
|
315
373
|
transaction_.maxFeePerBlobGas = BigInt(transaction.maxFeePerBlobGas)
|
|
@@ -330,7 +388,11 @@ export declare namespace fromRpc {
|
|
|
330
388
|
pending?: pending | boolean | undefined
|
|
331
389
|
}
|
|
332
390
|
|
|
333
|
-
type ErrorType =
|
|
391
|
+
type ErrorType =
|
|
392
|
+
| Frame.fromRpc.ErrorType
|
|
393
|
+
| FrameSignature.fromRpc.ErrorType
|
|
394
|
+
| Signature.extract.ErrorType
|
|
395
|
+
| Errors.GlobalErrorType
|
|
334
396
|
}
|
|
335
397
|
|
|
336
398
|
/**
|
|
@@ -394,6 +456,9 @@ export function toRpc<pending extends boolean = false>(
|
|
|
394
456
|
rpc.type = (toRpcType as any)[transaction.type] ?? transaction.type
|
|
395
457
|
rpc.value = Hex.fromNumber(transaction.value ?? 0n)
|
|
396
458
|
|
|
459
|
+
if (transaction.frames) rpc.frames = transaction.frames.map(Frame.toRpc)
|
|
460
|
+
if (transaction.signatures)
|
|
461
|
+
rpc.signatures = transaction.signatures.map(FrameSignature.toRpc)
|
|
397
462
|
if (transaction.accessList) rpc.accessList = transaction.accessList
|
|
398
463
|
if (transaction.authorizationList)
|
|
399
464
|
rpc.authorizationList = Authorization.toRpcList(
|
|
@@ -427,5 +492,9 @@ export declare namespace toRpc {
|
|
|
427
492
|
pending?: pending | boolean | undefined
|
|
428
493
|
}
|
|
429
494
|
|
|
430
|
-
type ErrorType =
|
|
495
|
+
type ErrorType =
|
|
496
|
+
| Frame.toRpc.ErrorType
|
|
497
|
+
| FrameSignature.toRpc.ErrorType
|
|
498
|
+
| Signature.extract.ErrorType
|
|
499
|
+
| Errors.GlobalErrorType
|
|
431
500
|
}
|
|
@@ -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 type { Compute } from './internal/types.js'
|
|
5
6
|
import * as Log from './Log.js'
|
|
@@ -10,6 +11,7 @@ export type TransactionReceipt<
|
|
|
10
11
|
type = Type,
|
|
11
12
|
bigintType = bigint,
|
|
12
13
|
numberType = number,
|
|
14
|
+
frameReceipt = FrameReceipt.FrameReceipt<bigintType>,
|
|
13
15
|
> = Compute<{
|
|
14
16
|
/** The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844. */
|
|
15
17
|
blobGasPrice?: bigintType | undefined
|
|
@@ -25,6 +27,8 @@ export type TransactionReceipt<
|
|
|
25
27
|
cumulativeGasUsed: bigintType
|
|
26
28
|
/** Pre-London, it is equal to the transaction's gasPrice. Post-London, it is equal to the actual gas price paid for inclusion. */
|
|
27
29
|
effectiveGasPrice: bigintType
|
|
30
|
+
/** Results for individual EIP-8141 frames. */
|
|
31
|
+
frameReceipts?: readonly frameReceipt[] | undefined
|
|
28
32
|
/** Transaction sender */
|
|
29
33
|
from: Address.Address
|
|
30
34
|
/** Gas used by this transaction */
|
|
@@ -33,6 +37,8 @@ export type TransactionReceipt<
|
|
|
33
37
|
logs: Log.Log<false, bigintType, numberType>[]
|
|
34
38
|
/** Logs bloom filter */
|
|
35
39
|
logsBloom: Hex.Hex
|
|
40
|
+
/** Account paying for an EIP-8141 transaction. */
|
|
41
|
+
payer?: Address.Address | undefined
|
|
36
42
|
/** The post-transaction state root. Only specified for transactions included before the Byzantium upgrade. */
|
|
37
43
|
root?: Hex.Hex | undefined
|
|
38
44
|
/** `success` if this transaction was successful or `reverted` if it failed */
|
|
@@ -48,7 +54,13 @@ export type TransactionReceipt<
|
|
|
48
54
|
}>
|
|
49
55
|
|
|
50
56
|
/** An RPC Transaction Receipt as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/receipt.yaml). */
|
|
51
|
-
export type Rpc = TransactionReceipt<
|
|
57
|
+
export type Rpc = TransactionReceipt<
|
|
58
|
+
RpcStatus,
|
|
59
|
+
RpcType,
|
|
60
|
+
Hex.Hex,
|
|
61
|
+
Hex.Hex,
|
|
62
|
+
FrameReceipt.Rpc
|
|
63
|
+
>
|
|
52
64
|
|
|
53
65
|
/**
|
|
54
66
|
* Union of Transaction Receipt statuses.
|
|
@@ -74,6 +86,7 @@ export type RpcStatus = '0x0' | '0x1'
|
|
|
74
86
|
* - `eip2930`
|
|
75
87
|
* - `eip4844`
|
|
76
88
|
* - `eip7702`
|
|
89
|
+
* - `eip8141`
|
|
77
90
|
* - any other string
|
|
78
91
|
*/
|
|
79
92
|
export type Type =
|
|
@@ -82,6 +95,7 @@ export type Type =
|
|
|
82
95
|
| 'eip2930'
|
|
83
96
|
| 'eip4844'
|
|
84
97
|
| 'eip7702'
|
|
98
|
+
| 'eip8141'
|
|
85
99
|
| (string & {})
|
|
86
100
|
|
|
87
101
|
/**
|
|
@@ -92,9 +106,17 @@ export type Type =
|
|
|
92
106
|
* - `0x2`: EIP-2930 transactions
|
|
93
107
|
* - `0x3`: EIP-4844 transactions
|
|
94
108
|
* - `0x4`: EIP-7702 transactions
|
|
109
|
+
* - `0x6`: EIP-8141 transactions
|
|
95
110
|
* - any other string
|
|
96
111
|
*/
|
|
97
|
-
export type RpcType =
|
|
112
|
+
export type RpcType =
|
|
113
|
+
| '0x0'
|
|
114
|
+
| '0x1'
|
|
115
|
+
| '0x2'
|
|
116
|
+
| '0x3'
|
|
117
|
+
| '0x4'
|
|
118
|
+
| '0x6'
|
|
119
|
+
| (string & {})
|
|
98
120
|
|
|
99
121
|
/** RPC status to status mapping. */
|
|
100
122
|
export const fromRpcStatus = {
|
|
@@ -115,6 +137,7 @@ export const fromRpcType = {
|
|
|
115
137
|
'0x2': 'eip1559',
|
|
116
138
|
'0x3': 'eip4844',
|
|
117
139
|
'0x4': 'eip7702',
|
|
140
|
+
'0x6': 'eip8141',
|
|
118
141
|
} as const
|
|
119
142
|
|
|
120
143
|
/** Type to RPC type mapping. */
|
|
@@ -124,6 +147,7 @@ export const toRpcType = {
|
|
|
124
147
|
eip1559: '0x2',
|
|
125
148
|
eip4844: '0x3',
|
|
126
149
|
eip7702: '0x4',
|
|
150
|
+
eip8141: '0x6',
|
|
127
151
|
} as const
|
|
128
152
|
|
|
129
153
|
/**
|
|
@@ -230,6 +254,9 @@ export function fromRpc<const receipt extends Rpc | null>(
|
|
|
230
254
|
|
|
231
255
|
return {
|
|
232
256
|
...receipt,
|
|
257
|
+
...(receipt.frameReceipts
|
|
258
|
+
? { frameReceipts: receipt.frameReceipts.map(FrameReceipt.fromRpc) }
|
|
259
|
+
: {}),
|
|
233
260
|
blobGasPrice: receipt.blobGasPrice
|
|
234
261
|
? BigInt(receipt.blobGasPrice)
|
|
235
262
|
: undefined,
|
|
@@ -246,7 +273,10 @@ export function fromRpc<const receipt extends Rpc | null>(
|
|
|
246
273
|
}
|
|
247
274
|
|
|
248
275
|
export declare namespace fromRpc {
|
|
249
|
-
export type ErrorType =
|
|
276
|
+
export type ErrorType =
|
|
277
|
+
| FrameReceipt.fromRpc.ErrorType
|
|
278
|
+
| Log.fromRpc.ErrorType
|
|
279
|
+
| Errors.GlobalErrorType
|
|
250
280
|
}
|
|
251
281
|
|
|
252
282
|
/**
|
|
@@ -304,6 +334,10 @@ export declare namespace fromRpc {
|
|
|
304
334
|
*/
|
|
305
335
|
export function toRpc(receipt: TransactionReceipt): Rpc {
|
|
306
336
|
return {
|
|
337
|
+
...(receipt.frameReceipts
|
|
338
|
+
? { frameReceipts: receipt.frameReceipts.map(FrameReceipt.toRpc) }
|
|
339
|
+
: {}),
|
|
340
|
+
...(receipt.payer ? { payer: receipt.payer } : {}),
|
|
307
341
|
blobGasPrice: receipt.blobGasPrice
|
|
308
342
|
? Hex.fromNumber(receipt.blobGasPrice)
|
|
309
343
|
: undefined,
|
|
@@ -329,5 +363,8 @@ export function toRpc(receipt: TransactionReceipt): Rpc {
|
|
|
329
363
|
}
|
|
330
364
|
|
|
331
365
|
export declare namespace toRpc {
|
|
332
|
-
export type ErrorType =
|
|
366
|
+
export type ErrorType =
|
|
367
|
+
| FrameReceipt.toRpc.ErrorType
|
|
368
|
+
| Hex.fromNumber.ErrorType
|
|
369
|
+
| Errors.GlobalErrorType
|
|
333
370
|
}
|
|
@@ -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 type { Compute } from './internal/types.js'
|
|
7
9
|
import * as Transaction from './Transaction.js'
|
|
@@ -11,6 +13,8 @@ export type TransactionRequest<
|
|
|
11
13
|
bigintType = bigint,
|
|
12
14
|
numberType = number,
|
|
13
15
|
type extends string = string,
|
|
16
|
+
frame = Frame.Frame<bigintType>,
|
|
17
|
+
signature = FrameSignature.FrameSignature,
|
|
14
18
|
> = Compute<{
|
|
15
19
|
/** EIP-2930 Access List. */
|
|
16
20
|
accessList?: AccessList.AccessList | undefined
|
|
@@ -28,6 +32,8 @@ export type TransactionRequest<
|
|
|
28
32
|
data?: Hex.Hex | undefined
|
|
29
33
|
/** @alias `data` – added for TransactionEnvelope - Transaction compatibility. */
|
|
30
34
|
input?: Hex.Hex | undefined
|
|
35
|
+
/** Frames in execution order for EIP-8141 transactions. */
|
|
36
|
+
frames?: readonly frame[] | undefined
|
|
31
37
|
/** Sender of the transaction. */
|
|
32
38
|
from?: Address.Address | undefined
|
|
33
39
|
/** Gas provided for transaction execution */
|
|
@@ -42,6 +48,8 @@ export type TransactionRequest<
|
|
|
42
48
|
maxPriorityFeePerGas?: bigintType | undefined
|
|
43
49
|
/** Unique number identifying this transaction */
|
|
44
50
|
nonce?: bigintType | undefined
|
|
51
|
+
/** Frame signature entries for EIP-8141 transactions. */
|
|
52
|
+
signatures?: readonly signature[] | undefined
|
|
45
53
|
/** Transaction recipient */
|
|
46
54
|
to?: Address.Address | null | undefined
|
|
47
55
|
/** Transaction type */
|
|
@@ -51,7 +59,13 @@ export type TransactionRequest<
|
|
|
51
59
|
}>
|
|
52
60
|
|
|
53
61
|
/** RPC representation of a {@link ox#TransactionRequest.TransactionRequest}. */
|
|
54
|
-
export type Rpc = TransactionRequest<
|
|
62
|
+
export type Rpc = TransactionRequest<
|
|
63
|
+
Hex.Hex,
|
|
64
|
+
Hex.Hex,
|
|
65
|
+
string,
|
|
66
|
+
Frame.Rpc,
|
|
67
|
+
FrameSignature.Rpc
|
|
68
|
+
>
|
|
55
69
|
|
|
56
70
|
/**
|
|
57
71
|
* Converts a {@link ox#TransactionRequest.Rpc} to a {@link ox#TransactionRequest.TransactionRequest}.
|
|
@@ -70,7 +84,7 @@ export type Rpc = TransactionRequest<Hex.Hex, Hex.Hex, string>
|
|
|
70
84
|
* @returns A transaction request.
|
|
71
85
|
*/
|
|
72
86
|
export function fromRpc(request: Rpc): TransactionRequest {
|
|
73
|
-
const request_ = request as TransactionRequest
|
|
87
|
+
const request_ = { ...request } as unknown as TransactionRequest
|
|
74
88
|
|
|
75
89
|
if (typeof request.authorizationList !== 'undefined')
|
|
76
90
|
request_.authorizationList = Authorization.fromRpcList(
|
|
@@ -78,6 +92,9 @@ export function fromRpc(request: Rpc): TransactionRequest {
|
|
|
78
92
|
)
|
|
79
93
|
if (typeof request.chainId !== 'undefined')
|
|
80
94
|
request_.chainId = Hex.toNumber(request.chainId)
|
|
95
|
+
if (request.frames) request_.frames = request.frames.map(Frame.fromRpc)
|
|
96
|
+
if (request.signatures)
|
|
97
|
+
request_.signatures = request.signatures.map(FrameSignature.fromRpc)
|
|
81
98
|
if (typeof request.gas !== 'undefined')
|
|
82
99
|
request_.gas = Hex.toBigInt(request.gas)
|
|
83
100
|
if (typeof request.gasPrice !== 'undefined')
|
|
@@ -103,6 +120,8 @@ export function fromRpc(request: Rpc): TransactionRequest {
|
|
|
103
120
|
|
|
104
121
|
export declare namespace fromRpc {
|
|
105
122
|
export type ErrorType =
|
|
123
|
+
| Frame.fromRpc.ErrorType
|
|
124
|
+
| FrameSignature.fromRpc.ErrorType
|
|
106
125
|
| Authorization.fromRpcList.ErrorType
|
|
107
126
|
| Hex.toNumber.ErrorType
|
|
108
127
|
| Hex.toBigInt.ErrorType
|
|
@@ -170,6 +189,9 @@ export function toRpc(request: TransactionRequest): Rpc {
|
|
|
170
189
|
request_rpc.input = request.input
|
|
171
190
|
}
|
|
172
191
|
if (typeof request.from !== 'undefined') request_rpc.from = request.from
|
|
192
|
+
if (request.frames) request_rpc.frames = request.frames.map(Frame.toRpc)
|
|
193
|
+
if (request.signatures)
|
|
194
|
+
request_rpc.signatures = request.signatures.map(FrameSignature.toRpc)
|
|
173
195
|
if (typeof request.gas !== 'undefined')
|
|
174
196
|
request_rpc.gas = Hex.fromNumber(request.gas)
|
|
175
197
|
if (typeof request.gasPrice !== 'undefined')
|
|
@@ -202,6 +224,8 @@ export function toRpc(request: TransactionRequest): Rpc {
|
|
|
202
224
|
|
|
203
225
|
export declare namespace toRpc {
|
|
204
226
|
export type ErrorType =
|
|
227
|
+
| Frame.toRpc.ErrorType
|
|
228
|
+
| FrameSignature.toRpc.ErrorType
|
|
205
229
|
| Authorization.toRpcList.ErrorType
|
|
206
230
|
| Hex.fromNumber.ErrorType
|
|
207
231
|
| Errors.GlobalErrorType
|