ox 1.7.2 → 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.
Files changed (142) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/core/AbiEvent.d.ts.map +1 -1
  3. package/dist/core/AbiEvent.js +10 -9
  4. package/dist/core/AbiEvent.js.map +1 -1
  5. package/dist/core/Blobs.d.ts.map +1 -1
  6. package/dist/core/Blobs.js +6 -2
  7. package/dist/core/Blobs.js.map +1 -1
  8. package/dist/core/Signature.d.ts +6 -5
  9. package/dist/core/Signature.d.ts.map +1 -1
  10. package/dist/core/Signature.js +17 -7
  11. package/dist/core/Signature.js.map +1 -1
  12. package/dist/core/Siwe.d.ts.map +1 -1
  13. package/dist/core/Siwe.js +21 -1
  14. package/dist/core/Siwe.js.map +1 -1
  15. package/dist/tempo/KeyAuthorization.d.ts +43 -39
  16. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  17. package/dist/tempo/KeyAuthorization.js +24 -4
  18. package/dist/tempo/KeyAuthorization.js.map +1 -1
  19. package/dist/tempo/MultisigConfig.d.ts +18 -15
  20. package/dist/tempo/MultisigConfig.d.ts.map +1 -1
  21. package/dist/tempo/MultisigConfig.js +49 -20
  22. package/dist/tempo/MultisigConfig.js.map +1 -1
  23. package/dist/tempo/MultisigOperation.d.ts +45 -28
  24. package/dist/tempo/MultisigOperation.d.ts.map +1 -1
  25. package/dist/tempo/MultisigOperation.js +81 -131
  26. package/dist/tempo/MultisigOperation.js.map +1 -1
  27. package/dist/tempo/MultisigSimulation.d.ts +85 -0
  28. package/dist/tempo/MultisigSimulation.d.ts.map +1 -0
  29. package/dist/tempo/MultisigSimulation.js +112 -0
  30. package/dist/tempo/MultisigSimulation.js.map +1 -0
  31. package/dist/tempo/RpcSchemaTempo.d.ts +20 -10
  32. package/dist/tempo/RpcSchemaTempo.d.ts.map +1 -1
  33. package/dist/tempo/SignatureEnvelope.d.ts +74 -153
  34. package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
  35. package/dist/tempo/SignatureEnvelope.js +130 -187
  36. package/dist/tempo/SignatureEnvelope.js.map +1 -1
  37. package/dist/tempo/TransactionRequest.d.ts +9 -7
  38. package/dist/tempo/TransactionRequest.d.ts.map +1 -1
  39. package/dist/tempo/TransactionRequest.js +12 -7
  40. package/dist/tempo/TransactionRequest.js.map +1 -1
  41. package/dist/tempo/index.d.ts +7 -5
  42. package/dist/tempo/index.d.ts.map +1 -1
  43. package/dist/tempo/index.js +7 -5
  44. package/dist/tempo/index.js.map +1 -1
  45. package/dist/zod/tempo/AuthorizationTempo.d.ts +360 -140
  46. package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
  47. package/dist/zod/tempo/KeyAuthorization.d.ts +247 -487
  48. package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
  49. package/dist/zod/tempo/KeyAuthorization.js +29 -31
  50. package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
  51. package/dist/zod/tempo/MultisigOperation.d.ts +0 -10
  52. package/dist/zod/tempo/MultisigOperation.d.ts.map +1 -1
  53. package/dist/zod/tempo/MultisigOperation.js +0 -3
  54. package/dist/zod/tempo/MultisigOperation.js.map +1 -1
  55. package/dist/zod/tempo/MultisigSimulation.d.ts +52 -0
  56. package/dist/zod/tempo/MultisigSimulation.d.ts.map +1 -0
  57. package/dist/zod/tempo/MultisigSimulation.js +44 -0
  58. package/dist/zod/tempo/MultisigSimulation.js.map +1 -0
  59. package/dist/zod/tempo/RpcSchemaTempo.d.ts +357 -422
  60. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  61. package/dist/zod/tempo/RpcSchemaTempo.js +19 -10
  62. package/dist/zod/tempo/RpcSchemaTempo.js.map +1 -1
  63. package/dist/zod/tempo/SignatureEnvelope.d.ts +108 -42
  64. package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
  65. package/dist/zod/tempo/SignatureEnvelope.js +21 -19
  66. package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
  67. package/dist/zod/tempo/Transaction.d.ts +678 -666
  68. package/dist/zod/tempo/Transaction.d.ts.map +1 -1
  69. package/dist/zod/tempo/TransactionRequest.d.ts +580 -619
  70. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  71. package/dist/zod/tempo/TransactionRequest.js +18 -10
  72. package/dist/zod/tempo/TransactionRequest.js.map +1 -1
  73. package/dist/zod/tempo/TxEnvelopeTempo.d.ts +327 -213
  74. package/dist/zod/tempo/TxEnvelopeTempo.d.ts.map +1 -1
  75. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +105 -3
  76. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts.map +1 -1
  77. package/dist/zod/tempo/z.d.ts +1 -1
  78. package/dist/zod/tempo/z.d.ts.map +1 -1
  79. package/dist/zod/tempo/z.js +1 -1
  80. package/dist/zod/tempo/z.js.map +1 -1
  81. package/package.json +9 -9
  82. package/src/core/AbiEvent.ts +11 -9
  83. package/src/core/Blobs.ts +6 -2
  84. package/src/core/Signature.ts +41 -11
  85. package/src/core/Siwe.ts +20 -1
  86. package/src/core/_test/AbiEvent.test.ts +45 -0
  87. package/src/core/_test/Blobs.test.ts +22 -0
  88. package/src/core/_test/Signature.test.ts +166 -0
  89. package/src/core/_test/Siwe.test.ts +100 -1
  90. package/src/tempo/AuthorizationTempo.test.ts +8 -0
  91. package/src/tempo/KeyAuthorization.test-d.ts +16 -74
  92. package/src/tempo/KeyAuthorization.test.ts +113 -14
  93. package/src/tempo/KeyAuthorization.ts +110 -66
  94. package/src/tempo/MultisigConfig.test.ts +44 -20
  95. package/src/tempo/MultisigConfig.ts +65 -23
  96. package/src/tempo/MultisigOperation.test-d.ts +8 -6
  97. package/src/tempo/MultisigOperation.test.ts +187 -591
  98. package/src/tempo/MultisigOperation.ts +129 -205
  99. package/src/tempo/MultisigSimulation.test-d.ts +33 -0
  100. package/src/tempo/MultisigSimulation.test.ts +194 -0
  101. package/src/tempo/MultisigSimulation.ts +192 -0
  102. package/src/tempo/RpcSchemaTempo.test-d.ts +45 -10
  103. package/src/tempo/RpcSchemaTempo.ts +15 -6
  104. package/src/tempo/SignatureEnvelope.test-d.ts +27 -101
  105. package/src/tempo/SignatureEnvelope.test.ts +330 -533
  106. package/src/tempo/SignatureEnvelope.ts +198 -310
  107. package/src/tempo/Transaction.test.ts +61 -0
  108. package/src/tempo/TransactionRequest.test-d.ts +7 -7
  109. package/src/tempo/TransactionRequest.test.ts +81 -223
  110. package/src/tempo/TransactionRequest.ts +34 -13
  111. package/src/tempo/index.ts +7 -5
  112. package/src/tempo/multisig.e2e.test.ts +329 -818
  113. package/src/version.ts +1 -1
  114. package/src/zod/tempo/KeyAuthorization.ts +50 -39
  115. package/src/zod/tempo/MultisigOperation.ts +0 -3
  116. package/src/zod/tempo/MultisigSimulation.ts +53 -0
  117. package/src/zod/tempo/RpcSchemaTempo.ts +20 -10
  118. package/src/zod/tempo/SignatureEnvelope.ts +46 -59
  119. package/src/zod/tempo/TransactionRequest.ts +28 -14
  120. package/src/zod/tempo/_test/KeyAuthorization.test.ts +66 -30
  121. package/src/zod/tempo/_test/MultisigOperation.test.ts +0 -2
  122. package/src/zod/tempo/_test/MultisigSimulation.test-d.ts +13 -0
  123. package/src/zod/tempo/_test/MultisigSimulation.test.ts +53 -0
  124. package/src/zod/tempo/_test/RpcSchemaTempo.test-d.ts +19 -2
  125. package/src/zod/tempo/_test/RpcSchemaTempo.test.ts +46 -4
  126. package/src/zod/tempo/_test/SignatureEnvelope.test.ts +108 -129
  127. package/src/zod/tempo/_test/TransactionRequest.test.ts +17 -168
  128. package/src/zod/tempo/z.ts +1 -1
  129. package/dist/tempo/MultisigWitness.d.ts +0 -106
  130. package/dist/tempo/MultisigWitness.d.ts.map +0 -1
  131. package/dist/tempo/MultisigWitness.js +0 -118
  132. package/dist/tempo/MultisigWitness.js.map +0 -1
  133. package/dist/zod/tempo/MultisigWitness.d.ts +0 -152
  134. package/dist/zod/tempo/MultisigWitness.d.ts.map +0 -1
  135. package/dist/zod/tempo/MultisigWitness.js +0 -76
  136. package/dist/zod/tempo/MultisigWitness.js.map +0 -1
  137. package/src/tempo/MultisigWitness.test-d.ts +0 -42
  138. package/src/tempo/MultisigWitness.test.ts +0 -288
  139. package/src/tempo/MultisigWitness.ts +0 -210
  140. package/src/zod/tempo/MultisigWitness.ts +0 -101
  141. package/src/zod/tempo/_test/MultisigWitness.test-d.ts +0 -13
  142. package/src/zod/tempo/_test/MultisigWitness.test.ts +0 -149
