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.
- package/CHANGELOG.md +33 -0
- package/dist/ox/AuthorizationTempo.d.ts +450 -0
- package/dist/ox/AuthorizationTempo.d.ts.map +1 -0
- package/dist/ox/AuthorizationTempo.js +433 -0
- package/dist/ox/AuthorizationTempo.js.map +1 -0
- package/dist/ox/KeyAuthorization.d.ts +4 -4
- package/dist/ox/KeyAuthorization.d.ts.map +1 -1
- package/dist/ox/KeyAuthorization.js +5 -6
- package/dist/ox/KeyAuthorization.js.map +1 -1
- package/dist/ox/Transaction.d.ts +11 -10
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +10 -3
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/{TransactionEnvelopeAA.d.ts → TransactionEnvelopeTempo.d.ts} +73 -73
- package/dist/ox/TransactionEnvelopeTempo.d.ts.map +1 -0
- package/dist/ox/{TransactionEnvelopeAA.js → TransactionEnvelopeTempo.js} +65 -61
- package/dist/ox/TransactionEnvelopeTempo.js.map +1 -0
- package/dist/ox/TransactionReceipt.d.ts +3 -3
- package/dist/ox/TransactionReceipt.d.ts.map +1 -1
- package/dist/ox/TransactionReceipt.js +2 -2
- package/dist/ox/TransactionReceipt.js.map +1 -1
- package/dist/ox/TransactionRequest.d.ts +7 -5
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js +9 -3
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +2 -1
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +2 -1
- package/dist/ox/index.js.map +1 -1
- package/dist/viem/Chain.d.ts +11 -6
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +1 -0
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +4 -17
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/Transaction.d.ts +21 -21
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js +17 -30
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/internal/types.d.ts +2 -2
- package/dist/viem/internal/types.d.ts.map +1 -1
- package/dist/wagmi/Connector.d.ts +6 -12
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +73 -18
- package/dist/wagmi/Connector.js.map +1 -1
- package/package.json +1 -1
- package/src/ox/AuthorizationTempo.test.ts +1256 -0
- package/src/ox/AuthorizationTempo.ts +648 -0
- package/src/ox/KeyAuthorization.ts +8 -10
- package/src/ox/Transaction.test.ts +6 -6
- package/src/ox/Transaction.ts +25 -14
- package/src/ox/{TransactionEnvelopeAA.test.ts → TransactionEnvelopeTempo.test.ts} +326 -141
- package/src/ox/{TransactionEnvelopeAA.ts → TransactionEnvelopeTempo.ts} +93 -81
- package/src/ox/TransactionReceipt.ts +3 -3
- package/src/ox/TransactionRequest.ts +22 -8
- package/src/ox/e2e.test.ts +159 -78
- package/src/ox/index.ts +2 -1
- package/src/viem/Chain.ts +1 -0
- package/src/viem/Formatters.ts +6 -19
- package/src/viem/Transaction.ts +50 -68
- package/src/viem/e2e.test.ts +28 -42
- package/src/viem/internal/types.ts +2 -2
- package/src/wagmi/Connector.ts +104 -31
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeAA.js.map +0 -1
|
@@ -65,7 +65,7 @@ describe('fromRpc', () => {
|
|
|
65
65
|
"type": "secp256k1",
|
|
66
66
|
},
|
|
67
67
|
"transactionIndex": 2,
|
|
68
|
-
"type": "
|
|
68
|
+
"type": "tempo",
|
|
69
69
|
"value": 0n,
|
|
70
70
|
}
|
|
71
71
|
`)
|
|
@@ -147,7 +147,7 @@ describe('fromRpc', () => {
|
|
|
147
147
|
"type": "secp256k1",
|
|
148
148
|
},
|
|
149
149
|
"transactionIndex": 2,
|
|
150
|
-
"type": "
|
|
150
|
+
"type": "tempo",
|
|
151
151
|
"value": 0n,
|
|
152
152
|
}
|
|
153
153
|
`)
|
|
@@ -254,7 +254,7 @@ describe('fromRpc', () => {
|
|
|
254
254
|
"type": "secp256k1",
|
|
255
255
|
},
|
|
256
256
|
"transactionIndex": 2,
|
|
257
|
-
"type": "
|
|
257
|
+
"type": "tempo",
|
|
258
258
|
"value": 0n,
|
|
259
259
|
}
|
|
260
260
|
`)
|
|
@@ -294,7 +294,7 @@ describe('toRpc', () => {
|
|
|
294
294
|
type: 'secp256k1',
|
|
295
295
|
},
|
|
296
296
|
transactionIndex: 2,
|
|
297
|
-
type: '
|
|
297
|
+
type: 'tempo',
|
|
298
298
|
})
|
|
299
299
|
expect(transaction).toMatchInlineSnapshot(`
|
|
300
300
|
{
|
|
@@ -370,7 +370,7 @@ describe('toRpc', () => {
|
|
|
370
370
|
type: 'secp256k1',
|
|
371
371
|
},
|
|
372
372
|
transactionIndex: 2,
|
|
373
|
-
type: '
|
|
373
|
+
type: 'tempo',
|
|
374
374
|
})
|
|
375
375
|
expect(transaction).toMatchInlineSnapshot(`
|
|
376
376
|
{
|
|
@@ -465,7 +465,7 @@ describe('toRpc', () => {
|
|
|
465
465
|
type: 'secp256k1',
|
|
466
466
|
},
|
|
467
467
|
transactionIndex: 2,
|
|
468
|
-
type: '
|
|
468
|
+
type: 'tempo',
|
|
469
469
|
})
|
|
470
470
|
expect(transaction).toMatchInlineSnapshot(`
|
|
471
471
|
{
|
package/src/ox/Transaction.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type * as AccessList from 'ox/AccessList'
|
|
2
2
|
import type * as Address from 'ox/Address'
|
|
3
|
-
import type * as Authorization from 'ox/Authorization'
|
|
4
3
|
import type * as Errors from 'ox/Errors'
|
|
5
4
|
import * as Hex from 'ox/Hex'
|
|
6
5
|
import * as Signature from 'ox/Signature'
|
|
7
6
|
import * as ox_Transaction from 'ox/Transaction'
|
|
8
7
|
import type { Compute, OneOf, UnionCompute } from '../internal/types.js'
|
|
8
|
+
import * as AuthorizationTempo from './AuthorizationTempo.js'
|
|
9
9
|
import * as KeyAuthorization from './KeyAuthorization.js'
|
|
10
10
|
import * as SignatureEnvelope from './SignatureEnvelope.js'
|
|
11
|
-
import type { Call } from './
|
|
11
|
+
import type { Call } from './TransactionEnvelopeTempo.js'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
@@ -19,7 +19,7 @@ export type Transaction<
|
|
|
19
19
|
numberType = number,
|
|
20
20
|
> = UnionCompute<
|
|
21
21
|
OneOf<
|
|
22
|
-
|
|
|
22
|
+
| Tempo<pending, bigintType, numberType>
|
|
23
23
|
| ox_Transaction.Transaction<pending, bigintType, numberType>
|
|
24
24
|
>
|
|
25
25
|
>
|
|
@@ -28,28 +28,28 @@ export type Transaction<
|
|
|
28
28
|
* An RPC Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
29
29
|
*/
|
|
30
30
|
export type Rpc<pending extends boolean = false> = UnionCompute<
|
|
31
|
-
OneOf<
|
|
31
|
+
OneOf<TempoRpc<pending> | ox_Transaction.Rpc<pending>>
|
|
32
32
|
>
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Native account abstraction transaction.
|
|
36
36
|
*/
|
|
37
|
-
export type
|
|
37
|
+
export type Tempo<
|
|
38
38
|
pending extends boolean = false,
|
|
39
39
|
bigintType = bigint,
|
|
40
40
|
numberType = number,
|
|
41
|
-
type extends string = '
|
|
41
|
+
type extends string = 'tempo',
|
|
42
42
|
> = Compute<
|
|
43
43
|
Omit<
|
|
44
44
|
ox_Transaction.Base<type, pending, bigintType, numberType>,
|
|
45
|
-
//
|
|
45
|
+
// Tempo transactions don't have these properties.
|
|
46
46
|
'input' | 'to' | 'value' | 'v' | 'r' | 's' | 'yParity'
|
|
47
47
|
> & {
|
|
48
48
|
/** EIP-2930 Access List. */
|
|
49
49
|
accessList: AccessList.AccessList
|
|
50
50
|
/** EIP-7702 Authorization list for the transaction. */
|
|
51
51
|
authorizationList?:
|
|
52
|
-
|
|
|
52
|
+
| AuthorizationTempo.ListSigned<bigintType, numberType>
|
|
53
53
|
| undefined
|
|
54
54
|
/** Array of calls to execute. */
|
|
55
55
|
calls: readonly Call<bigintType>[]
|
|
@@ -92,11 +92,12 @@ export type AA<
|
|
|
92
92
|
/**
|
|
93
93
|
* Native account abstraction transaction in RPC format.
|
|
94
94
|
*/
|
|
95
|
-
export type
|
|
95
|
+
export type TempoRpc<pending extends boolean = false> = Compute<
|
|
96
96
|
Omit<
|
|
97
|
-
|
|
98
|
-
'calls' | 'keyAuthorization' | 'signature'
|
|
97
|
+
Tempo<pending, Hex.Hex, Hex.Hex, ToRpcType['tempo']>,
|
|
98
|
+
'authorizationList' | 'calls' | 'keyAuthorization' | 'signature'
|
|
99
99
|
> & {
|
|
100
|
+
aaAuthorizationList?: AuthorizationTempo.ListRpc | undefined
|
|
100
101
|
calls:
|
|
101
102
|
| readonly {
|
|
102
103
|
input?: Hex.Hex | undefined
|
|
@@ -112,7 +113,7 @@ export type AARpc<pending extends boolean = false> = Compute<
|
|
|
112
113
|
/** Type to RPC Type mapping. */
|
|
113
114
|
export const toRpcType = {
|
|
114
115
|
...ox_Transaction.toRpcType,
|
|
115
|
-
|
|
116
|
+
tempo: '0x76',
|
|
116
117
|
} as const
|
|
117
118
|
|
|
118
119
|
/** Type to RPC Type mapping. */
|
|
@@ -123,7 +124,7 @@ export type ToRpcType = typeof toRpcType & {
|
|
|
123
124
|
/** RPC Type to Type mapping. */
|
|
124
125
|
export const fromRpcType = {
|
|
125
126
|
...ox_Transaction.fromRpcType,
|
|
126
|
-
'0x76': '
|
|
127
|
+
'0x76': 'tempo',
|
|
127
128
|
} as const
|
|
128
129
|
|
|
129
130
|
/** RPC Type to Type mapping. */
|
|
@@ -191,6 +192,12 @@ export function fromRpc<
|
|
|
191
192
|
|
|
192
193
|
transaction_.type = fromRpcType[transaction.type as keyof typeof fromRpcType]
|
|
193
194
|
|
|
195
|
+
if (transaction.aaAuthorizationList) {
|
|
196
|
+
transaction_.authorizationList = AuthorizationTempo.fromRpcList(
|
|
197
|
+
transaction.aaAuthorizationList,
|
|
198
|
+
)
|
|
199
|
+
delete (transaction_ as any).aaAuthorizationList
|
|
200
|
+
}
|
|
194
201
|
if (transaction.calls)
|
|
195
202
|
transaction_.calls = transaction.calls.map((call) => ({
|
|
196
203
|
to: call.to,
|
|
@@ -268,7 +275,7 @@ export declare namespace fromRpc {
|
|
|
268
275
|
* type: 'secp256k1',
|
|
269
276
|
* },
|
|
270
277
|
* transactionIndex: 2,
|
|
271
|
-
* type: '
|
|
278
|
+
* type: 'tempo',
|
|
272
279
|
* })
|
|
273
280
|
* ```
|
|
274
281
|
*
|
|
@@ -285,6 +292,10 @@ export function toRpc<pending extends boolean = false>(
|
|
|
285
292
|
|
|
286
293
|
rpc.type = toRpcType[transaction.type as keyof typeof toRpcType]
|
|
287
294
|
|
|
295
|
+
if (transaction.authorizationList)
|
|
296
|
+
rpc.aaAuthorizationList = AuthorizationTempo.toRpcList(
|
|
297
|
+
transaction.authorizationList as AuthorizationTempo.ListSigned,
|
|
298
|
+
)
|
|
288
299
|
if (transaction.calls)
|
|
289
300
|
rpc.calls = transaction.calls.map((call) => ({
|
|
290
301
|
to: call.to,
|