ox 1.8.6 → 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 (129) hide show
  1. package/CHANGELOG.md +29 -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 +16 -16
  15. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  16. package/dist/tempo/KeyAuthorization.js +10 -9
  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/TransactionRequest.d.ts +11 -9
  25. package/dist/tempo/TransactionRequest.d.ts.map +1 -1
  26. package/dist/tempo/TransactionRequest.js +14 -10
  27. package/dist/tempo/TransactionRequest.js.map +1 -1
  28. package/dist/tempo/index.d.ts +56 -54
  29. package/dist/tempo/index.d.ts.map +1 -1
  30. package/dist/tempo/index.js +56 -54
  31. package/dist/tempo/index.js.map +1 -1
  32. package/dist/zod/tempo/{MultisigConfig.d.ts → AccountConfig.d.ts} +6 -6
  33. package/dist/zod/tempo/AccountConfig.d.ts.map +1 -0
  34. package/dist/zod/tempo/{MultisigConfig.js → AccountConfig.js} +12 -12
  35. package/dist/zod/tempo/AccountConfig.js.map +1 -0
  36. package/dist/zod/tempo/{MultisigOperation.d.ts → AccountOperation.d.ts} +5 -5
  37. package/dist/zod/tempo/AccountOperation.d.ts.map +1 -0
  38. package/dist/zod/tempo/{MultisigOperation.js → AccountOperation.js} +10 -10
  39. package/dist/zod/tempo/AccountOperation.js.map +1 -0
  40. package/dist/zod/tempo/{MultisigSimulation.d.ts → AccountSimulation.d.ts} +5 -5
  41. package/dist/zod/tempo/AccountSimulation.d.ts.map +1 -0
  42. package/dist/zod/tempo/AccountSimulation.js +44 -0
  43. package/dist/zod/tempo/AccountSimulation.js.map +1 -0
  44. package/dist/zod/tempo/AuthorizationTempo.d.ts +10 -10
  45. package/dist/zod/tempo/KeyAuthorization.d.ts +12 -12
  46. package/dist/zod/tempo/KeyAuthorization.js +6 -6
  47. package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
  48. package/dist/zod/tempo/RpcSchemaTempo.d.ts +59 -59
  49. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  50. package/dist/zod/tempo/RpcSchemaTempo.js +28 -28
  51. package/dist/zod/tempo/RpcSchemaTempo.js.map +1 -1
  52. package/dist/zod/tempo/SignatureEnvelope.d.ts +7 -7
  53. package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
  54. package/dist/zod/tempo/SignatureEnvelope.js +22 -16
  55. package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
  56. package/dist/zod/tempo/Transaction.d.ts +24 -24
  57. package/dist/zod/tempo/TransactionRequest.d.ts +84 -84
  58. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  59. package/dist/zod/tempo/TransactionRequest.js +26 -17
  60. package/dist/zod/tempo/TransactionRequest.js.map +1 -1
  61. package/dist/zod/tempo/TxEnvelopeTempo.d.ts +12 -12
  62. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +3 -3
  63. package/dist/zod/tempo/z.d.ts +3 -3
  64. package/dist/zod/tempo/z.d.ts.map +1 -1
  65. package/dist/zod/tempo/z.js +3 -3
  66. package/dist/zod/tempo/z.js.map +1 -1
  67. package/package.json +31 -31
  68. package/src/tempo/{MultisigConfig.test-d.ts → AccountConfig.test-d.ts} +22 -12
  69. package/src/tempo/{MultisigConfig.test.ts → AccountConfig.test.ts} +155 -37
  70. package/src/tempo/{MultisigConfig.ts → AccountConfig.ts} +138 -66
  71. package/src/tempo/AccountOperation.test-d.ts +79 -0
  72. package/src/tempo/{MultisigOperation.test.ts → AccountOperation.test.ts} +97 -97
  73. package/src/tempo/{MultisigOperation.ts → AccountOperation.ts} +95 -97
  74. package/src/tempo/{MultisigSimulation.test-d.ts → AccountSimulation.test-d.ts} +7 -9
  75. package/src/tempo/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +28 -28
  76. package/src/tempo/{MultisigSimulation.ts → AccountSimulation.ts} +28 -30
  77. package/src/tempo/KeyAuthorization.test-d.ts +6 -6
  78. package/src/tempo/KeyAuthorization.test.ts +52 -36
  79. package/src/tempo/KeyAuthorization.ts +29 -27
  80. package/src/tempo/RpcSchemaTempo.test-d.ts +19 -19
  81. package/src/tempo/RpcSchemaTempo.ts +13 -13
  82. package/src/tempo/SignatureEnvelope.test-d.ts +7 -7
  83. package/src/tempo/SignatureEnvelope.test.ts +34 -34
  84. package/src/tempo/SignatureEnvelope.ts +112 -108
  85. package/src/tempo/Transaction.test.ts +4 -4
  86. package/src/tempo/TransactionRequest.test-d.ts +17 -6
  87. package/src/tempo/TransactionRequest.test.ts +32 -17
  88. package/src/tempo/TransactionRequest.ts +27 -19
  89. package/src/tempo/{multisig.e2e.test.ts → configurableAccounts.e2e.test.ts} +16 -16
  90. package/src/tempo/index.ts +56 -54
  91. package/src/version.ts +1 -1
  92. package/src/zod/tempo/{MultisigConfig.ts → AccountConfig.ts} +12 -12
  93. package/src/zod/tempo/{MultisigOperation.ts → AccountOperation.ts} +9 -9
  94. package/src/zod/tempo/AccountSimulation.ts +53 -0
  95. package/src/zod/tempo/KeyAuthorization.ts +8 -8
  96. package/src/zod/tempo/RpcSchemaTempo.ts +28 -28
  97. package/src/zod/tempo/SignatureEnvelope.ts +23 -17
  98. package/src/zod/tempo/TransactionRequest.ts +29 -18
  99. package/src/zod/tempo/_test/AccountConfig.test-d.ts +13 -0
  100. package/src/zod/tempo/_test/{MultisigConfig.test.ts → AccountConfig.test.ts} +7 -7
  101. package/src/zod/tempo/_test/AccountOperation.test-d.ts +27 -0
  102. package/src/zod/tempo/_test/{MultisigOperation.test.ts → AccountOperation.test.ts} +9 -9
  103. package/src/zod/tempo/_test/AccountSimulation.test-d.ts +13 -0
  104. package/src/zod/tempo/_test/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +13 -13
  105. package/src/zod/tempo/_test/KeyAuthorization.test.ts +9 -9
  106. package/src/zod/tempo/_test/RpcSchemaTempo.test-d.ts +27 -27
  107. package/src/zod/tempo/_test/RpcSchemaTempo.test.ts +16 -18
  108. package/src/zod/tempo/_test/SignatureEnvelope.test-d.ts +5 -5
  109. package/src/zod/tempo/_test/SignatureEnvelope.test.ts +12 -9
  110. package/src/zod/tempo/_test/TransactionRequest.test.ts +28 -8
  111. package/src/zod/tempo/z.ts +3 -3
  112. package/dist/tempo/MultisigConfig.d.ts.map +0 -1
  113. package/dist/tempo/MultisigConfig.js.map +0 -1
  114. package/dist/tempo/MultisigOperation.d.ts.map +0 -1
  115. package/dist/tempo/MultisigOperation.js.map +0 -1
  116. package/dist/tempo/MultisigSimulation.d.ts.map +0 -1
  117. package/dist/tempo/MultisigSimulation.js.map +0 -1
  118. package/dist/zod/tempo/MultisigConfig.d.ts.map +0 -1
  119. package/dist/zod/tempo/MultisigConfig.js.map +0 -1
  120. package/dist/zod/tempo/MultisigOperation.d.ts.map +0 -1
  121. package/dist/zod/tempo/MultisigOperation.js.map +0 -1
  122. package/dist/zod/tempo/MultisigSimulation.d.ts.map +0 -1
  123. package/dist/zod/tempo/MultisigSimulation.js +0 -44
  124. package/dist/zod/tempo/MultisigSimulation.js.map +0 -1
  125. package/src/tempo/MultisigOperation.test-d.ts +0 -79
  126. package/src/zod/tempo/MultisigSimulation.ts +0 -53
  127. package/src/zod/tempo/_test/MultisigConfig.test-d.ts +0 -13
  128. package/src/zod/tempo/_test/MultisigOperation.test-d.ts +0 -27
  129. package/src/zod/tempo/_test/MultisigSimulation.test-d.ts +0 -13
