ox 1.8.5 → 1.8.7

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 (137) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/tempo/{MultisigConfig.d.ts → AccountConfig.d.ts} +116 -63
  3. package/dist/tempo/AccountConfig.d.ts.map +1 -0
  4. package/dist/tempo/{MultisigConfig.js → AccountConfig.js} +109 -55
  5. package/dist/tempo/AccountConfig.js.map +1 -0
  6. package/dist/tempo/{MultisigOperation.d.ts → AccountOperation.d.ts} +62 -62
  7. package/dist/tempo/AccountOperation.d.ts.map +1 -0
  8. package/dist/tempo/{MultisigOperation.js → AccountOperation.js} +64 -64
  9. package/dist/tempo/AccountOperation.js.map +1 -0
  10. package/dist/tempo/{MultisigSimulation.d.ts → AccountSimulation.d.ts} +21 -21
  11. package/dist/tempo/AccountSimulation.d.ts.map +1 -0
  12. package/dist/tempo/{MultisigSimulation.js → AccountSimulation.js} +20 -20
  13. package/dist/tempo/AccountSimulation.js.map +1 -0
  14. package/dist/tempo/KeyAuthorization.d.ts +37 -27
  15. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  16. package/dist/tempo/KeyAuthorization.js +17 -19
  17. package/dist/tempo/KeyAuthorization.js.map +1 -1
  18. package/dist/tempo/RpcSchemaTempo.d.ts +13 -13
  19. package/dist/tempo/RpcSchemaTempo.d.ts.map +1 -1
  20. package/dist/tempo/SignatureEnvelope.d.ts +36 -33
  21. package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
  22. package/dist/tempo/SignatureEnvelope.js +77 -77
  23. package/dist/tempo/SignatureEnvelope.js.map +1 -1
  24. package/dist/tempo/TokenRole.d.ts +4 -2
  25. package/dist/tempo/TokenRole.d.ts.map +1 -1
  26. package/dist/tempo/TokenRole.js +4 -1
  27. package/dist/tempo/TokenRole.js.map +1 -1
  28. package/dist/tempo/TransactionRequest.d.ts +11 -9
  29. package/dist/tempo/TransactionRequest.d.ts.map +1 -1
  30. package/dist/tempo/TransactionRequest.js +14 -10
  31. package/dist/tempo/TransactionRequest.js.map +1 -1
  32. package/dist/tempo/index.d.ts +56 -54
  33. package/dist/tempo/index.d.ts.map +1 -1
  34. package/dist/tempo/index.js +56 -54
  35. package/dist/tempo/index.js.map +1 -1
  36. package/dist/zod/tempo/{MultisigConfig.d.ts → AccountConfig.d.ts} +6 -6
  37. package/dist/zod/tempo/AccountConfig.d.ts.map +1 -0
  38. package/dist/zod/tempo/{MultisigConfig.js → AccountConfig.js} +12 -12
  39. package/dist/zod/tempo/AccountConfig.js.map +1 -0
  40. package/dist/zod/tempo/{MultisigOperation.d.ts → AccountOperation.d.ts} +5 -5
  41. package/dist/zod/tempo/AccountOperation.d.ts.map +1 -0
  42. package/dist/zod/tempo/{MultisigOperation.js → AccountOperation.js} +10 -10
  43. package/dist/zod/tempo/AccountOperation.js.map +1 -0
  44. package/dist/zod/tempo/{MultisigSimulation.d.ts → AccountSimulation.d.ts} +5 -5
  45. package/dist/zod/tempo/AccountSimulation.d.ts.map +1 -0
  46. package/dist/zod/tempo/AccountSimulation.js +44 -0
  47. package/dist/zod/tempo/AccountSimulation.js.map +1 -0
  48. package/dist/zod/tempo/AuthorizationTempo.d.ts +10 -10
  49. package/dist/zod/tempo/KeyAuthorization.d.ts +12 -12
  50. package/dist/zod/tempo/KeyAuthorization.js +6 -6
  51. package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
  52. package/dist/zod/tempo/RpcSchemaTempo.d.ts +59 -59
  53. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  54. package/dist/zod/tempo/RpcSchemaTempo.js +28 -28
  55. package/dist/zod/tempo/RpcSchemaTempo.js.map +1 -1
  56. package/dist/zod/tempo/SignatureEnvelope.d.ts +7 -7
  57. package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
  58. package/dist/zod/tempo/SignatureEnvelope.js +22 -16
  59. package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
  60. package/dist/zod/tempo/TokenRole.d.ts +1 -1
  61. package/dist/zod/tempo/TokenRole.d.ts.map +1 -1
  62. package/dist/zod/tempo/Transaction.d.ts +24 -24
  63. package/dist/zod/tempo/TransactionRequest.d.ts +84 -84
  64. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  65. package/dist/zod/tempo/TransactionRequest.js +26 -17
  66. package/dist/zod/tempo/TransactionRequest.js.map +1 -1
  67. package/dist/zod/tempo/TxEnvelopeTempo.d.ts +12 -12
  68. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +3 -3
  69. package/dist/zod/tempo/z.d.ts +3 -3
  70. package/dist/zod/tempo/z.d.ts.map +1 -1
  71. package/dist/zod/tempo/z.js +3 -3
  72. package/dist/zod/tempo/z.js.map +1 -1
  73. package/package.json +31 -31
  74. package/src/tempo/{MultisigConfig.test-d.ts → AccountConfig.test-d.ts} +22 -12
  75. package/src/tempo/{MultisigConfig.test.ts → AccountConfig.test.ts} +155 -37
  76. package/src/tempo/{MultisigConfig.ts → AccountConfig.ts} +138 -66
  77. package/src/tempo/AccountOperation.test-d.ts +79 -0
  78. package/src/tempo/{MultisigOperation.test.ts → AccountOperation.test.ts} +97 -97
  79. package/src/tempo/{MultisigOperation.ts → AccountOperation.ts} +95 -97
  80. package/src/tempo/{MultisigSimulation.test-d.ts → AccountSimulation.test-d.ts} +7 -9
  81. package/src/tempo/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +28 -28
  82. package/src/tempo/{MultisigSimulation.ts → AccountSimulation.ts} +28 -30
  83. package/src/tempo/KeyAuthorization.test-d.ts +15 -6
  84. package/src/tempo/KeyAuthorization.test.ts +117 -37
  85. package/src/tempo/KeyAuthorization.ts +68 -59
  86. package/src/tempo/RpcSchemaTempo.test-d.ts +19 -19
  87. package/src/tempo/RpcSchemaTempo.ts +13 -13
  88. package/src/tempo/SignatureEnvelope.test-d.ts +7 -7
  89. package/src/tempo/SignatureEnvelope.test.ts +34 -34
  90. package/src/tempo/SignatureEnvelope.ts +112 -108
  91. package/src/tempo/TokenRole.ts +4 -1
  92. package/src/tempo/Transaction.test.ts +4 -4
  93. package/src/tempo/TransactionRequest.test-d.ts +17 -6
  94. package/src/tempo/TransactionRequest.test.ts +32 -17
  95. package/src/tempo/TransactionRequest.ts +27 -19
  96. package/src/tempo/{multisig.e2e.test.ts → configurableAccounts.e2e.test.ts} +16 -16
  97. package/src/tempo/e2e.test.ts +32 -20
  98. package/src/tempo/index.ts +56 -54
  99. package/src/version.ts +1 -1
  100. package/src/zod/tempo/{MultisigConfig.ts → AccountConfig.ts} +12 -12
  101. package/src/zod/tempo/{MultisigOperation.ts → AccountOperation.ts} +9 -9
  102. package/src/zod/tempo/AccountSimulation.ts +53 -0
  103. package/src/zod/tempo/KeyAuthorization.ts +8 -8
  104. package/src/zod/tempo/RpcSchemaTempo.ts +28 -28
  105. package/src/zod/tempo/SignatureEnvelope.ts +23 -17
  106. package/src/zod/tempo/TransactionRequest.ts +29 -18
  107. package/src/zod/tempo/_test/AccountConfig.test-d.ts +13 -0
  108. package/src/zod/tempo/_test/{MultisigConfig.test.ts → AccountConfig.test.ts} +7 -7
  109. package/src/zod/tempo/_test/AccountOperation.test-d.ts +27 -0
  110. package/src/zod/tempo/_test/{MultisigOperation.test.ts → AccountOperation.test.ts} +9 -9
  111. package/src/zod/tempo/_test/AccountSimulation.test-d.ts +13 -0
  112. package/src/zod/tempo/_test/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +13 -13
  113. package/src/zod/tempo/_test/KeyAuthorization.test.ts +9 -9
  114. package/src/zod/tempo/_test/RpcSchemaTempo.test-d.ts +27 -27
  115. package/src/zod/tempo/_test/RpcSchemaTempo.test.ts +16 -18
  116. package/src/zod/tempo/_test/SignatureEnvelope.test-d.ts +5 -5
  117. package/src/zod/tempo/_test/SignatureEnvelope.test.ts +12 -9
  118. package/src/zod/tempo/_test/TransactionRequest.test.ts +28 -8
  119. package/src/zod/tempo/z.ts +3 -3
  120. package/dist/tempo/MultisigConfig.d.ts.map +0 -1
  121. package/dist/tempo/MultisigConfig.js.map +0 -1
  122. package/dist/tempo/MultisigOperation.d.ts.map +0 -1
  123. package/dist/tempo/MultisigOperation.js.map +0 -1
  124. package/dist/tempo/MultisigSimulation.d.ts.map +0 -1
  125. package/dist/tempo/MultisigSimulation.js.map +0 -1
  126. package/dist/zod/tempo/MultisigConfig.d.ts.map +0 -1
  127. package/dist/zod/tempo/MultisigConfig.js.map +0 -1
  128. package/dist/zod/tempo/MultisigOperation.d.ts.map +0 -1
  129. package/dist/zod/tempo/MultisigOperation.js.map +0 -1
  130. package/dist/zod/tempo/MultisigSimulation.d.ts.map +0 -1
  131. package/dist/zod/tempo/MultisigSimulation.js +0 -44
  132. package/dist/zod/tempo/MultisigSimulation.js.map +0 -1
  133. package/src/tempo/MultisigOperation.test-d.ts +0 -79
  134. package/src/zod/tempo/MultisigSimulation.ts +0 -53
  135. package/src/zod/tempo/_test/MultisigConfig.test-d.ts +0 -13
  136. package/src/zod/tempo/_test/MultisigOperation.test-d.ts +0 -27
  137. package/src/zod/tempo/_test/MultisigSimulation.test-d.ts +0 -13
