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
@@ -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,13 +39,22 @@ 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(
49
49
  KeyAuthorization.toRpc(signed),
50
50
  ).toMatchTypeOf<KeyAuthorization.Rpc>()
51
51
  })
52
+
53
+ test('Tuple: skipped limits slot may be the RLP null placeholder', () => {
54
+ type Authorization = KeyAuthorization.Tuple[0]
55
+ type Limits = Extract<Authorization, { length: 5 }>[4]
56
+ expectTypeOf<'0x'>().toMatchTypeOf<Limits>()
57
+ expectTypeOf<
58
+ readonly [token: `0x${string}`, limit: `0x${string}`][]
59
+ >().toMatchTypeOf<Limits>()
60
+ })