@@ -1,6 +1,9 @@
1
1
  import { Transaction } from 'ox/tempo'
2
2
  import { describe, expect, test } from 'vp/test'
3
3
 
4
+ const multisigRpcSignature =
5
+ '0xf89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b' as const
6
+
4
7
  describe('fromRpc', () => {
5
8
  test('default', () => {
6
9
  const transaction = Transaction.fromRpc({
@@ -512,3 +515,61 @@ describe('toRpc', () => {
512
515
  `)
513
516
  })
514
517
  })
518
+
519
+ describe('roundtrip', () => {
520
+ test('behavior: multisig RPC signature', () => {
521
+ const rpc = {
522
+ accessList: [],
523
+ blockHash:
524
+ '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
525
+ blockNumber: '0x12f296f',
526
+ calls: [],
527
+ chainId: '0x1',
528
+ feeToken: '0x20c0000000000000000000000000000000000000',
529
+ from: '0xc4a590afa7337e5cd5eb3aa60cacf91c5400044b',
530
+ gas: '0x43f5d',
531
+ hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
532
+ maxFeePerGas: '0x2',
533
+ maxPriorityFeePerGas: '0x1',
534
+ nonce: '0x357',
535
+ signature: multisigRpcSignature,
536
+ transactionIndex: '0x2',
537
+ type: '0x76',
538
+ } as const satisfies Transaction.TempoRpc
539
+ const transaction = Transaction.fromRpc(rpc)
540
+
541
+ expect({
542
+ rpc: Transaction.toRpc(transaction).signature,
543
+ signature: transaction.signature,
544
+ }).toMatchInlineSnapshot(`
545
+ {
546
+ "rpc": "0xf89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b",
547
+ "signature": {
548
+ "account": "0xc4a590afa7337e5cd5eb3aa60cacf91c5400044b",
549
+ "config": {
550
+ "owners": [
551
+ {
552
+ "owner": "0x7e5f4552091a69125d5dfcb7b8c2659029395bdf",
553
+ "weight": 1,
554
+ },
555
+ ],
556
+ "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
557
+ "threshold": 1,
558
+ "version": 0n,
559
+ },
560
+ "signatures": [
561
+ {
562
+ "signature": {
563
+ "r": "0x869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f985",
564
+ "s": "0x35dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f4",
565
+ "yParity": 0,
566
+ },
567
+ "type": "secp256k1",
568
+ },
569
+ ],
570
+ "type": "multisig",
571
+ },
572
+ }
573
+ `)
574
+ })
575
+ })
@@ -1,7 +1,7 @@
1
1
  import type * as ox_TransactionRequest from '../core/TransactionRequest.js'
2
2
  import * as Signature from '../core/Signature.js'
3
3
  import { describe, expectTypeOf, test } from 'vp/test'
4
- import * as MultisigWitness from './MultisigWitness.js'
4
+ import * as MultisigSimulation from './MultisigSimulation.js'
5
5
  import * as SignatureEnvelope from './SignatureEnvelope.js'
6
6
  import * as TransactionRequest from './TransactionRequest.js'
7
7
  import * as TxEnvelopeTempo from './TxEnvelopeTempo.js'
@@ -49,12 +49,12 @@ describe('TransactionRequest type', () => {
49
49
  >()
50
50
  })
51
51
 
52
- test('carries domain and RPC multisig witnesses', () => {
52
+ test('carries domain and RPC multisig simulations', () => {
53
53
  expectTypeOf<
54
- TransactionRequest.TransactionRequest['multisigWitness']
55
- >().toEqualTypeOf<MultisigWitness.MultisigWitness | undefined>()
56
- expectTypeOf<TransactionRequest.Rpc['multisigWitness']>().toEqualTypeOf<
57
- MultisigWitness.Rpc | undefined
54
+ TransactionRequest.TransactionRequest['multisigSimulation']
55
+ >().toEqualTypeOf<MultisigSimulation.Spec | undefined>()
56
+ expectTypeOf<TransactionRequest.Rpc['multisigSimulation']>().toEqualTypeOf<
57
+ MultisigSimulation.Rpc | undefined
58
58
  >()
59
59
  })
60
60
  })
@@ -87,7 +87,7 @@ describe('toEnvelope', () => {
87
87
  keyType: 'secp256k1',
88
88
  maxFeePerGas: 1n,
89
89
  maxPriorityFeePerGas: 1n,
90
- multisigWitness: undefined,
90
+ multisigSimulation: undefined,
91
91
  nonce: 0n,
92
92
  nonceKey: 'random',
93
93
  signature: undefined,
@@ -1,6 +1,46 @@
1
- import { TransactionRequest } from 'ox/tempo'
1
+ import {
2
+ MultisigConfig,
3
+ type MultisigSimulation,
4
+ TransactionRequest,
5
+ } from 'ox/tempo'
2
6
  import { describe, expect, test } from 'vp/test'
3
7
 
8
+ const multisigSimulationRpc = {
9
+ approvals: [
10
+ {
11
+ keyType: 'webAuthn',
12
+ keyData: '0x0005',
13
+ owner: '0x1111111111111111111111111111111111111111',
14
+ },
15
+ ],
16
+ config:
17
+ '0xf852a011111111111111111111111111111111111111111111111111111111111111118002eed694111111111111111111111111111111111111111101d694bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb01',
18
+ } as const satisfies MultisigSimulation.Rpc
19
+
20
+ const multisigSimulation = {
21
+ approvals: [
22
+ {
23
+ keyType: 'webAuthn',
24
+ keyData: '0x0005',
25
+ owner: '0x1111111111111111111111111111111111111111',
26
+ },
27
+ ],
28
+ config: MultisigConfig.from({
29
+ owners: [
30
+ {
31
+ owner: '0x1111111111111111111111111111111111111111',
32
+ weight: 1,
33
+ },
34
+ {
35
+ owner: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
36
+ weight: 1,
37
+ },
38
+ ],
39
+ salt: `0x${'11'.repeat(32)}`,
40
+ threshold: 2,
41
+ }),
42
+ } as const satisfies MultisigSimulation.Spec
43
+
4
44
  describe('fromRpc', () => {
5
45
  test('default', () => {
6
46
  const request = TransactionRequest.fromRpc({
@@ -99,132 +139,37 @@ describe('fromRpc', () => {
99
139
  `)
100
140
  })
101
141
 
102
- test('behavior: multisig witness configs decode from RPC numbers', () => {
142
+ test('behavior: multisig simulation', () => {
103
143
  const request = TransactionRequest.fromRpc({
104
- calls: [{ to: '0xcafebabecafebabecafebabecafebabecafebabe' }],
105
- multisigWitness: {
106
- account: '0xcccccccccccccccccccccccccccccccccccccccc',
107
- approvals: [
108
- {
109
- keyData: '0x0578',
110
- keyType: 'webAuthn',
111
- owner: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
112
- type: 'primitive',
113
- },
114
- {
115
- type: 'multisig',
116
- witness: {
117
- account: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
118
- approvals: [
119
- {
120
- keyType: 'secp256k1',
121
- owner: '0xdddddddddddddddddddddddddddddddddddddddd',
122
- },
123
- {
124
- owner: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
125
- },
126
- ],
127
- config: {
128
- owners: [
129
- {
130
- owner: '0xdddddddddddddddddddddddddddddddddddddddd',
131
- weight: 1,
132
- },
133
- {
134
- owner: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
135
- weight: 1,
136
- },
137
- ],
138
- salt: '0x2222222222222222222222222222222222222222222222222222222222222222',
139
- threshold: 2,
140
- version: 2,
141
- },
142
- },
143
- },
144
- ],
145
- config: {
146
- owners: [
147
- {
148
- owner: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
149
- weight: 1,
150
- },
151
- {
152
- owner: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
153
- weight: 1,
154
- },
155
- ],
156
- salt: '0x1111111111111111111111111111111111111111111111111111111111111111',
157
- threshold: 2,
158
- version: 1,
159
- },
160
- },
144
+ from: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
145
+ multisigSimulation: multisigSimulationRpc,
161
146
  type: '0x76',
162
147
  })
163
- expect(request).toMatchInlineSnapshot(`
148
+
149
+ expect(request.multisigSimulation).toMatchInlineSnapshot(`
164
150
  {
165
- "calls": [
151
+ "approvals": [
166
152
  {
167
- "data": undefined,
168
- "to": "0xcafebabecafebabecafebabecafebabecafebabe",
153
+ "keyData": "0x0005",
154
+ "keyType": "webAuthn",
155
+ "owner": "0x1111111111111111111111111111111111111111",
169
156
  },
170
157
  ],
171
- "multisigWitness": {
172
- "account": "0xcccccccccccccccccccccccccccccccccccccccc",
173
- "approvals": [
158
+ "config": {
159
+ "owners": [
174
160
  {
175
- "keyData": "0x0578",
176
- "keyType": "webAuthn",
177
- "owner": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
178
- "type": "primitive",
161
+ "owner": "0x1111111111111111111111111111111111111111",
162
+ "weight": 1,
179
163
  },
180
164
  {
181
- "type": "multisig",
182
- "witness": {
183
- "account": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
184
- "approvals": [
185
- {
186
- "keyType": "secp256k1",
187
- "owner": "0xdddddddddddddddddddddddddddddddddddddddd",
188
- },
189
- {
190
- "owner": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
191
- },
192
- ],
193
- "config": {
194
- "owners": [
195
- {
196
- "owner": "0xdddddddddddddddddddddddddddddddddddddddd",
197
- "weight": 1,
198
- },
199
- {
200
- "owner": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
201
- "weight": 1,
202
- },
203
- ],
204
- "salt": "0x2222222222222222222222222222222222222222222222222222222222222222",
205
- "threshold": 2,
206
- "version": 2n,
207
- },
208
- },
165
+ "owner": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
166
+ "weight": 1,
209
167
  },
210
168
  ],
211
- "config": {
212
- "owners": [
213
- {
214
- "owner": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
215
- "weight": 1,
216
- },
217
- {
218
- "owner": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
219
- "weight": 1,
220
- },
221
- ],
222
- "salt": "0x1111111111111111111111111111111111111111111111111111111111111111",
223
- "threshold": 2,
224
- "version": 1n,
225
- },
169
+ "salt": "0x1111111111111111111111111111111111111111111111111111111111111111",
170
+ "threshold": 2,
171
+ "version": 0n,
226
172
  },
227
- "type": "tempo",
228
173
  }
229
174
  `)
230
175
  })
@@ -313,130 +258,31 @@ describe('toRpc', () => {
313
258
  `)
314
259
  })
315
260
 
316
- test('behavior: multisig witness configs encode as RPC numbers', () => {
261
+ test('behavior: multisig simulation', () => {
317
262
  const request = TransactionRequest.toRpc({
318
- calls: [{ to: '0xcafebabecafebabecafebabecafebabecafebabe' }],
319
- multisigWitness: {
320
- account: '0xcccccccccccccccccccccccccccccccccccccccc',
321
- approvals: [
322
- {
323
- keyData: '0x0578',
324
- keyType: 'webAuthn',
325
- owner: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
326
- type: 'primitive',
327
- },
328
- {
329
- type: 'multisig',
330
- witness: {
331
- account: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
332
- approvals: [
333
- {
334
- keyType: 'secp256k1',
335
- owner: '0xdddddddddddddddddddddddddddddddddddddddd',
336
- },
337
- {
338
- owner: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
339
- },
340
- ],
341
- config: {
342
- owners: [
343
- {
344
- owner: '0xdddddddddddddddddddddddddddddddddddddddd',
345
- weight: 1,
346
- },
347
- {
348
- owner: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
349
- weight: 1,
350
- },
351
- ],
352
- salt: '0x2222222222222222222222222222222222222222222222222222222222222222',
353
- threshold: 2,
354
- version: 2n,
355
- },
356
- },
357
- },
358
- ],
359
- config: {
360
- owners: [
361
- {
362
- owner: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
363
- weight: 1,
364
- },
365
- {
366
- owner: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
367
- weight: 1,
368
- },
369
- ],
370
- salt: '0x1111111111111111111111111111111111111111111111111111111111111111',
371
- threshold: 2,
372
- version: 1n,
373
- },
374
- },
263
+ from: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
264
+ multisigSimulation,
375
265
  })
266
+
376
267
  expect(request).toMatchInlineSnapshot(`
377
268
  {
378
269
  "calls": [
379
270
  {
380
271
  "data": "0x",
381
- "to": "0xcafebabecafebabecafebabecafebabecafebabe",
272
+ "to": "0x0000000000000000000000000000000000000000",
382
273
  "value": "0x",
383
274
  },
384
275
  ],
385
- "multisigWitness": {
386
- "account": "0xcccccccccccccccccccccccccccccccccccccccc",
276
+ "from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
277
+ "multisigSimulation": {
387
278
  "approvals": [
388
279
  {
389
- "keyData": "0x0578",
280
+ "keyData": "0x0005",
390
281
  "keyType": "webAuthn",
391
- "owner": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
392
- "type": "primitive",
393
- },
394
- {
395
- "type": "multisig",
396
- "witness": {
397
- "account": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
398
- "approvals": [
399
- {
400
- "keyType": "secp256k1",
401
- "owner": "0xdddddddddddddddddddddddddddddddddddddddd",
402
- },
403
- {
404
- "owner": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
405
- },
406
- ],
407
- "config": {
408
- "owners": [
409
- {
410
- "owner": "0xdddddddddddddddddddddddddddddddddddddddd",
411
- "weight": 1,
412
- },
413
- {
414
- "owner": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
415
- "weight": 1,
416
- },
417
- ],
418
- "salt": "0x2222222222222222222222222222222222222222222222222222222222222222",
419
- "threshold": 2,
420
- "version": 2,
421
- },
422
- },
282
+ "owner": "0x1111111111111111111111111111111111111111",
423
283
  },
424
284
  ],
425
- "config": {
426
- "owners": [
427
- {
428
- "owner": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
429
- "weight": 1,
430
- },
431
- {
432
- "owner": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
433
- "weight": 1,
434
- },
435
- ],
436
- "salt": "0x1111111111111111111111111111111111111111111111111111111111111111",
437
- "threshold": 2,
438
- "version": 1,
439
- },
285
+ "config": "0xf852a011111111111111111111111111111111111111111111111111111111111111118002eed694111111111111111111111111111111111111111101d694bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb01",
440
286
  },
441
287
  "type": "0x76",
442
288
  }
@@ -540,6 +386,8 @@ describe('roundtrip', () => {
540
386
  nonceKey: 255n,
541
387
  gas: 100000n,
542
388
  maxFeePerGas: 1000000000n,
389
+ keyAuthorizationSimulation: multisigSimulation,
390
+ multisigSimulation,
543
391
  }
544
392
 
545
393
  const rpc = TransactionRequest.toRpc(original)
@@ -560,6 +408,10 @@ describe('roundtrip', () => {
560
408
  expect(converted.nonceKey).toBe(original.nonceKey)
561
409
  expect(converted.gas).toBe(original.gas)
562
410
  expect(converted.maxFeePerGas).toBe(original.maxFeePerGas)
411
+ expect(converted.keyAuthorizationSimulation).toEqual(
412
+ original.keyAuthorizationSimulation,
413
+ )
414
+ expect(converted.multisigSimulation).toEqual(original.multisigSimulation)
563
415
  expect(converted.type).toBe('tempo')
564
416
  })
565
417
 
@@ -577,6 +429,8 @@ describe('roundtrip', () => {
577
429
  validAfter: '0x32',
578
430
  nonceKey: '0xff',
579
431
  gas: '0x186a0',
432
+ keyAuthorizationSimulation: multisigSimulationRpc,
433
+ multisigSimulation: multisigSimulationRpc,
580
434
  type: '0x76',
581
435
  }
582
436
 
@@ -589,6 +443,10 @@ describe('roundtrip', () => {
589
443
  expect(rpc.validAfter).toBe(original.validAfter)
590
444
  expect(rpc.nonceKey).toBe(original.nonceKey)
591
445
  expect(rpc.gas).toBe(original.gas)
446
+ expect(rpc.keyAuthorizationSimulation).toEqual(
447
+ original.keyAuthorizationSimulation,
448
+ )
449
+ expect(rpc.multisigSimulation).toEqual(original.multisigSimulation)
592
450
  expect(rpc.type).toBe('0x76')
593
451
  })
594
452
  })
@@ -7,13 +7,13 @@ import * as Signature from '../core/Signature.js'
7
7
  import * as ox_TransactionRequest from '../core/TransactionRequest.js'
8
8
  import * as AuthorizationTempo from './AuthorizationTempo.js'
9
9
  import * as KeyAuthorization from './KeyAuthorization.js'
10
- import * as MultisigWitness from './MultisigWitness.js'
10
+ import * as MultisigSimulation from './MultisigSimulation.js'
11
11
  import * as SignatureEnvelope from './SignatureEnvelope.js'
12
12
  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 = 'secp256k1' | 'p256' | 'webAuthn'
16
+ type KeyType = SignatureEnvelope.Type | 'multisig'
17
17
 
18
18
  /**
19
19
  * A Transaction Request that is generic to all transaction types.
@@ -41,10 +41,11 @@ 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
47
- multisigWitness?: MultisigWitness.MultisigWitness | undefined
48
+ multisigSimulation?: MultisigSimulation.Spec | undefined
48
49
  nonceKey?: 'random' | bigintType | undefined
49
50
  signature?: SignatureEnvelope.SignatureEnvelope<numberType> | undefined
50
51
  validAfter?: numberType | undefined
@@ -59,14 +60,16 @@ export type Rpc = Omit<
59
60
  | 'feePayerSignature'
60
61
  | 'feeToken'
61
62
  | 'keyAuthorization'
62
- | 'multisigWitness'
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
69
- multisigWitness?: MultisigWitness.Rpc | undefined
71
+ keyAuthorizationSimulation?: MultisigSimulation.Rpc | undefined
72
+ multisigSimulation?: MultisigSimulation.Rpc | undefined
70
73
  nonceKey?: Hex.Hex | undefined
71
74
  signature?: SignatureEnvelope.SignatureEnvelopeRpc | undefined
72
75
  }
@@ -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 { authorizationList: _, multisigWitness: __, ...rest } = request
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,8 +137,14 @@ export function fromRpc(request: Rpc): TransactionRequest {
129
137
  request_.keyAuthorization = KeyAuthorization.fromRpc(
130
138
  request.keyAuthorization,
131
139
  )
132
- if (request.multisigWitness)
133
- request_.multisigWitness = MultisigWitness.fromRpc(request.multisigWitness)
140
+ if (request.keyAuthorizationSimulation)
141
+ request_.keyAuthorizationSimulation = MultisigSimulation.fromRpc(
142
+ request.keyAuthorizationSimulation,
143
+ )
144
+ if (request.multisigSimulation)
145
+ request_.multisigSimulation = MultisigSimulation.fromRpc(
146
+ request.multisigSimulation,
147
+ )
134
148
  if (typeof request.validBefore !== 'undefined')
135
149
  request_.validBefore = Hex.toNumber(request.validBefore as Hex.Hex)
136
150
  if (typeof request.validAfter !== 'undefined')
@@ -146,7 +160,7 @@ export declare namespace fromRpc {
146
160
  | AuthorizationTempo.fromRpcList.ErrorType
147
161
  | Hex.toNumber.ErrorType
148
162
  | Hex.toBigInt.ErrorType
149
- | MultisigWitness.fromRpc.ErrorType
163
+ | MultisigSimulation.fromRpc.ErrorType
150
164
  | Errors.GlobalErrorType
151
165
  }
152
166
 
@@ -220,7 +234,8 @@ export function toRpc(request: toRpc.Input): Rpc {
220
234
  typeof request.keyData !== 'undefined' ||
221
235
  typeof request.keyId !== 'undefined' ||
222
236
  typeof request.keyType !== 'undefined' ||
223
- typeof request.multisigWitness !== 'undefined' ||
237
+ typeof request.keyAuthorizationSimulation !== 'undefined' ||
238
+ typeof request.multisigSimulation !== 'undefined' ||
224
239
  typeof request.nonceKey !== 'undefined' ||
225
240
  typeof request.validBefore !== 'undefined' ||
226
241
  typeof request.validAfter !== 'undefined' ||
@@ -270,8 +285,14 @@ export function toRpc(request: toRpc.Input): Rpc {
270
285
  if (typeof request.keyId !== 'undefined') request_rpc.keyId = request.keyId
271
286
  if (typeof request.keyType !== 'undefined')
272
287
  request_rpc.keyType = request.keyType
273
- if (typeof request.multisigWitness !== 'undefined')
274
- request_rpc.multisigWitness = MultisigWitness.toRpc(request.multisigWitness)
288
+ if (typeof request.keyAuthorizationSimulation !== 'undefined')
289
+ request_rpc.keyAuthorizationSimulation = MultisigSimulation.toRpc(
290
+ request.keyAuthorizationSimulation,
291
+ )
292
+ if (typeof request.multisigSimulation !== 'undefined')
293
+ request_rpc.multisigSimulation = MultisigSimulation.toRpc(
294
+ request.multisigSimulation,
295
+ )
275
296
  if (typeof request.validBefore !== 'undefined')
276
297
  request_rpc.validBefore = Quantity.fromNumberish(request.validBefore)
277
298
  if (typeof request.validAfter !== 'undefined')
@@ -306,7 +327,7 @@ export declare namespace toRpc {
306
327
  export type ErrorType =
307
328
  | AuthorizationTempo.toRpcList.ErrorType
308
329
  | Hex.fromNumber.ErrorType
309
- | MultisigWitness.toRpc.ErrorType
330
+ | MultisigSimulation.toRpc.ErrorType
310
331
  | Errors.GlobalErrorType
311
332
  }
312
333
 
@@ -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
@@ -183,14 +185,14 @@ export * as MultisigConfig from './MultisigConfig.js'
183
185
  */
184
186
  export * as MultisigOperation from './MultisigOperation.js'
185
187
  /**
186
- * Native multisig RPC simulation witness utilities.
188
+ * Native multisig RPC simulation utilities.
187
189
  *
188
- * Converts complete root and nested owner witnesses between their domain and
189
- * Tempo JSON-RPC representations.
190
+ * Converts complete root and nested owner specs between their domain and Tempo
191
+ * JSON-RPC representations.
190
192
  *
191
193
  * @category Reference
192
194
  */
193
- export * as MultisigWitness from './MultisigWitness.js'
195
+ export * as MultisigSimulation from './MultisigSimulation.js'
194
196
  /**
195
197
  * Utilities for constructing period durations (in seconds) for recurring spending limits.
196
198
  *