tempo.ts 0.8.3 → 0.10.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 (66) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/ox/AuthorizationTempo.d.ts +450 -0
  3. package/dist/ox/AuthorizationTempo.d.ts.map +1 -0
  4. package/dist/ox/AuthorizationTempo.js +433 -0
  5. package/dist/ox/AuthorizationTempo.js.map +1 -0
  6. package/dist/ox/KeyAuthorization.d.ts +4 -4
  7. package/dist/ox/KeyAuthorization.d.ts.map +1 -1
  8. package/dist/ox/KeyAuthorization.js +5 -6
  9. package/dist/ox/KeyAuthorization.js.map +1 -1
  10. package/dist/ox/Transaction.d.ts +11 -10
  11. package/dist/ox/Transaction.d.ts.map +1 -1
  12. package/dist/ox/Transaction.js +10 -3
  13. package/dist/ox/Transaction.js.map +1 -1
  14. package/dist/ox/{TransactionEnvelopeAA.d.ts → TransactionEnvelopeTempo.d.ts} +73 -73
  15. package/dist/ox/TransactionEnvelopeTempo.d.ts.map +1 -0
  16. package/dist/ox/{TransactionEnvelopeAA.js → TransactionEnvelopeTempo.js} +65 -61
  17. package/dist/ox/TransactionEnvelopeTempo.js.map +1 -0
  18. package/dist/ox/TransactionReceipt.d.ts +3 -3
  19. package/dist/ox/TransactionReceipt.d.ts.map +1 -1
  20. package/dist/ox/TransactionReceipt.js +2 -2
  21. package/dist/ox/TransactionReceipt.js.map +1 -1
  22. package/dist/ox/TransactionRequest.d.ts +7 -5
  23. package/dist/ox/TransactionRequest.d.ts.map +1 -1
  24. package/dist/ox/TransactionRequest.js +9 -3
  25. package/dist/ox/TransactionRequest.js.map +1 -1
  26. package/dist/ox/index.d.ts +2 -1
  27. package/dist/ox/index.d.ts.map +1 -1
  28. package/dist/ox/index.js +2 -1
  29. package/dist/ox/index.js.map +1 -1
  30. package/dist/viem/Chain.d.ts +11 -6
  31. package/dist/viem/Chain.d.ts.map +1 -1
  32. package/dist/viem/Chain.js +1 -0
  33. package/dist/viem/Chain.js.map +1 -1
  34. package/dist/viem/Formatters.d.ts.map +1 -1
  35. package/dist/viem/Formatters.js +4 -17
  36. package/dist/viem/Formatters.js.map +1 -1
  37. package/dist/viem/Transaction.d.ts +21 -21
  38. package/dist/viem/Transaction.d.ts.map +1 -1
  39. package/dist/viem/Transaction.js +17 -30
  40. package/dist/viem/Transaction.js.map +1 -1
  41. package/dist/viem/internal/types.d.ts +2 -2
  42. package/dist/viem/internal/types.d.ts.map +1 -1
  43. package/dist/wagmi/Connector.d.ts +6 -12
  44. package/dist/wagmi/Connector.d.ts.map +1 -1
  45. package/dist/wagmi/Connector.js +73 -18
  46. package/dist/wagmi/Connector.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/ox/AuthorizationTempo.test.ts +1256 -0
  49. package/src/ox/AuthorizationTempo.ts +648 -0
  50. package/src/ox/KeyAuthorization.ts +8 -10
  51. package/src/ox/Transaction.test.ts +6 -6
  52. package/src/ox/Transaction.ts +25 -14
  53. package/src/ox/{TransactionEnvelopeAA.test.ts → TransactionEnvelopeTempo.test.ts} +326 -141
  54. package/src/ox/{TransactionEnvelopeAA.ts → TransactionEnvelopeTempo.ts} +93 -81
  55. package/src/ox/TransactionReceipt.ts +3 -3
  56. package/src/ox/TransactionRequest.ts +22 -8
  57. package/src/ox/e2e.test.ts +159 -78
  58. package/src/ox/index.ts +2 -1
  59. package/src/viem/Chain.ts +1 -0
  60. package/src/viem/Formatters.ts +6 -19
  61. package/src/viem/Transaction.ts +50 -68
  62. package/src/viem/e2e.test.ts +28 -42
  63. package/src/viem/internal/types.ts +2 -2
  64. package/src/wagmi/Connector.ts +104 -31
  65. package/dist/ox/TransactionEnvelopeAA.d.ts.map +0 -1
  66. package/dist/ox/TransactionEnvelopeAA.js.map +0 -1
@@ -1,8 +1,9 @@
1
1
  import { Hex, P256, Rlp, Secp256k1, Value, WebAuthnP256 } from 'ox'
2
2
  import { describe, expect, test } from 'vitest'
3
+ import * as AuthorizationTempo from './AuthorizationTempo.js'
3
4
  import { SignatureEnvelope } from './index.js'
4
5
  import * as KeyAuthorization from './KeyAuthorization.js'
5
- import * as TransactionEnvelopeAA from './TransactionEnvelopeAA.js'
6
+ import * as TransactionEnvelopeTempo from './TransactionEnvelopeTempo.js'
6
7
 
7
8
  const privateKey =
8
9
  '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