@@ -1,4 +1,4 @@
1
- import { MultisigConfig, MultisigSimulation } from 'ox/tempo'
1
+ import { AccountConfig, AccountSimulation } from 'ox/tempo'
2
2
  import { describe, expect, test } from 'vp/test'
3
3
 
4
4
  const config =
@@ -12,11 +12,11 @@ const rpc = {
12
12
  },
13
13
  ],
14
14
  config,
15
- } as const satisfies MultisigSimulation.Rpc
15
+ } as const satisfies AccountSimulation.Rpc
16
16
 
17
17
  describe('fromRpc', () => {
18
18
  test('behavior: decodes the configuration', () => {
19
- expect(MultisigSimulation.fromRpc(rpc)).toMatchInlineSnapshot(`
19
+ expect(AccountSimulation.fromRpc(rpc)).toMatchInlineSnapshot(`
20
20
  {
21
21
  "approvals": [
22
22
  {
@@ -49,35 +49,35 @@ describe('fromRpc', () => {
49
49
  '0xf843a0000000000000000000000000000000000000000000000000000000000000000088ffffffffffffffff01d7d694111111111111111111111111111111111111111101' as const
50
50
 
51
51
  expect(
52
- MultisigSimulation.fromRpc({ ...rpc, approvals: [], config }).config
52
+ AccountSimulation.fromRpc({ ...rpc, approvals: [], config }).config
53
53
  .version,
54
54
  ).toMatchInlineSnapshot(`18446744073709551615n`)
55
55
  })
56
56
 
57
57
  test('error: rejects excess root approvals', () => {
58
58
  expect(() =>
59
- MultisigSimulation.fromRpc({
59
+ AccountSimulation.fromRpc({
60
60
  ...rpc,
61
61
  approvals: Array.from({ length: 9 }, () => rpc.approvals[0]),
62
62
  }),
63
63
  ).toThrowErrorMatchingInlineSnapshot(
64
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: approval count exceeds 8.]`,
64
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: approval count exceeds 8.]`,
65
65
  )
66
66
  })
67
67
  test('error: rejects nested approvals', () => {
68
68
  expect(() =>
69
- MultisigSimulation.fromRpc({
69
+ AccountSimulation.fromRpc({
70
70
  ...rpc,
71
- approvals: [{ type: 'multisig', spec: rpc }],
71
+ approvals: [{ type: 'configurable', spec: rpc }],
72
72
  } as never),
73
73
  ).toThrowErrorMatchingInlineSnapshot(
74
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: only untagged primitive owner approvals are allowed.]`,
74
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: only untagged primitive owner approvals are allowed.]`,
75
75
  )
76
76
  })
77
77
 
78
78
  test('error: rejects trailing configuration bytes', () => {
79
79
  expect(() =>
80
- MultisigSimulation.fromRpc({ ...rpc, config: `${config}00` }),
80
+ AccountSimulation.fromRpc({ ...rpc, config: `${config}00` }),
81
81
  ).toThrowErrorMatchingInlineSnapshot(
82
82
  `[Rlp.TrailingBytesError: RLP payload encodes a single item, but \`1\` trailing byte remains.]`,
83
83
  )
@@ -85,7 +85,7 @@ describe('fromRpc', () => {
85
85
 
86
86
  test('error: rejects malformed configuration RLP', () => {
87
87
  expect(() =>
88
- MultisigSimulation.fromRpc({ ...rpc, config: '0xf8' }),
88
+ AccountSimulation.fromRpc({ ...rpc, config: '0xf8' }),
89
89
  ).toThrowErrorMatchingInlineSnapshot(
90
90
  `[Cursor.PositionOutOfBoundsError: Position \`1\` is out of bounds (\`0 < position < 1\`).]`,
91
91
  )
@@ -93,9 +93,9 @@ describe('fromRpc', () => {
93
93
 
94
94
  test('error: rejects a non-list configuration', () => {
95
95
  expect(() =>
96
- MultisigSimulation.fromRpc({ ...rpc, config: '0x01' }),
96
+ AccountSimulation.fromRpc({ ...rpc, config: '0x01' }),
97
97
  ).toThrowErrorMatchingInlineSnapshot(
98
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: invalid config encoding.]`,
98
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: invalid config encoding.]`,
99
99
  )
100
100
  })
101
101
 
@@ -105,16 +105,16 @@ describe('fromRpc', () => {
105
105
  .replace('118002', '11810002') as `0x${string}`
106
106
 
107
107
  expect(() =>
108
- MultisigSimulation.fromRpc({ ...rpc, config: noncanonical }),
108
+ AccountSimulation.fromRpc({ ...rpc, config: noncanonical }),
109
109
  ).toThrowErrorMatchingInlineSnapshot(
110
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: invalid config encoding.]`,
110
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: invalid config encoding.]`,
111
111
  )
112
112
  })
113
113
  })
114
114
 
115
115
  describe('toRpc', () => {
116
116
  test('behavior: encodes configurations and shims long key data', () => {
117
- expect(MultisigSimulation.toRpc(MultisigSimulation.fromRpc(rpc)))
117
+ expect(AccountSimulation.toRpc(AccountSimulation.fromRpc(rpc)))
118
118
  .toMatchInlineSnapshot(`
119
119
  {
120
120
  "approvals": [
@@ -130,12 +130,12 @@ describe('toRpc', () => {
130
130
  })
131
131
 
132
132
  test('behavior: preserves short key data', () => {
133
- const spec = MultisigSimulation.fromRpc({
133
+ const spec = AccountSimulation.fromRpc({
134
134
  ...rpc,
135
135
  approvals: [{ ...rpc.approvals[0], keyData: '0x0102' }],
136
136
  })
137
137
 
138
- expect(MultisigSimulation.toRpc(spec).approvals).toMatchInlineSnapshot(`
138
+ expect(AccountSimulation.toRpc(spec).approvals).toMatchInlineSnapshot(`
139
139
  [
140
140
  {
141
141
  "keyData": "0x0102",
@@ -147,13 +147,13 @@ describe('toRpc', () => {
147
147
  })
148
148
 
149
149
  test('behavior: encodes the maximum uint64 configuration version', () => {
150
- const spec = MultisigSimulation.fromRpc(rpc)
150
+ const spec = AccountSimulation.fromRpc(rpc)
151
151
 
152
152
  expect(
153
- MultisigSimulation.toRpc({
153
+ AccountSimulation.toRpc({
154
154
  ...spec,
155
155
  approvals: [],
156
- config: MultisigConfig.from({
156
+ config: AccountConfig.from({
157
157
  owners: [
158
158
  {
159
159
  owner: '0x1111111111111111111111111111111111111111',
@@ -161,7 +161,7 @@ describe('toRpc', () => {
161
161
  },
162
162
  ],
163
163
  threshold: 1,
164
- version: MultisigConfig.maxVersion,
164
+ version: AccountConfig.maxVersion,
165
165
  }),
166
166
  }).config,
167
167
  ).toMatchInlineSnapshot(
@@ -170,25 +170,25 @@ describe('toRpc', () => {
170
170
  })
171
171
 
172
172
  test('error: rejects excess root approvals', () => {
173
- const spec = MultisigSimulation.fromRpc(rpc)
173
+ const spec = AccountSimulation.fromRpc(rpc)
174
174
 
175
175
  expect(() =>
176
- MultisigSimulation.toRpc({
176
+ AccountSimulation.toRpc({
177
177
  ...spec,
178
178
  approvals: Array.from({ length: 9 }, () => spec.approvals[0]!),
179
179
  }),
180
180
  ).toThrowErrorMatchingInlineSnapshot(
181
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: approval count exceeds 8.]`,
181
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: approval count exceeds 8.]`,
182
182
  )
183
183
  })
184
184
  test('error: rejects nested approvals', () => {
185
185
  expect(() =>
186
- MultisigSimulation.toRpc({
186
+ AccountSimulation.toRpc({
187
187
  ...rpc,
188
- approvals: [{ type: 'multisig', spec: rpc }],
188
+ approvals: [{ type: 'configurable', spec: rpc }],
189
189
  } as never),
190
190
  ).toThrowErrorMatchingInlineSnapshot(
191
- `[MultisigSimulation.InvalidSimulationError: Invalid multisig simulation: only untagged primitive owner approvals are allowed.]`,
191
+ `[AccountSimulation.InvalidSimulationError: Invalid account simulation: only untagged primitive owner approvals are allowed.]`,
192
192
  )
193
193
  })
194
194
  })
@@ -3,13 +3,13 @@ import * as Errors from '../core/Errors.js'
3
3
  import * as Hex from '../core/Hex.js'
4
4
  import type { Compute } from '../core/internal/types.js'
5
5
  import * as Rlp from '../core/Rlp.js'
6
- import * as MultisigConfig from './MultisigConfig.js'
6
+ import * as AccountConfig from './AccountConfig.js'
7
7
  import type * as SignatureEnvelope from './SignatureEnvelope.js'
8
8
 
9
- /** Native multisig owner approval used for RPC simulation. */
9
+ /** Configurable account owner approval used for RPC simulation. */
10
10
  export type Approval = PrimitiveApproval
11
11
 
12
- /** JSON-RPC native multisig owner approval used for RPC simulation. */
12
+ /** JSON-RPC configurable account owner approval used for RPC simulation. */
13
13
  export type ApprovalRpc = PrimitiveApproval
14
14
 
15
15
  /** Primitive owner approval used for RPC simulation. */
@@ -22,7 +22,7 @@ export type PrimitiveApproval = {
22
22
  owner: Address.Address
23
23
  }
24
24
 
25
- /** JSON-RPC representation of a native multisig simulation spec. */
25
+ /** JSON-RPC representation of an account simulation spec. */
26
26
  export type Rpc = Compute<{
27
27
  /** Owner approvals to model. */
28
28
  approvals: readonly ApprovalRpc[]
@@ -30,27 +30,27 @@ export type Rpc = Compute<{
30
30
  config: Hex.Hex
31
31
  }>
32
32
 
33
- /** Native multisig spec used to construct an RPC simulation signature. */
33
+ /** Account simulation spec used to construct an RPC simulation signature. */
34
34
  export type Spec = Compute<{
35
35
  /** Owner approvals to model. */
36
36
  approvals: readonly Approval[]
37
37
  /** Complete applicable configuration. */
38
- config: MultisigConfig.Config
38
+ config: AccountConfig.Config
39
39
  }>
40
40
 
41
41
  /**
42
- * Converts a JSON-RPC multisig simulation spec to its domain representation.
42
+ * Converts a JSON-RPC account simulation spec to its domain representation.
43
43
  *
44
44
  * @example
45
45
  * ```ts twoslash
46
46
  * // @noErrors
47
- * import { MultisigSimulation } from 'ox/tempo'
47
+ * import { AccountSimulation } from 'ox/tempo'
48
48
  *
49
- * const spec = MultisigSimulation.fromRpc(specRpc)
49
+ * const spec = AccountSimulation.fromRpc(specRpc)
50
50
  * ```
51
51
  *
52
- * @param spec - JSON-RPC multisig simulation spec.
53
- * @returns The multisig simulation spec with decoded configurations.
52
+ * @param spec - JSON-RPC account simulation spec.
53
+ * @returns The account simulation spec with decoded configurations.
54
54
  */
55
55
  export function fromRpc(spec: Rpc): Spec {
56
56
  const { approvals, config } = spec
@@ -63,25 +63,25 @@ export declare namespace fromRpc {
63
63
  export type ErrorType =
64
64
  | Hex.isEqual.ErrorType
65
65
  | InvalidSimulationError
66
- | MultisigConfig.assert.ErrorType
66
+ | AccountConfig.assert.ErrorType
67
67
  | Rlp.fromHex.ErrorType
68
68
  | Rlp.toHex.ErrorType
69
69
  | Errors.GlobalErrorType
70
70
  }
71
71
 
72
72
  /**
73
- * Converts a multisig simulation spec to its JSON-RPC representation.
73
+ * Converts an account simulation spec to its JSON-RPC representation.
74
74
  *
75
75
  * @example
76
76
  * ```ts twoslash
77
77
  * // @noErrors
78
- * import { MultisigSimulation } from 'ox/tempo'
78
+ * import { AccountSimulation } from 'ox/tempo'
79
79
  *
80
- * const specRpc = MultisigSimulation.toRpc(spec)
80
+ * const specRpc = AccountSimulation.toRpc(spec)
81
81
  * ```
82
82
  *
83
- * @param spec - Multisig simulation spec.
84
- * @returns The JSON-RPC multisig simulation spec with encoded configurations.
83
+ * @param spec - Account simulation spec.
84
+ * @returns The JSON-RPC account simulation spec with encoded configurations.
85
85
  */
86
86
  export function toRpc(spec: Spec): Rpc {
87
87
  const { approvals, config } = spec
@@ -101,7 +101,7 @@ export declare namespace toRpc {
101
101
  export type ErrorType =
102
102
  | Hex.fromNumber.ErrorType
103
103
  | InvalidSimulationError
104
- | MultisigConfig.assert.ErrorType
104
+ | AccountConfig.assert.ErrorType
105
105
  | Rlp.fromHex.ErrorType
106
106
  | Errors.GlobalErrorType
107
107
  }
@@ -120,14 +120,14 @@ function assertApprovals(approvals: readonly unknown[]) {
120
120
  throw new InvalidSimulationError({
121
121
  reason: 'only untagged primitive owner approvals are allowed',
122
122
  })
123
- if (approvals.length > MultisigConfig.maxSignatures)
123
+ if (approvals.length > AccountConfig.maxSignatures)
124
124
  throw new InvalidSimulationError({
125
- reason: `approval count exceeds ${MultisigConfig.maxSignatures}`,
125
+ reason: `approval count exceeds ${AccountConfig.maxSignatures}`,
126
126
  })
127
127
  }
128
128
 
129
129
  /** @internal */
130
- function deserializeConfig(config: Hex.Hex): MultisigConfig.Config {
130
+ function deserializeConfig(config: Hex.Hex): AccountConfig.Config {
131
131
  const tuple = Rlp.toHex(config)
132
132
  if (!Array.isArray(tuple) || tuple.length !== 4)
133
133
  throw new InvalidSimulationError({ reason: 'invalid config encoding' })
@@ -151,18 +151,16 @@ function deserializeConfig(config: Hex.Hex): MultisigConfig.Config {
151
151
  )
152
152
  )
153
153
  throw new InvalidSimulationError({ reason: 'invalid config encoding' })
154
- const value = MultisigConfig.fromTuple(
155
- tuple as unknown as MultisigConfig.Tuple,
156
- )
157
- MultisigConfig.assert(value)
154
+ const value = AccountConfig.fromTuple(tuple as unknown as AccountConfig.Tuple)
155
+ AccountConfig.assert(value)
158
156
  if (!Hex.isEqual(config, serializeConfig(value)))
159
157
  throw new InvalidSimulationError({ reason: 'noncanonical config encoding' })
160
158
  return value
161
159
  }
162
160
 
163
161
  /** @internal */
164
- function serializeConfig(config: MultisigConfig.Input): Hex.Hex {
165
- return Rlp.fromHex(MultisigConfig.toTuple(config))
162
+ function serializeConfig(config: AccountConfig.Input): Hex.Hex {
163
+ return Rlp.fromHex(AccountConfig.toTuple(config))
166
164
  }
167
165
 
168
166
  /**
@@ -175,11 +173,11 @@ function shimKeyData(data: Hex.Hex): Hex.Hex {
175
173
  return Hex.fromNumber(size, { size: 2 })
176
174
  }
177
175
 
178
- /** Thrown when a native multisig simulation spec is invalid. */
176
+ /** Thrown when an account simulation spec is invalid. */
179
177
  export class InvalidSimulationError extends Errors.BaseError {
180
- override readonly name = 'MultisigSimulation.InvalidSimulationError'
178
+ override readonly name = 'AccountSimulation.InvalidSimulationError'
181
179
  constructor(options: InvalidSimulationError.Options) {
182
- super(`Invalid multisig simulation: ${options.reason}.`)
180
+ super(`Invalid account simulation: ${options.reason}.`)
183
181
  }
184
182
  }
185
183
 
@@ -17,7 +17,7 @@ const signature = {
17
17
  type: 'secp256k1',
18
18
  } as const satisfies SignatureEnvelope.Secp256k1
19
19
 
20
- const multisig = {
20
+ const configurable = {
21
21
  account: '0x2222222222222222222222222222222222222222',
22
22
  config: {
23
23
  salt: `0x${'00'.repeat(32)}`,
@@ -28,8 +28,8 @@ const multisig = {
28
28
  ],
29
29
  },
30
30
  signatures: [signature],
31
- type: 'multisig',
32
- } as const satisfies SignatureEnvelope.Multisig
31
+ type: 'configurable',
32
+ } as const satisfies SignatureEnvelope.Configurable
33
33
 
34
34
  test('accepts primitive signatures', () => {
35
35
  const signed = KeyAuthorization.from(authorization, { signature })
@@ -39,10 +39,10 @@ test('accepts primitive signatures', () => {
39
39
  >()
40
40
  })
41
41
 
42
- test('accepts multisig signatures and account-bound grants', () => {
42
+ test('accepts configurable signatures and account-bound grants', () => {
43
43
  const signed = KeyAuthorization.from(
44
- { ...authorization, account: multisig.account, type: 'multisig' },
45
- { signature: multisig },
44
+ { ...authorization, account: configurable.account, type: 'configurable' },
45
+ { signature: configurable },
46
46
  )
47
47
  expectTypeOf(signed).toMatchTypeOf<KeyAuthorization.Signed>()
48
48
  expectTypeOf(
@@ -8,8 +8,8 @@ import {
8
8
  WebAuthnP256,
9
9
  } from 'ox'
10
10
  import { describe, expect, test } from 'vp/test'
11
+ import * as AccountConfig from './AccountConfig.js'
11
12
  import * as KeyAuthorization from './KeyAuthorization.js'
12
- import * as MultisigConfig from './MultisigConfig.js'
13
13
  import * as Period from './Period.js'
14
14
  import * as SignatureEnvelope from './SignatureEnvelope.js'
15
15
 
@@ -71,9 +71,9 @@ const signature_webauthn = SignatureEnvelope.from({
71
71
  },
72
72
  })
73
73
 
74
- const signature_multisig = {
74
+ const signature_configurable = {
75
75
  account: address,
76
- config: MultisigConfig.from({
76
+ config: AccountConfig.from({
77
77
  owners: [
78
78
  {
79
79
  owner: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
@@ -84,9 +84,9 @@ const signature_multisig = {
84
84
  version: 1n,
85
85
  }),
86
86
  signatures: [SignatureEnvelope.from(signature_secp256k1)],
87
- type: 'multisig',
88
- } as const satisfies SignatureEnvelope.Multisig
89
- const signature_multisig_rpc =
87
+ type: 'configurable',
88
+ } as const satisfies SignatureEnvelope.Configurable
89
+ const signature_configurable_rpc =
90
90
  '0xf89794be95c3f554e9fc85ec51be69a3d807a0d55bcf2cf83ba000000000000000000000000000000000000000000000000000000000000000000101d7d694f39fd6e51aad88f6f4ce6ab8827279cfffb9226601f843b841fa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d01c' as const
91
91
 
92
92
  const signature_keychain = {
@@ -95,9 +95,13 @@ const signature_keychain = {
95
95
  userAddress: address,
96
96
  } as const satisfies SignatureEnvelope.Keychain
97
97
 
98
- describe('multisig account binding', () => {
98
+ describe('configurable account binding', () => {
99
99
  test('rejects unbound grants before signing or encoding', () => {
100
- const authorization = { address, chainId: 1n, type: 'multisig' } as const
100
+ const authorization = {
101
+ address,
102
+ chainId: 1n,
103
+ type: 'configurable',
104
+ } as const
101
105
  const signed = {
102
106
  ...authorization,
103
107
  signature: SignatureEnvelope.from(signature_secp256k1),
@@ -110,13 +114,13 @@ describe('multisig account binding', () => {
110
114
  () => KeyAuthorization.toRpc(signed),
111
115
  ])
112
116
  expect(encode).toThrowErrorMatchingInlineSnapshot(
113
- `[KeyAuthorization.MissingAccountError: Multisig key grants require a parent account binding.]`,
117
+ `[KeyAuthorization.MissingAccountError: Configurable account key grants require a parent account binding.]`,
114
118
  )
115
119
  })
116
120
 
117
121
  test('rejects unbound RPC and RLP grants', () => {
118
122
  const signed = KeyAuthorization.from(
119
- { account: address, address, chainId: 1n, type: 'multisig' },
123
+ { account: address, address, chainId: 1n, type: 'configurable' },
120
124
  { signature: signature_secp256k1 },
121
125
  )
122
126
  const rpc = KeyAuthorization.toRpc(signed)
@@ -156,15 +160,15 @@ describe('from', () => {
156
160
  }).toEqual(limitsVectors)
157
161
  })
158
162
 
159
- test('accepts multisig grants and delegates', () => {
163
+ test('accepts configurable grants and delegates', () => {
160
164
  const signed = KeyAuthorization.from(
161
165
  {
162
166
  address,
163
167
  chainId: 1n,
164
- type: 'multisig',
165
- account: signature_multisig.account,
168
+ type: 'configurable',
169
+ account: signature_configurable.account,
166
170
  },
167
- { signature: signature_multisig },
171
+ { signature: signature_configurable },
168
172
  )
169
173
  expect(
170
174
  KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)),
@@ -539,7 +543,7 @@ describe('fromRpc', () => {
539
543
  `)
540
544
  })
541
545
 
542
- test('with signature (multisig)', () => {
546
+ test('with signature (configurable)', () => {
543
547
  const authorization = KeyAuthorization.from({
544
548
  address,
545
549
  chainId: 1n,
@@ -547,20 +551,20 @@ describe('fromRpc', () => {
547
551
  })
548
552
 
549
553
  const signed = KeyAuthorization.from(authorization, {
550
- signature: signature_multisig,
554
+ signature: signature_configurable,
551
555
  })
552
- expect(signed.signature).toEqual(signature_multisig)
556
+ expect(signed.signature).toEqual(signature_configurable)
553
557
  expect(
554
558
  KeyAuthorization.from(authorization, {
555
- signature: SignatureEnvelope.serialize(signature_multisig),
559
+ signature: SignatureEnvelope.serialize(signature_configurable),
556
560
  }).signature,
557
- ).toEqual(signature_multisig)
561
+ ).toEqual(signature_configurable)
558
562
  expect(
559
563
  KeyAuthorization.from({
560
564
  ...authorization,
561
- signature: signature_multisig,
565
+ signature: signature_configurable,
562
566
  }).signature,
563
- ).toEqual(signature_multisig)
567
+ ).toEqual(signature_configurable)
564
568
  expect(
565
569
  KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)),
566
570
  ).toEqual(signed)
@@ -578,7 +582,7 @@ describe('fromRpc', () => {
578
582
  signature: signature_keychain as never,
579
583
  }),
580
584
  ).toThrowErrorMatchingInlineSnapshot(
581
- `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`multisig\`.]`,
585
+ `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`configurable\`.]`,
582
586
  )
583
587
 
584
588
  expect(() =>
@@ -586,7 +590,7 @@ describe('fromRpc', () => {
586
590
  signature: SignatureEnvelope.serialize(signature_keychain),
587
591
  }),
588
592
  ).toThrowErrorMatchingInlineSnapshot(
589
- `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`multisig\`.]`,
593
+ `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`configurable\`.]`,
590
594
  )
591
595
 
592
596
  expect(() =>
@@ -595,19 +599,19 @@ describe('fromRpc', () => {
595
599
  signature: signature_keychain,
596
600
  } as never),
597
601
  ).toThrowErrorMatchingInlineSnapshot(
598
- `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`multisig\`.]`,
602
+ `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`configurable\`.]`,
599
603
  )
600
604
  })
601
605
  })
602
606
 
603
607
  describe('fromRpc', () => {
604
- test('behavior: multisig', () => {
608
+ test('behavior: configurable', () => {
605
609
  const authorization = KeyAuthorization.fromRpc({
606
610
  chainId: '0x1',
607
611
  expiry: null,
608
612
  keyId: address,
609
613
  keyType: 'secp256k1',
610
- signature: signature_multisig_rpc,
614
+ signature: signature_configurable_rpc,
611
615
  })
612
616
 
613
617
  expect(authorization.signature).toMatchInlineSnapshot(`
@@ -634,7 +638,7 @@ describe('fromRpc', () => {
634
638
  "type": "secp256k1",
635
639
  },
636
640
  ],
637
- "type": "multisig",
641
+ "type": "configurable",
638
642
  }
639
643
  `)
640
644
  })
@@ -649,7 +653,7 @@ describe('fromRpc', () => {
649
653
  signature: SignatureEnvelope.toRpc(signature_keychain),
650
654
  } as never),
651
655
  ).toThrowErrorMatchingInlineSnapshot(
652
- `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`multisig\`.]`,
656
+ `[KeyAuthorization.InvalidSignatureTypeError: Signature type \`keychain\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, \`webAuthn\`, or \`configurable\`.]`,
653
657
  )
654
658
  })
655
659
 
@@ -1223,7 +1227,7 @@ describe('getSignPayload', () => {
1223
1227
  })
1224
1228
 
1225
1229
  describe('deserialize', () => {
1226
- test('example: matches the frozen multisig witness vector', () => {
1230
+ test('example: matches the frozen configurable witness vector', () => {
1227
1231
  const serialized =
1228
1232
  '0xf8f1f85382107980941eff47bc3a10a45d4b230b5d10e37751fe6aa718808080a053535353535353535353535353535353535353535353535353535353535353538094c4a590afa7337e5cd5eb3aa60cacf91c5400044bb89a05f89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b8412cfed9350faf80e4115e3c4c967356b80a8e6ee42e4a49ab953c8c8a3537d8d8359bf035a9bea18f32b0da7129cdce3ce701abc09ad8919b93da21a0d57e21451b' as const
1229
1233
  const authorization = KeyAuthorization.deserialize(serialized)
@@ -1256,7 +1260,7 @@ describe('deserialize', () => {
1256
1260
  "type": "secp256k1",
1257
1261
  },
1258
1262
  ],
1259
- "type": "multisig",
1263
+ "type": "configurable",
1260
1264
  },
1261
1265
  "type": "secp256k1",
1262
1266
  "witness": "0x5353535353535353535353535353535353535353535353535353535353535353",
@@ -1265,14 +1269,14 @@ describe('deserialize', () => {
1265
1269
  expect(KeyAuthorization.serialize(authorization)).toBe(serialized)
1266
1270
  })
1267
1271
 
1268
- test('multisig', () => {
1272
+ test('configurable', () => {
1269
1273
  const serialized = Rlp.fromHex([
1270
1274
  ['0x1', '0x', address],
1271
- SignatureEnvelope.serialize(signature_multisig),
1275
+ SignatureEnvelope.serialize(signature_configurable),
1272
1276
  ])
1273
1277
 
1274
1278
  expect(KeyAuthorization.deserialize(serialized).signature).toEqual(
1275
- signature_multisig,
1279
+ signature_configurable,
1276
1280
  )
1277
1281
  })
1278
1282
 
@@ -1446,16 +1450,28 @@ describe('serialize', () => {
1446
1450
  })
1447
1451
 
1448
1452
  describe('toRpc', () => {
1449
- test('behavior: multisig', () => {
1453
+ test('behavior: configurable key type uses the RPC multisig key type', () => {
1454
+ const authorization = KeyAuthorization.from(
1455
+ { account: address, address, chainId: 1n, type: 'configurable' },
1456
+ { signature: signature_secp256k1 },
1457
+ )
1458
+ const rpc = KeyAuthorization.toRpc(authorization)
1459
+ expect(rpc.keyType).toMatchInlineSnapshot(`"multisig"`)
1460
+ expect(KeyAuthorization.fromRpc(rpc).type).toMatchInlineSnapshot(
1461
+ `"configurable"`,
1462
+ )
1463
+ })
1464
+
1465
+ test('behavior: configurable', () => {
1450
1466
  const authorization = KeyAuthorization.toRpc({
1451
1467
  address,
1452
1468
  chainId: 1n,
1453
- signature: signature_multisig,
1469
+ signature: signature_configurable,
1454
1470
  type: 'secp256k1',
1455
1471
  })
1456
1472
 
1457
1473
  expect(authorization.signature).toMatchInlineSnapshot(
1458
- `"${signature_multisig_rpc}"`,
1474
+ `"${signature_configurable_rpc}"`,
1459
1475
  )
1460
1476
  })
1461
1477