@@ -9,39 +9,44 @@ import type { Compute } from '../core/internal/types.js'
9
9
  /** Maximum encoded byte length for one primitive owner approval. */
10
10
  export const maxOwnerSignatureBytes = 2049
11
11
 
12
- /** Maximum number of owners allowed in a native multisig config. */
12
+ /** Maximum number of owners allowed in an account config. */
13
13
  export const maxOwners = 48
14
14
 
15
- /** Maximum number of owner approvals in a native multisig signature. */
15
+ /** Maximum number of owner approvals in a configurable account signature. */
16
16
  export const maxSignatures = 8
17
17
 
18
- /** Maximum threshold accepted by a native multisig config. */
19
- export const maxThreshold = 8
18
+ /**
19
+ * Maximum threshold accepted by an account config.
20
+ *
21
+ * The threshold must also be reachable by at most {@link ox#AccountConfig.maxSignatures}
22
+ * owner approvals.
23
+ */
24
+ export const maxThreshold = 0xff
20
25
 
21
- /** Maximum version accepted by a native multisig config. */
26
+ /** Maximum version accepted by an account config. */
22
27
  export const maxVersion = 2n ** 64n - 1n
23
28
 
24
- /** Tempo signature type byte for native multisig signatures. */
29
+ /** Tempo signature type byte for configurable account signatures. */
25
30
  export const signatureTypeByte = '0x05' as const
