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,6 +1,5 @@
1
1
  import * as AccessList from 'ox/AccessList'
2
2
  import * as Address from 'ox/Address'
3
- import type * as Authorization from 'ox/Authorization'
4
3
  import * as Errors from 'ox/Errors'
5
4
  import * as Hash from 'ox/Hash'
6
5
  import * as Hex from 'ox/Hex'
@@ -14,12 +13,13 @@ import type {
14
13
  PartialBy,
15
14
  UnionPartialBy,
16
15
  } from '../internal/types.js'
16
+ import * as AuthorizationTempo from './AuthorizationTempo.js'
17
17
  import * as KeyAuthorization from './KeyAuthorization.js'
18
18
  import * as SignatureEnvelope from './SignatureEnvelope.js'
19
19
  import * as TokenId from './TokenId.js'
20
20
 
21
21
  /**
22
- * Represents a single call within an AA transaction.
22
+ * Represents a single call within a Tempo transaction.
23
23
  */
24
24
  export type Call<bigintType = bigint> = {
25
25
  /** Call data. */
@@ -30,7 +30,7 @@ export type Call<bigintType = bigint> = {
30
30
  value?: bigintType | undefined
31
31
  }
32
32
 
33
- export type TransactionEnvelopeAA<
33
+ export type TransactionEnvelopeTempo<
34
34
  signed extends boolean = boolean,
35
35
  bigintType = bigint,
36
36
  numberType = number,
@@ -39,9 +39,9 @@ export type TransactionEnvelopeAA<
39
39
  {
40
40
  /** EIP-2930 Access List. */
41
41
  accessList?: AccessList.AccessList | undefined
42
- /** EIP-7702 Authorization list for the transaction. */
42
+ /** EIP-7702 (Tempo) Authorization list for the transaction. */
43
43
  authorizationList?:
44
- | Authorization.ListSigned<bigintType, numberType>
44
+ | AuthorizationTempo.ListSigned<bigintType, numberType>
45
45
  | undefined
46
46
  /** Array of calls to execute. */
47
47
  calls: readonly Call<bigintType>[]
@@ -93,7 +93,7 @@ export type TransactionEnvelopeAA<
93
93
  })
94
94
  >
95
95
 
96
- export type Rpc<signed extends boolean = boolean> = TransactionEnvelopeAA<
96
+ export type Rpc<signed extends boolean = boolean> = TransactionEnvelopeTempo<
97
97
  signed,
98
98
  Hex.Hex,
99
99
  Hex.Hex,
@@ -105,22 +105,22 @@ export type FeePayerMagic = typeof feePayerMagic
105
105
 
106
106
  export type Serialized = `${SerializedType}${string}`
107
107
 
108
- export type Signed = TransactionEnvelopeAA<true>
108
+ export type Signed = TransactionEnvelopeTempo<true>
109
109
 
110
110
  export const serializedType = '0x76' as const
111
111
  export type SerializedType = typeof serializedType
112
112
 
113
- export const type = 'aa' as const
113
+ export const type = 'tempo' as const
114
114
  export type Type = typeof type
115
115
 
116
116
  /**
117
- * Asserts a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA} is valid.
117
+ * Asserts a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo} is valid.
118
118
  *
119
119
  * @example
120
120
  * ```ts twoslash
121
- * import { TransactionEnvelopeAA } from 'ox/tempo'
121
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
122
122
  *
123
- * TransactionEnvelopeAA.assert({
123
+ * TransactionEnvelopeTempo.assert({
124
124
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: 0n }],
125
125
  * chainId: 1,
126
126
  * maxFeePerGas: 1000000000n,
@@ -129,7 +129,7 @@ export type Type = typeof type
129
129
  *
130
130
  * @param envelope - The transaction envelope to assert.
131
131
  */