@@ -10,54 +11,54 @@ const privateKey =
10
11
  describe('assert', () => {
11
12
  test('empty calls list', () => {
12
13
  expect(() =>
13
- TransactionEnvelopeAA.assert({
14
+ TransactionEnvelopeTempo.assert({
14
15
  calls: [],
15
16
  chainId: 1,
16
17
  }),
17
18
  ).toThrowErrorMatchingInlineSnapshot(
18
- `[TransactionEnvelopeAA.CallsEmptyError: Calls list cannot be empty.]`,
19
+ `[TransactionEnvelopeTempo.CallsEmptyError: Calls list cannot be empty.]`,
19
20
  )
20
21
  })
21
22
 
22
23
  test('missing calls', () => {
23
24
  expect(() =>
24
- TransactionEnvelopeAA.assert({
25
+ TransactionEnvelopeTempo.assert({
25
26
  chainId: 1,
26
27
  } as any),
27
28
  ).toThrowErrorMatchingInlineSnapshot(
28
- `[TransactionEnvelopeAA.CallsEmptyError: Calls list cannot be empty.]`,
29
+ `[TransactionEnvelopeTempo.CallsEmptyError: Calls list cannot be empty.]`,
29
30
  )
30
31
  })
31
32
 
32
33
  test('invalid validity window', () => {
33
34
  expect(() =>
34
- TransactionEnvelopeAA.assert({
35
+ TransactionEnvelopeTempo.assert({
35
36
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
36
37
  chainId: 1,
37
38
  validBefore: 100,
38
39
  validAfter: 200,
39
40
  }),
40
41
  ).toThrowErrorMatchingInlineSnapshot(
41
- `[TransactionEnvelopeAA.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (200).]`,
42
+ `[TransactionEnvelopeTempo.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (200).]`,
42
43
  )
43
44
  })
44
45
 
45
46
  test('invalid validity window (equal)', () => {
46
47
  expect(() =>
47
- TransactionEnvelopeAA.assert({
48
+ TransactionEnvelopeTempo.assert({
48
49
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
49
50
  chainId: 1,
50
51
  validBefore: 100,
51
52
  validAfter: 100,
52
53
  }),
53
54
  ).toThrowErrorMatchingInlineSnapshot(
54
- `[TransactionEnvelopeAA.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (100).]`,
55
+ `[TransactionEnvelopeTempo.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (100).]`,
55
56
  )
56
57
  })
57
58
 
58
59
  test('invalid call address', () => {
59
60
  expect(() =>
60
- TransactionEnvelopeAA.assert({
61
+ TransactionEnvelopeTempo.assert({
61
62
  calls: [{ to: '0x000000000000000000000000000000000000000z' }],
62
63
  chainId: 1,
63
64
  }),
@@ -72,7 +73,7 @@ describe('assert', () => {
72
73
 
73
74
  test('fee cap too high', () => {
74
75
  expect(() =>
75
- TransactionEnvelopeAA.assert({
76
+ TransactionEnvelopeTempo.assert({
76
77
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
77
78
  maxFeePerGas: 2n ** 256n - 1n + 1n,
78
79
  chainId: 1,
@@ -84,7 +85,7 @@ describe('assert', () => {
84
85
 
85
86
  test('tip above fee cap', () => {
86
87
  expect(() =>
87
- TransactionEnvelopeAA.assert({
88
+ TransactionEnvelopeTempo.assert({
88
89
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
89
90
  chainId: 1,
90
91
  maxFeePerGas: 10n,
@@ -97,7 +98,7 @@ describe('assert', () => {
97
98
 
98
99
  test('invalid chain id', () => {
99
100
  expect(() =>
100
- TransactionEnvelopeAA.assert({
101
+ TransactionEnvelopeTempo.assert({
101
102
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
102
103
  chainId: 0,
103
104
  }),
@@ -108,7 +109,7 @@ describe('assert', () => {
108
109
  })
109
110
 
110
111
  describe('deserialize', () => {
111
- const transaction = TransactionEnvelopeAA.from({
112
+ const transaction = TransactionEnvelopeTempo.from({
112
113
  chainId: 1,
113
114
  calls: [
114
115
  {
@@ -122,24 +123,26 @@ describe('deserialize', () => {
122
123
  })
123
124
 
124
125
  test('default', () => {
125
- const serialized = TransactionEnvelopeAA.serialize(transaction)
126
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
126
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
127
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
127
128
  expect(deserialized).toEqual(transaction)
128
129
  })
129
130
 
130
131
  test('minimal', () => {
131
- const transaction = TransactionEnvelopeAA.from({
132
+ const transaction = TransactionEnvelopeTempo.from({
132
133
  chainId: 1,
133
134
  calls: [{}],
134
135
  nonce: 0n,
135
136
  nonceKey: 0n,
136
137
  })
137
- const serialized = TransactionEnvelopeAA.serialize(transaction)
138
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(transaction)
138
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
139
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
140
+ transaction,
141
+ )
139
142
  })
140
143
 
141
144
  test('multiple calls', () => {
142
- const transaction_multiCall = TransactionEnvelopeAA.from({
145
+ const transaction_multiCall = TransactionEnvelopeTempo.from({
143
146
  ...transaction,
144
147
  calls: [
145
148
  {
@@ -152,25 +155,25 @@ describe('deserialize', () => {
152
155
  },
153
156
  ],
154
157
  })
155
- const serialized = TransactionEnvelopeAA.serialize(transaction_multiCall)
156
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
158
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_multiCall)
159
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
157
160
  transaction_multiCall,
158
161
  )
159
162
  })
160
163
 
161
164
  test('gas', () => {
162
- const transaction_gas = TransactionEnvelopeAA.from({
165
+ const transaction_gas = TransactionEnvelopeTempo.from({
163
166
  ...transaction,
164
167
  gas: 21001n,
165
168
  })
166
- const serialized = TransactionEnvelopeAA.serialize(transaction_gas)
167
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
169
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_gas)
170
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
168
171
  transaction_gas,
169
172
  )
170
173
  })
171
174
 
172
175
  test('accessList', () => {
173
- const transaction_accessList = TransactionEnvelopeAA.from({
176
+ const transaction_accessList = TransactionEnvelopeTempo.from({
174
177
  ...transaction,
175
178
  accessList: [
176
179
  {
@@ -182,75 +185,81 @@ describe('deserialize', () => {
182
185
  },
183
186
  ],
184
187
  })
185
- const serialized = TransactionEnvelopeAA.serialize(transaction_accessList)
186
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
188
+ const serialized = TransactionEnvelopeTempo.serialize(
189
+ transaction_accessList,
190
+ )
191
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
187
192
  transaction_accessList,
188
193
  )
189
194
  })
190
195
 
191
196
  test('nonce', () => {
192
- const transaction_nonce = TransactionEnvelopeAA.from({
197
+ const transaction_nonce = TransactionEnvelopeTempo.from({
193
198
  ...transaction,
194
199
  nonce: 0n,
195
200
  })
196
- const serialized = TransactionEnvelopeAA.serialize(transaction_nonce)
197
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
201
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_nonce)
202
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
198
203
  transaction_nonce,
199
204
  )
200
205
  })
201
206
 
202
207
  test('nonceKey', () => {
203
- const transaction_nonceKey = TransactionEnvelopeAA.from({
208
+ const transaction_nonceKey = TransactionEnvelopeTempo.from({
204
209
  ...transaction,
205
210
  nonceKey: 0n,
206
211
  })
207
- const serialized = TransactionEnvelopeAA.serialize(transaction_nonceKey)
208
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
212
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_nonceKey)
213
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
209
214
  transaction_nonceKey,
210
215
  )
211
216
  })
212
217
 
213
218
  test('validBefore', () => {
214
- const transaction_validBefore = TransactionEnvelopeAA.from({
219
+ const transaction_validBefore = TransactionEnvelopeTempo.from({
215
220
  ...transaction,
216
221
  validBefore: 1000000,
217
222
  })
218
- const serialized = TransactionEnvelopeAA.serialize(transaction_validBefore)
219
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
223
+ const serialized = TransactionEnvelopeTempo.serialize(
224
+ transaction_validBefore,
225
+ )
226
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
220
227
  transaction_validBefore,
221
228
  )
222
229
  })
223
230
 
224
231
  test('validAfter', () => {
225
- const transaction_validAfter = TransactionEnvelopeAA.from({
232
+ const transaction_validAfter = TransactionEnvelopeTempo.from({
226
233
  ...transaction,
227
234
  validAfter: 500000,
228
235
  })
229
- const serialized = TransactionEnvelopeAA.serialize(transaction_validAfter)
230
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
236
+ const serialized = TransactionEnvelopeTempo.serialize(
237
+ transaction_validAfter,
238
+ )
239
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
231
240
  transaction_validAfter,
232
241
  )
233
242
  })
234
243
 
235
244
  test('validBefore and validAfter', () => {
236
- const transaction_validity = TransactionEnvelopeAA.from({
245
+ const transaction_validity = TransactionEnvelopeTempo.from({
237
246
  ...transaction,
238
247
  validBefore: 1000000,
239
248
  validAfter: 500000,
240
249
  })
241
- const serialized = TransactionEnvelopeAA.serialize(transaction_validity)
242
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
250
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_validity)
251
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
243
252
  transaction_validity,
244
253
  )
245
254
  })
246
255
 
247
256
  test('feeToken', () => {
248
- const transaction_feeToken = TransactionEnvelopeAA.from({
257
+ const transaction_feeToken = TransactionEnvelopeTempo.from({
249
258
  ...transaction,
250
259
  feeToken: '0x20c0000000000000000000000000000000000000',
251
260
  })
252
- const serialized = TransactionEnvelopeAA.serialize(transaction_feeToken)
253
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
261
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_feeToken)
262
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
254
263
  transaction_feeToken,
255
264
  )
256
265
  })
@@ -273,29 +282,81 @@ describe('deserialize', () => {
273
282
  }),
274
283
  })
275
284
 
276
- const transaction_keyAuthorization = TransactionEnvelopeAA.from({
285
+ const transaction_keyAuthorization = TransactionEnvelopeTempo.from({
277
286
  ...transaction,
278
287
  keyAuthorization,
279
288
  })
280
289
 
281
- const serialized = TransactionEnvelopeAA.serialize(
290
+ const serialized = TransactionEnvelopeTempo.serialize(
282
291
  transaction_keyAuthorization,
283
292
  )
284
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
293
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
285
294
  transaction_keyAuthorization,
286
295
  )
287
296
  })
288
297
 
298
+ test('authorizationList', () => {
299
+ const authorizationList = [
300
+ AuthorizationTempo.from({
301
+ address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
302
+ chainId: 1,
303
+ nonce: 40n,
304
+ signature: SignatureEnvelope.from({
305
+ r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
306
+ s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
307
+ yParity: 0,
308
+ }),
309
+ }),
310
+ AuthorizationTempo.from({
311
+ address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
312
+ chainId: 1,
313
+ nonce: 55n,
314
+ signature: SignatureEnvelope.from({
315
+ r: 12345678901234567890n,
316
+ s: 98765432109876543210n,
317
+ yParity: 1,
318
+ }),
319
+ }),
320
+ ] as const
321
+
322
+ const transaction_authorizationList = TransactionEnvelopeTempo.from({
323
+ ...transaction,
324
+ authorizationList,
325
+ })
326
+
327
+ const serialized = TransactionEnvelopeTempo.serialize(
328
+ transaction_authorizationList,
329
+ )
330
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
331
+ transaction_authorizationList,
332
+ )
333
+ })
334
+
335
+ test('authorizationList (empty)', () => {
336
+ const transaction_authorizationList = TransactionEnvelopeTempo.from({
337
+ ...transaction,
338
+ authorizationList: [],
339
+ })
340
+
341
+ const serialized = TransactionEnvelopeTempo.serialize(
342
+ transaction_authorizationList,
343
+ )
344
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
345
+
346
+ // Empty authorizationList should be undefined after deserialization
347
+ expect(deserialized.authorizationList).toBeUndefined()
348
+ })
349
+
289
350
  describe('signature', () => {
290
351
  test('secp256k1', () => {
291
352
  const signature = Secp256k1.sign({
292
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
353
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
293
354
  privateKey,
294
355
  })
295
- const serialized = TransactionEnvelopeAA.serialize(transaction, {
356
+ const serialized = TransactionEnvelopeTempo.serialize(transaction, {
296
357
  signature: SignatureEnvelope.from(signature),
297
358
  })
298
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual({
359
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual({
299
360
  ...transaction,
300
361
  signature: { signature, type: 'secp256k1' },
301
362
  })
@@ -305,10 +366,10 @@ describe('deserialize', () => {
305
366
  const privateKey = P256.randomPrivateKey()
306
367
  const publicKey = P256.getPublicKey({ privateKey })
307
368
  const signature = P256.sign({
308
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
369
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
309
370
  privateKey,
310
371
  })
311
- const serialized = TransactionEnvelopeAA.serialize(transaction, {
372
+ const serialized = TransactionEnvelopeTempo.serialize(transaction, {
312
373
  signature: SignatureEnvelope.from({
313
374
  signature,
314
375
  publicKey,
@@ -318,7 +379,7 @@ describe('deserialize', () => {
318
379
  // biome-ignore lint/suspicious/noTsIgnore: _
319
380
  // @ts-ignore
320
381
  delete signature.yParity
321
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual({
382
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual({
322
383
  ...transaction,
323
384
  signature: { prehash: true, publicKey, signature, type: 'p256' },
324
385
  })
@@ -326,12 +387,12 @@ describe('deserialize', () => {
326
387
  })
327
388
 
328
389
  test('feePayerSignature null', () => {
329
- const transaction_feePayer = TransactionEnvelopeAA.from({
390
+ const transaction_feePayer = TransactionEnvelopeTempo.from({
330
391
  ...transaction,
331
392
  feePayerSignature: null,
332
393
  })
333
- const serialized = TransactionEnvelopeAA.serialize(transaction_feePayer)
334
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual(
394
+ const serialized = TransactionEnvelopeTempo.serialize(transaction_feePayer)
395
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual(
335
396
  transaction_feePayer,
336
397
  )
337
398
  })
@@ -358,7 +419,7 @@ describe('deserialize', () => {
358
419
  '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // feePayerSignatureOrSender (address)
359
420
  [], // authorizationList
360
421
  ]).slice(2)}` as const
361
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
422
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
362
423
  expect(deserialized.feePayerSignature).toBe(null)
363
424
  })
364
425
 
@@ -384,7 +445,7 @@ describe('deserialize', () => {
384
445
  [Hex.fromNumber(0), Hex.fromNumber(1), Hex.fromNumber(2)], // feePayerSignatureOrSender (signature tuple)
385
446
  [], // authorizationList
386
447
  ]).slice(2)}` as const
387
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
448
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
388
449
  expect(deserialized.feePayerSignature).toEqual({
389
450
  yParity: 0,
390
451
  r: 1n,
@@ -416,7 +477,7 @@ describe('deserialize', () => {
416
477
  [], // authorizationList
417
478
  ]).slice(2)}` as const
418
479
  expect(
419
- TransactionEnvelopeAA.deserialize(serialized),
480
+ TransactionEnvelopeTempo.deserialize(serialized),
420
481
  ).toMatchInlineSnapshot(`
421
482
  {
422
483
  "calls": [
@@ -431,7 +492,7 @@ describe('deserialize', () => {
431
492
  "maxPriorityFeePerGas": 1n,
432
493
  "nonce": 0n,
433
494
  "nonceKey": 0n,
434
- "type": "aa",
495
+ "type": "tempo",
435
496
  }
436
497
  `)
437
498
  })
@@ -459,7 +520,7 @@ describe('deserialize', () => {
459
520
  [], // authorizationList
460
521
  ]).slice(2)}` as const
461
522
  expect(
462
- TransactionEnvelopeAA.deserialize(serialized),
523
+ TransactionEnvelopeTempo.deserialize(serialized),
463
524
  ).toMatchInlineSnapshot(`
464
525
  {
465
526
  "calls": [
@@ -474,7 +535,7 @@ describe('deserialize', () => {
474
535
  "maxPriorityFeePerGas": 1n,
475
536
  "nonce": 0n,
476
537
  "nonceKey": 0n,
477
- "type": "aa",
538
+ "type": "tempo",
478
539
  }
479
540
  `)
480
541
  })
@@ -483,31 +544,31 @@ describe('deserialize', () => {
483
544
  describe('errors', () => {
484
545
  test('invalid transaction (all missing)', () => {
485
546
  expect(() =>
486
- TransactionEnvelopeAA.deserialize(`0x76${Rlp.fromHex([]).slice(2)}`),
547
+ TransactionEnvelopeTempo.deserialize(`0x76${Rlp.fromHex([]).slice(2)}`),
487
548
  ).toThrowErrorMatchingInlineSnapshot(`
488
- [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "aa" was provided.
549
+ [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "tempo" was provided.
489
550
 
490
551
  Serialized Transaction: "0x76c0"
491
- Missing Attributes: chainId, maxPriorityFeePerGas, maxFeePerGas, gas, calls, accessList, keyAuthorization, nonceKey, nonce, validBefore, validAfter, feeToken, feePayerSignatureOrSender]
552
+ Missing Attributes: authorizationList, chainId, maxPriorityFeePerGas, maxFeePerGas, gas, calls, accessList, keyAuthorization, nonceKey, nonce, validBefore, validAfter, feeToken, feePayerSignatureOrSender]
492
553
  `)
493
554
  })
494
555
 
495
556
  test('invalid transaction (some missing)', () => {
496
557
  expect(() =>
497
- TransactionEnvelopeAA.deserialize(
558
+ TransactionEnvelopeTempo.deserialize(
498
559
  `0x76${Rlp.fromHex(['0x00', '0x01']).slice(2)}`,
499
560
  ),
500
561
  ).toThrowErrorMatchingInlineSnapshot(`
501
- [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "aa" was provided.
562
+ [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "tempo" was provided.
502
563
 
503
564
  Serialized Transaction: "0x76c20001"
504
- Missing Attributes: maxFeePerGas, gas, calls, accessList, keyAuthorization, nonceKey, nonce, validBefore, validAfter, feeToken, feePayerSignatureOrSender]
565
+ Missing Attributes: authorizationList, maxFeePerGas, gas, calls, accessList, keyAuthorization, nonceKey, nonce, validBefore, validAfter, feeToken, feePayerSignatureOrSender]
505
566
  `)
506
567
  })
507
568
 
508
569
  test('invalid transaction (empty calls)', () => {
509
570
  expect(() =>
510
- TransactionEnvelopeAA.deserialize(
571
+ TransactionEnvelopeTempo.deserialize(
511
572
  `0x76${Rlp.fromHex([
512
573
  Hex.fromNumber(1), // chainId
513
574
  Hex.fromNumber(1), // maxPriorityFeePerGas
@@ -525,13 +586,13 @@ describe('deserialize', () => {
525
586
  ]).slice(2)}`,
526
587
  ),
527
588
  ).toThrowErrorMatchingInlineSnapshot(
528
- `[TransactionEnvelopeAA.CallsEmptyError: Calls list cannot be empty.]`,
589
+ `[TransactionEnvelopeTempo.CallsEmptyError: Calls list cannot be empty.]`,
529
590
  )
530
591
  })
531
592
 
532
593
  test('invalid transaction (too many fields with signature)', () => {
533
594
  expect(() =>
534
- TransactionEnvelopeAA.deserialize(
595
+ TransactionEnvelopeTempo.deserialize(
535
596
  `0x76${Rlp.fromHex([
536
597
  Hex.fromNumber(1), // chainId
537
598
  Hex.fromNumber(1), // maxPriorityFeePerGas
@@ -558,7 +619,7 @@ describe('deserialize', () => {
558
619
  ]).slice(2)}`,
559
620
  ),
560
621
  ).toThrowErrorMatchingInlineSnapshot(`
561
- [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "aa" was provided.
622
+ [TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "tempo" was provided.
562
623
 
563
624
  Serialized Transaction: "0x76ec01010101d8d7940000000000000000000000000000000000000000008080000080808080c0c0821234825678"]
564
625
  `)
@@ -569,7 +630,7 @@ describe('deserialize', () => {
569
630
  describe('from', () => {
570
631
  test('default', () => {
571
632
  {
572
- const envelope = TransactionEnvelopeAA.from({
633
+ const envelope = TransactionEnvelopeTempo.from({
573
634
  chainId: 1,
574
635
  calls: [{}],
575
636
  nonce: 0n,
@@ -583,16 +644,16 @@ describe('from', () => {
583
644
  "chainId": 1,
584
645
  "nonce": 0n,
585
646
  "nonceKey": 0n,
586
- "type": "aa",
647
+ "type": "tempo",
587
648
  }
588
649
  `)
589
- const serialized = TransactionEnvelopeAA.serialize(envelope)
590
- const envelope2 = TransactionEnvelopeAA.from(serialized)
650
+ const serialized = TransactionEnvelopeTempo.serialize(envelope)
651
+ const envelope2 = TransactionEnvelopeTempo.from(serialized)
591
652
  expect(envelope2).toEqual(envelope)
592
653
  }
593
654
 
594
655
  {
595
- const envelope = TransactionEnvelopeAA.from({
656
+ const envelope = TransactionEnvelopeTempo.from({
596
657
  chainId: 1,
597
658
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
598
659
  nonce: 0n,
@@ -621,11 +682,11 @@ describe('from', () => {
621
682
  },
622
683
  "type": "secp256k1",
623
684
  },
624
- "type": "aa",
685
+ "type": "tempo",
625
686
  }
626
687
  `)
627
- const serialized = TransactionEnvelopeAA.serialize(envelope)
628
- const envelope2 = TransactionEnvelopeAA.from(serialized)
688
+ const serialized = TransactionEnvelopeTempo.serialize(envelope)
689
+ const envelope2 = TransactionEnvelopeTempo.from(serialized)
629
690
  expect(envelope2).toEqual({
630
691
  ...envelope,
631
692
  signature: { ...envelope.signature, type: 'secp256k1' },
@@ -634,7 +695,7 @@ describe('from', () => {
634
695
  })
635
696
 
636
697
  test('options: signature', () => {
637
- const envelope = TransactionEnvelopeAA.from(
698
+ const envelope = TransactionEnvelopeTempo.from(
638
699
  {
639
700
  chainId: 1,
640
701
  calls: [{}],
@@ -665,16 +726,16 @@ describe('from', () => {
665
726
  },
666
727
  "type": "secp256k1",
667
728
  },
668
- "type": "aa",
729
+ "type": "tempo",
669
730
  }
670
731
  `)
671
- const serialized = TransactionEnvelopeAA.serialize(envelope)
672
- const envelope2 = TransactionEnvelopeAA.from(serialized)
732
+ const serialized = TransactionEnvelopeTempo.serialize(envelope)
733
+ const envelope2 = TransactionEnvelopeTempo.from(serialized)
673
734
  expect(envelope2).toEqual(envelope)
674
735
  })
675
736
 
676
737
  test('options: feePayerSignature', () => {
677
- const envelope = TransactionEnvelopeAA.from(
738
+ const envelope = TransactionEnvelopeTempo.from(
678
739
  {
679
740
  chainId: 1,
680
741
  calls: [{}],
@@ -705,14 +766,14 @@ describe('from', () => {
705
766
  "nonce": 0n,
706
767
  "r": 1n,
707
768
  "s": 2n,
708
- "type": "aa",
769
+ "type": "tempo",
709
770
  "yParity": 0,
710
771
  }
711
772
  `)
712
773
  })
713
774
 
714
775
  test('options: feePayerSignature (null)', () => {
715
- const envelope = TransactionEnvelopeAA.from(
776
+ const envelope = TransactionEnvelopeTempo.from(
716
777
  {
717
778
  chainId: 1,
718
779
  calls: [{}],
@@ -729,7 +790,7 @@ describe('from', () => {
729
790
  ],
730
791
  "chainId": 1,
731
792
  "nonce": 0n,
732
- "type": "aa",
793
+ "type": "tempo",
733
794
  }
734
795
  `)
735
796
  })
@@ -737,7 +798,7 @@ describe('from', () => {
737
798
 
738
799
  describe('serialize', () => {
739
800
  test('default', () => {
740
- const transaction = TransactionEnvelopeAA.from({
801
+ const transaction = TransactionEnvelopeTempo.from({
741
802
  chainId: 1,
742
803
  calls: [
743
804
  {
@@ -748,37 +809,39 @@ describe('serialize', () => {
748
809
  maxFeePerGas: Value.fromGwei('2'),
749
810
  maxPriorityFeePerGas: Value.fromGwei('2'),
750
811
  })
751
- expect(TransactionEnvelopeAA.serialize(transaction)).toMatchInlineSnapshot(
812
+ expect(
813
+ TransactionEnvelopeTempo.serialize(transaction),
814
+ ).toMatchInlineSnapshot(
752
815
  `"0x76ef018477359400847735940080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c08082031180808080c0"`,
753
816
  )
754
817
  })
755
818
 
756
819
  test('minimal', () => {
757
- const transaction = TransactionEnvelopeAA.from({
820
+ const transaction = TransactionEnvelopeTempo.from({
758
821
  chainId: 1,
759
822
  calls: [{}],
760
823
  nonce: 0n,
761
824
  })
762
- expect(TransactionEnvelopeAA.serialize(transaction)).toMatchInlineSnapshot(
763
- `"0x76d101808080c4c3808080c0808080808080c0"`,
764
- )
825
+ expect(
826
+ TransactionEnvelopeTempo.serialize(transaction),
827
+ ).toMatchInlineSnapshot(`"0x76d101808080c4c3808080c0808080808080c0"`)
765
828
  })
766
829
 
767
830
  test('undefined nonceKey', () => {
768
- const transaction = TransactionEnvelopeAA.from({
831
+ const transaction = TransactionEnvelopeTempo.from({
769
832
  chainId: 1,
770
833
  calls: [{}],
771
834
  nonce: 0n,
772
835
  nonceKey: undefined,
773
836
  })
774
- const serialized = TransactionEnvelopeAA.serialize(transaction)
837
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
775
838
  expect(serialized).toMatchInlineSnapshot(
776
839
  `"0x76d101808080c4c3808080c0808080808080c0"`,
777
840
  )
778
841
  })
779
842
 
780
843
  test('multiple calls', () => {
781
- const transaction = TransactionEnvelopeAA.from({
844
+ const transaction = TransactionEnvelopeTempo.from({
782
845
  chainId: 1,
783
846
  calls: [
784
847
  {
@@ -792,7 +855,9 @@ describe('serialize', () => {
792
855
  ],
793
856
  nonce: 0n,
794
857
  })
795
- expect(TransactionEnvelopeAA.serialize(transaction)).toMatchInlineSnapshot(
858
+ expect(
859
+ TransactionEnvelopeTempo.serialize(transaction),
860
+ ).toMatchInlineSnapshot(
796
861
  `"0x76f84101808080f4d79470997970c51812dc3a010c7d01b50e0d17dc79c88080db943c44cdddb6a900fa2b585dd299e03d12fa4293bc8207d0821234c0808080808080c0"`,
797
862
  )
798
863
  })
@@ -815,19 +880,19 @@ describe('serialize', () => {
815
880
  }),
816
881
  })
817
882
 
818
- const transaction = TransactionEnvelopeAA.from({
883
+ const transaction = TransactionEnvelopeTempo.from({
819
884
  chainId: 1,
820
885
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
821
886
  nonce: 0n,
822
887
  keyAuthorization,
823
888
  })
824
889
 
825
- const serialized = TransactionEnvelopeAA.serialize(transaction)
890
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
826
891
  expect(serialized).toMatchInlineSnapshot(
827
892
  `"0x76f8a201808080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c0808080808080c0f87bf7808094be95c3f554e9fc85ec51be69a3d807a0d55bcf2c84499602d2dad99420c000000000000000000000000000000000000183989680b841635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f05401b"`,
828
893
  )
829
894
 
830
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
895
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
831
896
  expect(deserialized.keyAuthorization).toEqual(keyAuthorization)
832
897
  })
833
898
 
@@ -856,19 +921,19 @@ describe('serialize', () => {
856
921
  }),
857
922
  })
858
923
 
859
- const transaction = TransactionEnvelopeAA.from({
924
+ const transaction = TransactionEnvelopeTempo.from({
860
925
  chainId: 1,
861
926
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
862
927
  nonce: 0n,
863
928
  keyAuthorization,
864
929
  })
865
930
 
866
- const serialized = TransactionEnvelopeAA.serialize(transaction)
931
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
867
932
  expect(serialized).toMatchInlineSnapshot(
868
933
  `"0x76f8e301808080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c0808080808080c0f8bcf7800194be95c3f554e9fc85ec51be69a3d807a0d55bcf2c84499602d2dad99420c000000000000000000000000000000000000183989680b88201ccbb3485d4726235f13cb15ef394fb7158179fb7b1925eccec0147671090c52e77c3c53373cc1e3b05e7c23f609deb17cea8fe097300c45411237e9fe4166b35ad8ac16e167d6992c3e120d7f17d2376bc1cbcf30c46ba6dd00ce07303e742f511edf6ce1c32de66846f56afa7be1cbd729bc35750b6d0cdcf3ec9d75461aba001"`,
869
934
  )
870
935
 
871
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
936
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
872
937
  expect(deserialized.keyAuthorization).toEqual(keyAuthorization)
873
938
  })
874
939
 
@@ -907,36 +972,153 @@ describe('serialize', () => {
907
972
  }),
908
973
  })
909
974
 
910
- const transaction = TransactionEnvelopeAA.from({
975
+ const transaction = TransactionEnvelopeTempo.from({
911
976
  chainId: 1,
912
977
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
913
978
  nonce: 0n,
914
979
  keyAuthorization,
915
980
  })
916
981
 
917
- const serialized = TransactionEnvelopeAA.serialize(transaction)
982
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
918
983
  expect(serialized).toMatchInlineSnapshot(
919
984
  `"0x76f9016501808080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c0808080808080c0f9013df7800294be95c3f554e9fc85ec51be69a3d807a0d55bcf2c84499602d2dad99420c000000000000000000000000000000000000183989680b901020249960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d976305000000007b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a223371322d3777222c226f726967696e223a22687474703a2f2f6c6f63616c686f7374222c2263726f73734f726967696e223a66616c73657dccbb3485d4726235f13cb15ef394fb7158179fb7b1925eccec0147671090c52e77c3c53373cc1e3b05e7c23f609deb17cea8fe097300c45411237e9fe4166b35ad8ac16e167d6992c3e120d7f17d2376bc1cbcf30c46ba6dd00ce07303e742f511edf6ce1c32de66846f56afa7be1cbd729bc35750b6d0cdcf3ec9d75461aba0"`,
920
985
  )
921
986
 
922
987
  // Verify roundtrip
923
- const deserialized = TransactionEnvelopeAA.deserialize(serialized)
988
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
924
989
  expect(deserialized.keyAuthorization).toEqual(keyAuthorization)
925
990
  })
926
991
 
992
+ test('authorizationList (secp256k1)', () => {
993
+ const authorizationList = [
994
+ AuthorizationTempo.from({
995
+ address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
996
+ chainId: 1,
997
+ nonce: 40n,
998
+ signature: SignatureEnvelope.from({
999
+ r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
1000
+ s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
1001
+ yParity: 0,
1002
+ }),
1003
+ }),
1004
+ AuthorizationTempo.from({
1005
+ address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1006
+ chainId: 1,
1007
+ nonce: 55n,
1008
+ signature: SignatureEnvelope.from({
1009
+ r: 12345678901234567890n,
1010
+ s: 98765432109876543210n,
1011
+ yParity: 1,
1012
+ }),
1013
+ }),
1014
+ ] as const
1015
+
1016
+ const transaction = TransactionEnvelopeTempo.from({
1017
+ chainId: 1,
1018
+ calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
1019
+ nonce: 0n,
1020
+ authorizationList,
1021
+ })
1022
+
1023
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
1024
+ expect(serialized).toMatchInlineSnapshot(
1025
+ `"0x76f8de01808080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c0808080808080f8b8f85a0194be95c3f554e9fc85ec51be69a3d807a0d55bcf2c28b8416e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81bf85a019470997970c51812dc3a010c7d01b50e0d17dc79c837b841000000000000000000000000000000000000000000000000ab54a98ceb1f0ad20000000000000000000000000000000000000000000000055aa54d38e5267eea1c"`,
1026
+ )
1027
+
1028
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
1029
+ expect(deserialized.authorizationList).toEqual(authorizationList)
1030
+ })
1031
+
1032
+ test('authorizationList (multiple types)', () => {
1033
+ const privateKey = P256.randomPrivateKey()
1034
+ const publicKey = P256.getPublicKey({ privateKey })
1035
+
1036
+ const authorization1 = AuthorizationTempo.from({
1037
+ address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
1038
+ chainId: 1,
1039
+ nonce: 40n,
1040
+ })
1041
+ const secp256k1Signature = Secp256k1.sign({
1042
+ payload: AuthorizationTempo.getSignPayload(authorization1),
1043
+ privateKey,
1044
+ })
1045
+
1046
+ const authorization2 = AuthorizationTempo.from({
1047
+ address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1048
+ chainId: 1,
1049
+ nonce: 55n,
1050
+ })
1051
+ const p256Signature = P256.sign({
1052
+ payload: AuthorizationTempo.getSignPayload(authorization2),
1053
+ privateKey,
1054
+ })
1055
+
1056
+ const authorizationList = [
1057
+ AuthorizationTempo.from(authorization1, {
1058
+ signature: SignatureEnvelope.from({ signature: secp256k1Signature }),
1059
+ }),
1060
+ AuthorizationTempo.from(authorization2, {
1061
+ signature: SignatureEnvelope.from({
1062
+ signature: p256Signature,
1063
+ publicKey,
1064
+ prehash: true,
1065
+ }),
1066
+ }),
1067
+ ]
1068
+
1069
+ const transaction = TransactionEnvelopeTempo.from({
1070
+ chainId: 1,
1071
+ calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
1072
+ nonce: 0n,
1073
+ authorizationList,
1074
+ })
1075
+
1076
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
1077
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
1078
+
1079
+ expect(deserialized.authorizationList).toHaveLength(2)
1080
+ expect(deserialized.authorizationList?.[0]?.address).toBe(
1081
+ '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
1082
+ )
1083
+ expect(deserialized.authorizationList?.[0]?.signature?.type).toBe(
1084
+ 'secp256k1',
1085
+ )
1086
+ expect(deserialized.authorizationList?.[1]?.address).toBe(
1087
+ '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
1088
+ )
1089
+ expect(deserialized.authorizationList?.[1]?.signature?.type).toBe('p256')
1090
+ })
1091
+
1092
+ test('authorizationList (empty)', () => {
1093
+ const transaction = TransactionEnvelopeTempo.from({
1094
+ chainId: 1,
1095
+ calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
1096
+ nonce: 0n,
1097
+ authorizationList: [],
1098
+ })
1099
+
1100
+ const serialized = TransactionEnvelopeTempo.serialize(transaction)
1101
+ expect(serialized).toMatchInlineSnapshot(
1102
+ `"0x76e501808080d8d79470997970c51812dc3a010c7d01b50e0d17dc79c88080c0808080808080c0"`,
1103
+ )
1104
+
1105
+ const deserialized = TransactionEnvelopeTempo.deserialize(serialized)
1106
+ expect(deserialized.authorizationList).toBeUndefined()
1107
+ })
1108
+
927
1109
  describe('with signature', () => {
928
1110
  test('secp256k1', () => {
929
- const transaction = TransactionEnvelopeAA.from({
1111
+ const transaction = TransactionEnvelopeTempo.from({
930
1112
  chainId: 1,
931
1113
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
932
1114
  nonce: 0n,
933
1115
  })
934
1116
  const signature = Secp256k1.sign({
935
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1117
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
936
1118
  privateKey,
937
1119
  })
938
1120
  expect(
939
- TransactionEnvelopeAA.serialize(transaction, {
1121
+ TransactionEnvelopeTempo.serialize(transaction, {
940
1122
  signature: SignatureEnvelope.from(signature),
941
1123
  }),
942
1124
  ).toMatchInlineSnapshot(
@@ -945,7 +1127,7 @@ describe('serialize', () => {
945
1127
  })
946
1128
 
947
1129
  test('p256', () => {
948
- const transaction = TransactionEnvelopeAA.from({
1130
+ const transaction = TransactionEnvelopeTempo.from({
949
1131
  chainId: 1,
950
1132
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
951
1133
  nonce: 0n,
@@ -953,10 +1135,10 @@ describe('serialize', () => {
953
1135
  const privateKey = P256.randomPrivateKey()
954
1136
  const publicKey = P256.getPublicKey({ privateKey })
955
1137
  const signature = P256.sign({
956
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1138
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
957
1139
  privateKey,
958
1140
  })
959
- const serialized = TransactionEnvelopeAA.serialize(transaction, {
1141
+ const serialized = TransactionEnvelopeTempo.serialize(transaction, {
960
1142
  signature: SignatureEnvelope.from({
961
1143
  signature,
962
1144
  publicKey,
@@ -966,7 +1148,7 @@ describe('serialize', () => {
966
1148
  // biome-ignore lint/suspicious/noTsIgnore: _
967
1149
  // @ts-ignore
968
1150
  delete signature.yParity
969
- expect(TransactionEnvelopeAA.deserialize(serialized)).toEqual({
1151
+ expect(TransactionEnvelopeTempo.deserialize(serialized)).toEqual({
970
1152
  ...transaction,
971
1153
  nonceKey: 0n,
972
1154
  signature: { prehash: true, publicKey, signature, type: 'p256' },
@@ -975,13 +1157,13 @@ describe('serialize', () => {
975
1157
  })
976
1158
 
977
1159
  test('with feePayerSignature', () => {
978
- const transaction = TransactionEnvelopeAA.from({
1160
+ const transaction = TransactionEnvelopeTempo.from({
979
1161
  chainId: 1,
980
1162
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
981
1163
  nonce: 0n,
982
1164
  })
983
1165
  expect(
984
- TransactionEnvelopeAA.serialize(transaction, {
1166
+ TransactionEnvelopeTempo.serialize(transaction, {
985
1167
  feePayerSignature: {
986
1168
  r: 1n,
987
1169
  s: 2n,
@@ -994,13 +1176,13 @@ describe('serialize', () => {
994
1176
  })
995
1177
 
996
1178
  test('with feePayerSignature (null)', () => {
997
- const transaction = TransactionEnvelopeAA.from({
1179
+ const transaction = TransactionEnvelopeTempo.from({
998
1180
  chainId: 1,
999
1181
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
1000
1182
  nonce: 0n,
1001
1183
  })
1002
1184
  expect(
1003
- TransactionEnvelopeAA.serialize(transaction, {
1185
+ TransactionEnvelopeTempo.serialize(transaction, {
1004
1186
  feePayerSignature: null,
1005
1187
  }),
1006
1188
  ).toMatchInlineSnapshot(
@@ -1009,13 +1191,13 @@ describe('serialize', () => {
1009
1191
  })
1010
1192
 
1011
1193
  test('format: feePayer', () => {
1012
- const transaction = TransactionEnvelopeAA.from({
1194
+ const transaction = TransactionEnvelopeTempo.from({
1013
1195
  chainId: 1,
1014
1196
  calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8' }],
1015
1197
  nonce: 0n,
1016
1198
  })
1017
1199
  expect(
1018
- TransactionEnvelopeAA.serialize(transaction, {
1200
+ TransactionEnvelopeTempo.serialize(transaction, {
1019
1201
  sender: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1020
1202
  format: 'feePayer',
1021
1203
  }),
@@ -1028,7 +1210,7 @@ describe('serialize', () => {
1028
1210
  describe('hash', () => {
1029
1211
  describe('default', () => {
1030
1212
  test('secp256k1', () => {
1031
- const transaction = TransactionEnvelopeAA.from({
1213
+ const transaction = TransactionEnvelopeTempo.from({
1032
1214
  chainId: 1,
1033
1215
  calls: [
1034
1216
  {
@@ -1038,20 +1220,20 @@ describe('hash', () => {
1038
1220
  nonce: 0n,
1039
1221
  })
1040
1222
  const signature = Secp256k1.sign({
1041
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1223
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
1042
1224
  privateKey,
1043
1225
  })
1044
- const signed = TransactionEnvelopeAA.from(transaction, {
1226
+ const signed = TransactionEnvelopeTempo.from(transaction, {
1045
1227
  signature: SignatureEnvelope.from(signature),
1046
1228
  })
1047
- expect(TransactionEnvelopeAA.hash(signed)).toMatchInlineSnapshot(
1229
+ expect(TransactionEnvelopeTempo.hash(signed)).toMatchInlineSnapshot(
1048
1230
  `"0x04ad27d1607bc3fc37445724d8864b0843f88008bafd818814474e5ee94647eb"`,
1049
1231
  )
1050
1232
  })
1051
1233
  })
1052
1234
 
1053
1235
  test('presign', () => {
1054
- const transaction = TransactionEnvelopeAA.from({
1236
+ const transaction = TransactionEnvelopeTempo.from({
1055
1237
  chainId: 1,
1056
1238
  calls: [
1057
1239
  {
@@ -1061,7 +1243,7 @@ describe('hash', () => {
1061
1243
  nonce: 0n,
1062
1244
  })
1063
1245
  expect(
1064
- TransactionEnvelopeAA.hash(transaction, { presign: true }),
1246
+ TransactionEnvelopeTempo.hash(transaction, { presign: true }),
1065
1247
  ).toMatchInlineSnapshot(
1066
1248
  `"0xe1222a45806457acbe3a13940aae4c34f3180659fa16613b5a45dc183adae07c"`,
1067
1249
  )
@@ -1070,7 +1252,7 @@ describe('hash', () => {
1070
1252
 
1071
1253
  describe('getSignPayload', () => {
1072
1254
  test('default', () => {
1073
- const transaction = TransactionEnvelopeAA.from({
1255
+ const transaction = TransactionEnvelopeTempo.from({
1074
1256
  chainId: 1,
1075
1257
  calls: [
1076
1258
  {
@@ -1080,7 +1262,7 @@ describe('getSignPayload', () => {
1080
1262
  nonce: 0n,
1081
1263
  })
1082
1264
  expect(
1083
- TransactionEnvelopeAA.getSignPayload(transaction),
1265
+ TransactionEnvelopeTempo.getSignPayload(transaction),
1084
1266
  ).toMatchInlineSnapshot(
1085
1267
  `"0xe1222a45806457acbe3a13940aae4c34f3180659fa16613b5a45dc183adae07c"`,
1086
1268
  )
@@ -1089,7 +1271,7 @@ describe('getSignPayload', () => {
1089
1271
 
1090
1272
  describe('getFeePayerSignPayload', () => {
1091
1273
  test('default', () => {
1092
- const transaction = TransactionEnvelopeAA.from({
1274
+ const transaction = TransactionEnvelopeTempo.from({
1093
1275
  chainId: 1,
1094
1276
  calls: [
1095
1277
  {
@@ -1099,7 +1281,7 @@ describe('getFeePayerSignPayload', () => {
1099
1281
  nonce: 0n,
1100
1282
  })
1101
1283
  expect(
1102
- TransactionEnvelopeAA.getFeePayerSignPayload(transaction, {
1284
+ TransactionEnvelopeTempo.getFeePayerSignPayload(transaction, {
1103
1285
  sender: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1104
1286
  }),
1105
1287
  ).toMatchInlineSnapshot(
@@ -1108,7 +1290,7 @@ describe('getFeePayerSignPayload', () => {
1108
1290
  })
1109
1291
 
1110
1292
  test('with feeToken', () => {
1111
- const transaction = TransactionEnvelopeAA.from({
1293
+ const transaction = TransactionEnvelopeTempo.from({
1112
1294
  chainId: 1,
1113
1295
  calls: [
1114
1296
  {
@@ -1118,18 +1300,21 @@ describe('getFeePayerSignPayload', () => {
1118
1300
  nonce: 0n,
1119
1301
  feeToken: '0x20c0000000000000000000000000000000000000',
1120
1302
  })
1121
- const hash1 = TransactionEnvelopeAA.getFeePayerSignPayload(transaction, {
1303
+ const hash1 = TransactionEnvelopeTempo.getFeePayerSignPayload(transaction, {
1122
1304
  sender: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1123
1305
  })
1124
1306
 
1125
1307
  // Change feeToken - hash should be different
1126
- const transaction2 = TransactionEnvelopeAA.from({
1308
+ const transaction2 = TransactionEnvelopeTempo.from({
1127
1309
  ...transaction,
1128
1310
  feeToken: '0x20c0000000000000000000000000000000000001',
1129
1311
  })
1130
- const hash2 = TransactionEnvelopeAA.getFeePayerSignPayload(transaction2, {
1131
- sender: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1132
- })
1312
+ const hash2 = TransactionEnvelopeTempo.getFeePayerSignPayload(
1313
+ transaction2,
1314
+ {
1315
+ sender: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
1316
+ },
1317
+ )
1133
1318
 
1134
1319
  expect(hash1).not.toBe(hash2)
1135
1320
  })
@@ -1138,7 +1323,7 @@ describe('getFeePayerSignPayload', () => {
1138
1323
  describe('validate', () => {
1139
1324
  test('valid', () => {
1140
1325
  expect(
1141
- TransactionEnvelopeAA.validate({
1326
+ TransactionEnvelopeTempo.validate({
1142
1327
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
1143
1328
  chainId: 1,
1144
1329
  }),
@@ -1147,7 +1332,7 @@ describe('validate', () => {
1147
1332
 
1148
1333
  test('invalid (empty calls)', () => {
1149
1334
  expect(
1150
- TransactionEnvelopeAA.validate({
1335
+ TransactionEnvelopeTempo.validate({
1151
1336
  calls: [],
1152
1337
  chainId: 1,
1153
1338
  }),
@@ -1156,7 +1341,7 @@ describe('validate', () => {
1156
1341
 
1157
1342
  test('invalid (validity window)', () => {
1158
1343
  expect(
1159
- TransactionEnvelopeAA.validate({
1344
+ TransactionEnvelopeTempo.validate({
1160
1345
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
1161
1346
  chainId: 1,
1162
1347
  validBefore: 100,