26
31
 
27
32
  /** Zero 32-byte salt (the default when no salt is provided). */
28
33
  export const zeroSalt = `0x${'00'.repeat(32)}` as const
29
34
 
30
- /** Domain prefix for the native multisig account address derivation. */
35
+ /** Domain prefix for the configurable account address derivation. */
31
36
  const accountDomain = 'tempo:multisig:account'
32
37
 
33
- /** Domain prefix for native multisig configuration commitments. */
38
+ /** Domain prefix for account configuration commitments. */
34
39
  const configDomain = 'tempo:multisig:config'
35
40
 
36
41
  /** Keccak-256 of the canonical recovery wallet creation code. */
37
42
  const recoveryWalletInitCodeHash =
38
43
  '0x583cc63a2e37f645b43eac911b1a6d6de08b83abdc308c61364edda8cfc3bd37'
39
44
 
40
- /** Domain prefix for native multisig owner approvals. */
45
+ /** Domain prefix for configurable account owner approvals. */
41
46
  const signatureDomain = 'tempo:multisig:signature'
42
47
 
43
48
  /**
44
- * Complete native multisig configuration witness.
49
+ * Complete account configuration witness.
45
50
  */
46
51
  export type Config<bigintType = bigint, numberType = number> = Compute<{
47
52
  /** Weighted owner list, strictly ascending by owner address. */
@@ -54,7 +59,7 @@ export type Config<bigintType = bigint, numberType = number> = Compute<{
54
59
  version: bigintType
55
60
  }>
56
61
 
57
- /** Input accepted when constructing a native multisig configuration. */
62
+ /** Input accepted when constructing an account configuration. */
58
63
  export type Input<
59
64
  versionType extends bigint | number = bigint | number,
60
65
  numberType = number,
@@ -63,7 +68,7 @@ export type Input<
63
68
  owners: readonly Owner<numberType>[]
64
69
  /**
65
70
  * Caller-chosen 32-byte salt mixed into the derived account address.
66
- * Defaults to the zero salt (`MultisigConfig.zeroSalt`) when omitted.
71
+ * Defaults to the zero salt (`AccountConfig.zeroSalt`) when omitted.
67
72
  */
68
73
  salt?: Hex.Hex | undefined
69
74
  /** Minimum total owner weight required to authorize a transaction. */
@@ -72,7 +77,7 @@ export type Input<
72
77
  version?: versionType | undefined
73
78
  }>