132
- export function assert(envelope: PartialBy<TransactionEnvelopeAA, 'type'>) {
132
+ export function assert(envelope: PartialBy<TransactionEnvelopeTempo, 'type'>) {
133
133
  const {
134
134
  calls,
135
135
  chainId,
@@ -189,15 +189,15 @@ export declare namespace assert {
189
189
  }
190
190
 
191
191
  /**
192
- * Deserializes a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA} from its serialized form.
192
+ * Deserializes a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo} from its serialized form.
193
193
  *
194
194
  * @example
195
195
  * ```ts twoslash
196
- * import { TransactionEnvelopeAA } from 'ox/tempo'
196
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
197
197
  *
198
- * const envelope = TransactionEnvelopeAA.deserialize('0x76f84a0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0808080')
198
+ * const envelope = TransactionEnvelopeTempo.deserialize('0x76f84a0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0808080')
199
199
  * // @log: {
200
- * // @log: type: 'aa',
200
+ * // @log: type: 'tempo',
201
201
  * // @log: nonce: 785n,
202
202
  * // @log: maxFeePerGas: 2000000000n,
203
203
  * // @log: gas: 1000000n,
@@ -210,7 +210,7 @@ export declare namespace assert {
210
210
  */
211
211
  export function deserialize(
212
212
  serialized: Serialized,
213
- ): Compute<TransactionEnvelopeAA> {
213
+ ): Compute<TransactionEnvelopeTempo> {
214
214
  const transactionArray = Rlp.toHex(Hex.slice(serialized, 1))
215
215
 
216
216
  const [
@@ -226,7 +226,7 @@ export function deserialize(
226
226
  validAfter,
227
227
  feeToken,
228
228
  feePayerSignatureOrSender,
229
- _authorizationList, // TODO: add
229
+ authorizationList,
230
230
  keyAuthorizationOrSignature,
231
231
  maybeSignature,
232
232
  ] = transactionArray as readonly Hex.Hex[]
@@ -247,6 +247,7 @@ export function deserialize(
247
247
  )
248
248
  throw new TransactionEnvelope.InvalidSerializedError({
249
249
  attributes: {
250
+ authorizationList,
250
251
  chainId,
251
252
  maxPriorityFeePerGas,
252
253
  maxFeePerGas,
@@ -273,7 +274,7 @@ export function deserialize(
273
274
  let transaction = {
274
275
  chainId: Number(chainId),
275
276
  type,
276
- } as TransactionEnvelopeAA
277
+ } as TransactionEnvelopeTempo
277
278
 
278
279
  if (Hex.validate(gas) && gas !== '0x') transaction.gas = BigInt(gas)
279
280
  if (Hex.validate(nonce))
@@ -307,6 +308,11 @@ export function deserialize(
307
308
  if (accessList?.length !== 0 && accessList !== '0x')
308
309
  transaction.accessList = AccessList.fromTupleList(accessList as never)
309
310
 
311
+ if (authorizationList?.length !== 0 && authorizationList !== '0x')
312
+ transaction.authorizationList = AuthorizationTempo.fromTupleList(
313
+ authorizationList as never,
314
+ )
315
+
310
316
  if (
311
317
  feePayerSignatureOrSender !== '0x' &&
312
318
  feePayerSignatureOrSender !== undefined
@@ -346,14 +352,14 @@ export declare namespace deserialize {
346
352
  }
347
353
 
348
354
  /**
349
- * Converts an arbitrary transaction object into an AA Transaction Envelope.
355
+ * Converts an arbitrary transaction object into a Tempo Transaction Envelope.
350
356
  *
351
357
  * @example
352
358
  * ```ts twoslash
353
359
  * import { Value } from 'ox'
354
- * import { TransactionEnvelopeAA } from 'ox/tempo'
360
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
355
361
  *
356
- * const envelope = TransactionEnvelopeAA.from({ // [!code focus]
362
+ * const envelope = TransactionEnvelopeTempo.from({ // [!code focus]
357
363
  * chainId: 1, // [!code focus]
358
364
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: Value.fromEther('1') }], // [!code focus]
359
365
  * maxFeePerGas: Value.fromGwei('10'), // [!code focus]
@@ -369,9 +375,9 @@ export declare namespace deserialize {
369
375
  * ```ts twoslash
370
376
  * // @noErrors
371
377
  * import { Secp256k1, Value } from 'ox'
372
- * import { TransactionEnvelopeAA } from 'ox/tempo'
378
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
373
379
  *
374
- * const envelope = TransactionEnvelopeAA.from({
380
+ * const envelope = TransactionEnvelopeTempo.from({
375
381
  * chainId: 1,
376
382
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: Value.fromEther('1') }],
377
383
  * maxFeePerGas: Value.fromGwei('10'),
@@ -379,11 +385,11 @@ export declare namespace deserialize {
379
385
  * })
380
386
  *
381
387
  * const signature = Secp256k1.sign({
382
- * payload: TransactionEnvelopeAA.getSignPayload(envelope),
388
+ * payload: TransactionEnvelopeTempo.getSignPayload(envelope),
383
389
  * privateKey: '0x...',
384
390
  * })
385
391
  *
386
- * const envelope_signed = TransactionEnvelopeAA.from(envelope, { // [!code focus]
392
+ * const envelope_signed = TransactionEnvelopeTempo.from(envelope, { // [!code focus]
387
393
  * signature, // [!code focus]
388
394
  * }) // [!code focus]
389
395
  * // @log: {
@@ -391,7 +397,7 @@ export declare namespace deserialize {
391
397
  * // @log: calls: [{ to: '0x0000000000000000000000000000000000000000', value: 1000000000000000000n }],
392
398
  * // @log: maxFeePerGas: 10000000000n,
393
399
  * // @log: maxPriorityFeePerGas: 1000000000n,
394
- * // @log: type: 'aa',
400
+ * // @log: type: 'tempo',
395
401
  * // @log: r: 125...n,
396
402
  * // @log: s: 642...n,
397
403
  * // @log: yParity: 0,
@@ -401,27 +407,27 @@ export declare namespace deserialize {
401
407
  * @example
402
408
  * ### From Serialized
403
409
  *
404
- * It is possible to instantiate an AA Transaction Envelope from a {@link ox#TransactionEnvelopeAA.Serialized} value.
410
+ * It is possible to instantiate a Tempo Transaction Envelope from a {@link ox#TransactionEnvelopeTempo.Serialized} value.
405
411
  *
406
412
  * ```ts twoslash
407
- * import { TransactionEnvelopeAA } from 'ox/tempo'
413
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
408
414
  *
409
- * const envelope = TransactionEnvelopeAA.from('0x76f84a0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0808080')
415
+ * const envelope = TransactionEnvelopeTempo.from('0x76f84a0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0808080')
410
416
  * // @log: {
411
417
  * // @log: chainId: 1,
412
418
  * // @log: calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n }],
413
419
  * // @log: maxFeePerGas: 10000000000n,
414
- * // @log: type: 'aa',
420
+ * // @log: type: 'tempo',
415
421
  * // @log: }
416
422
  * ```
417
423
  *
418
424
  * @param envelope - The transaction object to convert.
419
425
  * @param options - Options.
420
- * @returns An AA Transaction Envelope.
426
+ * @returns A Tempo Transaction Envelope.
421
427
  */
422
428
  export function from<
423
429
  const envelope extends
424
- | UnionPartialBy<TransactionEnvelopeAA, 'type'>
430
+ | UnionPartialBy<TransactionEnvelopeTempo, 'type'>
425
431
  | Serialized,
426
432
  const signature extends
427
433
  | SignatureEnvelope.SignatureEnvelope
@@ -429,7 +435,7 @@ export function from<
429
435
  >(
430
436
  envelope:
431
437
  | envelope
432
- | UnionPartialBy<TransactionEnvelopeAA, 'type'>
438
+ | UnionPartialBy<TransactionEnvelopeTempo, 'type'>
433
439
  | Serialized,
434
440
  options: from.Options<signature> = {},
435
441
  ): from.ReturnValue<envelope, signature> {
@@ -437,7 +443,7 @@ export function from<
437
443
 
438
444
  const envelope_ = (
439
445
  typeof envelope === 'string' ? deserialize(envelope) : envelope
440
- ) as TransactionEnvelopeAA
446
+ ) as TransactionEnvelopeTempo
441
447
 
442
448
  assert(envelope_)
443
449
 
@@ -447,7 +453,7 @@ export function from<
447
453
  ...(feePayerSignature
448
454
  ? { feePayerSignature: Signature.from(feePayerSignature) }
449
455
  : {}),
450
- type: 'aa',
456
+ type: 'tempo',
451
457
  } as never
452
458
  }
453
459
 
@@ -462,21 +468,21 @@ export declare namespace from {
462
468
  }
463
469
 
464
470
  type ReturnValue<
465
- envelope extends UnionPartialBy<TransactionEnvelopeAA, 'type'> | Hex.Hex =
466
- | TransactionEnvelopeAA
467
- | Hex.Hex,
471
+ envelope extends
472
+ | UnionPartialBy<TransactionEnvelopeTempo, 'type'>
473
+ | Hex.Hex = TransactionEnvelopeTempo | Hex.Hex,
468
474
  signature extends
469
475
  | SignatureEnvelope.SignatureEnvelope
470
476
  | undefined = undefined,
471
477
  > = Compute<
472
478
  envelope extends Hex.Hex
473
- ? TransactionEnvelopeAA
479
+ ? TransactionEnvelopeTempo
474
480
  : Assign<
475
481
  envelope,
476
482
  (signature extends SignatureEnvelope.SignatureEnvelope
477
483
  ? { signature: SignatureEnvelope.from.ReturnValue<signature> }
478
484
  : {}) & {
479
- readonly type: 'aa'
485
+ readonly type: 'tempo'
480
486
  }
481
487
  >
482
488
  >
@@ -488,21 +494,21 @@ export declare namespace from {
488
494
  }
489
495
 
490
496
  /**
491
- * Serializes a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA}.
497
+ * Serializes a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo}.
492
498
  *
493
499
  * @example
494
500
  * ```ts twoslash
495
501
  * // @noErrors
496
502
  * import { Value } from 'ox'
497
- * import { TransactionEnvelopeAA } from 'ox/tempo'
503
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
498
504
  *
499
- * const envelope = TransactionEnvelopeAA.from({
505
+ * const envelope = TransactionEnvelopeTempo.from({
500
506
  * chainId: 1,
501
507
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: Value.fromEther('1') }],
502
508
  * maxFeePerGas: Value.fromGwei('10'),
503
509
  * })
504
510
  *
505
- * const serialized = TransactionEnvelopeAA.serialize(envelope) // [!code focus]
511
+ * const serialized = TransactionEnvelopeTempo.serialize(envelope) // [!code focus]
506
512
  * ```
507
513
  *
508
514
  * @example
@@ -513,20 +519,20 @@ export declare namespace from {
513
519
  * ```ts twoslash
514
520
  * // @noErrors
515
521
  * import { Secp256k1, Value } from 'ox'
516
- * import { TransactionEnvelopeAA } from 'ox/tempo'
522
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
517
523
  *
518
- * const envelope = TransactionEnvelopeAA.from({
524
+ * const envelope = TransactionEnvelopeTempo.from({
519
525
  * chainId: 1,
520
526
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: Value.fromEther('1') }],
521
527
  * maxFeePerGas: Value.fromGwei('10'),
522
528
  * })
523
529
  *
524
530
  * const signature = Secp256k1.sign({
525
- * payload: TransactionEnvelopeAA.getSignPayload(envelope),
531
+ * payload: TransactionEnvelopeTempo.getSignPayload(envelope),
526
532
  * privateKey: '0x...',
527
533
  * })
528
534
  *
529
- * const serialized = TransactionEnvelopeAA.serialize(envelope, { // [!code focus]
535
+ * const serialized = TransactionEnvelopeTempo.serialize(envelope, { // [!code focus]
530
536
  * signature, // [!code focus]
531
537
  * }) // [!code focus]
532
538
  *
@@ -538,11 +544,12 @@ export declare namespace from {
538
544
  * @returns The serialized Transaction Envelope.
539
545
  */
540
546
  export function serialize(
541
- envelope: PartialBy<TransactionEnvelopeAA, 'type'>,
547
+ envelope: PartialBy<TransactionEnvelopeTempo, 'type'>,
542
548
  options: serialize.Options = {},
543
549
  ): Serialized {
544
550
  const {
545
551
  accessList,
552
+ authorizationList,
546
553
  calls,
547
554
  chainId,
548
555
  feeToken,
@@ -561,6 +568,9 @@ export function serialize(
561
568
  const accessTupleList = AccessList.toTupleList(accessList)
562
569
  const signature = options.signature || envelope.signature
563
570
 
571
+ const authorizationTupleList =
572
+ AuthorizationTempo.toTupleList(authorizationList)
573
+
564
574
  // Encode calls as RLP list of [to, value, data] tuples
565
575
  const callsTupleList = calls.map((call) => [
566
576
  call.to ?? '0x',
@@ -594,7 +604,7 @@ export function serialize(
594
604
  ? TokenId.toAddress(feeToken)
595
605
  : '0x',
596
606
  feePayerSignatureOrSender,
597
- [], // TODO: authList
607
+ authorizationTupleList,
598
608
  ...(keyAuthorization ? [KeyAuthorization.toTuple(keyAuthorization)] : []),
599
609
  ...(signature
600
610
  ? [SignatureEnvelope.serialize(SignatureEnvelope.from(signature))]
@@ -649,7 +659,7 @@ export declare namespace serialize {
649
659
  }
650
660
 
651
661
  /**
652
- * Returns the payload to sign for a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA}.
662
+ * Returns the payload to sign for a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo}.
653
663
  *
654
664
  * @example
655
665
  * The example below demonstrates how to compute the sign payload which can be used
@@ -658,9 +668,9 @@ export declare namespace serialize {
658
668
  * ```ts twoslash
659
669
  * // @noErrors
660
670
  * import { Secp256k1 } from 'ox'
661
- * import { TransactionEnvelopeAA } from 'ox/tempo'
671
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
662
672
  *
663
- * const envelope = TransactionEnvelopeAA.from({
673
+ * const envelope = TransactionEnvelopeTempo.from({
664
674
  * chainId: 1,
665
675
  * calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n }],
666
676
  * nonce: 0n,
@@ -668,7 +678,7 @@ export declare namespace serialize {
668
678
  * gas: 21000n,
669
679
  * })
670
680
  *
671
- * const payload = TransactionEnvelopeAA.getSignPayload(envelope) // [!code focus]
681
+ * const payload = TransactionEnvelopeTempo.getSignPayload(envelope) // [!code focus]
672
682
  * // @log: '0x...'
673
683
  *
674
684
  * const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
@@ -678,7 +688,7 @@ export declare namespace serialize {
678
688
  * @returns The sign payload.
679
689
  */
680
690
  export function getSignPayload(
681
- envelope: TransactionEnvelopeAA,
691
+ envelope: TransactionEnvelopeTempo,
682
692
  ): getSignPayload.ReturnValue {
683
693
  return hash(envelope, { presign: true })
684
694
  }
@@ -690,15 +700,15 @@ export declare namespace getSignPayload {
690
700
  }
691
701
 
692
702
  /**
693
- * Hashes a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA}. This is the "transaction hash".
703
+ * Hashes a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo}. This is the "transaction hash".
694
704
  *
695
705
  * @example
696
706
  * ```ts twoslash
697
707
  * // @noErrors
698
708
  * import { Secp256k1 } from 'ox'
699
- * import { TransactionEnvelopeAA } from 'ox/tempo'
709
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
700
710
  *
701
- * const envelope = TransactionEnvelopeAA.from({
711
+ * const envelope = TransactionEnvelopeTempo.from({
702
712
  * chainId: 1,
703
713
  * calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n }],
704
714
  * nonce: 0n,
@@ -707,21 +717,21 @@ export declare namespace getSignPayload {
707
717
  * })
708
718
  *
709
719
  * const signature = Secp256k1.sign({
710
- * payload: TransactionEnvelopeAA.getSignPayload(envelope),
720
+ * payload: TransactionEnvelopeTempo.getSignPayload(envelope),
711
721
  * privateKey: '0x...'
712
722
  * })
713
723
  *
714
- * const envelope_signed = TransactionEnvelopeAA.from(envelope, { signature })
724
+ * const envelope_signed = TransactionEnvelopeTempo.from(envelope, { signature })
715
725
  *
716
- * const hash = TransactionEnvelopeAA.hash(envelope_signed) // [!code focus]
726
+ * const hash = TransactionEnvelopeTempo.hash(envelope_signed) // [!code focus]
717
727
  * ```
718
728
  *
719
- * @param envelope - The AA Transaction Envelope to hash.
729
+ * @param envelope - The Tempo Transaction Envelope to hash.
720
730
  * @param options - Options.
721
731
  * @returns The hash of the transaction envelope.
722
732
  */
723
733
  export function hash<presign extends boolean = false>(
724
- envelope: TransactionEnvelopeAA<presign extends true ? false : true>,
734
+ envelope: TransactionEnvelopeTempo<presign extends true ? false : true>,
725
735
  options: hash.Options<presign> = {},
726
736
  ): hash.ReturnValue {
727
737
  const serialized = serialize({
@@ -754,15 +764,15 @@ export declare namespace hash {
754
764
  }
755
765
 
756
766
  /**
757
- * Returns the fee payer payload to sign for a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA}.
767
+ * Returns the fee payer payload to sign for a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo}.
758
768
  *
759
769
  * @example
760
770
  * ```ts twoslash
761
771
  * // @noErrors
762
772
  * import { Secp256k1 } from 'ox'
763
- * import { TransactionEnvelopeAA } from 'ox/tempo'
773
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
764
774
  *
765
- * const envelope = TransactionEnvelopeAA.from({
775
+ * const envelope = TransactionEnvelopeTempo.from({
766
776
  * chainId: 1,
767
777
  * calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n }],
768
778
  * nonce: 0n,
@@ -770,7 +780,7 @@ export declare namespace hash {
770
780
  * gas: 21000n,
771
781
  * })
772
782
  *
773
- * const payload = TransactionEnvelopeAA.getFeePayerSignPayload(envelope, {
783
+ * const payload = TransactionEnvelopeTempo.getFeePayerSignPayload(envelope, {
774
784
  * sender: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
775
785
  * }) // [!code focus]
776
786
  * // @log: '0x...'
@@ -783,7 +793,7 @@ export declare namespace hash {
783
793
  * @returns The fee payer sign payload.
784
794
  */
785
795
  export function getFeePayerSignPayload(
786
- envelope: TransactionEnvelopeAA,
796
+ envelope: TransactionEnvelopeTempo,
787
797
  options: getFeePayerSignPayload.Options,
788
798
  ): getFeePayerSignPayload.ReturnValue {
789
799
  const { sender } = options
@@ -811,13 +821,13 @@ export declare namespace getFeePayerSignPayload {
811
821
  }
812
822
 
813
823
  /**
814
- * Validates a {@link ox#TransactionEnvelopeAA.TransactionEnvelopeAA}. Returns `true` if the envelope is valid, `false` otherwise.
824
+ * Validates a {@link ox#TransactionEnvelopeTempo.TransactionEnvelopeTempo}. Returns `true` if the envelope is valid, `false` otherwise.
815
825
  *
816
826
  * @example
817
827
  * ```ts twoslash
818
- * import { TransactionEnvelopeAA } from 'ox/tempo'
828
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
819
829
  *
820
- * const valid = TransactionEnvelopeAA.validate({
830
+ * const valid = TransactionEnvelopeTempo.validate({
821
831
  * calls: [{ to: '0x0000000000000000000000000000000000000000', value: 0n }],
822
832
  * chainId: 1,
823
833
  * maxFeePerGas: 1000000000n,
@@ -827,7 +837,9 @@ export declare namespace getFeePayerSignPayload {
827
837
  *
828
838
  * @param envelope - The transaction envelope to validate.
829
839
  */
830
- export function validate(envelope: PartialBy<TransactionEnvelopeAA, 'type'>) {
840
+ export function validate(
841
+ envelope: PartialBy<TransactionEnvelopeTempo, 'type'>,
842
+ ) {
831
843
  try {
832
844
  assert(envelope)
833
845
  return true
@@ -845,17 +857,17 @@ export declare namespace validate {
845
857
  *
846
858
  * @example
847
859
  * ```ts twoslash
848
- * import { TransactionEnvelopeAA } from 'ox/tempo'
860
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
849
861
  *
850
- * TransactionEnvelopeAA.assert({
862
+ * TransactionEnvelopeTempo.assert({
851
863
  * calls: [],
852
864
  * chainId: 1,
853
865
  * })
854
- * // @error: TransactionEnvelopeAA.CallsEmptyError: Calls list cannot be empty.
866
+ * // @error: TransactionEnvelopeTempo.CallsEmptyError: Calls list cannot be empty.
855
867
  * ```
856
868
  */
857
869
  export class CallsEmptyError extends Errors.BaseError {
858
- override readonly name = 'TransactionEnvelopeAA.CallsEmptyError'
870
+ override readonly name = 'TransactionEnvelopeTempo.CallsEmptyError'
859
871
  constructor() {
860
872
  super('Calls list cannot be empty.')
861
873
  }
@@ -866,19 +878,19 @@ export class CallsEmptyError extends Errors.BaseError {
866
878
  *
867
879
  * @example
868
880
  * ```ts twoslash
869
- * import { TransactionEnvelopeAA } from 'ox/tempo'
881
+ * import { TransactionEnvelopeTempo } from 'ox/tempo'
870
882
  *
871
- * TransactionEnvelopeAA.assert({
883
+ * TransactionEnvelopeTempo.assert({
872
884
  * calls: [{ to: '0x0000000000000000000000000000000000000000' }],
873
885
  * chainId: 1,
874
886
  * validBefore: 100n,
875
887
  * validAfter: 200n,
876
888
  * })
877
- * // @error: TransactionEnvelopeAA.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (200).
889
+ * // @error: TransactionEnvelopeTempo.InvalidValidityWindowError: validBefore (100) must be greater than validAfter (200).
878
890
  * ```
879
891
  */
880
892
  export class InvalidValidityWindowError extends Errors.BaseError {
881
- override readonly name = 'TransactionEnvelopeAA.InvalidValidityWindowError'
893
+ override readonly name = 'TransactionEnvelopeTempo.InvalidValidityWindowError'
882
894
  constructor({
883
895
  validBefore,
884
896
  validAfter,
@@ -29,7 +29,7 @@ export type Rpc = TransactionReceipt<
29
29
  Hex.Hex
30
30
  >
31
31
 
32
- export type Type = 'aa' | ox_TransactionReceipt.Type
32
+ export type Type = 'tempo' | ox_TransactionReceipt.Type
33
33
 
34
34
  export type RpcType = '0x76' | ox_TransactionReceipt.RpcType
35
35
 
@@ -40,13 +40,13 @@ export type RpcStatus = ox_TransactionReceipt.RpcStatus
40
40
  /** RPC type to type mapping. */
41
41
  export const fromRpcType = {
42
42
  ...ox_TransactionReceipt.fromRpcType,
43
- '0x76': 'aa',
43
+ '0x76': 'tempo',
44
44
  } as const
45
45
 
46
46
  /** Type to RPC type mapping. */
47
47
  export const toRpcType = {
48
48
  ...ox_TransactionReceipt.toRpcType,
49
- aa: '0x76',
49
+ tempo: '0x76',
50
50
  } as const
51
51
 
52
52
  /**
@@ -1,12 +1,12 @@
1
- import type * as Authorization from 'ox/Authorization'
2
1
  import type * as Errors from 'ox/Errors'
3
2
  import * as Hex from 'ox/Hex'
4
3
  import * as ox_TransactionRequest from 'ox/TransactionRequest'
5
4
  import type { Compute } from '../internal/types.js'
5
+ import * as AuthorizationTempo from './AuthorizationTempo.js'
6
6
  import * as KeyAuthorization from './KeyAuthorization.js'
7
7
  import * as TokenId from './TokenId.js'
8
8
  import * as Transaction from './Transaction.js'
9
- import type { Call } from './TransactionEnvelopeAA.js'
9
+ import type { Call } from './TransactionEnvelopeTempo.js'
10
10
 
11
11
  type KeyType = 'secp256k1' | 'p256' | 'webAuthn'
12
12
 
@@ -16,7 +16,13 @@ export type TransactionRequest<
16
16
  numberType = number,
17
17
  type extends string = string,
18
18
  > = Compute<
19
- ox_TransactionRequest.TransactionRequest<bigintType, numberType, type> & {
19
+ Omit<
20
+ ox_TransactionRequest.TransactionRequest<bigintType, numberType, type>,
21
+ 'authorizationList'
22
+ > & {
23
+ authorizationList?:
24
+ | AuthorizationTempo.ListSigned<bigintType, numberType>
25
+ | undefined
20
26
  calls?: readonly Call<bigintType>[] | undefined
21
27
  keyAuthorization?: KeyAuthorization.KeyAuthorization<true> | undefined
22
28
  keyData?: Hex.Hex | undefined
@@ -31,8 +37,9 @@ export type TransactionRequest<
31
37
  /** RPC representation of a {@link ox#TransactionRequest.TransactionRequest}. */
32
38
  export type Rpc = Omit<
33
39
  TransactionRequest<Hex.Hex, Hex.Hex, string>,
34
- 'keyAuthorization'
40
+ 'authorizationList' | 'keyAuthorization'
35
41
  > & {
42
+ authorizationList?: AuthorizationTempo.ListRpc | undefined
36
43
  keyAuthorization?: KeyAuthorization.Rpc | undefined
37
44
  nonceKey?: Hex.Hex | undefined
38
45
  }
@@ -81,8 +88,15 @@ export type Rpc = Omit<
81
88
  * @returns An RPC request.
82
89
  */
83
90
  export function toRpc(request: TransactionRequest): Rpc {
84
- const request_rpc = ox_TransactionRequest.toRpc(request) as Rpc
91
+ const request_rpc = ox_TransactionRequest.toRpc({
92
+ ...request,
93
+ authorizationList: undefined,
94
+ }) as Rpc
85
95
 
96
+ if (request.authorizationList)
97
+ request_rpc.authorizationList = AuthorizationTempo.toRpcList(
98
+ request.authorizationList,
99
+ )
86
100
  if (request.calls)
87
101
  request_rpc.calls = request.calls.map((call) => ({
88
102
  to: call.to ?? '0x',
@@ -113,9 +127,9 @@ export function toRpc(request: TransactionRequest): Rpc {
113
127
  typeof request.feeToken !== 'undefined' ||
114
128
  typeof request.validBefore !== 'undefined' ||
115
129
  typeof request.validAfter !== 'undefined' ||
116
- request.type === 'aa'
130
+ request.type === 'tempo'
117
131
  ) {
118
- request_rpc.type = Transaction.toRpcType.aa
132
+ request_rpc.type = Transaction.toRpcType.tempo
119
133
  delete request_rpc.data
120
134
  delete request_rpc.input
121
135
  delete request_rpc.to
@@ -127,7 +141,7 @@ export function toRpc(request: TransactionRequest): Rpc {
127
141
 
128
142
  export declare namespace toRpc {
129
143
  export type ErrorType =
130
- | Authorization.toRpcList.ErrorType
144
+ | AuthorizationTempo.toRpcList.ErrorType
131
145
  | Hex.fromNumber.ErrorType
132
146
  | Errors.GlobalErrorType
133
147
  }