ox 1.0.0-beta.11 → 1.0.0-beta.12

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 (38) hide show
  1. package/dist/tempo/MultisigConfig.d.ts +37 -85
  2. package/dist/tempo/MultisigConfig.d.ts.map +1 -1
  3. package/dist/tempo/MultisigConfig.js +39 -83
  4. package/dist/tempo/MultisigConfig.js.map +1 -1
  5. package/dist/tempo/SignatureEnvelope.d.ts +32 -30
  6. package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
  7. package/dist/tempo/SignatureEnvelope.js +56 -51
  8. package/dist/tempo/SignatureEnvelope.js.map +1 -1
  9. package/dist/tempo/index.d.ts +2 -2
  10. package/dist/tempo/index.js +2 -2
  11. package/dist/zod/tempo/AuthorizationTempo.d.ts +0 -20
  12. package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
  13. package/dist/zod/tempo/KeyAuthorization.d.ts +0 -11
  14. package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
  15. package/dist/zod/tempo/RpcSchemaTempo.d.ts +0 -12
  16. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  17. package/dist/zod/tempo/SignatureEnvelope.d.ts +0 -6
  18. package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
  19. package/dist/zod/tempo/SignatureEnvelope.js +0 -2
  20. package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
  21. package/dist/zod/tempo/Transaction.d.ts +0 -24
  22. package/dist/zod/tempo/Transaction.d.ts.map +1 -1
  23. package/dist/zod/tempo/TransactionRequest.d.ts +0 -21
  24. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  25. package/dist/zod/tempo/TxEnvelopeTempo.d.ts +0 -9
  26. package/dist/zod/tempo/TxEnvelopeTempo.d.ts.map +1 -1
  27. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +0 -3
  28. package/dist/zod/tempo/ZoneRpcAuthentication.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/tempo/MultisigConfig.test.ts +54 -37
  31. package/src/tempo/MultisigConfig.ts +59 -134
  32. package/src/tempo/SignatureEnvelope.test.ts +118 -17
  33. package/src/tempo/SignatureEnvelope.ts +77 -72
  34. package/src/tempo/e2e.test.ts +221 -1
  35. package/src/tempo/index.ts +2 -2
  36. package/src/version.ts +1 -1
  37. package/src/zod/tempo/SignatureEnvelope.ts +0 -2
  38. package/src/zod/tempo/_test/SignatureEnvelope.test.ts +0 -2
@@ -5,7 +5,12 @@ import * as Hash from '../core/Hash.js';
5
5
  import * as Hex from '../core/Hex.js';
6
6
  import type { Compute, OneOf } from '../core/internal/types.js';
7
7
  /** Maximum number of owners allowed in a native multisig config. */
8
- export declare const maxOwners = 10;
8
+ export declare const maxOwners = 255;
9
+ /**
10
+ * Maximum number of native multisig signatures in one nested authorization
11
+ * path, including the top-level transaction signature.
12
+ */
13
+ export declare const maxNestingDepth = 3;
9
14
  /** Maximum encoded byte length for one primitive owner approval. */
10
15
  export declare const maxOwnerSignatureBytes = 2049;
11
16
  /** Tempo signature type byte for native multisig signatures. */
@@ -13,13 +18,13 @@ export declare const signatureTypeByte: "0x05";
13
18
  /** Zero 32-byte salt (the default when no salt is provided). */
14
19
  export declare const zeroSalt: `0x${string}`;
15
20
  /**
16
- * Native multisig configuration. Determines the permanent config ID and the
17
- * stable multisig account address.
21
+ * Native multisig configuration. Determines the stable multisig account
22
+ * address.
18
23
  */