74
79
 
75
- /** Native multisig owner entry. */
80
+ /** Account config owner entry. */
76
81
  export type Owner<numberType = number> = {
77
82
  /** Owner address (recovered from the owner's approval). */
78
83
  owner: Address.Address
@@ -80,10 +85,10 @@ export type Owner<numberType = number> = {
80
85
  weight: numberType
81
86
  }
82
87
 
83
- /** JSON-RPC representation of a native multisig configuration. */
88
+ /** JSON-RPC representation of an account configuration. */
84
89
  export type Rpc = Config<Hex.Hex, number>
85
90
 
86
- /** RLP tuple representation of a {@link ox#MultisigConfig.Config}. */
91
+ /** RLP tuple representation of a {@link ox#AccountConfig.Config}. */
87
92
  export type Tuple = readonly [
88
93
  salt: Hex.Hex,
89
94
  version: Hex.Hex,
@@ -92,7 +97,7 @@ export type Tuple = readonly [
92
97
  ]
93
98
 
94
99
  /**
95
- * Asserts that a native multisig {@link ox#MultisigConfig.Config} is valid.
100
+ * Asserts that an {@link ox#AccountConfig.Config} is valid.
96
101
  *
97
102
  * Mirrors the Tempo configuration rules: owners non-empty and
98
103
  * `<= maxOwners`, strictly ascending unique nonzero owner addresses, nonzero
@@ -102,9 +107,9 @@ export type Tuple = readonly [
102
107
  *
103
108
  * @example
104
109
  * ```ts twoslash
105
- * import { MultisigConfig } from 'ox/tempo'
110
+ * import { AccountConfig } from 'ox/tempo'
106
111
  *
107
- * MultisigConfig.assert({
112
+ * AccountConfig.assert({
108
113
  * threshold: 1,
109
114
  * owners: [
110
115
  * {
@@ -115,7 +120,7 @@ export type Tuple = readonly [
115
120
  * })
116
121
  * ```
117
122
  *
118
- * @param config - The multisig config.
123
+ * @param config - The account config.
119
124
  */
120
125
  export function assert<
121
126
  versionType extends bigint | number = bigint | number,
@@ -186,16 +191,16 @@ export declare namespace assert {
186
191
  }
187
192
 
188
193
  /**
189
- * Normalizes a native multisig {@link ox#MultisigConfig.Config}.
194
+ * Normalizes an {@link ox#AccountConfig.Config}.
190
195
  *
191
196
  * Sorts owners into strictly ascending `owner` address order (the canonical
192
197
  * form required for account derivation) and asserts the config is valid.
193
198
  *
194
199
  * @example
195
200
  * ```ts twoslash
196
- * import { MultisigConfig } from 'ox/tempo'
201
+ * import { AccountConfig } from 'ox/tempo'
197
202
  *
198
- * const config = MultisigConfig.from({
203
+ * const config = AccountConfig.from({
199
204
  * owners: [
200
205
  * {
201
206
  * owner: '0x2222222222222222222222222222222222222222',
@@ -211,8 +216,8 @@ export declare namespace assert {
211
216
  * // owners are now sorted ascending by address
212
217
  * ```
213
218
  *
214
- * @param config - The multisig config.
215
- * @returns The normalized multisig config.
219
+ * @param config - The account config.
220
+ * @returns The normalized account config.
216
221
  */
217
222
  export function from<numberType = number>(
218
223
  config: Input<0 | 0n, numberType> & { version?: 0 | 0n | undefined },
@@ -246,13 +251,13 @@ export function from<numberType = number>(
246
251
  }
247
252
 
248
253
  /**
249
- * Converts a JSON-RPC multisig configuration to its domain representation.
254
+ * Converts a JSON-RPC account configuration to its domain representation.
250
255
  *
251
256
  * @example
252
257
  * ```ts twoslash
253
- * import { MultisigConfig } from 'ox/tempo'
258
+ * import { AccountConfig } from 'ox/tempo'
254
259
  *
255
- * const config = MultisigConfig.fromRpc({
260
+ * const config = AccountConfig.fromRpc({
256
261
  * owners: [
257
262
  * {
258
263
  * owner: '0x1111111111111111111111111111111111111111',
@@ -265,8 +270,8 @@ export function from<numberType = number>(
265
270
  * })
266
271
  * ```
267
272
  *
268
- * @param config - The JSON-RPC multisig configuration.
269
- * @returns The normalized multisig configuration.
273
+ * @param config - The JSON-RPC account configuration.
274
+ * @returns The normalized account configuration.
270
275
  */
271
276
  export function fromRpc(config: Rpc): Config {
272
277
  return from({
@@ -283,14 +288,14 @@ export declare namespace fromRpc {
283
288
  }
284
289
 
285
290
  /**
286
- * Converts an RLP {@link ox#MultisigConfig.Tuple} back to a
287
- * {@link ox#MultisigConfig.Config}.
291
+ * Converts an RLP {@link ox#AccountConfig.Tuple} back to a
292
+ * {@link ox#AccountConfig.Config}.
288
293
  *
289
294
  * @example
290
295
  * ```ts twoslash
291
- * import { MultisigConfig } from 'ox/tempo'
296
+ * import { AccountConfig } from 'ox/tempo'
292
297
  *
293
- * const config = MultisigConfig.fromTuple([
298
+ * const config = AccountConfig.fromTuple([
294
299
  * `0x${'00'.repeat(32)}`,
295
300
  * '0x',
296
301
  * '0x01',
@@ -299,7 +304,7 @@ export declare namespace fromRpc {
299
304
  * ```
300
305
  *
301
306
  * @param tuple - The RLP tuple.
302
- * @returns The multisig config.
307
+ * @returns The account config.
303
308
  */
304
309
  export function fromTuple(tuple: Tuple): Config {
305
310
  const [salt, version, threshold, owners] = tuple
@@ -343,7 +348,7 @@ export function fromTuple(tuple: Tuple): Config {
343
348
  }
344
349
 
345
350
  /**
346
- * Derives the stable native multisig account address.
351
+ * Derives the stable configurable account address.
347
352
  *
348
353
  * The initial config is hashed into a CREATE2 salt using fixed-width
349
354
  * big-endian fields, not RLP. The account uses the chain-configured recovery
@@ -354,9 +359,9 @@ export function fromTuple(tuple: Tuple): Config {
354
359
  *
355
360
  * @example
356
361
  * ```ts twoslash
357
- * import { MultisigConfig } from 'ox/tempo'
362
+ * import { AccountConfig } from 'ox/tempo'
358
363
  *
359
- * const initialConfig = MultisigConfig.from({
364
+ * const initialConfig = AccountConfig.from({
360
365
  * owners: [
361
366
  * {
362
367
  * owner: '0x1111111111111111111111111111111111111111',
@@ -366,14 +371,14 @@ export function fromTuple(tuple: Tuple): Config {
366
371
  * threshold: 1
367
372
  * })
368
373
  *
369
- * const address = MultisigConfig.getAddress(initialConfig, {
374
+ * const address = AccountConfig.getAddress(initialConfig, {
370
375
  * factory: '0x7171717171717171717171717171717171717171'
371
376
  * })
372
377
  * ```
373
378
  *
374
- * @param config - The initial multisig config.
379
+ * @param config - The initial account config.
375
380
  * @param options - The recovery factory configured by the chain.
376
- * @returns The multisig account address.
381
+ * @returns The configurable account address.
377
382
  */
378
383
  export function getAddress(
379
384
  config: Input,
@@ -428,16 +433,16 @@ export declare namespace getAddress {
428
433
  }
429
434
 
430
435
  /**
431
- * Computes the commitment for a native multisig configuration.
436
+ * Computes the commitment for an account configuration.
432
437
  *
433
438
  * The commitment uses raw fixed-width fields, not RLP or ABI encoding:
434
439
  * `keccak256("tempo:multisig:config" || salt || uint64be(version) || uint8(threshold) || uint8(owners.length) || owners)`.
435
440
  *
436
441
  * @example
437
442
  * ```ts twoslash
438
- * import { MultisigConfig } from 'ox/tempo'
443
+ * import { AccountConfig } from 'ox/tempo'
439
444
  *
440
- * const commitment = MultisigConfig.getCommitment({
445
+ * const commitment = AccountConfig.getCommitment({
441
446
  * owners: [
442
447
  * {
443
448
  * owner: '0x1111111111111111111111111111111111111111',
@@ -449,7 +454,7 @@ export declare namespace getAddress {
449
454
  * })
450
455
  * ```
451
456
  *
452
- * @param config - The complete multisig configuration.
457
+ * @param config - The complete account configuration.
453
458
  * @returns The configuration commitment.
454
459
  */
455
460
  export function getCommitment(config: Input): Hex.Hex {
@@ -480,7 +485,7 @@ export declare namespace getCommitment {
480
485
  }
481
486
 
482
487
  /**
483
- * Computes the digest a native multisig owner approves (signs).
488
+ * Computes the digest a configurable account owner approves (signs).
484
489
  *
485
490
  * `keccak256("tempo:multisig:signature" || inner_digest || account || uint64be(version))`,
486
491
  * where `inner_digest` is the transaction sign payload
@@ -492,9 +497,9 @@ export declare namespace getCommitment {
492
497
  *
493
498
  * @example
494
499
  * ```ts twoslash
495
- * import { MultisigConfig, TxEnvelopeTempo } from 'ox/tempo'
500
+ * import { AccountConfig, TxEnvelopeTempo } from 'ox/tempo'
496
501
  *
497
- * const config = MultisigConfig.from({
502
+ * const config = AccountConfig.from({
498
503
  * owners: [
499
504
  * {
500
505
  * owner: '0x1111111111111111111111111111111111111111',
@@ -509,8 +514,8 @@ export declare namespace getCommitment {
509
514
  * calls: []
510
515
  * })
511
516
  *
512
- * const digest = MultisigConfig.getSignPayload({
513
- * account: MultisigConfig.getAddress(config, {
517
+ * const digest = AccountConfig.getSignPayload({
518
+ * account: AccountConfig.getAddress(config, {
514
519
  * factory: '0x7171717171717171717171717171717171717171'
515
520
  * }),
516
521
  * config,
@@ -539,7 +544,7 @@ export function getSignPayload(value: getSignPayload.Value): Hex.Hex {
539
544
 
540
545
  export declare namespace getSignPayload {
541
546
  type Value = {
542
- /** The native multisig account address. */
547
+ /** The configurable account address. */
543
548
  account: Address.Address
544
549
  /** Configuration whose version applies to the approval. */
545
550
  config: Pick<Config<bigint | number>, 'version'>
@@ -557,13 +562,13 @@ export declare namespace getSignPayload {
557
562
  }
558
563
 
559
564
  /**
560
- * Converts a multisig configuration to its JSON-RPC representation.
565
+ * Converts an account configuration to its JSON-RPC representation.
561
566
  *
562
567
  * @example
563
568
  * ```ts twoslash
564
- * import { MultisigConfig } from 'ox/tempo'
569
+ * import { AccountConfig } from 'ox/tempo'
565
570
  *
566
- * const config = MultisigConfig.toRpc({
571
+ * const config = AccountConfig.toRpc({
567
572
  * owners: [
568
573
  * {
569
574
  * owner: '0x1111111111111111111111111111111111111111',
@@ -574,8 +579,8 @@ export declare namespace getSignPayload {
574
579
  * })
575
580
  * ```
576
581
  *
577
- * @param config - The multisig configuration.
578
- * @returns The JSON-RPC multisig configuration.
582
+ * @param config - The account configuration.
583
+ * @returns The JSON-RPC account configuration.
579
584
  */
580
585
  export function toRpc(config: Input): Rpc {
581
586
  const value = from(config)
@@ -598,7 +603,7 @@ export declare namespace toRpc {
598
603
  }
599
604
 
600
605
  /**
601
- * Converts a {@link ox#MultisigConfig.Config} to its RLP tuple form.
606
+ * Converts a {@link ox#AccountConfig.Config} to its RLP tuple form.
602
607
  *
603
608
  * Tuple shape: `[salt, version, threshold, [[owner, weight], ...]]`. The
604
609
  * 32-byte `salt` encodes as a full fixed-width string; other integers use
@@ -606,9 +611,9 @@ export declare namespace toRpc {
606
611
  *
607
612
  * @example
608
613
  * ```ts twoslash
609
- * import { MultisigConfig } from 'ox/tempo'
614
+ * import { AccountConfig } from 'ox/tempo'
610
615
  *
611
- * const tuple = MultisigConfig.toTuple({
616
+ * const tuple = AccountConfig.toTuple({
612
617
  * owners: [
613
618
  * {
614
619
  * owner: '0x1111111111111111111111111111111111111111',
@@ -619,7 +624,7 @@ export declare namespace toRpc {
619
624
  * })
620
625
  * ```
621
626
  *
622
- * @param config - The multisig config.
627
+ * @param config - The account config.
623
628
  * @returns The RLP tuple.
624
629
  */
625
630
  export function toTuple(config: Input): Tuple {
@@ -640,14 +645,81 @@ export function toTuple(config: Input): Tuple {
640
645
  }
641
646
 
642
647
  /**
643
- * Validates a native multisig {@link ox#MultisigConfig.Config}. Returns `true`
648
+ * Derives the configuration that replaces the current one in an owner update.
649
+ *
650
+ * Mirrors the `updateConfig` precompile ([TIP-1109](https://tips.sh/1109)):
651
+ * keeps the current salt, increments the version by one, and replaces the
652
+ * owners and threshold. Owners are sorted into canonical order and the next
653
+ * configuration is validated. The account address does not change.
654
+ *
655
+ * @example
656
+ * ```ts twoslash
657
+ * import { AccountConfig } from 'ox/tempo'
658
+ *
659
+ * const initialConfig = AccountConfig.from({
660
+ * owners: [
661
+ * {
662
+ * owner: '0x1111111111111111111111111111111111111111',
663
+ * weight: 1
664
+ * }
665
+ * ],
666
+ * threshold: 1
667
+ * })
668
+ *
669
+ * const config = AccountConfig.update(initialConfig, {
670
+ * owners: [
671
+ * {
672
+ * owner: '0x2222222222222222222222222222222222222222',
673
+ * weight: 1
674
+ * }
675
+ * ],
676
+ * threshold: 1
677
+ * })
678
+ * // config.version === 1n, with the initial salt
679
+ * ```
680
+ *
681
+ * @param config - The current account config.
682
+ * @param options - The replacement owners and threshold.
683
+ * @returns The next account config.
684
+ */
685
+ export function update<numberType = number>(
686
+ config: Input<bigint | number, numberType>,
687
+ options: update.Options<numberType>,
688
+ ): Config<bigint, numberType> {
689
+ const current = from(config)
690
+ if (current.version === maxVersion)
691
+ throw new InvalidConfigError({ reason: 'version overflow' })
692
+ return from({
693
+ owners: options.owners,
694
+ salt: current.salt,
695
+ threshold: options.threshold,
696
+ version: current.version + 1n,
697
+ })
698
+ }
699
+
700
+ export declare namespace update {
701
+ type Options<numberType = number> = {
702
+ /** Replacement weighted owners. Sorted into canonical order. */
703
+ owners: readonly Owner<numberType>[]
704
+ /** Replacement minimum total owner weight required for authorization. */
705
+ threshold: numberType
706
+ }
707
+
708
+ type ErrorType =
709
+ | assert.ErrorType
710
+ | InvalidConfigError
711
+ | Errors.GlobalErrorType
712
+ }
713
+
714
+ /**
715
+ * Validates an {@link ox#AccountConfig.Config}. Returns `true`
644
716
  * if valid, `false` otherwise.
645
717
  *
646
718
  * @example
647
719
  * ```ts twoslash
648
- * import { MultisigConfig } from 'ox/tempo'
720
+ * import { AccountConfig } from 'ox/tempo'
649
721
  *
650
- * const valid = MultisigConfig.validate({
722
+ * const valid = AccountConfig.validate({
651
723
  * owners: [
652
724
  * {
653
725
  * owner: '0x1111111111111111111111111111111111111111',
@@ -659,7 +731,7 @@ export function toTuple(config: Input): Tuple {
659
731
  * // @log: true
660
732
  * ```
661
733
  *
662
- * @param config - The multisig config.
734
+ * @param config - The account config.
663
735
  * @returns Whether the config is valid.
664
736
  */
665
737
  export function validate(config: Input): boolean {
@@ -671,11 +743,11 @@ export function validate(config: Input): boolean {
671
743
  }
672
744
  }
673
745
 
674
- /** Thrown when a native multisig config is invalid. */
746
+ /** Thrown when an account config is invalid. */
675
747
  export class InvalidConfigError extends Errors.BaseError {
676
- override readonly name = 'MultisigConfig.InvalidConfigError'
748
+ override readonly name = 'AccountConfig.InvalidConfigError'
677
749
  constructor({ reason }: { reason: string }) {
678
- super(`Invalid native multisig config: ${reason}.`)
750
+ super(`Invalid account config: ${reason}.`)
679
751
  }
680
752
  }
681
753
 
@@ -0,0 +1,79 @@
1
+ import { expectTypeOf, test } from 'vp/test'
2
+ import type * as Hex from '../core/Hex.js'
3
+ import * as AccountOperation from './AccountOperation.js'
4
+ import type * as TxEnvelopeTempo from './TxEnvelopeTempo.js'
5
+
6
+ declare const transaction: AccountOperation.TransactionOperation
7
+ declare const transactionRpc: AccountOperation.TransactionRpc
8
+ declare const keyAuthorization: AccountOperation.KeyAuthorizationOperation
9
+ declare const keyAuthorizationRpc: AccountOperation.KeyAuthorizationRpc
10
+ declare const operation: AccountOperation.Operation
11
+ declare const operationRpc: AccountOperation.Rpc
12
+ declare const getHashOptions: AccountOperation.getHash.Options
13
+ declare const selectApprovalsOptions: AccountOperation.selectApprovals.Options
14
+ declare const serializedKeyAuthorization: Hex.Hex
15
+ declare const serializeKeyAuthorizationOptions: AccountOperation.serializeKeyAuthorization.Options
16
+ declare const serializeTransactionOptions: AccountOperation.serializeTransaction.Options
17
+
18
+ test('preserves operation kinds during validation', () => {
19
+ expectTypeOf(
20
+ AccountOperation.from(transaction),
21
+ ).toEqualTypeOf<AccountOperation.TransactionOperation>()
22
+ expectTypeOf(
23
+ AccountOperation.from(keyAuthorization),
24
+ ).toEqualTypeOf<AccountOperation.KeyAuthorizationOperation>()
25
+ expectTypeOf(
26
+ AccountOperation.from(operation),
27
+ ).toEqualTypeOf<AccountOperation.Operation>()
28
+ })
29
+
30
+ test('preserves operation kinds during RPC conversion', () => {
31
+ expectTypeOf(
32
+ AccountOperation.fromRpc(transactionRpc),
33
+ ).toEqualTypeOf<AccountOperation.TransactionOperation>()
34
+ expectTypeOf(
35
+ AccountOperation.fromRpc(keyAuthorizationRpc),
36
+ ).toEqualTypeOf<AccountOperation.KeyAuthorizationOperation>()
37
+ expectTypeOf(
38
+ AccountOperation.toRpc(transaction),
39
+ ).toEqualTypeOf<AccountOperation.TransactionRpc>()
40
+ expectTypeOf(
41
+ AccountOperation.toRpc(keyAuthorization),
42
+ ).toEqualTypeOf<AccountOperation.KeyAuthorizationRpc>()
43
+ expectTypeOf(
44
+ AccountOperation.fromRpc(operationRpc),
45
+ ).toEqualTypeOf<AccountOperation.Operation>()
46
+ expectTypeOf(
47
+ AccountOperation.toRpc(operation),
48
+ ).toEqualTypeOf<AccountOperation.Rpc>()
49
+ })
50
+
51
+ test('uses JSON-RPC quantities only in RPC operations', () => {
52
+ expectTypeOf<
53
+ AccountOperation.Operation['config']['version']
54
+ >().toEqualTypeOf<bigint>()
55
+ expectTypeOf<
56
+ AccountOperation.Rpc['config']['version']
57
+ >().toEqualTypeOf<Hex.Hex>()
58
+ })
59
+
60
+ test('operation helpers return narrow types', async () => {
61
+ expectTypeOf(
62
+ AccountOperation.getHash(getHashOptions),
63
+ ).toEqualTypeOf<Hex.Hex>()
64
+ expectTypeOf(
65
+ await AccountOperation.selectApprovals(selectApprovalsOptions),
66
+ ).toEqualTypeOf<AccountOperation.selectApprovals.ReturnValue>()
67
+ expectTypeOf(
68
+ AccountOperation.serializeKeyAuthorization(
69
+ serializedKeyAuthorization,
70
+ serializeKeyAuthorizationOptions,
71
+ ),
72
+ ).toEqualTypeOf<Hex.Hex>()
73
+ expectTypeOf(
74
+ AccountOperation.serializeTransaction(
75
+ transaction,
76
+ serializeTransactionOptions,
77
+ ),
78
+ ).toEqualTypeOf<TxEnvelopeTempo.Serialized>()
79
+ })