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
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import * as Address from './Address.js';
|
|
2
|
+
import * as Blobs from './Blobs.js';
|
|
3
|
+
import * as Bytes from './Bytes.js';
|
|
4
|
+
import * as Errors from './Errors.js';
|
|
5
|
+
import * as Frame from './Frame.js';
|
|
6
|
+
import * as FrameSignature from './FrameSignature.js';
|
|
7
|
+
import * as Hash from './Hash.js';
|
|
8
|
+
import * as Hex from './Hex.js';
|
|
9
|
+
import * as Quantity from './internal/quantity.js';
|
|
10
|
+
import * as Rlp from './Rlp.js';
|
|
11
|
+
/** Serialized EIP-8141 transaction type prefix. */
|
|
12
|
+
export const serializedType = '0x06';
|
|
13
|
+
/** EIP-8141 transaction type. */
|
|
14
|
+
export const type = 'eip8141';
|
|
15
|
+
/**
|
|
16
|
+
* Asserts that an EIP-8141 envelope satisfies structural transaction constraints.
|
|
17
|
+
*
|
|
18
|
+
* Accepts unsigned signature entries for construction. Does not verify signatures,
|
|
19
|
+
* account authorization, balances, or blob proofs.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ### Basic Usage
|
|
23
|
+
*
|
|
24
|
+
* ```ts twoslash
|
|
25
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
26
|
+
*
|
|
27
|
+
* TxEnvelopeEip8141.assert({
|
|
28
|
+
* chainId: 1,
|
|
29
|
+
* frames: [{ gas: 50_000n, mode: 'verify' }],
|
|
30
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param envelope - The transaction envelope to assert.
|
|
35
|
+
*/
|
|
36
|
+
export function assert(envelope) {
|
|
37
|
+
const { blobVersionedHashes = [], chainId, frames, maxFeePerBlobGas = 0n, maxFeePerGas = 0n, maxPriorityFeePerGas = 0n, nonce = 0n, sender, signatures = [], } = envelope;
|
|
38
|
+
if ((typeof chainId !== 'bigint' &&
|
|
39
|
+
(typeof chainId !== 'number' || !Number.isSafeInteger(chainId))) ||
|
|
40
|
+
BigInt(chainId) < 0n ||
|
|
41
|
+
BigInt(chainId) >= 2n ** 256n)
|
|
42
|
+
throw new InvalidError('chainId must be an unsigned 256-bit integer; use bigint for large IDs.');
|
|
43
|
+
Address.assert(sender, { strict: false });
|
|
44
|
+
for (const [field, value, bits] of [
|
|
45
|
+
['maxFeePerBlobGas', maxFeePerBlobGas, 256n],
|
|
46
|
+
['maxFeePerGas', maxFeePerGas, 256n],
|
|
47
|
+
['maxPriorityFeePerGas', maxPriorityFeePerGas, 256n],
|
|
48
|
+
['nonce', nonce, 64n],
|
|
49
|
+
])
|
|
50
|
+
if (typeof value !== 'bigint' || value < 0n || value >= 2n ** bits)
|
|
51
|
+
throw new InvalidError(`${field} must be an unsigned ${bits}-bit integer.`);
|
|
52
|
+
if (maxPriorityFeePerGas > maxFeePerGas)
|
|
53
|
+
throw new InvalidError('maxPriorityFeePerGas exceeds maxFeePerGas.');
|
|
54
|
+
if (!Array.isArray(frames) || frames.length === 0 || frames.length > 64)
|
|
55
|
+
throw new InvalidError('Expected between 1 and 64 frames.');
|
|
56
|
+
if (!Array.isArray(signatures) || !Array.isArray(blobVersionedHashes))
|
|
57
|
+
throw new InvalidError('Signatures and blob versioned hashes must be lists.');
|
|
58
|
+
for (const hash of blobVersionedHashes) {
|
|
59
|
+
Hex.assert(hash, { strict: true });
|
|
60
|
+
if (hash.length !== 66 || Hex.slice(hash, 0, 1) !== '0x01')
|
|
61
|
+
throw new InvalidError('Blob versioned hashes must contain 32 bytes and version 0x01.');
|
|
62
|
+
}
|
|
63
|
+
if (blobVersionedHashes.length === 0 && maxFeePerBlobGas !== 0n)
|
|
64
|
+
throw new InvalidError('maxFeePerBlobGas must be zero without blobs.');
|
|
65
|
+
let gas = 0n;
|
|
66
|
+
let stateGas = 0n;
|
|
67
|
+
let previousBatch = false;
|
|
68
|
+
let expiry = false;
|
|
69
|
+
let tokens = 0n;
|
|
70
|
+
let size = 0n;
|
|
71
|
+
let intrinsic = 12000n + BigInt(frames.length) * 475n;
|
|
72
|
+
const count = (data) => {
|
|
73
|
+
for (const byte of Hex.toBytes(data))
|
|
74
|
+
tokens += byte === 0 ? 1n : 4n;
|
|
75
|
+
size += BigInt(Hex.size(data));
|
|
76
|
+
};
|
|
77
|
+
for (const [index, frame] of frames.entries()) {
|
|
78
|
+
Frame.assert(frame);
|
|
79
|
+
const flags = typeof frame.flags === 'string'
|
|
80
|
+
? Frame.flags[frame.flags]
|
|
81
|
+
: (frame.flags ?? 0);
|
|
82
|
+
const batch = (flags & 4) !== 0;
|
|
83
|
+
if (flags & 2 &&
|
|
84
|
+
frame.to !== undefined &&
|
|
85
|
+
!Address.isEqual(frame.to, sender))
|
|
86
|
+
throw new InvalidError('Execution approval must target the sender.');
|
|
87
|
+
if ((batch || previousBatch) && flags & 3)
|
|
88
|
+
throw new InvalidError('Atomic batches cannot contain approval frames.');
|
|
89
|
+
if (batch) {
|
|
90
|
+
const next = frames[index + 1];
|
|
91
|
+
if (!next || next.mode === 1 || next.mode === 'verify')
|
|
92
|
+
throw new InvalidError('An atomic batch requires a following non-verify frame.');
|
|
93
|
+
}
|
|
94
|
+
previousBatch = batch;
|
|
95
|
+
if ((frame.mode === 1 || frame.mode === 'verify') &&
|
|
96
|
+
frame.to?.toLowerCase() === '0x0000000000000000000000000000000000008141') {
|
|
97
|
+
if (expiry ||
|
|
98
|
+
flags !== 0 ||
|
|
99
|
+
(frame.stateGas ?? 0n) !== 0n ||
|
|
100
|
+
Hex.size(frame.data ?? '0x') !== 8)
|
|
101
|
+
throw new InvalidError('Invalid or duplicate expiry verifier frame.');
|
|
102
|
+
expiry = true;
|
|
103
|
+
}
|
|
104
|
+
gas += frame.gas ?? 0n;
|
|
105
|
+
stateGas += frame.stateGas ?? 0n;
|
|
106
|
+
count(frame.data ?? '0x');
|
|
107
|
+
if ((frame.value ?? 0n) > 0n &&
|
|
108
|
+
frame.to !== undefined &&
|
|
109
|
+
!Address.isEqual(frame.to, sender))
|
|
110
|
+
intrinsic += 6000n;
|
|
111
|
+
}
|
|
112
|
+
for (const entry of signatures) {
|
|
113
|
+
const [scheme, signer, payload, signature] = FrameSignature.toTuple(entry);
|
|
114
|
+
intrinsic += scheme === '0x' ? 100n : scheme === '0x01' ? 2800n : 6700n;
|
|
115
|
+
count(signer);
|
|
116
|
+
count(payload);
|
|
117
|
+
count(signature);
|
|
118
|
+
}
|
|
119
|
+
if (gas + stateGas >= 2n ** 64n)
|
|
120
|
+
throw new InvalidError('Combined frame gas must be less than 2^64.');
|
|
121
|
+
if (intrinsic + tokens * 4n + gas > 16777216n ||
|
|
122
|
+
intrinsic + size * 64n > 16777216n)
|
|
123
|
+
throw new InvalidError('Transaction execution gas exceeds 16777216.');
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Deserializes an EIP-8141 transaction body or PeerDAS network wrapper.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ### Basic Usage
|
|
130
|
+
*
|
|
131
|
+
* ```ts twoslash
|
|
132
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
133
|
+
*
|
|
134
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
135
|
+
* chainId: 1,
|
|
136
|
+
* frames: [Frame.from({})],
|
|
137
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
138
|
+
* })
|
|
139
|
+
*
|
|
140
|
+
* const serialized = TxEnvelopeEip8141.serialize(envelope)
|
|
141
|
+
* const decoded = TxEnvelopeEip8141.deserialize(serialized)
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param serialized - Serialized transaction or network wrapper.
|
|
145
|
+
* @returns The transaction envelope.
|
|
146
|
+
*/
|
|
147
|
+
export function deserialize(serialized) {
|
|
148
|
+
Hex.assert(serialized, { strict: true });
|
|
149
|
+
if (Hex.slice(serialized, 0, 1) !== serializedType)
|
|
150
|
+
throw new InvalidError('Expected transaction type 0x06.');
|
|
151
|
+
const decoded = Rlp.toHex(Hex.slice(serialized, 1));
|
|
152
|
+
if (!Array.isArray(decoded))
|
|
153
|
+
throw new InvalidError('Expected a transaction list.');
|
|
154
|
+
const wrapped = Array.isArray(decoded[0]);
|
|
155
|
+
const body = wrapped ? decoded[0] : decoded;
|
|
156
|
+
if (!Array.isArray(body) || body.length !== 7)
|
|
157
|
+
throw new InvalidError('Expected seven transaction fields.');
|
|
158
|
+
const [chainId, nonce, sender, frames, signatures, fees, hashes] = body;
|
|
159
|
+
if (typeof sender !== 'string' ||
|
|
160
|
+
!Array.isArray(frames) ||
|
|
161
|
+
!Array.isArray(signatures) ||
|
|
162
|
+
!Array.isArray(fees) ||
|
|
163
|
+
fees.length !== 3 ||
|
|
164
|
+
!Array.isArray(hashes) ||
|
|
165
|
+
hashes.some((hash) => typeof hash !== 'string'))
|
|
166
|
+
throw new InvalidError('Invalid transaction field shape.');
|
|
167
|
+
const integer = (value) => {
|
|
168
|
+
if (typeof value !== 'string' ||
|
|
169
|
+
(value !== '0x' && value.startsWith('0x00')))
|
|
170
|
+
throw new InvalidError('Expected a minimally encoded integer.');
|
|
171
|
+
return value === '0x' ? 0n : Hex.toBigInt(value);
|
|
172
|
+
};
|
|
173
|
+
const id = integer(chainId);
|
|
174
|
+
const envelope = {
|
|
175
|
+
blobVersionedHashes: hashes,
|
|
176
|
+
chainId: id <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(id) : id,
|
|
177
|
+
frames: frames.map((frame) => Frame.fromTuple(frame)),
|
|
178
|
+
maxFeePerBlobGas: integer(fees[2]),
|
|
179
|
+
maxFeePerGas: integer(fees[1]),
|
|
180
|
+
maxPriorityFeePerGas: integer(fees[0]),
|
|
181
|
+
nonce: integer(nonce),
|
|
182
|
+
sender: sender,
|
|
183
|
+
signatures: signatures.map((entry) => FrameSignature.fromTuple(entry)),
|
|
184
|
+
type,
|
|
185
|
+
};
|
|
186
|
+
if (wrapped) {
|
|
187
|
+
if (decoded.length !== 5 ||
|
|
188
|
+
decoded[1] !== '0x01' ||
|
|
189
|
+
!Array.isArray(decoded[2]) ||
|
|
190
|
+
!Array.isArray(decoded[3]) ||
|
|
191
|
+
!Array.isArray(decoded[4]))
|
|
192
|
+
throw new InvalidError('Expected a version 1 PeerDAS wrapper.');
|
|
193
|
+
envelope.sidecars = {
|
|
194
|
+
blobs: decoded[2],
|
|
195
|
+
cellProofs: decoded[4],
|
|
196
|
+
commitments: decoded[3],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
assert(envelope);
|
|
200
|
+
// Re-encoding rejects nonminimal RLP lengths as well as malformed nested lists.
|
|
201
|
+
if (serialize(envelope).toLowerCase() !== serialized.toLowerCase())
|
|
202
|
+
throw new InvalidError('Noncanonical transaction encoding.');
|
|
203
|
+
return envelope;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Creates an EIP-8141 transaction envelope from an object or serialized transaction.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ### Basic Usage
|
|
210
|
+
*
|
|
211
|
+
* ```ts twoslash
|
|
212
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
213
|
+
*
|
|
214
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
215
|
+
* chainId: 1,
|
|
216
|
+
* frames: [
|
|
217
|
+
* {
|
|
218
|
+
* flags: 'approveExecutionAndPayment',
|
|
219
|
+
* gas: 50_000n,
|
|
220
|
+
* mode: 'verify'
|
|
221
|
+
* }
|
|
222
|
+
* ],
|
|
223
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
224
|
+
* })
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @param envelope - An envelope object or serialized transaction.
|
|
228
|
+
* @returns The envelope with its transaction type.
|
|
229
|
+
*/
|
|
230
|
+
export function from(envelope) {
|
|
231
|
+
const value = (typeof envelope === 'string' ? deserialize(envelope) : envelope);
|
|
232
|
+
assert(value);
|
|
233
|
+
return { ...value, type };
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Converts an RPC envelope to an EIP-8141 envelope without losing chain ID precision.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ### Basic Usage
|
|
240
|
+
*
|
|
241
|
+
* ```ts twoslash
|
|
242
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
243
|
+
*
|
|
244
|
+
* const rpc = TxEnvelopeEip8141.toRpc(
|
|
245
|
+
* TxEnvelopeEip8141.from({
|
|
246
|
+
* chainId: 1,
|
|
247
|
+
* frames: [Frame.from({})],
|
|
248
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
249
|
+
* })
|
|
250
|
+
* )
|
|
251
|
+
* const envelope = TxEnvelopeEip8141.fromRpc(rpc)
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @param envelope - The value to convert.
|
|
255
|
+
* @returns The converted value.
|
|
256
|
+
*/
|
|
257
|
+
export function fromRpc(envelope) {
|
|
258
|
+
const chainId = Hex.toBigInt(envelope.chainId);
|
|
259
|
+
return from({
|
|
260
|
+
blobVersionedHashes: envelope.blobVersionedHashes,
|
|
261
|
+
chainId: chainId <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(chainId) : chainId,
|
|
262
|
+
frames: envelope.frames.map(Frame.fromRpc),
|
|
263
|
+
maxFeePerBlobGas: Hex.toBigInt(envelope.maxFeePerBlobGas),
|
|
264
|
+
maxFeePerGas: Hex.toBigInt(envelope.maxFeePerGas),
|
|
265
|
+
maxPriorityFeePerGas: Hex.toBigInt(envelope.maxPriorityFeePerGas),
|
|
266
|
+
nonce: Hex.toBigInt(envelope.nonce),
|
|
267
|
+
sender: envelope.from,
|
|
268
|
+
signatures: envelope.signatures.map(FrameSignature.fromRpc),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Converts an EIP-8141 envelope to RPC fields. Sidecars are excluded.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ### Basic Usage
|
|
276
|
+
*
|
|
277
|
+
* ```ts twoslash
|
|
278
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
279
|
+
*
|
|
280
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
281
|
+
* chainId: 1,
|
|
282
|
+
* frames: [Frame.from({})],
|
|
283
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
284
|
+
* })
|
|
285
|
+
* const rpc = TxEnvelopeEip8141.toRpc(envelope)
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* @param envelope - The value to convert.
|
|
289
|
+
* @returns The converted value.
|
|
290
|
+
*/
|
|
291
|
+
export function toRpc(envelope) {
|
|
292
|
+
return {
|
|
293
|
+
blobVersionedHashes: envelope.blobVersionedHashes ?? [],
|
|
294
|
+
chainId: Quantity.fromNumberish(envelope.chainId),
|
|
295
|
+
frames: envelope.frames.map(Frame.toRpc),
|
|
296
|
+
from: envelope.sender,
|
|
297
|
+
maxFeePerBlobGas: Quantity.fromNumberish(envelope.maxFeePerBlobGas ?? 0n),
|
|
298
|
+
maxFeePerGas: Quantity.fromNumberish(envelope.maxFeePerGas ?? 0n),
|
|
299
|
+
maxPriorityFeePerGas: Quantity.fromNumberish(envelope.maxPriorityFeePerGas ?? 0n),
|
|
300
|
+
nonce: Quantity.fromNumberish(envelope.nonce ?? 0n),
|
|
301
|
+
signatures: (envelope.signatures ?? []).map(FrameSignature.toRpc),
|
|
302
|
+
type: '0x6',
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Returns the canonical signing payload of an EIP-8141 envelope.
|
|
307
|
+
*
|
|
308
|
+
* Elides signature bytes only for entries with an empty payload. Explicit-payload
|
|
309
|
+
* signatures remain committed. The envelope is not mutated.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ### Signing
|
|
313
|
+
*
|
|
314
|
+
* ```ts twoslash
|
|
315
|
+
* import {
|
|
316
|
+
* Address,
|
|
317
|
+
* FrameSignature,
|
|
318
|
+
* Secp256k1,
|
|
319
|
+
* TxEnvelopeEip8141
|
|
320
|
+
* } from 'ox'
|
|
321
|
+
*
|
|
322
|
+
* const privateKey = Secp256k1.randomPrivateKey()
|
|
323
|
+
* const sender = Address.fromPublicKey(
|
|
324
|
+
* Secp256k1.getPublicKey({ privateKey })
|
|
325
|
+
* )
|
|
326
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
327
|
+
* chainId: 1,
|
|
328
|
+
* frames: [
|
|
329
|
+
* {
|
|
330
|
+
* flags: 'approveExecutionAndPayment',
|
|
331
|
+
* gas: 50_000n,
|
|
332
|
+
* mode: 'verify'
|
|
333
|
+
* }
|
|
334
|
+
* ],
|
|
335
|
+
* sender,
|
|
336
|
+
* signatures: [FrameSignature.from({ scheme: 'secp256k1' })]
|
|
337
|
+
* })
|
|
338
|
+
*
|
|
339
|
+
* const payload = TxEnvelopeEip8141.getSignPayload(envelope)
|
|
340
|
+
* const signature = Secp256k1.sign({ payload, privateKey })
|
|
341
|
+
* const signed = TxEnvelopeEip8141.from({
|
|
342
|
+
* ...envelope,
|
|
343
|
+
* signatures: [
|
|
344
|
+
* FrameSignature.from({ scheme: 'secp256k1', signature })
|
|
345
|
+
* ]
|
|
346
|
+
* })
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* @param envelope - The transaction envelope to sign.
|
|
350
|
+
* @returns The canonical signing digest.
|
|
351
|
+
*/
|
|
352
|
+
export function getSignPayload(envelope) {
|
|
353
|
+
return hash(envelope, { presign: true });
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Hashes an EIP-8141 transaction, excluding its blob sidecars.
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ### Basic Usage
|
|
360
|
+
*
|
|
361
|
+
* ```ts twoslash
|
|
362
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
363
|
+
*
|
|
364
|
+
* const hash = TxEnvelopeEip8141.hash({
|
|
365
|
+
* chainId: 1,
|
|
366
|
+
* frames: [Frame.from({})],
|
|
367
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
368
|
+
* })
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* @param envelope - The transaction envelope to hash.
|
|
372
|
+
* @param options - Hashing options.
|
|
373
|
+
* @returns The transaction hash or signing digest.
|
|
374
|
+
*/
|
|
375
|
+
export function hash(envelope, options = {}) {
|
|
376
|
+
assert(envelope);
|
|
377
|
+
const body = toTuple(envelope);
|
|
378
|
+
if (options.presign)
|
|
379
|
+
body[4] = body[4].map((entry) => entry[2] === '0x' ? [entry[0], entry[1], entry[2], '0x'] : entry);
|
|
380
|
+
return Hash.keccak256(Hex.concat(serializedType, Rlp.fromHex(body)));
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Serializes an EIP-8141 envelope, including a PeerDAS wrapper when sidecars exist.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ### Basic Usage
|
|
387
|
+
*
|
|
388
|
+
* ```ts twoslash
|
|
389
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
390
|
+
*
|
|
391
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
392
|
+
* chainId: 1,
|
|
393
|
+
* frames: [{ gas: 50_000n, mode: 'sender' }],
|
|
394
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
395
|
+
* })
|
|
396
|
+
* const serialized = TxEnvelopeEip8141.serialize(envelope)
|
|
397
|
+
* ```
|
|
398
|
+
*
|
|
399
|
+
* @param envelope - The transaction envelope to serialize.
|
|
400
|
+
* @returns The serialized transaction.
|
|
401
|
+
*/
|
|
402
|
+
export function serialize(envelope) {
|
|
403
|
+
assert(envelope);
|
|
404
|
+
const body = toTuple(envelope);
|
|
405
|
+
const { sidecars } = envelope;
|
|
406
|
+
if (sidecars) {
|
|
407
|
+
const { blobs, cellProofs, commitments } = sidecars;
|
|
408
|
+
const hashes = envelope.blobVersionedHashes ?? [];
|
|
409
|
+
if (hashes.length === 0 ||
|
|
410
|
+
blobs.length !== hashes.length ||
|
|
411
|
+
commitments.length !== hashes.length ||
|
|
412
|
+
cellProofs.length !== hashes.length * 128)
|
|
413
|
+
throw new InvalidError('PeerDAS sidecar counts do not match blob hashes.');
|
|
414
|
+
for (const [index, blob] of blobs.entries()) {
|
|
415
|
+
Hex.assert(blob, { strict: true });
|
|
416
|
+
const commitment = commitments[index];
|
|
417
|
+
Hex.assert(commitment, { strict: true });
|
|
418
|
+
if (blob.length !== 2 + Blobs.bytesPerBlob * 2 ||
|
|
419
|
+
commitment.length !== 98 ||
|
|
420
|
+
Blobs.commitmentToVersionedHash(commitment).toLowerCase() !==
|
|
421
|
+
hashes[index].toLowerCase())
|
|
422
|
+
throw new InvalidError('Invalid blob size or commitment.');
|
|
423
|
+
}
|
|
424
|
+
for (const proof of cellProofs) {
|
|
425
|
+
Hex.assert(proof, { strict: true });
|
|
426
|
+
if (proof.length !== 98)
|
|
427
|
+
throw new InvalidError('Cell proofs must contain 48 bytes.');
|
|
428
|
+
}
|
|
429
|
+
return Hex.concat(serializedType, Rlp.fromHex([body, '0x01', blobs, commitments, cellProofs]));
|
|
430
|
+
}
|
|
431
|
+
return Hex.concat(serializedType, Rlp.fromHex(body));
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Returns whether an EIP-8141 envelope satisfies structural constraints.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ### Basic Usage
|
|
438
|
+
*
|
|
439
|
+
* ```ts twoslash
|
|
440
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
441
|
+
*
|
|
442
|
+
* const valid = TxEnvelopeEip8141.validate({
|
|
443
|
+
* chainId: 1,
|
|
444
|
+
* frames: [Frame.from({})],
|
|
445
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
446
|
+
* })
|
|
447
|
+
* ```
|
|
448
|
+
*
|
|
449
|
+
* @param envelope - The transaction envelope to validate.
|
|
450
|
+
* @returns Whether the envelope is structurally valid.
|
|
451
|
+
*/
|
|
452
|
+
export function validate(envelope) {
|
|
453
|
+
try {
|
|
454
|
+
assert(envelope);
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
catch {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/** Thrown when an EIP-8141 envelope is structurally invalid. */
|
|
462
|
+
export class InvalidError extends Errors.BaseError {
|
|
463
|
+
constructor() {
|
|
464
|
+
super(...arguments);
|
|
465
|
+
Object.defineProperty(this, "name", {
|
|
466
|
+
enumerable: true,
|
|
467
|
+
configurable: true,
|
|
468
|
+
writable: true,
|
|
469
|
+
value: 'TxEnvelopeEip8141.InvalidError'
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function toTuple(envelope) {
|
|
474
|
+
const quantity = (value) => value ? Hex.fromBytes(Bytes.fromNumber(value)) : '0x';
|
|
475
|
+
return [
|
|
476
|
+
quantity(envelope.chainId),
|
|
477
|
+
quantity(envelope.nonce),
|
|
478
|
+
envelope.sender,
|
|
479
|
+
envelope.frames.map((frame) => Frame.toTuple(frame)),
|
|
480
|
+
(envelope.signatures ?? []).map((entry) => FrameSignature.toTuple(entry)),
|
|
481
|
+
[
|
|
482
|
+
quantity(envelope.maxPriorityFeePerGas),
|
|
483
|
+
quantity(envelope.maxFeePerGas),
|
|
484
|
+
quantity(envelope.maxFeePerBlobGas),
|
|
485
|
+
],
|
|
486
|
+
envelope.blobVersionedHashes ?? [],
|
|
487
|
+
];
|
|
488
|
+
}
|
|
489
|
+
//# sourceMappingURL=TxEnvelopeEip8141.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TxEnvelopeEip8141.js","sourceRoot":"","sources":["../../core/TxEnvelopeEip8141.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAElD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AA6D/B,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAe,CAAA;AAK7C,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,SAAkB,CAAA;AAKtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CAAC,QAA8C;IACnE,MAAM,EACJ,mBAAmB,GAAG,EAAE,EACxB,OAAO,EACP,MAAM,EACN,gBAAgB,GAAG,EAAE,EACrB,YAAY,GAAG,EAAE,EACjB,oBAAoB,GAAG,EAAE,EACzB,KAAK,GAAG,EAAE,EACV,MAAM,EACN,UAAU,GAAG,EAAE,GAChB,GAAG,QAAQ,CAAA;IACZ,IACE,CAAC,OAAO,OAAO,KAAK,QAAQ;QAC1B,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,MAAM,CAAC,OAAO,CAAC,GAA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CAAC;SACpC;QACD,QAAQ,CAAC,mBAAmB,IAAI,EAAE;KASnC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curve constants, inlined so that modules needing nothing but an order do not
|
|
3
|
+
* pull a curve implementation into the bundle.
|
|
4
|
+
*
|
|
5
|
+
* These are fixed by the curve specifications and are asserted against
|
|
6
|
+
* `@noble/curves` in `src/core/_test/curves.test.ts`.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Order of the secp256r1 (P-256) curve.
|
|
12
|
+
*
|
|
13
|
+
* @see https://www.secg.org/sec2-v2.pdf
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export const p256N = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n;
|
|
17
|
+
/** Order of the secp256k1 curve. @internal */
|
|
18
|
+
export const secp256k1N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
|
|
19
|
+
//# sourceMappingURL=curves.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curves.js","sourceRoot":"","sources":["../../../core/internal/curves.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAChB,mEAAmE,CAAA;AAErE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GACrB,mEAAmE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Hex from '../Hex.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a "numberish" value (`Hex.Hex | bigint | number`) to an RPC quantity
|
|
4
|
+
* (`Hex.Hex`). Hex values are passed through unchanged; numbers and bigints are
|
|
5
|
+
* encoded via {@link ox#Hex.(fromNumber:function)}.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export function fromNumberish(value, options) {
|
|
10
|
+
if (typeof value === 'string')
|
|
11
|
+
return value;
|
|
12
|
+
return Hex.fromNumber(value, options);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=quantity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantity.js","sourceRoot":"","sources":["../../../core/internal/quantity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;AAEhC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgC,EAChC,OAAgC;IAEhC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserOperationReceipt.js","sourceRoot":"","sources":["../../erc4337/UserOperationReceipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"UserOperationReceipt.js","sourceRoot":"","sources":["../../erc4337/UserOperationReceipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAA;AAqDnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,OAAO;QACL,GAAG,GAAG;QACN,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;QACxC,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;QACxC,IAAI,EAAE,GAAG,CAAC,IAAI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AAoB,CAAC,MAAM,CAAA;IAEzE,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/_esm/index.js
CHANGED
|
@@ -1516,6 +1516,60 @@ export * as Fee from './core/Fee.js';
|
|
|
1516
1516
|
* @category Execution Spec
|
|
1517
1517
|
*/
|
|
1518
1518
|
export * as Filter from './core/Filter.js';
|
|
1519
|
+
/**
|
|
1520
|
+
* Utilities for constructing, validating, and encoding [EIP-8141](https://eips.ethereum.org/EIPS/eip-8141) call frames.
|
|
1521
|
+
*
|
|
1522
|
+
* A {@link ox#Frame.Frame} describes a call with an execution mode, approval flags,
|
|
1523
|
+
* and separate execution and state gas limits.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* ### Creating Frames
|
|
1527
|
+
*
|
|
1528
|
+
* Use {@link ox#Frame.(from:function)} to construct a frame with named mode and flags.
|
|
1529
|
+
*
|
|
1530
|
+
* ```ts twoslash
|
|
1531
|
+
* import { Frame } from 'ox'
|
|
1532
|
+
*
|
|
1533
|
+
* const frame = Frame.from({
|
|
1534
|
+
* flags: 'approveExecutionAndPayment',
|
|
1535
|
+
* gas: 50_000n,
|
|
1536
|
+
* mode: 'verify'
|
|
1537
|
+
* })
|
|
1538
|
+
* ```
|
|
1539
|
+
*
|
|
1540
|
+
* @category Transaction Envelopes
|
|
1541
|
+
*/
|
|
1542
|
+
export * as Frame from './core/Frame.js';
|
|
1543
|
+
/**
|
|
1544
|
+
* Utilities for converting EIP-8141 frame receipts between RPC and decoded forms.
|
|
1545
|
+
*
|
|
1546
|
+
* Frame receipts include execution gas, state gas, logs, and execution status.
|
|
1547
|
+
*
|
|
1548
|
+
* @category Execution Spec
|
|
1549
|
+
*/
|
|
1550
|
+
export * as FrameReceipt from './core/FrameReceipt.js';
|
|
1551
|
+
/**
|
|
1552
|
+
* Utilities for constructing, validating, and encoding [EIP-8141](https://eips.ethereum.org/EIPS/eip-8141) signature entries.
|
|
1553
|
+
*
|
|
1554
|
+
* Supports {@link ox#FrameSignature.Arbitrary}, {@link ox#FrameSignature.Secp256k1},
|
|
1555
|
+
* and {@link ox#FrameSignature.P256} entries. An empty payload selects the canonical
|
|
1556
|
+
* transaction signing hash.
|
|
1557
|
+
*
|
|
1558
|
+
* @example
|
|
1559
|
+
* ### Creating Signature Entries
|
|
1560
|
+
*
|
|
1561
|
+
* Use {@link ox#FrameSignature.(from:function)} to wrap arbitrary witness bytes.
|
|
1562
|
+
*
|
|
1563
|
+
* ```ts twoslash
|
|
1564
|
+
* import { FrameSignature } from 'ox'
|
|
1565
|
+
*
|
|
1566
|
+
* const entry = FrameSignature.from('0xaabb')
|
|
1567
|
+
* // @log: { payload: '0x', scheme: 'arbitrary', signature: '0xaabb' }
|
|
1568
|
+
* ```
|
|
1569
|
+
*
|
|
1570
|
+
* @category Transaction Envelopes
|
|
1571
|
+
*/
|
|
1572
|
+
export * as FrameSignature from './core/FrameSignature.js';
|
|
1519
1573
|
/**
|
|
1520
1574
|
* Utility functions for hashing (keccak256, sha256, etc).
|
|
1521
1575
|
*
|
|
@@ -3231,6 +3285,25 @@ export * as TxEnvelopeEip4844 from './core/TxEnvelopeEip4844.js';
|
|
|
3231
3285
|
* @category Transaction Envelopes
|
|
3232
3286
|
*/
|
|
3233
3287
|
export * as TxEnvelopeEip7702 from './core/TxEnvelopeEip7702.js';
|
|
3288
|
+
/**
|
|
3289
|
+
* Utilities for constructing, signing, and encoding EIP-8141 frame transactions.
|
|
3290
|
+
*
|
|
3291
|
+
* @example
|
|
3292
|
+
* ### Basic Usage
|
|
3293
|
+
*
|
|
3294
|
+
* ```ts twoslash
|
|
3295
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
3296
|
+
*
|
|
3297
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
3298
|
+
* chainId: 1,
|
|
3299
|
+
* frames: [{ gas: 50_000n, mode: 'sender' }],
|
|
3300
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
3301
|
+
* })
|
|
3302
|
+
* ```
|
|
3303
|
+
*
|
|
3304
|
+
* @category Transaction Envelopes
|
|
3305
|
+
*/
|
|
3306
|
+
export * as TxEnvelopeEip8141 from './core/TxEnvelopeEip8141.js';
|
|
3234
3307
|
/**
|
|
3235
3308
|
* Utility functions for working
|
|
3236
3309
|
* with **Legacy Transaction Envelopes**.
|