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,5 +1,6 @@
1
1
  import {
2
2
  Address,
3
+ Hex,
3
4
  P256,
4
5
  Secp256k1,
5
6
  Value,
@@ -10,9 +11,13 @@ import { getTransactionCount } from 'viem/actions'
10
11
  import { beforeEach, describe, expect, test } from 'vitest'
11
12
  import { chainId } from '../../test/config.js'
12
13
  import { client, fundAddress } from '../../test/viem/config.js'
13
- import { KeyAuthorization, SignatureEnvelope } from './index.js'
14
+ import {
15
+ AuthorizationTempo,
16
+ KeyAuthorization,
17
+ SignatureEnvelope,
18
+ } from './index.js'
14
19
  import * as Transaction from './Transaction.js'
15
- import * as TransactionEnvelopeAA from './TransactionEnvelopeAA.js'
20
+ import * as TransactionEnvelopeTempo from './TransactionEnvelopeTempo.js'
16
21
  import * as TransactionReceipt from './TransactionReceipt.js'
17
22
 
18
23
  test('behavior: default (secp256k1)', async () => {
@@ -28,7 +33,7 @@ test('behavior: default (secp256k1)', async () => {
28
33
  blockTag: 'pending',
29
34
  })
30
35
 
31
- const transaction = TransactionEnvelopeAA.from({
36
+ const transaction = TransactionEnvelopeTempo.from({
32
37
  calls: [
33
38
  {
34
39
  to: '0x0000000000000000000000000000000000000000',
@@ -43,11 +48,11 @@ test('behavior: default (secp256k1)', async () => {
43
48
  })
44
49
 
45
50
  const signature = Secp256k1.sign({
46
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
51
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
47
52
  privateKey,
48
53
  })
49
54
 
50
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
55
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
51
56
  signature: SignatureEnvelope.from(signature),
52
57
  })
53
58
 
@@ -96,8 +101,8 @@ test('behavior: default (secp256k1)', async () => {
96
101
  expect(transactionIndex).toBeDefined()
97
102
  expect(rest).toMatchInlineSnapshot(`
98
103
  {
99
- "aaAuthorizationList": [],
100
104
  "accessList": [],
105
+ "authorizationList": [],
101
106
  "calls": [
102
107
  {
103
108
  "data": "0x",
@@ -110,7 +115,7 @@ test('behavior: default (secp256k1)', async () => {
110
115
  "gas": 100000n,
111
116
  "gasPrice": 20000000000n,
112
117
  "nonceKey": 0n,
113
- "type": "aa",
118
+ "type": "tempo",
114
119
  "validAfter": null,
115
120
  "validBefore": null,
116
121
  "value": 0n,
@@ -154,6 +159,73 @@ test('behavior: default (secp256k1)', async () => {
154
159
  `)
155
160
  })
156
161
 
162
+ test('behavior: authorizationList (secp256k1)', async () => {
163
+ const privateKey = Secp256k1.randomPrivateKey()
164
+ const address = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey }))
165
+
166
+ await fundAddress(client, {
167
+ address,
168
+ })
169
+
170
+ const nonce = await getTransactionCount(client, {
171
+ address,
172
+ blockTag: 'pending',
173
+ })
174
+
175
+ const authorization = AuthorizationTempo.from({
176
+ address: '0x0000000000000000000000000000000000000001',
177
+ chainId: 0,
178
+ nonce: BigInt(nonce + 1),
179
+ })
180
+
181
+ const authorizationSigned = AuthorizationTempo.from(authorization, {
182
+ signature: SignatureEnvelope.from(
183
+ Secp256k1.sign({
184
+ payload: AuthorizationTempo.getSignPayload(authorization),
185
+ privateKey,
186
+ }),
187
+ ),
188
+ })
189
+
190
+ const transaction = TransactionEnvelopeTempo.from({
191
+ authorizationList: [authorizationSigned],
192
+ calls: [
193
+ {
194
+ to: '0x0000000000000000000000000000000000000000',
195
+ },
196
+ ],
197
+ chainId,
198
+ feeToken: '0x20c0000000000000000000000000000000000001',
199
+ nonce: BigInt(nonce),
200
+ gas: 100_000n,
201
+ maxFeePerGas: Value.fromGwei('20'),
202
+ maxPriorityFeePerGas: Value.fromGwei('10'),
203
+ })
204
+
205
+ const signature = Secp256k1.sign({
206
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
207
+ privateKey,
208
+ })
209
+
210
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
211
+ signature: SignatureEnvelope.from(signature),
212
+ })
213
+
214
+ const receipt = (await client
215
+ .request({
216
+ method: 'eth_sendRawTransactionSync',
217
+ params: [serialized_signed],
218
+ })
219
+ .then((tx) => TransactionReceipt.fromRpc(tx as any)))!
220
+ expect(receipt).toBeDefined()
221
+
222
+ const code = await client.request({
223
+ method: 'eth_getCode',
224
+ params: [address, 'latest'],
225
+ })
226
+ expect(Hex.slice(code, 3)).toBe('0x0000000000000000000000000000000000000001')
227
+ })
228
+
157
229
  test('behavior: default (p256)', async () => {
158
230
  const privateKey = P256.randomPrivateKey()
159
231
  const publicKey = P256.getPublicKey({ privateKey })
@@ -163,7 +235,7 @@ test('behavior: default (p256)', async () => {
163
235
  address,
164
236
  })
165
237
 
166
- const transaction = TransactionEnvelopeAA.from({
238
+ const transaction = TransactionEnvelopeTempo.from({
167
239
  calls: [
168
240
  {
169
241
  to: '0x0000000000000000000000000000000000000000',
@@ -177,12 +249,12 @@ test('behavior: default (p256)', async () => {
177
249
  })
178
250
 
179
251
  const signature = P256.sign({
180
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
252
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
181
253
  privateKey,
182
254
  hash: false,
183
255
  })
184
256
 
185
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
257
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
186
258
  signature: SignatureEnvelope.from({
187
259
  signature,
188
260
  publicKey,
@@ -236,8 +308,8 @@ test('behavior: default (p256)', async () => {
236
308
  expect(transactionIndex).toBeDefined()
237
309
  expect(rest).toMatchInlineSnapshot(`
238
310
  {
239
- "aaAuthorizationList": [],
240
311
  "accessList": [],
312
+ "authorizationList": [],
241
313
  "calls": [
242
314
  {
243
315
  "data": "0x",
@@ -250,7 +322,7 @@ test('behavior: default (p256)', async () => {
250
322
  "gas": 100000n,
251
323
  "gasPrice": 20000000000n,
252
324
  "nonceKey": 0n,
253
- "type": "aa",
325
+ "type": "tempo",
254
326
  "validAfter": null,
255
327
  "validBefore": null,
256
328
  "value": 0n,
@@ -302,7 +374,7 @@ test('behavior: default (p256 - webcrypto)', async () => {
302
374
  address,
303
375
  })
304
376
 
305
- const transaction = TransactionEnvelopeAA.from({
377
+ const transaction = TransactionEnvelopeTempo.from({
306
378
  calls: [
307
379
  {
308
380
  to: '0x0000000000000000000000000000000000000000',
@@ -316,11 +388,11 @@ test('behavior: default (p256 - webcrypto)', async () => {
316
388
  })
317
389
 
318
390
  const signature = await WebCryptoP256.sign({
319
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
391
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
320
392
  privateKey: keyPair.privateKey,
321
393
  })
322
394
 
323
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
395
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
324
396
  signature: SignatureEnvelope.from({
325
397
  signature,
326
398
  publicKey: keyPair.publicKey,
@@ -375,8 +447,8 @@ test('behavior: default (p256 - webcrypto)', async () => {
375
447
  expect(transactionIndex).toBeDefined()
376
448
  expect(rest).toMatchInlineSnapshot(`
377
449
  {
378
- "aaAuthorizationList": [],
379
450
  "accessList": [],
451
+ "authorizationList": [],
380
452
  "calls": [
381
453
  {
382
454
  "data": "0x",
@@ -389,7 +461,7 @@ test('behavior: default (p256 - webcrypto)', async () => {
389
461
  "gas": 100000n,
390
462
  "gasPrice": 20000000000n,
391
463
  "nonceKey": 0n,
392
- "type": "aa",
464
+ "type": "tempo",
393
465
  "validAfter": null,
394
466
  "validBefore": null,
395
467
  "value": 0n,
@@ -442,7 +514,7 @@ test('behavior: default (webauthn)', async () => {
442
514
  address,
443
515
  })
444
516
 
445
- const transaction = TransactionEnvelopeAA.from({
517
+ const transaction = TransactionEnvelopeTempo.from({
446
518
  calls: [
447
519
  {
448
520
  to: '0x0000000000000000000000000000000000000000',
@@ -456,7 +528,7 @@ test('behavior: default (webauthn)', async () => {
456
528
  })
457
529
 
458
530
  const { metadata, payload } = WebAuthnP256.getSignPayload({
459
- challenge: TransactionEnvelopeAA.getSignPayload(transaction),
531
+ challenge: TransactionEnvelopeTempo.getSignPayload(transaction),
460
532
  rpId: 'localhost',
461
533
  origin: 'http://localhost',
462
534
  })
@@ -467,7 +539,7 @@ test('behavior: default (webauthn)', async () => {
467
539
  hash: true,
468
540
  })
469
541
 
470
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
542
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
471
543
  signature: SignatureEnvelope.from({
472
544
  signature,
473
545
  publicKey,
@@ -521,8 +593,8 @@ test('behavior: default (webauthn)', async () => {
521
593
  expect(transactionIndex).toBeDefined()
522
594
  expect(rest).toMatchInlineSnapshot(`
523
595
  {
524
- "aaAuthorizationList": [],
525
596
  "accessList": [],
597
+ "authorizationList": [],
526
598
  "calls": [
527
599
  {
528
600
  "data": "0x",
@@ -535,7 +607,7 @@ test('behavior: default (webauthn)', async () => {
535
607
  "gas": 100000n,
536
608
  "gasPrice": 20000000000n,
537
609
  "nonceKey": 0n,
538
- "type": "aa",
610
+ "type": "tempo",
539
611
  "validAfter": null,
540
612
  "validBefore": null,
541
613
  "value": 0n,
@@ -603,7 +675,7 @@ test('behavior: feePayerSignature (user → feePayer)', async () => {
603
675
  //////////////////////////////////////////////////////////////////
604
676
  // Sender flow
605
677
 
606
- const transaction = TransactionEnvelopeAA.from({
678
+ const transaction = TransactionEnvelopeTempo.from({
607
679
  calls: [{ to: '0x0000000000000000000000000000000000000000', value: 0n }],
608
680
  chainId,
609
681
  feePayerSignature: null,
@@ -614,32 +686,32 @@ test('behavior: feePayerSignature (user → feePayer)', async () => {
614
686
  })
615
687
 
616
688
  const signature = Secp256k1.sign({
617
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
689
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
618
690
  // unfunded PK
619
691
  privateKey: senderPrivateKey,
620
692
  })
621
693
 
622
- const transaction_signed = TransactionEnvelopeAA.from(transaction, {
694
+ const transaction_signed = TransactionEnvelopeTempo.from(transaction, {
623
695
  signature: SignatureEnvelope.from(signature),
624
696
  })
625
697
 
626
698
  //////////////////////////////////////////////////////////////////
627
699
  // Fee payer flow
628
700
 
629
- const transaction_feePayer = TransactionEnvelopeAA.from({
701
+ const transaction_feePayer = TransactionEnvelopeTempo.from({
630
702
  ...transaction_signed,
631
703
  feeToken: '0x20c0000000000000000000000000000000000001',
632
704
  })
633
705
 
634
706
  const feePayerSignature = Secp256k1.sign({
635
- payload: TransactionEnvelopeAA.getFeePayerSignPayload(
707
+ payload: TransactionEnvelopeTempo.getFeePayerSignPayload(
636
708
  transaction_feePayer,
637
709
  { sender: senderAddress },
638
710
  ),
639
711
  privateKey: feePayerPrivateKey,
640
712
  })
641
713
 
642
- const serialized_signed = TransactionEnvelopeAA.serialize(
714
+ const serialized_signed = TransactionEnvelopeTempo.serialize(
643
715
  transaction_feePayer,
644
716
  {
645
717
  feePayerSignature,
@@ -745,7 +817,7 @@ describe('behavior: keyAuthorization', () => {
745
817
  blockTag: 'pending',
746
818
  })
747
819
 
748
- const transaction = TransactionEnvelopeAA.from({
820
+ const transaction = TransactionEnvelopeTempo.from({
749
821
  calls: [
750
822
  {
751
823
  to: '0x0000000000000000000000000000000000000000',
@@ -761,11 +833,11 @@ describe('behavior: keyAuthorization', () => {
761
833
  })
762
834
 
763
835
  const signature = Secp256k1.sign({
764
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
836
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
765
837
  privateKey: access.privateKey,
766
838
  })
767
839
 
768
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
840
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
769
841
  signature: SignatureEnvelope.from({
770
842
  userAddress: root.address,
771
843
  inner: SignatureEnvelope.from(signature),
@@ -818,8 +890,8 @@ describe('behavior: keyAuthorization', () => {
818
890
  expect(transactionIndex).toBeDefined()
819
891
  expect(rest).toMatchInlineSnapshot(`
820
892
  {
821
- "aaAuthorizationList": [],
822
893
  "accessList": [],
894
+ "authorizationList": [],
823
895
  "calls": [
824
896
  {
825
897
  "data": "0x",
@@ -832,7 +904,7 @@ describe('behavior: keyAuthorization', () => {
832
904
  "feeToken": "0x20c0000000000000000000000000000000000001",
833
905
  "gas": 100000n,
834
906
  "nonceKey": 0n,
835
- "type": "aa",
907
+ "type": "tempo",
836
908
  "validAfter": null,
837
909
  "validBefore": null,
838
910
  "value": 0n,
@@ -883,7 +955,7 @@ describe('behavior: keyAuthorization', () => {
883
955
  blockTag: 'pending',
884
956
  })
885
957
 
886
- const transaction = TransactionEnvelopeAA.from({
958
+ const transaction = TransactionEnvelopeTempo.from({
887
959
  calls: [
888
960
  {
889
961
  to: '0x0000000000000000000000000000000000000000',
@@ -898,17 +970,20 @@ describe('behavior: keyAuthorization', () => {
898
970
  })
899
971
 
900
972
  const signature = Secp256k1.sign({
901
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
973
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
902
974
  privateKey: access.privateKey,
903
975
  })
904
976
 
905
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
906
- signature: SignatureEnvelope.from({
907
- userAddress: root.address,
908
- inner: SignatureEnvelope.from(signature),
909
- type: 'keychain',
910
- }),
911
- })
977
+ const serialized_signed = TransactionEnvelopeTempo.serialize(
978
+ transaction,
979
+ {
980
+ signature: SignatureEnvelope.from({
981
+ userAddress: root.address,
982
+ inner: SignatureEnvelope.from(signature),
983
+ type: 'keychain',
984
+ }),
985
+ },
986
+ )
912
987
 
913
988
  const receipt = await client.request({
914
989
  method: 'eth_sendRawTransactionSync',
@@ -949,7 +1024,7 @@ describe('behavior: keyAuthorization', () => {
949
1024
  blockTag: 'pending',
950
1025
  })
951
1026
 
952
- const transaction = TransactionEnvelopeAA.from({
1027
+ const transaction = TransactionEnvelopeTempo.from({
953
1028
  calls: [
954
1029
  {
955
1030
  to: '0x0000000000000000000000000000000000000000',
@@ -965,11 +1040,11 @@ describe('behavior: keyAuthorization', () => {
965
1040
  })
966
1041
 
967
1042
  const signature = P256.sign({
968
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1043
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
969
1044
  privateKey: access.privateKey,
970
1045
  })
971
1046
 
972
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
1047
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
973
1048
  signature: SignatureEnvelope.from({
974
1049
  userAddress: root.address,
975
1050
  inner: SignatureEnvelope.from({
@@ -1028,8 +1103,8 @@ describe('behavior: keyAuthorization', () => {
1028
1103
  expect(transactionIndex).toBeDefined()
1029
1104
  expect(rest).toMatchInlineSnapshot(`
1030
1105
  {
1031
- "aaAuthorizationList": [],
1032
1106
  "accessList": [],
1107
+ "authorizationList": [],
1033
1108
  "calls": [
1034
1109
  {
1035
1110
  "data": "0x",
@@ -1042,7 +1117,7 @@ describe('behavior: keyAuthorization', () => {
1042
1117
  "feeToken": "0x20c0000000000000000000000000000000000001",
1043
1118
  "gas": 100000n,
1044
1119
  "nonceKey": 0n,
1045
- "type": "aa",
1120
+ "type": "tempo",
1046
1121
  "validAfter": null,
1047
1122
  "validBefore": null,
1048
1123
  "value": 0n,
@@ -1093,7 +1168,7 @@ describe('behavior: keyAuthorization', () => {
1093
1168
  blockTag: 'pending',
1094
1169
  })
1095
1170
 
1096
- const transaction = TransactionEnvelopeAA.from({
1171
+ const transaction = TransactionEnvelopeTempo.from({
1097
1172
  calls: [
1098
1173
  {
1099
1174
  to: '0x0000000000000000000000000000000000000000',
@@ -1108,22 +1183,25 @@ describe('behavior: keyAuthorization', () => {
1108
1183
  })
1109
1184
 
1110
1185
  const signature = P256.sign({
1111
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1186
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
1112
1187
  privateKey: access.privateKey,
1113
1188
  })
1114
1189
 
1115
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
1116
- signature: SignatureEnvelope.from({
1117
- userAddress: root.address,
1118
- inner: SignatureEnvelope.from({
1119
- prehash: false,
1120
- publicKey: access.publicKey,
1121
- signature,
1122
- type: 'p256',
1190
+ const serialized_signed = TransactionEnvelopeTempo.serialize(
1191
+ transaction,
1192
+ {
1193
+ signature: SignatureEnvelope.from({
1194
+ userAddress: root.address,
1195
+ inner: SignatureEnvelope.from({
1196
+ prehash: false,
1197
+ publicKey: access.publicKey,
1198
+ signature,
1199
+ type: 'p256',
1200
+ }),
1201
+ type: 'keychain',
1123
1202
  }),
1124
- type: 'keychain',
1125
- }),
1126
- })
1203
+ },
1204
+ )
1127
1205
 
1128
1206
  const receipt = await client.request({
1129
1207
  method: 'eth_sendRawTransactionSync',
@@ -1162,7 +1240,7 @@ describe('behavior: keyAuthorization', () => {
1162
1240
  blockTag: 'pending',
1163
1241
  })
1164
1242
 
1165
- const transaction = TransactionEnvelopeAA.from({
1243
+ const transaction = TransactionEnvelopeTempo.from({
1166
1244
  calls: [
1167
1245
  {
1168
1246
  to: '0x0000000000000000000000000000000000000000',
@@ -1178,11 +1256,11 @@ describe('behavior: keyAuthorization', () => {
1178
1256
  })
1179
1257
 
1180
1258
  const signature = await WebCryptoP256.sign({
1181
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1259
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
1182
1260
  privateKey: keyPair.privateKey,
1183
1261
  })
1184
1262
 
1185
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
1263
+ const serialized_signed = TransactionEnvelopeTempo.serialize(transaction, {
1186
1264
  signature: SignatureEnvelope.from({
1187
1265
  userAddress: root.address,
1188
1266
  inner: SignatureEnvelope.from({
@@ -1240,8 +1318,8 @@ describe('behavior: keyAuthorization', () => {
1240
1318
  expect(transactionIndex).toBeDefined()
1241
1319
  expect(rest).toMatchInlineSnapshot(`
1242
1320
  {
1243
- "aaAuthorizationList": [],
1244
1321
  "accessList": [],
1322
+ "authorizationList": [],
1245
1323
  "calls": [
1246
1324
  {
1247
1325
  "data": "0x",
@@ -1254,7 +1332,7 @@ describe('behavior: keyAuthorization', () => {
1254
1332
  "feeToken": "0x20c0000000000000000000000000000000000001",
1255
1333
  "gas": 100000n,
1256
1334
  "nonceKey": 0n,
1257
- "type": "aa",
1335
+ "type": "tempo",
1258
1336
  "validAfter": null,
1259
1337
  "validBefore": null,
1260
1338
  "value": 0n,
@@ -1269,7 +1347,7 @@ describe('behavior: keyAuthorization', () => {
1269
1347
  blockTag: 'pending',
1270
1348
  })
1271
1349
 
1272
- const transaction = TransactionEnvelopeAA.from({
1350
+ const transaction = TransactionEnvelopeTempo.from({
1273
1351
  calls: [
1274
1352
  {
1275
1353
  to: '0x0000000000000000000000000000000000000000',
@@ -1284,22 +1362,25 @@ describe('behavior: keyAuthorization', () => {
1284
1362
  })
1285
1363
 
1286
1364
  const signature = await WebCryptoP256.sign({
1287
- payload: TransactionEnvelopeAA.getSignPayload(transaction),
1365
+ payload: TransactionEnvelopeTempo.getSignPayload(transaction),
1288
1366
  privateKey: keyPair.privateKey,
1289
1367
  })
1290
1368
 
1291
- const serialized_signed = TransactionEnvelopeAA.serialize(transaction, {
1292
- signature: SignatureEnvelope.from({
1293
- userAddress: root.address,
1294
- inner: SignatureEnvelope.from({
1295
- prehash: true,
1296
- publicKey: access.publicKey,
1297
- signature,
1298
- type: 'p256',
1369
+ const serialized_signed = TransactionEnvelopeTempo.serialize(
1370
+ transaction,
1371
+ {
1372
+ signature: SignatureEnvelope.from({
1373
+ userAddress: root.address,
1374
+ inner: SignatureEnvelope.from({
1375
+ prehash: true,
1376
+ publicKey: access.publicKey,
1377
+ signature,
1378
+ type: 'p256',
1379
+ }),
1380
+ type: 'keychain',
1299
1381
  }),
1300
- type: 'keychain',
1301
- }),
1302
- })
1382
+ },
1383
+ )
1303
1384
 
1304
1385
  const receipt = await client.request({
1305
1386
  method: 'eth_sendRawTransactionSync',
package/src/ox/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * as AuthorizationTempo from './AuthorizationTempo.js'
1
2
  export * as KeyAuthorization from './KeyAuthorization.js'
2
3
  export * as Order from './Order.js'
3
4
  export * as OrdersFilters from './OrdersFilters.js'
@@ -9,4 +10,4 @@ export * as Tick from './Tick.js'
9
10
  export * as TokenId from './TokenId.js'
10
11
  export * as TokenRole from './TokenRole.js'
11
12
  export * as Transaction from './Transaction.js'
12
- export * as TransactionEnvelopeAA from './TransactionEnvelopeAA.js'
13
+ export * as TransactionEnvelopeTempo from './TransactionEnvelopeTempo.js'
package/src/viem/Chain.ts CHANGED
@@ -55,6 +55,7 @@ function config<const chain extends Chain>(chain: chain) {
55
55
  },
56
56
  formatters: {
57
57
  transaction: defineTransaction({
58
+ exclude: ['aaAuthorizationList' as never],
58
59
  format: Formatters.formatTransaction,
59
60
  }),
60
61
  transactionReceipt: defineTransactionReceipt({
@@ -34,17 +34,11 @@ export function formatTransaction(
34
34
  gasPrice: _,
35
35
  nonce,
36
36
  ...tx
37
- } = ox_Transaction.fromRpc(transaction as never) as ox_Transaction.AA
37
+ } = ox_Transaction.fromRpc(transaction as never) as ox_Transaction.Tempo
38
38
 
39
39
  return {
40
40
  ...tx,
41
41
  accessList: tx.accessList!,
42
- authorizationList: tx.authorizationList?.map((auth) => ({
43
- ...auth,
44
- nonce: Number(auth.nonce),
45
- r: Hex.fromNumber(auth.r, { size: 32 }),
46
- s: Hex.fromNumber(auth.s, { size: 32 }),
47
- })),
48
42
  feePayerSignature: feePayerSignature
49
43
  ? {
50
44
  r: Hex.fromNumber(feePayerSignature.r, { size: 32 }),
@@ -58,7 +52,7 @@ export function formatTransaction(
58
52
  ox_Transaction.toRpcType[
59
53
  tx.type as keyof typeof ox_Transaction.toRpcType
60
54
  ],
61
- type: tx.type as 'aa',
55
+ type: tx.type as 'tempo',
62
56
  }
63
57
  }
64
58
 
@@ -84,8 +78,8 @@ export function formatTransactionRequest<chain extends Chain | undefined>(
84
78
  ? parseAccount<Account | viem_Account | Address>(request.account)
85
79
  : undefined
86
80
 
87
- // Convert EIP-1559 transactions to AA transactions.
88
- if (request.type === 'eip1559') (request as any).type = 'aa'
81
+ // Convert EIP-1559 transactions to Tempo transactions.
82
+ if (request.type === 'eip1559') (request as any).type = 'tempo'
89
83
 
90
84
  // If the request is not a Tempo transaction, route to Viem formatter.
91
85
  if (!isTempo(request))
@@ -105,14 +99,7 @@ export function formatTransactionRequest<chain extends Chain | undefined>(
105
99
 
106
100
  const rpc = ox_TransactionRequest.toRpc({
107
101
  ...request,
108
- authorizationList: request.authorizationList?.map((auth) => ({
109
- ...auth,
110
- nonce: BigInt(auth.nonce),
111
- r: BigInt(auth.r!),
112
- s: BigInt(auth.s!),
113
- yParity: Number(auth.yParity),
114
- })),
115
- type: 'aa',
102
+ type: 'tempo',
116
103
  } as never)
117
104
 
118
105
  if (action === 'estimateGas') {
@@ -134,7 +121,7 @@ export function formatTransactionRequest<chain extends Chain | undefined>(
134
121
  rpc.type = undefined
135
122
  }
136
123
 
137
- // We rely on `calls` for AA transactions.
124
+ // We rely on `calls` for Tempo transactions.
138
125
  // However, `calls` may not be supported by JSON-RPC accounts (wallets) yet,
139
126
  // so we will not remove the `data`, `to`, and `value` fields to make it
140
127
  // compatible with the base transaction structure.