19
24
  export type Config<numberType = number> = Compute<{
20
25
  /**
21
- * Caller-chosen 32-byte salt mixed into the permanent config ID. Defaults to
22
- * the zero salt (`MultisigConfig.zeroSalt`) when omitted.
26
+ * Caller-chosen 32-byte salt mixed into the derived account address.
27
+ * Defaults to the zero salt (`MultisigConfig.zeroSalt`) when omitted.
23
28
  */
24
29
  salt?: Hex.Hex | undefined;
25
30
  /** Minimum total owner weight required to authorize a transaction. */
@@ -29,7 +34,7 @@ export type Config<numberType = number> = Compute<{
29
34
  }>;
30
35
  /** Native multisig owner entry. */
31
36
  export type Owner<numberType = number> = {
32
- /** Owner address (recovered from the owner's primitive signature). */
37
+ /** Owner address (recovered from the owner's approval). */
33
38
  owner: Address.Address;
34
39
  /** Nonzero owner weight. */
35
40
  weight: numberType;
@@ -43,9 +48,9 @@ export type Tuple = readonly [
43
48
  /**
44
49
  * Asserts that a native multisig {@link ox#MultisigConfig.Config} is valid.
45
50
  *
46
- * Mirrors the Tempo `validate_multisig_config` rules: owners non-empty and
51
+ * Mirrors the Tempo `InitMultisig::validate` rules: owners non-empty and
47
52
  * `<= maxOwners`, strictly ascending unique nonzero owner addresses, nonzero
48
- * owner weights, `threshold >= 1`, total weight `<= u32::MAX`, and
53
+ * owner weights, `threshold >= 1`, total weight `<= 255` (u8 max), and
49
54
  * `threshold <= total weight`.
50
55
  *
51
56
  * @example
@@ -73,7 +78,7 @@ export declare namespace assert {
73
78
  * Normalizes a native multisig {@link ox#MultisigConfig.Config}.
74
79
  *
75
80
  * Sorts owners into strictly ascending `owner` address order (the canonical
76
- * form required for config ID derivation) and asserts the config is valid.
81
+ * form required for account derivation) and asserts the config is valid.
77
82
  *
78
83
  * @example
79
84
  * ```ts twoslash
@@ -121,7 +126,11 @@ export declare function fromTuple(tuple: Tuple): Config;
121
126
  /**
122
127
  * Derives the stable native multisig account address.
123
128
  *
124
- * `keccak256("tempo:multisig:account" || config_id)[12:32]`.
129
+ * Preimage (fixed-width big-endian, **not** RLP):
130
+ * `keccak256("tempo:multisig:account" || salt || u8(threshold) || u8(owners.length) || (owner || u8(weight)) for each owner)[12:32]`.
131
+ *
132
+ * The address is derived once from the initial (bootstrap) config and never
133
+ * changes — config updates do not affect it.
125
134
  *
126
135
  * @example
127
136
  * ```ts twoslash
@@ -140,47 +149,26 @@ export declare function fromTuple(tuple: Tuple): Config;
140
149
  * const address = MultisigConfig.getAddress(genesisConfig)
141
150
  * ```
142
151
  *
143
- * @example
144
- * ### From an genesis config ID
145
- *
146
- * If you already have the permanent `genesisConfigId`, pass it directly:
147
- *
148
- * ```ts twoslash
149
- * import { MultisigConfig } from 'ox/tempo'
150
- *
151
- * const genesisConfigId = `0x${'00'.repeat(32)}` as const
152
- *
153
- * const address = MultisigConfig.getAddress({
154
- * genesisConfigId
155
- * })
156
- * ```
157
- *
158
- * @param value - The genesis config (positional) or `{ genesisConfigId }`.
152
+ * @param config - The initial (bootstrap) multisig config.
159
153
  * @returns The multisig account address.
160
154
  */
161
- export declare function getAddress(value: getAddress.Value): Address.Address;
155
+ export declare function getAddress(config: Config): Address.Address;
162
156
  export declare namespace getAddress {
163
- type Value = Config | {
164
- /**
165
- * The permanent genesis config ID (`MultisigConfig.toId(genesisConfig)`).
166
- * Config updates never change this value, so it identifies the
167
- * account permanently.
168
- */
169
- genesisConfigId: Hex.Hex;
170
- };
171
- type ErrorType = toId.ErrorType | Address.from.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Hex.slice.ErrorType | Errors.GlobalErrorType;
157
+ type ErrorType = assert.ErrorType | Address.from.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Hex.fromString.ErrorType | Hex.slice.ErrorType | Errors.GlobalErrorType;
172
158
  }
173
159
  /**
174
160
  * Computes the digest a native multisig owner approves (signs).
175
161
  *
176
- * `keccak256("tempo:multisig:signature" || inner_digest || account || config_id)`,
162
+ * `keccak256("tempo:multisig:signature" || inner_digest || account)`,
177
163
  * where `inner_digest` is the transaction sign payload
178
164
  * ({@link ox#TxEnvelopeTempo.(getSignPayload:function)}).
179
165
  *
180
- * The digest is always keyed on the permanent `account`/`genesisConfigId`
181
- * derived from the genesis (bootstrap) config — config updates never change
182
- * these values, so the genesis config is the correct input even for
183
- * post-update transactions.
166
+ * The digest is keyed on the permanent `account` derived from the genesis
167
+ * (bootstrap) config — config updates never change it, so the genesis config
168
+ * is the correct input even for post-update transactions.
169
+ *
170
+ * For a nested multisig owner approval, the parent digest becomes the nested
171
+ * approval's `payload`, with the nested multisig `account`.
184
172
  *
185
173
  * @example
186
174
  * ```ts twoslash
@@ -208,10 +196,10 @@ export declare namespace getAddress {
208
196
  * ```
209
197
  *
210
198
  * @example
211
- * ### From `account` + `genesisConfigId`
199
+ * ### From `account`
212
200
  *
213
- * If you already have the permanent `account` and `genesisConfigId` (for
214
- * example, recovered from a stored envelope), pass them directly:
201
+ * If you already have the permanent `account` (for example, recovered from a
202
+ * stored envelope), pass it directly:
215
203
  *
216
204
  * ```ts twoslash
217
205
  * import { MultisigConfig, TxEnvelopeTempo } from 'ox/tempo'
@@ -225,7 +213,6 @@ export declare namespace getAddress {
225
213
  * }
226
214
  * ]
227
215
  * })
228
- * const genesisConfigId = MultisigConfig.toId(genesisConfig)
229
216
  * const account = MultisigConfig.getAddress(genesisConfig)
230
217
  *
231
218
  * const envelope = TxEnvelopeTempo.from({
@@ -235,8 +222,7 @@ export declare namespace getAddress {
235
222
  *
236
223
  * const digest = MultisigConfig.getSignPayload({
237
224
  * payload: TxEnvelopeTempo.getSignPayload(envelope),
238
- * account,
239
- * genesisConfigId
225
+ * account
240
226
  * })
241
227
  * ```
242
228
  *
@@ -251,50 +237,16 @@ export declare namespace getSignPayload {
251
237
  } & OneOf<{
252
238
  /** The native multisig account address. */
253
239
  account: Address.Address;
254
- /** The permanent config ID. */
255
- genesisConfigId: Hex.Hex;
256
240
  } | {
257
241
  /**
258
242
  * The initial multisig config (the bootstrap config that derived the
259
- * permanent `account` and `genesisConfigId`). Used to derive both values
260
- * automatically. Config updates never change `account`/`genesisConfigId`,
261
- * so the genesis config is also the correct input for post-update
262
- * transactions.
243
+ * permanent `account`). Used to derive the account automatically.
244
+ * Config updates never change `account`, so the genesis config is
245
+ * also the correct input for post-update transactions.
263
246
  */
264
247
  genesisConfig: Config;
265
248
  }>;
266
- type ErrorType = getAddress.ErrorType | toId.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Hex.from.ErrorType | Errors.GlobalErrorType;
267
- }
268
- /**
269
- * Derives the permanent config ID for a native multisig
270
- * {@link ox#MultisigConfig.Config}.
271
- *
272
- * Preimage (fixed-width big-endian, **not** RLP):
273
- * `keccak256("tempo:multisig:config" || salt || be_u32(threshold) || be_u32(owners.length) || (owner || be_u32(weight)) for each owner)`.
274
- *
275
- * @example
276
- * ```ts twoslash
277
- * import { MultisigConfig } from 'ox/tempo'
278
- *
279
- * const config = MultisigConfig.from({
280
- * threshold: 1,
281
- * owners: [
282
- * {
283
- * owner: '0x1111111111111111111111111111111111111111',
284
- * weight: 1
285
- * }
286
- * ]
287
- * })
288
- *
289
- * const genesisConfigId = MultisigConfig.toId(config)
290
- * ```
291
- *
292
- * @param config - The multisig config.
293
- * @returns The 32-byte config ID.
294
- */
295
- export declare function toId(config: Config): Hex.Hex;
296
- export declare namespace toId {
297
- type ErrorType = assert.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Hex.fromString.ErrorType | Errors.GlobalErrorType;
249
+ type ErrorType = getAddress.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Hex.from.ErrorType | Errors.GlobalErrorType;
298
250
  }
299
251
  /**
300
252
  * Converts a {@link ox#MultisigConfig.Config} to its RLP tuple form (carried
@@ -1 +1 @@
1
- {"version":3,"file":"MultisigConfig.d.ts","sourceRoot":"","sources":["../../src/tempo/MultisigConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAE/D,oEAAoE;AACpE,eAAO,MAAM,SAAS,KAAK,CAAA;AAE3B,oEAAoE;AAC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AI,CAAC,SAAS,CAAC,SAAS,GACxB,GAAG,CAAC,MAAM,CAAC,SAAS,GACpB,GAAG,CAAC,IAAI,CAAC,SAAS,GAClB,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAS7C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOhD;AAED,uDAAuD;AACvD,qBAAa,kBAAmB,SAAQ,MAAM,CAAC,SAAS;IACtD,SAAkB,IAAI,uCAAsC;gBAChD,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAG3C"}
@@ -3,7 +3,12 @@ import * as Errors from '../core/Errors.js';
3
3
  import * as Hash from '../core/Hash.js';
4
4
  import * as Hex from '../core/Hex.js';
5
5
  /** Maximum number of owners allowed in a native multisig config. */
6
- export const maxOwners = 10;
6
+ export const maxOwners = 255;
7
+ /**
8
+ * Maximum number of native multisig signatures in one nested authorization
9
+ * path, including the top-level transaction signature.
10
+ */
11
+ export const maxNestingDepth = 3;
7
12
  /** Maximum encoded byte length for one primitive owner approval. */
8
13
  export const maxOwnerSignatureBytes = 2049;
9
14
  /** Tempo signature type byte for native multisig signatures. */
@@ -12,16 +17,14 @@ export const signatureTypeByte = '0x05';
12
17
  export const zeroSalt = `0x${'00'.repeat(32)}`;
13
18
  /** Domain prefix for the native multisig account address derivation. */
14
19
  const accountDomain = 'tempo:multisig:account';
15
- /** Domain prefix for the native multisig config ID derivation. */
16
- const configDomain = 'tempo:multisig:config';
17
20
  /** Domain prefix for native multisig owner approvals. */
18
21
  const signatureDomain = 'tempo:multisig:signature';
19
22
  /**
20
23
  * Asserts that a native multisig {@link ox#MultisigConfig.Config} is valid.
21
24
  *
22
- * Mirrors the Tempo `validate_multisig_config` rules: owners non-empty and
25
+ * Mirrors the Tempo `InitMultisig::validate` rules: owners non-empty and
23
26
  * `<= maxOwners`, strictly ascending unique nonzero owner addresses, nonzero
24
- * owner weights, `threshold >= 1`, total weight `<= u32::MAX`, and
27
+ * owner weights, `threshold >= 1`, total weight `<= 255` (u8 max), and
25
28
  * `threshold <= total weight`.
26
29
  *
27
30
  * @example
@@ -66,9 +69,9 @@ export function assert(config) {
66
69
  previous = current;
67
70
  totalWeight += Number(owner.weight);
68
71
  }
69
- if (totalWeight > 0xffffffff)
72
+ if (totalWeight > 0xff)
70
73
  throw new InvalidConfigError({
71
- reason: 'total owner weight exceeds u32 max',
74
+ reason: 'total owner weight exceeds u8 max',
72
75
  });
73
76
  if (Number(threshold) > totalWeight)
74
77
  throw new InvalidConfigError({
@@ -79,7 +82,7 @@ export function assert(config) {
79
82
  * Normalizes a native multisig {@link ox#MultisigConfig.Config}.
80
83
  *
81
84
  * Sorts owners into strictly ascending `owner` address order (the canonical
82
- * form required for config ID derivation) and asserts the config is valid.
85
+ * form required for account derivation) and asserts the config is valid.
83
86
  *
84
87
  * @example
85
88
  * ```ts twoslash
@@ -149,7 +152,11 @@ export function fromTuple(tuple) {
149
152
  /**
150
153
  * Derives the stable native multisig account address.
151
154
  *
152
- * `keccak256("tempo:multisig:account" || config_id)[12:32]`.
155
+ * Preimage (fixed-width big-endian, **not** RLP):
156
+ * `keccak256("tempo:multisig:account" || salt || u8(threshold) || u8(owners.length) || (owner || u8(weight)) for each owner)[12:32]`.
157
+ *
158
+ * The address is derived once from the initial (bootstrap) config and never
159
+ * changes — config updates do not affect it.
153
160
  *
154
161
  * @example
155
162
  * ```ts twoslash
@@ -168,42 +175,33 @@ export function fromTuple(tuple) {
168
175
  * const address = MultisigConfig.getAddress(genesisConfig)
169
176
  * ```
170
177
  *
171
- * @example
172
- * ### From an genesis config ID
173
- *
174
- * If you already have the permanent `genesisConfigId`, pass it directly:
175
- *
176
- * ```ts twoslash
177
- * import { MultisigConfig } from 'ox/tempo'
178
- *
179
- * const genesisConfigId = `0x${'00'.repeat(32)}` as const
180
- *
181
- * const address = MultisigConfig.getAddress({
182
- * genesisConfigId
183
- * })
184
- * ```
185
- *
186
- * @param value - The genesis config (positional) or `{ genesisConfigId }`.
178
+ * @param config - The initial (bootstrap) multisig config.
187
179
  * @returns The multisig account address.
188
180
  */
189
- export function getAddress(value) {
190
- const id = typeof value === 'object' && 'genesisConfigId' in value
191
- ? value.genesisConfigId
192
- : toId(value);
193
- const hash = Hash.keccak256(Hex.concat(Hex.fromString(accountDomain), id));
194
- return Address.from(Hex.slice(hash, 12, 32));
181
+ export function getAddress(config) {
182
+ assert(config);
183
+ const hash = Hash.keccak256(Hex.concat(Hex.fromString(accountDomain), Hex.padLeft(config.salt ?? zeroSalt, 32), Hex.fromNumber(config.threshold, { size: 1 }), Hex.fromNumber(config.owners.length, { size: 1 }), ...config.owners.flatMap((owner) => [
184
+ owner.owner,
185
+ Hex.fromNumber(owner.weight, { size: 1 }),
186
+ ])));
187
+ const account = Address.from(Hex.slice(hash, 12, 32));
188
+ if (Hex.toBigInt(account) === 0n)
189
+ throw new InvalidConfigError({ reason: 'derived account cannot be zero' });
190
+ return account;
195
191
  }
196
192
  /**
197
193
  * Computes the digest a native multisig owner approves (signs).
198
194
  *
199
- * `keccak256("tempo:multisig:signature" || inner_digest || account || config_id)`,
195
+ * `keccak256("tempo:multisig:signature" || inner_digest || account)`,
200
196
  * where `inner_digest` is the transaction sign payload
201
197
  * ({@link ox#TxEnvelopeTempo.(getSignPayload:function)}).
202
198
  *
203
- * The digest is always keyed on the permanent `account`/`genesisConfigId`
204
- * derived from the genesis (bootstrap) config — config updates never change
205
- * these values, so the genesis config is the correct input even for
206
- * post-update transactions.
199
+ * The digest is keyed on the permanent `account` derived from the genesis
200
+ * (bootstrap) config — config updates never change it, so the genesis config
201
+ * is the correct input even for post-update transactions.
202
+ *
203
+ * For a nested multisig owner approval, the parent digest becomes the nested
204
+ * approval's `payload`, with the nested multisig `account`.
207
205
  *
208
206
  * @example
209
207
  * ```ts twoslash
@@ -231,10 +229,10 @@ export function getAddress(value) {
231
229
  * ```
232
230
  *
233
231
  * @example
234
- * ### From `account` + `genesisConfigId`
232
+ * ### From `account`
235
233
  *
236
- * If you already have the permanent `account` and `genesisConfigId` (for
237
- * example, recovered from a stored envelope), pass them directly:
234
+ * If you already have the permanent `account` (for example, recovered from a
235
+ * stored envelope), pass it directly:
238
236
  *
239
237
  * ```ts twoslash
240
238
  * import { MultisigConfig, TxEnvelopeTempo } from 'ox/tempo'
@@ -248,7 +246,6 @@ export function getAddress(value) {
248
246
  * }
249
247
  * ]
250
248
  * })
251
- * const genesisConfigId = MultisigConfig.toId(genesisConfig)
252
249
  * const account = MultisigConfig.getAddress(genesisConfig)
253
250
  *
254
251
  * const envelope = TxEnvelopeTempo.from({
@@ -258,8 +255,7 @@ export function getAddress(value) {
258
255
  *
259
256
  * const digest = MultisigConfig.getSignPayload({
260
257
  * payload: TxEnvelopeTempo.getSignPayload(envelope),
261
- * account,
262
- * genesisConfigId
258
+ * account
263
259
  * })
264
260
  * ```
265
261
  *
@@ -271,47 +267,7 @@ export function getSignPayload(value) {
271
267
  const account = 'account' in value && value.account
272
268
  ? value.account
273
269
  : getAddress(value.genesisConfig);
274
- const genesisConfigId = 'genesisConfigId' in value && value.genesisConfigId
275
- ? value.genesisConfigId
276
- : toId(value.genesisConfig);
277
- return Hash.keccak256(Hex.concat(Hex.fromString(signatureDomain), Hex.from(payload), account, genesisConfigId));
278
- }
279
- /**
280
- * Derives the permanent config ID for a native multisig
281
- * {@link ox#MultisigConfig.Config}.
282
- *
283
- * Preimage (fixed-width big-endian, **not** RLP):
284
- * `keccak256("tempo:multisig:config" || salt || be_u32(threshold) || be_u32(owners.length) || (owner || be_u32(weight)) for each owner)`.
285
- *
286
- * @example
287
- * ```ts twoslash
288
- * import { MultisigConfig } from 'ox/tempo'
289
- *
290
- * const config = MultisigConfig.from({
291
- * threshold: 1,
292
- * owners: [
293
- * {
294
- * owner: '0x1111111111111111111111111111111111111111',
295
- * weight: 1
296
- * }
297
- * ]
298
- * })
299
- *
300
- * const genesisConfigId = MultisigConfig.toId(config)
301
- * ```
302
- *
303
- * @param config - The multisig config.
304
- * @returns The 32-byte config ID.
305
- */
306
- export function toId(config) {
307
- assert(config);
308
- const id = Hash.keccak256(Hex.concat(Hex.fromString(configDomain), Hex.padLeft(config.salt ?? zeroSalt, 32), Hex.fromNumber(config.threshold, { size: 4 }), Hex.fromNumber(config.owners.length, { size: 4 }), ...config.owners.flatMap((owner) => [
309
- owner.owner,
310
- Hex.fromNumber(owner.weight, { size: 4 }),
311
- ])));
312
- if (Hex.toBigInt(id) === 0n)
313
- throw new InvalidConfigError({ reason: 'config ID cannot be zero' });
314
- return id;
270
+ return Hash.keccak256(Hex.concat(Hex.fromString(signatureDomain), Hex.from(payload), account));
315
271
  }
316
272
  /**
317
273
  * Converts a {@link ox#MultisigConfig.Config} to its RLP tuple form (carried
@@ -1 +1 @@
1
- {"version":3,"file":"MultisigConfig.js","sourceRoot":"","sources":["../../src/tempo/MultisigConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAE7C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAGrC,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAA;AAE3B,oEAAoE;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAE1C,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAe,CAAA;AAEhD,gEAAgE;AAChE,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAW,CAAA;AAEvD,wEAAwE;AACxE,MAAM,aAAa,GAAG,wBAAwB,CAAA;AAE9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G,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,CAAU,CAAA;AAClE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,IAAI,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAA;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,uDAAuD;AACvD,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC,SAAS;IACpC,IAAI,GAAG,mCAAmC,CAAA;IAC5D,YAAY,EAAE,MAAM,EAAsB;QACxC,KAAK,CAAC,mCAAmC,MAAM,GAAG,CAAC,CAAA;IACrD,CAAC;CACF"}
@@ -55,7 +55,6 @@ export type GetType<envelope extends PartialBy<SignatureEnvelope, 'type'> | unkn
55
55
  userAddress: Address.Address;
56
56
  } ? 'keychain' : envelope extends {
57
57
  account: Address.Address;
58
- genesisConfigId: `0x${string}`;
59
58
  signatures: any;
60
59
  } ? 'multisig' : never;
61
60
  /**
@@ -115,9 +114,10 @@ export type KeychainRpc = {
115
114
  /**
116
115
  * Native multisig signature (type `0x05`).
117
116
  *
118
- * Wraps a set of primitive owner approvals (secp256k1, p256, or webAuthn) over the
119
- * multisig owner approval digest. The transaction sender is the derived `account`,
120
- * authorized once the recovered owner weights meet the configured threshold.
117
+ * Wraps a set of owner approvals (secp256k1, p256, webAuthn, or nested
118
+ * multisig) over the multisig owner approval digest. The transaction sender is
119
+ * the derived `account`, authorized once the recovered owner weights meet the
120
+ * configured threshold.
121
121
  *
122
122
  * [TIP-1061](https://tips.sh/1061)
123
123
  */
@@ -125,9 +125,11 @@ export type Multisig<numberType = number> = {
125
125
  type: 'multisig';
126
126
  /** Native multisig account address. */
127
127
  account: Address.Address;
128
- /** Permanent config ID derived from the initial multisig config. */
129
- genesisConfigId: Hex.Hex;
130
- /** Primitive owner approvals over the multisig owner approval digest. */
128
+ /**
129
+ * Owner approvals over the multisig owner approval digest. Each approval is
130
+ * either a primitive signature or a nested multisig signature (keychain
131
+ * approvals are invalid).
132
+ */
131
133
  signatures: readonly SignatureEnvelope<numberType>[];
132
134
  /**
133
135
  * Initial native multisig config for bootstrapping this account. Present only on
@@ -140,14 +142,8 @@ export type MultisigRpc = {
140
142
  type: 'multisig';
141
143
  account: Address.Address;
142
144
  /**
143
- * The permanent multisig config ID (TIP-1061 wire field `config_id`).
144
- * Maps to `genesisConfigId` on the typed
145
- * {@link ox#SignatureEnvelope.Multisig} envelope.
146
- */
147
- configId: Hex.Hex;
148
- /**
149
- * Encoded primitive owner approvals (raw serialized signatures), matching the
150
- * node's `Vec<Bytes>` representation.
145
+ * Encoded owner approvals (raw serialized signatures), matching the node's
146
+ * `Vec<Bytes>` representation.
151
147
  */
152
148
  signatures: readonly Serialized[];
153
149
  init?: MultisigConfig.Config | undefined;
@@ -219,7 +215,7 @@ export type Type = (typeof types)[number];
219
215
  */
220
216
  export declare function assert(envelope: PartialBy<SignatureEnvelope, 'type'>): void;
221
217
  export declare namespace assert {
222
- type ErrorType = CoercionError | MissingPropertiesError | MultisigConfig.assert.ErrorType | Signature.assert.ErrorType | Errors.GlobalErrorType;
218
+ type ErrorType = CoercionError | InvalidMultisigApprovalError | MissingPropertiesError | MultisigConfig.assert.ErrorType | Signature.assert.ErrorType | Errors.GlobalErrorType;
223
219
  }
224
220
  /**
225
221
  * Extracts the address of the signer from a {@link ox#SignatureEnvelope.SignatureEnvelope}.
@@ -455,9 +451,9 @@ export declare function deserialize(value: Serialized): SignatureEnvelope;
455
451
  * @example
456
452
  * ### Multisig (from genesis config)
457
453
  *
458
- * Pass `genesisConfig` to derive `account` and `genesisConfigId` automatically.
459
- * Set `init: true` to opt into bootstrap (uses `genesisConfig` as the
460
- * bootstrap `init`); omit `init` for subsequent (non-bootstrap) transactions.
454
+ * Pass `genesisConfig` to derive `account` automatically. Set `init: true` to
455
+ * opt into bootstrap (uses `genesisConfig` as the bootstrap `init`); omit
456
+ * `init` for subsequent (non-bootstrap) transactions.
461
457
  *
462
458
  * ```ts twoslash
463
459
  * import { Secp256k1 } from 'ox'
@@ -502,9 +498,9 @@ export declare namespace from {
502
498
  payload?: Hex.Hex | Bytes.Bytes | undefined;
503
499
  };
504
500
  /**
505
- * Multisig envelope input variant where `account` and `genesisConfigId` are derived
506
- * from the supplied `genesisConfig`. Pass `init: true` to opt into bootstrap
507
- * (uses `genesisConfig` as the bootstrap `init`); omit `init` for subsequent
501
+ * Multisig envelope input variant where `account` is derived from the
502
+ * supplied `genesisConfig`. Pass `init: true` to opt into bootstrap (uses
503
+ * `genesisConfig` as the bootstrap `init`); omit `init` for subsequent
508
504
  * (non-bootstrap) transactions.
509
505
  */
510
506
  type MultisigFromGenesisConfig = {
@@ -613,10 +609,10 @@ export declare namespace serialize {
613
609
  * ({@link ox#MultisigConfig.(getSignPayload:function)}), so the signer of
614
610
  * every approval is recovered against that digest and the list is sorted by the
615
611
  * recovered owner address. Works for any owner key type (secp256k1, p256,
616
- * webAuthn, keychain).
612
+ * webAuthn).
617
613
  *
618
- * Config updates never change `account`/`genesisConfigId`, so the genesis
619
- * config is the correct input even for post-update transactions.
614
+ * Config updates never change `account`, so the genesis config is the correct
615
+ * input even for post-update transactions.
620
616
  *
621
617
  * @example
622
618
  * ```ts twoslash
@@ -674,18 +670,15 @@ export declare namespace sortMultisigApprovals {
674
670
  type Value = {
675
671
  /** The inner transaction sign payload (`tx.signature_hash()`). */
676
672
  payload: Hex.Hex | Bytes.Bytes;
677
- /** The primitive owner approvals to order. */
673
+ /** The owner approvals to order. */
678
674
  signatures: readonly SignatureEnvelope[];
679
675
  } & OneOf<{
680
676
  /** The native multisig account address. */
681
677
  account: Address.Address;
682
- /** The permanent config ID. */
683
- genesisConfigId: Hex.Hex;
684
678
  } | {
685
679
  /**
686
680
  * The initial multisig config (the bootstrap config that derived the
687
- * permanent `account` and `genesisConfigId`). Used to derive both values
688
- * automatically.
681
+ * permanent `account`). Used to derive the account automatically.
689
682
  */
690
683
  genesisConfig: MultisigConfig.Config;
691
684
  }>;
@@ -903,6 +896,15 @@ export declare class InvalidSerializedError extends Errors.BaseError {
903
896
  serialized: Hex.Hex;
904
897
  });
905
898
  }
899
+ /**
900
+ * Error thrown when a native multisig owner approval is invalid.
901
+ */
902
+ export declare class InvalidMultisigApprovalError extends Errors.BaseError {
903
+ readonly name = "SignatureEnvelope.InvalidMultisigApprovalError";
904
+ constructor({ reason }: {
905
+ reason: string;
906
+ });
907
+ }
906
908
  /**
907
909
  * Error thrown when a signature envelope fails to verify.
908
910
  */