ox 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/core/AbiEvent.d.ts.map +1 -1
- package/dist/core/AbiEvent.js +10 -9
- package/dist/core/AbiEvent.js.map +1 -1
- package/dist/core/Blobs.d.ts.map +1 -1
- package/dist/core/Blobs.js +6 -2
- package/dist/core/Blobs.js.map +1 -1
- package/dist/core/Signature.d.ts +6 -5
- package/dist/core/Signature.d.ts.map +1 -1
- package/dist/core/Signature.js +17 -7
- package/dist/core/Signature.js.map +1 -1
- package/dist/core/Siwe.d.ts.map +1 -1
- package/dist/core/Siwe.js +21 -1
- package/dist/core/Siwe.js.map +1 -1
- package/dist/tempo/KeyAuthorization.d.ts +42 -38
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorization.js +24 -4
- package/dist/tempo/KeyAuthorization.js.map +1 -1
- package/dist/tempo/MultisigConfig.d.ts +18 -15
- package/dist/tempo/MultisigConfig.d.ts.map +1 -1
- package/dist/tempo/MultisigConfig.js +49 -20
- package/dist/tempo/MultisigConfig.js.map +1 -1
- package/dist/tempo/MultisigOperation.d.ts +3 -2
- package/dist/tempo/MultisigOperation.d.ts.map +1 -1
- package/dist/tempo/MultisigOperation.js +20 -100
- package/dist/tempo/MultisigOperation.js.map +1 -1
- package/dist/tempo/MultisigSimulation.d.ts +2 -49
- package/dist/tempo/MultisigSimulation.d.ts.map +1 -1
- package/dist/tempo/MultisigSimulation.js +18 -46
- package/dist/tempo/MultisigSimulation.js.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +72 -140
- package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/tempo/SignatureEnvelope.js +130 -181
- package/dist/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/tempo/TransactionRequest.d.ts +4 -2
- package/dist/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/tempo/TransactionRequest.js +6 -1
- package/dist/tempo/TransactionRequest.js.map +1 -1
- package/dist/tempo/index.d.ts +3 -1
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +3 -1
- package/dist/tempo/index.js.map +1 -1
- package/dist/zod/tempo/AuthorizationTempo.d.ts +350 -10
- package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
- package/dist/zod/tempo/KeyAuthorization.d.ts +242 -422
- package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/zod/tempo/KeyAuthorization.js +29 -31
- package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
- package/dist/zod/tempo/MultisigSimulation.d.ts +8 -76
- package/dist/zod/tempo/MultisigSimulation.d.ts.map +1 -1
- package/dist/zod/tempo/MultisigSimulation.js +3 -37
- package/dist/zod/tempo/MultisigSimulation.js.map +1 -1
- package/dist/zod/tempo/RpcSchemaTempo.d.ts +284 -228
- package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.d.ts +105 -3
- package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.js +21 -9
- package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/zod/tempo/Transaction.d.ts +676 -448
- package/dist/zod/tempo/Transaction.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.d.ts +590 -473
- package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.js +8 -0
- package/dist/zod/tempo/TransactionRequest.js.map +1 -1
- package/dist/zod/tempo/TxEnvelopeTempo.d.ts +327 -213
- package/dist/zod/tempo/TxEnvelopeTempo.d.ts.map +1 -1
- package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +105 -3
- package/dist/zod/tempo/ZoneRpcAuthentication.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AbiEvent.ts +11 -9
- package/src/core/Blobs.ts +6 -2
- package/src/core/Signature.ts +41 -11
- package/src/core/Siwe.ts +20 -1
- package/src/core/_test/AbiEvent.test.ts +45 -0
- package/src/core/_test/Blobs.test.ts +22 -0
- package/src/core/_test/Signature.test.ts +166 -0
- package/src/core/_test/Siwe.test.ts +100 -1
- package/src/tempo/AuthorizationTempo.test.ts +8 -4
- package/src/tempo/KeyAuthorization.test-d.ts +16 -63
- package/src/tempo/KeyAuthorization.test.ts +69 -11
- package/src/tempo/KeyAuthorization.ts +107 -63
- package/src/tempo/MultisigConfig.test.ts +44 -20
- package/src/tempo/MultisigConfig.ts +65 -23
- package/src/tempo/MultisigOperation.test.ts +79 -550
- package/src/tempo/MultisigOperation.ts +31 -146
- package/src/tempo/MultisigSimulation.test-d.ts +2 -2
- package/src/tempo/MultisigSimulation.test.ts +21 -110
- package/src/tempo/MultisigSimulation.ts +25 -99
- package/src/tempo/SignatureEnvelope.test-d.ts +29 -47
- package/src/tempo/SignatureEnvelope.test.ts +328 -541
- package/src/tempo/SignatureEnvelope.ts +196 -291
- package/src/tempo/Transaction.test.ts +4 -4
- package/src/tempo/TransactionRequest.test.ts +17 -80
- package/src/tempo/TransactionRequest.ts +19 -2
- package/src/tempo/index.ts +3 -1
- package/src/tempo/multisig.e2e.test.ts +321 -860
- package/src/version.ts +1 -1
- package/src/zod/tempo/KeyAuthorization.ts +50 -39
- package/src/zod/tempo/MultisigSimulation.ts +3 -48
- package/src/zod/tempo/SignatureEnvelope.ts +46 -35
- package/src/zod/tempo/TransactionRequest.ts +14 -0
- package/src/zod/tempo/_test/KeyAuthorization.test.ts +69 -20
- package/src/zod/tempo/_test/MultisigSimulation.test.ts +6 -31
- package/src/zod/tempo/_test/SignatureEnvelope.test.ts +118 -85
- package/src/zod/tempo/_test/TransactionRequest.test.ts +9 -19
|
@@ -2,7 +2,7 @@ import { Transaction } from 'ox/tempo'
|
|
|
2
2
|
import { describe, expect, test } from 'vp/test'
|
|
3
3
|
|
|
4
4
|
const multisigRpcSignature =
|
|
5
|
-
'
|
|
5
|
+
'0xf89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b' as const
|
|
6
6
|
|
|
7
7
|
describe('fromRpc', () => {
|
|
8
8
|
test('default', () => {
|
|
@@ -526,7 +526,7 @@ describe('roundtrip', () => {
|
|
|
526
526
|
calls: [],
|
|
527
527
|
chainId: '0x1',
|
|
528
528
|
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
529
|
-
from: '
|
|
529
|
+
from: '0xc4a590afa7337e5cd5eb3aa60cacf91c5400044b',
|
|
530
530
|
gas: '0x43f5d',
|
|
531
531
|
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
532
532
|
maxFeePerGas: '0x2',
|
|
@@ -543,9 +543,9 @@ describe('roundtrip', () => {
|
|
|
543
543
|
signature: transaction.signature,
|
|
544
544
|
}).toMatchInlineSnapshot(`
|
|
545
545
|
{
|
|
546
|
-
"rpc": "
|
|
546
|
+
"rpc": "0xf89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b",
|
|
547
547
|
"signature": {
|
|
548
|
-
"account": "
|
|
548
|
+
"account": "0xc4a590afa7337e5cd5eb3aa60cacf91c5400044b",
|
|
549
549
|
"config": {
|
|
550
550
|
"owners": [
|
|
551
551
|
{
|
|
@@ -6,27 +6,11 @@ import {
|
|
|
6
6
|
import { describe, expect, test } from 'vp/test'
|
|
7
7
|
|
|
8
8
|
const multisigSimulationRpc = {
|
|
9
|
-
account: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
|
10
9
|
approvals: [
|
|
11
10
|
{
|
|
12
|
-
keyType: '
|
|
11
|
+
keyType: 'webAuthn',
|
|
12
|
+
keyData: '0x0005',
|
|
13
13
|
owner: '0x1111111111111111111111111111111111111111',
|
|
14
|
-
type: 'primitive',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
spec: {
|
|
18
|
-
account: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
|
|
19
|
-
approvals: [
|
|
20
|
-
{
|
|
21
|
-
keyData: '0x0578',
|
|
22
|
-
keyType: 'webAuthn',
|
|
23
|
-
owner: '0x2222222222222222222222222222222222222222',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
config:
|
|
27
|
-
'0xf83ba022222222222222222222222222222222222222222222222222222222222222220101d7d694222222222222222222222222222222222222222201',
|
|
28
|
-
},
|
|
29
|
-
type: 'multisig',
|
|
30
14
|
},
|
|
31
15
|
],
|
|
32
16
|
config:
|
|
@@ -34,26 +18,11 @@ const multisigSimulationRpc = {
|
|
|
34
18
|
} as const satisfies MultisigSimulation.Rpc
|
|
35
19
|
|
|
36
20
|
const multisigSimulation = {
|
|
37
|
-
account: multisigSimulationRpc.account,
|
|
38
21
|
approvals: [
|
|
39
|
-
multisigSimulationRpc.approvals[0],
|
|
40
22
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
config: MultisigConfig.from({
|
|
45
|
-
owners: [
|
|
46
|
-
{
|
|
47
|
-
owner: '0x2222222222222222222222222222222222222222',
|
|
48
|
-
weight: 1,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
salt: `0x${'22'.repeat(32)}`,
|
|
52
|
-
threshold: 1,
|
|
53
|
-
version: 1n,
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
type: 'multisig',
|
|
23
|
+
keyType: 'webAuthn',
|
|
24
|
+
keyData: '0x0005',
|
|
25
|
+
owner: '0x1111111111111111111111111111111111111111',
|
|
57
26
|
},
|
|
58
27
|
],
|
|
59
28
|
config: MultisigConfig.from({
|
|
@@ -179,36 +148,11 @@ describe('fromRpc', () => {
|
|
|
179
148
|
|
|
180
149
|
expect(request.multisigSimulation).toMatchInlineSnapshot(`
|
|
181
150
|
{
|
|
182
|
-
"account": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
183
151
|
"approvals": [
|
|
184
152
|
{
|
|
185
|
-
"
|
|
153
|
+
"keyData": "0x0005",
|
|
154
|
+
"keyType": "webAuthn",
|
|
186
155
|
"owner": "0x1111111111111111111111111111111111111111",
|
|
187
|
-
"type": "primitive",
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"spec": {
|
|
191
|
-
"account": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
192
|
-
"approvals": [
|
|
193
|
-
{
|
|
194
|
-
"keyData": "0x0578",
|
|
195
|
-
"keyType": "webAuthn",
|
|
196
|
-
"owner": "0x2222222222222222222222222222222222222222",
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
"config": {
|
|
200
|
-
"owners": [
|
|
201
|
-
{
|
|
202
|
-
"owner": "0x2222222222222222222222222222222222222222",
|
|
203
|
-
"weight": 1,
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
"salt": "0x2222222222222222222222222222222222222222222222222222222222222222",
|
|
207
|
-
"threshold": 1,
|
|
208
|
-
"version": 1n,
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
"type": "multisig",
|
|
212
156
|
},
|
|
213
157
|
],
|
|
214
158
|
"config": {
|
|
@@ -331,26 +275,11 @@ describe('toRpc', () => {
|
|
|
331
275
|
],
|
|
332
276
|
"from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
333
277
|
"multisigSimulation": {
|
|
334
|
-
"account": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
335
278
|
"approvals": [
|
|
336
279
|
{
|
|
337
|
-
"
|
|
280
|
+
"keyData": "0x0005",
|
|
281
|
+
"keyType": "webAuthn",
|
|
338
282
|
"owner": "0x1111111111111111111111111111111111111111",
|
|
339
|
-
"type": "primitive",
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"spec": {
|
|
343
|
-
"account": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
344
|
-
"approvals": [
|
|
345
|
-
{
|
|
346
|
-
"keyData": "0x0578",
|
|
347
|
-
"keyType": "webAuthn",
|
|
348
|
-
"owner": "0x2222222222222222222222222222222222222222",
|
|
349
|
-
},
|
|
350
|
-
],
|
|
351
|
-
"config": "0xf83ba022222222222222222222222222222222222222222222222222222222222222220101d7d694222222222222222222222222222222222222222201",
|
|
352
|
-
},
|
|
353
|
-
"type": "multisig",
|
|
354
283
|
},
|
|
355
284
|
],
|
|
356
285
|
"config": "0xf852a011111111111111111111111111111111111111111111111111111111111111118002eed694111111111111111111111111111111111111111101d694bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb01",
|
|
@@ -457,6 +386,7 @@ describe('roundtrip', () => {
|
|
|
457
386
|
nonceKey: 255n,
|
|
458
387
|
gas: 100000n,
|
|
459
388
|
maxFeePerGas: 1000000000n,
|
|
389
|
+
keyAuthorizationSimulation: multisigSimulation,
|
|
460
390
|
multisigSimulation,
|
|
461
391
|
}
|
|
462
392
|
|
|
@@ -478,6 +408,9 @@ describe('roundtrip', () => {
|
|
|
478
408
|
expect(converted.nonceKey).toBe(original.nonceKey)
|
|
479
409
|
expect(converted.gas).toBe(original.gas)
|
|
480
410
|
expect(converted.maxFeePerGas).toBe(original.maxFeePerGas)
|
|
411
|
+
expect(converted.keyAuthorizationSimulation).toEqual(
|
|
412
|
+
original.keyAuthorizationSimulation,
|
|
413
|
+
)
|
|
481
414
|
expect(converted.multisigSimulation).toEqual(original.multisigSimulation)
|
|
482
415
|
expect(converted.type).toBe('tempo')
|
|
483
416
|
})
|
|
@@ -496,6 +429,7 @@ describe('roundtrip', () => {
|
|
|
496
429
|
validAfter: '0x32',
|
|
497
430
|
nonceKey: '0xff',
|
|
498
431
|
gas: '0x186a0',
|
|
432
|
+
keyAuthorizationSimulation: multisigSimulationRpc,
|
|
499
433
|
multisigSimulation: multisigSimulationRpc,
|
|
500
434
|
type: '0x76',
|
|
501
435
|
}
|
|
@@ -509,6 +443,9 @@ describe('roundtrip', () => {
|
|
|
509
443
|
expect(rpc.validAfter).toBe(original.validAfter)
|
|
510
444
|
expect(rpc.nonceKey).toBe(original.nonceKey)
|
|
511
445
|
expect(rpc.gas).toBe(original.gas)
|
|
446
|
+
expect(rpc.keyAuthorizationSimulation).toEqual(
|
|
447
|
+
original.keyAuthorizationSimulation,
|
|
448
|
+
)
|
|
512
449
|
expect(rpc.multisigSimulation).toEqual(original.multisigSimulation)
|
|
513
450
|
expect(rpc.type).toBe('0x76')
|
|
514
451
|
})
|
|
@@ -13,7 +13,7 @@ import * as Transaction from './Transaction.js'
|
|
|
13
13
|
import * as TxEnvelopeTempo from './TxEnvelopeTempo.js'
|
|
14
14
|
import type { Call } from './TxEnvelopeTempo.js'
|
|
15
15
|
|
|
16
|
-
type KeyType =
|
|
16
|
+
type KeyType = SignatureEnvelope.Type | 'multisig'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A Transaction Request that is generic to all transaction types.
|
|
@@ -41,6 +41,7 @@ export type TransactionRequest<
|
|
|
41
41
|
feePayerSignature?: Signature.Signature<true, numberType> | null | undefined
|
|
42
42
|
feeToken?: Address.Address | undefined
|
|
43
43
|
keyAuthorization?: KeyAuthorization.KeyAuthorization<true> | undefined
|
|
44
|
+
keyAuthorizationSimulation?: MultisigSimulation.Spec | undefined
|
|
44
45
|
keyData?: Hex.Hex | undefined
|
|
45
46
|
keyId?: Address.Address | undefined
|
|
46
47
|
keyType?: KeyType | undefined
|
|
@@ -60,12 +61,14 @@ export type Rpc = Omit<
|
|
|
60
61
|
| 'feeToken'
|
|
61
62
|
| 'keyAuthorization'
|
|
62
63
|
| 'multisigSimulation'
|
|
64
|
+
| 'keyAuthorizationSimulation'
|
|
63
65
|
| 'signature'
|
|
64
66
|
> & {
|
|
65
67
|
authorizationList?: AuthorizationTempo.ListRpc | undefined
|
|
66
68
|
feePayerSignature?: Signature.Rpc | null | undefined
|
|
67
69
|
feeToken?: Hex.Hex | undefined
|
|
68
70
|
keyAuthorization?: KeyAuthorization.Rpc | undefined
|
|
71
|
+
keyAuthorizationSimulation?: MultisigSimulation.Rpc | undefined
|
|
69
72
|
multisigSimulation?: MultisigSimulation.Rpc | undefined
|
|
70
73
|
nonceKey?: Hex.Hex | undefined
|
|
71
74
|
signature?: SignatureEnvelope.SignatureEnvelopeRpc | undefined
|
|
@@ -94,7 +97,12 @@ export type Rpc = Omit<
|
|
|
94
97
|
* @returns A transaction request.
|
|
95
98
|
*/
|
|
96
99
|
export function fromRpc(request: Rpc): TransactionRequest {
|
|
97
|
-
const {
|
|
100
|
+
const {
|
|
101
|
+
authorizationList: _,
|
|
102
|
+
multisigSimulation: __,
|
|
103
|
+
keyAuthorizationSimulation: ___,
|
|
104
|
+
...rest
|
|
105
|
+
} = request
|
|
98
106
|
const request_ = ox_TransactionRequest.fromRpc(
|
|
99
107
|
rest as any,
|
|
100
108
|
) as TransactionRequest
|
|
@@ -129,6 +137,10 @@ export function fromRpc(request: Rpc): TransactionRequest {
|
|
|
129
137
|
request_.keyAuthorization = KeyAuthorization.fromRpc(
|
|
130
138
|
request.keyAuthorization,
|
|
131
139
|
)
|
|
140
|
+
if (request.keyAuthorizationSimulation)
|
|
141
|
+
request_.keyAuthorizationSimulation = MultisigSimulation.fromRpc(
|
|
142
|
+
request.keyAuthorizationSimulation,
|
|
143
|
+
)
|
|
132
144
|
if (request.multisigSimulation)
|
|
133
145
|
request_.multisigSimulation = MultisigSimulation.fromRpc(
|
|
134
146
|
request.multisigSimulation,
|
|
@@ -222,6 +234,7 @@ export function toRpc(request: toRpc.Input): Rpc {
|
|
|
222
234
|
typeof request.keyData !== 'undefined' ||
|
|
223
235
|
typeof request.keyId !== 'undefined' ||
|
|
224
236
|
typeof request.keyType !== 'undefined' ||
|
|
237
|
+
typeof request.keyAuthorizationSimulation !== 'undefined' ||
|
|
225
238
|
typeof request.multisigSimulation !== 'undefined' ||
|
|
226
239
|
typeof request.nonceKey !== 'undefined' ||
|
|
227
240
|
typeof request.validBefore !== 'undefined' ||
|
|
@@ -272,6 +285,10 @@ export function toRpc(request: toRpc.Input): Rpc {
|
|
|
272
285
|
if (typeof request.keyId !== 'undefined') request_rpc.keyId = request.keyId
|
|
273
286
|
if (typeof request.keyType !== 'undefined')
|
|
274
287
|
request_rpc.keyType = request.keyType
|
|
288
|
+
if (typeof request.keyAuthorizationSimulation !== 'undefined')
|
|
289
|
+
request_rpc.keyAuthorizationSimulation = MultisigSimulation.toRpc(
|
|
290
|
+
request.keyAuthorizationSimulation,
|
|
291
|
+
)
|
|
275
292
|
if (typeof request.multisigSimulation !== 'undefined')
|
|
276
293
|
request_rpc.multisigSimulation = MultisigSimulation.toRpc(
|
|
277
294
|
request.multisigSimulation,
|
package/src/tempo/index.ts
CHANGED
|
@@ -167,7 +167,9 @@ export * as KeyAuthorization from './KeyAuthorization.js'
|
|
|
167
167
|
* ]
|
|
168
168
|
* })
|
|
169
169
|
*
|
|
170
|
-
* const account = MultisigConfig.getAddress(initialConfig
|
|
170
|
+
* const account = MultisigConfig.getAddress(initialConfig, {
|
|
171
|
+
* factory: '0x7171717171717171717171717171717171717171'
|
|
172
|
+
* })
|
|
171
173
|
* ```
|
|
172
174
|
*
|
|
173
175
|
* @category Reference
|