ox 1.8.9 → 1.8.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 (68) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/core/AbiEvent.d.ts.map +1 -1
  3. package/dist/core/AbiEvent.js +32 -10
  4. package/dist/core/AbiEvent.js.map +1 -1
  5. package/dist/core/Authorization.d.ts.map +1 -1
  6. package/dist/core/Authorization.js +44 -6
  7. package/dist/core/Authorization.js.map +1 -1
  8. package/dist/core/Hex.d.ts +13 -1
  9. package/dist/core/Hex.d.ts.map +1 -1
  10. package/dist/core/Hex.js +5 -3
  11. package/dist/core/Hex.js.map +1 -1
  12. package/dist/core/RpcTransport.d.ts.map +1 -1
  13. package/dist/core/RpcTransport.js +21 -14
  14. package/dist/core/RpcTransport.js.map +1 -1
  15. package/dist/core/Signature.d.ts +1 -1
  16. package/dist/core/Signature.d.ts.map +1 -1
  17. package/dist/core/Signature.js +3 -2
  18. package/dist/core/Signature.js.map +1 -1
  19. package/dist/core/Siwe.d.ts.map +1 -1
  20. package/dist/core/Siwe.js +1 -1
  21. package/dist/core/Siwe.js.map +1 -1
  22. package/dist/core/TypedData.js +1 -1
  23. package/dist/core/TypedData.js.map +1 -1
  24. package/dist/core/internal/abiItem.d.ts.map +1 -1
  25. package/dist/core/internal/abiItem.js +45 -19
  26. package/dist/core/internal/abiItem.js.map +1 -1
  27. package/dist/tempo/AccountConfig.d.ts +7 -17
  28. package/dist/tempo/AccountConfig.d.ts.map +1 -1
  29. package/dist/tempo/AccountConfig.js +8 -26
  30. package/dist/tempo/AccountConfig.js.map +1 -1
  31. package/dist/tempo/AccountOperation.d.ts +1 -1
  32. package/dist/tempo/AccountOperation.js +1 -1
  33. package/dist/tempo/index.d.ts +1 -3
  34. package/dist/tempo/index.d.ts.map +1 -1
  35. package/dist/tempo/index.js +1 -3
  36. package/dist/tempo/index.js.map +1 -1
  37. package/dist/zod/Authorization.d.ts.map +1 -1
  38. package/dist/zod/Authorization.js +6 -9
  39. package/dist/zod/Authorization.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/core/AbiEvent.ts +61 -22
  42. package/src/core/Authorization.ts +43 -6
  43. package/src/core/Hex.ts +17 -3
  44. package/src/core/RpcTransport.ts +20 -16
  45. package/src/core/Signature.ts +5 -2
  46. package/src/core/Siwe.ts +1 -1
  47. package/src/core/TypedData.ts +1 -1
  48. package/src/core/_test/AbiEvent.test.ts +232 -1
  49. package/src/core/_test/AbiItem.test.ts +342 -0
  50. package/src/core/_test/Authorization.test.ts +166 -0
  51. package/src/core/_test/Hex.test.ts +31 -0
  52. package/src/core/_test/RpcTransport.test.ts +48 -0
  53. package/src/core/_test/Signature.test.ts +42 -1
  54. package/src/core/_test/Siwe.test.ts +53 -0
  55. package/src/core/_test/TransactionEnvelopeEip7702.test.ts +66 -0
  56. package/src/core/_test/TypedData.test.ts +29 -0
  57. package/src/core/internal/abiItem.ts +59 -25
  58. package/src/tempo/AccountConfig.test.ts +34 -47
  59. package/src/tempo/AccountConfig.ts +9 -37
  60. package/src/tempo/AccountOperation.test.ts +36 -37
  61. package/src/tempo/AccountOperation.ts +1 -1
  62. package/src/tempo/SignatureEnvelope.test.ts +1 -3
  63. package/src/tempo/configurableAccounts.e2e.test.ts +1 -2
  64. package/src/tempo/index.ts +1 -3
  65. package/src/version.ts +1 -1
  66. package/src/zod/Authorization.ts +6 -24
  67. package/src/zod/_test/Authorization.test.ts +35 -2
  68. package/src/zod/_test/TransactionRequest.test.ts +1 -1
@@ -1,4 +1,3 @@
1
- import { factory } from '../../test/tempo/configurableAccounts.js'
2
1
  import { Hash, Hex, Rlp } from 'ox'
3
2
  import { AccountConfig } from 'ox/tempo'
4
3
  import { describe, expect, test } from 'vp/test'
@@ -10,13 +9,12 @@ const config = AccountConfig.from({
10
9
  owners: [{ owner: owner_1, weight: 1 }],
11
10
  threshold: 1,
12
11
  })
13
- const account = AccountConfig.getAddress(config, { factory })
12
+ const account = AccountConfig.getAddress(config)
14
13
 
15
14
  // Vectors from Tempo `crates/primitives/tests/configurable_account.rs`
16
15
  // (`configurable_account_hashes_follow_vectors_and_documented_layout`).
17
16
  const tempo = {
18
17
  account: '0x91847576f406d0842ad7c1a0c97c22a122e64278',
19
- factory: '0x9999999999999999999999999999999999999999',
20
18
  } as const
21
19
 
22
20
  describe('from', () => {
@@ -180,78 +178,67 @@ describe('fromUpgrade', () => {
180
178
  describe('getAddress', () => {
181
179
  test('example: matches the Tempo vectors', () => {
182
180
  expect({
183
- maxOwners: AccountConfig.getAddress(
184
- {
185
- owners: Array.from({ length: AccountConfig.maxOwners }, (_, i) => ({
186
- owner: Hex.padLeft(Hex.fromNumber(i + 1), 20),
187
- weight: 1,
188
- })),
189
- threshold: 8,
190
- },
191
- { factory: tempo.factory },
192
- ),
193
- single: AccountConfig.getAddress(config, { factory: tempo.factory }),
181
+ maxOwners: AccountConfig.getAddress({
182
+ owners: Array.from({ length: AccountConfig.maxOwners }, (_, i) => ({
183
+ owner: Hex.padLeft(Hex.fromNumber(i + 1), 20),
184
+ weight: 1,
185
+ })),
186
+ threshold: 8,
187
+ }),
188
+ single: AccountConfig.getAddress(config),
194
189
  }).toMatchInlineSnapshot(`
195
190
  {
196
- "maxOwners": "0x7a4279bb3f1b8b54d703484317f64eae6814e827",
197
- "single": "0x87c346a9029d675f296db533b12e146439cf20d5",
191
+ "maxOwners": "0x9859f0316567499ebcd81d3417c0622999d7179f",
192
+ "single": "0xcbb727e2489c904a905420e794e8275b6150bfe1",
198
193
  }
199
194
  `)
200
195
  })
201
196
 
202
- test('example: matches the frozen CREATE2 vector', () => {
197
+ test('example: matches the frozen keccak vector', () => {
203
198
  expect(account).toMatchInlineSnapshot(
204
- `"0x2318ebe50d1d476ec10854bfd949f96ea7737b68"`,
199
+ `"0xcbb727e2489c904a905420e794e8275b6150bfe1"`,
205
200
  )
206
201
  expect(account).not.toBe('0x8820d1497eeaf4f68e00b2cfc00a2f3b1dbb00da')
207
202
  })
208
203
 
209
204
  test('behavior: includes salt, threshold, and owners', () => {
210
205
  expect(
211
- AccountConfig.getAddress(
212
- {
213
- owners: [
214
- { owner: owner_1, weight: 1 },
215
- { owner: owner_2, weight: 2 },
216
- ],
217
- salt: `0x${'42'.repeat(32)}`,
218
- threshold: 2,
219
- },
220
- { factory },
221
- ),
222
- ).toMatchInlineSnapshot(`"0x1baa996a4f142d99999aa22f1cb1eb97eed2a24a"`)
206
+ AccountConfig.getAddress({
207
+ owners: [
208
+ { owner: owner_1, weight: 1 },
209
+ { owner: owner_2, weight: 2 },
210
+ ],
211
+ salt: `0x${'42'.repeat(32)}`,
212
+ threshold: 2,
213
+ }),
214
+ ).toMatchInlineSnapshot(`"0x870b14ffcb3d1bd52be7cc6e8358a35712fec535"`)
223
215
  })
224
216
 
225
217
  test('behavior: is stable and binds the salt', () => {
226
218
  expect({
227
- repeated: AccountConfig.getAddress(config, { factory }),
228
- salted: AccountConfig.getAddress(
229
- {
230
- ...config,
231
- salt: `0x${'42'.repeat(32)}`,
232
- },
233
- { factory },
234
- ),
219
+ repeated: AccountConfig.getAddress(config),
220
+ salted: AccountConfig.getAddress({
221
+ ...config,
222
+ salt: `0x${'42'.repeat(32)}`,
223
+ }),
235
224
  }).toMatchInlineSnapshot(`
236
225
  {
237
- "repeated": "0x2318ebe50d1d476ec10854bfd949f96ea7737b68",
238
- "salted": "0x70d2e44032514493b68641ce5182cc878baa51f0",
226
+ "repeated": "0xcbb727e2489c904a905420e794e8275b6150bfe1",
227
+ "salted": "0xfc6a724c4715d331ec47dc8c1636798956fd3e4d",
239
228
  }
240
229
  `)
241
230
  })
242
231
 
243
232
  test('error: rejects a current configuration', () => {
244
233
  expect(() =>
245
- AccountConfig.getAddress({ ...config, version: 1n }, { factory }),
234
+ AccountConfig.getAddress({ ...config, version: 1n }),
246
235
  ).toThrowErrorMatchingInlineSnapshot(
247
236
  `[AccountConfig.InvalidConfigError: Invalid account config: account address requires version zero.]`,
248
237
  )
249
238
  })
250
239
 
251
240
  test('behavior: accepts numeric zero for an initial configuration', () => {
252
- expect(
253
- AccountConfig.getAddress({ ...config, version: 0 }, { factory }),
254
- ).toBe(account)
241
+ expect(AccountConfig.getAddress({ ...config, version: 0 })).toBe(account)
255
242
  })
256
243
  })
257
244
 
@@ -308,7 +295,7 @@ describe('getSignPayload', () => {
308
295
  expect(
309
296
  AccountConfig.getSignPayload({ account, config, payload }),
310
297
  ).toMatchInlineSnapshot(
311
- `"0x32144254ec42f7a37b97e3a843667b527479f933320be553265e6594dc44ea87"`,
298
+ `"0x53a60618dd8fd4d01c2c94a4d9dc482dbb7b97115eb448a4590d153b933e549a"`,
312
299
  )
313
300
  })
314
301
 
@@ -449,14 +436,14 @@ describe('assert/validate', () => {
449
436
  })
450
437
  const rlp = Rlp.fromHex(AccountConfig.toTuple(boundary))
451
438
  expect({
452
- account: AccountConfig.getAddress(boundary, { factory }),
439
+ account: AccountConfig.getAddress(boundary),
453
440
  commitment: AccountConfig.getCommitment(boundary),
454
441
  rlpHash: Hash.keccak256(rlp),
455
442
  rlpLength: Hex.size(rlp),
456
443
  valid: AccountConfig.validate(boundary),
457
444
  }).toMatchInlineSnapshot(`
458
445
  {
459
- "account": "0x8400988285be93cba9391d445e473601633e5d62",
446
+ "account": "0x9859f0316567499ebcd81d3417c0622999d7179f",
460
447
  "commitment": "0xa9282ca5b73ac63b7e27f49cafa6ab13bd2aa79fc45267cf27342db73150cd46",
461
448
  "rlpHash": "0xbaf0d030add91caaa10815d2e99c942f1e39b0d199216973781adb4fc1af6955",
462
449
  "rlpLength": 1145,
@@ -1,6 +1,5 @@
1
1
  import * as Address from '../core/Address.js'
2
2
  import type * as Bytes from '../core/Bytes.js'
3
- import * as ContractAddress from '../core/ContractAddress.js'
4
3
  import * as Errors from '../core/Errors.js'
5
4
  import * as Hash from '../core/Hash.js'
6
5
  import * as Hex from '../core/Hex.js'
@@ -38,15 +37,6 @@ const accountDomain = 'tempo:configurable-account:account'
38
37
  /** Domain prefix for account configuration commitments. */
39
38
  const configDomain = 'tempo:configurable-account:config'
40
39
 
41
- /**
42
- * Keccak-256 of the account proxy creation code.
43
- *
44
- * Placeholder until [TIP-1110](https://tips.sh/1110) fixes the canonical
45
- * account proxy, which will change every derived address.
46
- */
47
- const accountProxyInitCodeHash =
48
- '0x583cc63a2e37f645b43eac911b1a6d6de08b83abdc308c61364edda8cfc3bd37'
49
-
50
40
  /** Domain prefix for configurable account owner approvals. */
51
41
  const signatureDomain = 'tempo:configurable-account:signature'
52
42
 
@@ -421,9 +411,9 @@ export declare namespace fromUpgrade {
421
411
  /**
422
412
  * Derives the stable configurable account address.
423
413
  *
424
- * The initial config is hashed into a CREATE2 salt using fixed-width
425
- * big-endian fields, not RLP. The account uses the chain-configured recovery
426
- * factory and account proxy init-code hash.
414
+ * The address is the last 20 bytes of the keccak256 hash of the initial
415
+ * config, encoded with fixed-width big-endian fields, not RLP:
416
+ * `keccak256("tempo:configurable-account:account" || salt || uint8(threshold) || uint8(owners.length) || owners)`.
427
417
  *
428
418
  * The address is derived once from the initial version-0 config. Config
429
419
  * updates do not change it.
@@ -442,26 +432,19 @@ export declare namespace fromUpgrade {
442
432
  * threshold: 1
443
433
  * })
444
434
  *
445
- * const address = AccountConfig.getAddress(initialConfig, {
446
- * factory: '0x7171717171717171717171717171717171717171'
447
- * })
435
+ * const address = AccountConfig.getAddress(initialConfig)
448
436
  * ```
449
437
  *
450
438
  * @param config - The initial account config.
451
- * @param options - The recovery factory configured by the chain.
452
439
  * @returns The configurable account address.
453
440
  */
454
- export function getAddress(
455
- config: Input,
456
- options: getAddress.Options,
457
- ): Address.Address {
458
- Address.assert(options.factory)
441
+ export function getAddress(config: Input): Address.Address {
459
442
  assert(config)
460
443
  if (BigInt(config.version ?? 0) !== 0n)
461
444
  throw new InvalidConfigError({
462
445
  reason: 'account address requires version zero',
463
446
  })
464
- const accountSalt = Hash.keccak256(
447
+ const hash = Hash.keccak256(
465
448
  Hex.concat(
466
449
  Hex.fromString(accountDomain),
467
450
  Hex.padLeft(config.salt ?? zeroSalt, 32),
@@ -473,11 +456,7 @@ export function getAddress(
473
456
  ]),
474
457
  ),
475
458
  )
476
- const account = ContractAddress.fromCreate2({
477
- bytecodeHash: accountProxyInitCodeHash,
478
- from: options.factory,
479
- salt: accountSalt,
480
- })
459
+ const account = Hex.slice(hash, 12)
481
460
  if (Hex.toBigInt(account) === 0n)
482
461
  throw new InvalidConfigError({ reason: 'derived account cannot be zero' })
483
462
  if (config.owners.some((owner) => Address.isEqual(owner.owner, account)))
@@ -488,18 +467,13 @@ export function getAddress(
488
467
  }
489
468
 
490
469
  export declare namespace getAddress {
491
- type Options = {
492
- /** Recovery factory configured by the chain. */
493
- factory: Address.Address
494
- }
495
-
496
470
  type ErrorType =
497
471
  | assert.ErrorType
498
- | ContractAddress.fromCreate2.ErrorType
499
472
  | Hash.keccak256.ErrorType
500
473
  | Hex.concat.ErrorType
501
474
  | Hex.fromNumber.ErrorType
502
475
  | Hex.fromString.ErrorType
476
+ | Hex.slice.ErrorType
503
477
  | Errors.GlobalErrorType
504
478
  }
505
479
 
@@ -586,9 +560,7 @@ export declare namespace getCommitment {
586
560
  * })
587
561
  *
588
562
  * const digest = AccountConfig.getSignPayload({
589
- * account: AccountConfig.getAddress(config, {
590
- * factory: '0x7171717171717171717171717171717171717171'
591
- * }),
563
+ * account: AccountConfig.getAddress(config),
592
564
  * config,
593
565
  * payload: TxEnvelopeTempo.getSignPayload(envelope)
594
566
  * })
@@ -1,4 +1,3 @@
1
- import { factory } from '../../test/tempo/configurableAccounts.js'
2
1
  import { Address, Hash, Hex, P256 } from 'ox'
3
2
  import {
4
3
  AccountConfig,
@@ -41,7 +40,7 @@ const config = AccountConfig.from({
41
40
  threshold: 2,
42
41
  })
43
42
  const currentConfig = AccountConfig.from({ ...config, version: 1n })
44
- const account = AccountConfig.getAddress(config, { factory })
43
+ const account = AccountConfig.getAddress(config)
45
44
  const ownerSignature_1 = owners[0]!.signature
46
45
  const approval_1 = SignatureEnvelope.serialize(ownerSignature_1)
47
46
  const approval_2 = SignatureEnvelope.serialize(owners[1]!.signature)
@@ -153,8 +152,8 @@ describe('getHash', () => {
153
152
  }),
154
153
  }).toMatchInlineSnapshot(`
155
154
  {
156
- "keyAuthorization": "0xd18f389ae23bdc81939861c9a1079201968a2ec5fbd67ad1063556b46af8914f",
157
- "transaction": "0x246027f7c6940fb4b68a746c49819c1c45737aa6c975aafcce721b4a619a9ab1",
155
+ "keyAuthorization": "0x5e8fa6d31c6e604cdac971bdd0a10b825cbb039c76ee399a6d6f619957032de4",
156
+ "transaction": "0x4f312a4616f3f96375e6bd4c20f992694408a8c804429140068aee31bd0b0eaf",
158
157
  }
159
158
  `)
160
159
  })
@@ -170,7 +169,7 @@ describe('selectApprovals', () => {
170
169
  ],
171
170
  threshold: 3,
172
171
  })
173
- const account = AccountConfig.getAddress(config, { factory })
172
+ const account = AccountConfig.getAddress(config)
174
173
  const hash = AccountOperation.getHash({
175
174
  account,
176
175
  config: { ...config, version: 1n },
@@ -226,7 +225,7 @@ describe('selectApprovals', () => {
226
225
  }
227
226
  `)
228
227
  })
229
- test('accepts an explicit account from a chain-configured factory', async () => {
228
+ test('accepts an explicit derived account', async () => {
230
229
  const selected = await AccountOperation.selectApprovals({
231
230
  account,
232
231
  approvals: [],
@@ -345,14 +344,14 @@ describe('serializeKeyAuthorization', () => {
345
344
  expect(results).toMatchInlineSnapshot(`
346
345
  [
347
346
  {
348
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
349
- "hash": "0x8d72c92f8aca5cf651ff914a928a32b1717e51b70fce97e305aaab02617474f5",
347
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
348
+ "hash": "0xa12b482453a90d0be6ec0c85e9871d47c322278e2e623191196a974aef52cafd",
350
349
  "signatureCount": 2,
351
350
  "version": 1n,
352
351
  },
353
352
  {
354
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
355
- "hash": "0x1dce79ae000bb60526cbe3b18be29d517319ee0958b01e5e3e89608e19c13459",
353
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
354
+ "hash": "0x65666f84fa858423447d9eb84e4ad8e36ea483b358cfb935103f14912db0de93",
356
355
  "signatureCount": 2,
357
356
  "version": 0n,
358
357
  },
@@ -446,15 +445,15 @@ describe('serializeTransaction', () => {
446
445
  expect(results).toMatchInlineSnapshot(`
447
446
  [
448
447
  {
449
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
450
- "hash": "0x75106153400c34efbeb7380828e3fef939340eb0a3a42dda6a22f798f94665d0",
448
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
449
+ "hash": "0x58d5d2655982d69e28c791189c23056344a2b7a166a893988a4b9be228b73469",
451
450
  "signatureCount": 2,
452
451
  "type": "0x76",
453
452
  "version": 1n,
454
453
  },
455
454
  {
456
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
457
- "hash": "0x2718b956492b1f8ff4e25165ac425e9e7064580b76eb087ce764e263723152bc",
455
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
456
+ "hash": "0xb3e7bcc63f69d80a954c2e4a5ba186903012686ea31bd049465f6c1e2308c046",
458
457
  "signatureCount": 2,
459
458
  "type": "0x76",
460
459
  "version": 0n,
@@ -535,7 +534,7 @@ describe('serializeTransaction', () => {
535
534
  [
536
535
  {
537
536
  "feePayerSignature": null,
538
- "from": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
537
+ "from": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
539
538
  "signatureCount": 2,
540
539
  "type": "0x78",
541
540
  },
@@ -545,7 +544,7 @@ describe('serializeTransaction', () => {
545
544
  "s": "0x0000000000000000000000000000000000000000000000000000000000000006",
546
545
  "yParity": 0,
547
546
  },
548
- "from": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
547
+ "from": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
549
548
  "signatureCount": 2,
550
549
  "type": "0x78",
551
550
  },
@@ -617,7 +616,7 @@ describe('from', () => {
617
616
  expect({ pending, submitting, success }).toMatchInlineSnapshot(`
618
617
  {
619
618
  "pending": {
620
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
619
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
621
620
  "approvals": [
622
621
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
623
622
  ],
@@ -637,7 +636,7 @@ describe('from', () => {
637
636
  "version": 1n,
638
637
  },
639
638
  "createdAt": 1,
640
- "hash": "0x246027f7c6940fb4b68a746c49819c1c45737aa6c975aafcce721b4a619a9ab1",
639
+ "hash": "0x4f312a4616f3f96375e6bd4c20f992694408a8c804429140068aee31bd0b0eaf",
641
640
  "signatureCount": 1,
642
641
  "status": "pending",
643
642
  "threshold": 2,
@@ -647,7 +646,7 @@ describe('from', () => {
647
646
  "weight": 1,
648
647
  },
649
648
  "submitting": {
650
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
649
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
651
650
  "approvals": [
652
651
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
653
652
  "0x01000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
@@ -669,7 +668,7 @@ describe('from', () => {
669
668
  },
670
669
  "createdAt": 1,
671
670
  "expiresAt": 10,
672
- "hash": "0x246027f7c6940fb4b68a746c49819c1c45737aa6c975aafcce721b4a619a9ab1",
671
+ "hash": "0x4f312a4616f3f96375e6bd4c20f992694408a8c804429140068aee31bd0b0eaf",
673
672
  "signatureCount": 2,
674
673
  "status": "submitting",
675
674
  "submissionId": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
@@ -680,7 +679,7 @@ describe('from', () => {
680
679
  "weight": 2,
681
680
  },
682
681
  "success": {
683
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
682
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
684
683
  "approvals": [
685
684
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
686
685
  "0x01000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
@@ -701,7 +700,7 @@ describe('from', () => {
701
700
  "version": 1n,
702
701
  },
703
702
  "createdAt": 1,
704
- "hash": "0x246027f7c6940fb4b68a746c49819c1c45737aa6c975aafcce721b4a619a9ab1",
703
+ "hash": "0x4f312a4616f3f96375e6bd4c20f992694408a8c804429140068aee31bd0b0eaf",
705
704
  "signatureCount": 2,
706
705
  "status": "success",
707
706
  "threshold": 2,
@@ -747,7 +746,7 @@ describe('from', () => {
747
746
  },
748
747
  `
749
748
  {
750
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
749
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
751
750
  "approvals": [
752
751
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
753
752
  ],
@@ -833,7 +832,7 @@ describe('from', () => {
833
832
  },
834
833
  `
835
834
  {
836
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
835
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
837
836
  "approvals": [
838
837
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
839
838
  ],
@@ -890,7 +889,7 @@ describe('from', () => {
890
889
  expect({ pending, success }).toMatchInlineSnapshot(`
891
890
  {
892
891
  "pending": {
893
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
892
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
894
893
  "approvals": [
895
894
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
896
895
  ],
@@ -910,8 +909,8 @@ describe('from', () => {
910
909
  "version": 1n,
911
910
  },
912
911
  "createdAt": 1,
913
- "hash": "0xd18f389ae23bdc81939861c9a1079201968a2ec5fbd67ad1063556b46af8914f",
914
- "keyAuthorization": "0xf838f782107980943333333333333333333333333333333333333333846b49d20080808080940f8659dd87410f00a1668211ecda7ac7f9c9fd13",
912
+ "hash": "0x5e8fa6d31c6e604cdac971bdd0a10b825cbb039c76ee399a6d6f619957032de4",
913
+ "keyAuthorization": "0xf838f782107980943333333333333333333333333333333333333333846b49d2008080808094b3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
915
914
  "signatureCount": 1,
916
915
  "status": "pending",
917
916
  "threshold": 2,
@@ -920,7 +919,7 @@ describe('from', () => {
920
919
  "weight": 1,
921
920
  },
922
921
  "success": {
923
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
922
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
924
923
  "approvals": [
925
924
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
926
925
  "0x01000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
@@ -941,8 +940,8 @@ describe('from', () => {
941
940
  "version": 1n,
942
941
  },
943
942
  "createdAt": 1,
944
- "hash": "0xd18f389ae23bdc81939861c9a1079201968a2ec5fbd67ad1063556b46af8914f",
945
- "keyAuthorization": "0xf901b3f782107980943333333333333333333333333333333333333333846b49d20080808080940f8659dd87410f00a1668211ecda7ac7f9c9fd13b9017805f90174940f8659dd87410f00a1668211ecda7ac7f9c9fd13f852a000000000000000000000000000000000000000000000000000000000000000000102eed69407e1ed8ea0e9601e5546b0a03aed683df360140701d694288f0cd85005f34168f731a468aef268c2f9456f01f90108b88201000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200b88201000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
943
+ "hash": "0x5e8fa6d31c6e604cdac971bdd0a10b825cbb039c76ee399a6d6f619957032de4",
944
+ "keyAuthorization": "0xf901b3f782107980943333333333333333333333333333333333333333846b49d2008080808094b3cc0b31026c7a54a9c45e468c674722c3c5b3b5b9017805f9017494b3cc0b31026c7a54a9c45e468c674722c3c5b3b5f852a000000000000000000000000000000000000000000000000000000000000000000102eed69407e1ed8ea0e9601e5546b0a03aed683df360140701d694288f0cd85005f34168f731a468aef268c2f9456f01f90108b88201000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200b88201000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
946
945
  "signatureCount": 2,
947
946
  "status": "success",
948
947
  "threshold": 2,
@@ -988,7 +987,7 @@ describe('from', () => {
988
987
  },
989
988
  `
990
989
  {
991
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
990
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
992
991
  "approvals": [
993
992
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
994
993
  "0x01000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
@@ -1034,7 +1033,7 @@ describe('RPC conversion', () => {
1034
1033
  expect({ keyAuthorizationRpc, transactionRpc }).toMatchInlineSnapshot(`
1035
1034
  {
1036
1035
  "keyAuthorizationRpc": {
1037
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
1036
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
1038
1037
  "approvals": [
1039
1038
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
1040
1039
  ],
@@ -1054,8 +1053,8 @@ describe('RPC conversion', () => {
1054
1053
  "version": "0x1",
1055
1054
  },
1056
1055
  "createdAt": 1,
1057
- "hash": "0xd18f389ae23bdc81939861c9a1079201968a2ec5fbd67ad1063556b46af8914f",
1058
- "keyAuthorization": "0xf838f782107980943333333333333333333333333333333333333333846b49d20080808080940f8659dd87410f00a1668211ecda7ac7f9c9fd13",
1056
+ "hash": "0x5e8fa6d31c6e604cdac971bdd0a10b825cbb039c76ee399a6d6f619957032de4",
1057
+ "keyAuthorization": "0xf838f782107980943333333333333333333333333333333333333333846b49d2008080808094b3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
1059
1058
  "signatureCount": 1,
1060
1059
  "status": "pending",
1061
1060
  "threshold": 2,
@@ -1064,7 +1063,7 @@ describe('RPC conversion', () => {
1064
1063
  "weight": 1,
1065
1064
  },
1066
1065
  "transactionRpc": {
1067
- "account": "0x0f8659dd87410f00a1668211ecda7ac7f9c9fd13",
1066
+ "account": "0xb3cc0b31026c7a54a9c45e468c674722c3c5b3b5",
1068
1067
  "approvals": [
1069
1068
  "0x01000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200",
1070
1069
  ],
@@ -1084,7 +1083,7 @@ describe('RPC conversion', () => {
1084
1083
  "version": "0x1",
1085
1084
  },
1086
1085
  "createdAt": 1,
1087
- "hash": "0x246027f7c6940fb4b68a746c49819c1c45737aa6c975aafcce721b4a619a9ab1",
1086
+ "hash": "0x4f312a4616f3f96375e6bd4c20f992694408a8c804429140068aee31bd0b0eaf",
1088
1087
  "signatureCount": 1,
1089
1088
  "status": "pending",
1090
1089
  "threshold": 2,
@@ -1427,7 +1426,7 @@ describe('validation', () => {
1427
1426
  salt: `0x${'AB'.repeat(32)}`,
1428
1427
  threshold: 2,
1429
1428
  })
1430
- const account = AccountConfig.getAddress(config, { factory })
1429
+ const account = AccountConfig.getAddress(config)
1431
1430
  const authorization = KeyAuthorization.from({
1432
1431
  account,
1433
1432
  address: '0x3333333333333333333333333333333333333333',
@@ -143,7 +143,7 @@ export declare namespace getHash {
143
143
  * The function retains one canonical approval per owner. It selects the
144
144
  * smallest deterministic quorum by owner weight, then orders the selected
145
145
  * approvals by owner address for serialization. The caller supplies the
146
- * account and config; the chain validates their factory-derived identity.
146
+ * account and config; the chain validates their derived identity.
147
147
  *
148
148
  * @example
149
149
  * ```ts twoslash
@@ -1769,9 +1769,7 @@ describe('sortApprovals', () => {
1769
1769
  owners: ascendingOwners.map((o) => ({ owner: o.address, weight: 1 })),
1770
1770
  })
1771
1771
  const payload = `0x${'42'.repeat(32)}` as const
1772
- const account = AccountConfig.getAddress(genesisConfig, {
1773
- factory: '0x7171717171717171717171717171717171717171',
1774
- })
1772
+ const account = AccountConfig.getAddress(genesisConfig)
1775
1773
  const version = 3n
1776
1774
  const digest = AccountConfig.getSignPayload({
1777
1775
  payload,
@@ -1,7 +1,6 @@
1
1
  import { AbiFunction, Address, Hex, Secp256k1, Value } from 'ox'
2
2
  import { describe, expect, test } from 'vp/test'
3
3
  import { chain, client, fundAddress } from '../../test/tempo/config.js'
4
- import { factory } from '../../test/tempo/configurableAccounts.js'
5
4
  import {
6
5
  AccountConfig,
7
6
  KeyAuthorization,
@@ -31,7 +30,7 @@ async function setup() {
31
30
  threshold: 2,
32
31
  owners: keys.map((key) => ({ owner: key.address, weight: 1 })),
33
32
  })
34
- const account = AccountConfig.getAddress(config, { factory })
33
+ const account = AccountConfig.getAddress(config)
35
34
  await fundAddress(client, { address: account })
36
35
  return { account, config, keys }
37
36
  }
@@ -29,9 +29,7 @@
29
29
  * ]
30
30
  * })
31
31
  *
32
- * const account = AccountConfig.getAddress(initialConfig, {
33
- * factory: '0x7171717171717171717171717171717171717171'
34
- * })
32
+ * const account = AccountConfig.getAddress(initialConfig)
35
33
  * ```
36
34
  *
37
35
  * @category Reference
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '1.8.9'
2
+ export const version = '1.8.12'
@@ -1,16 +1,14 @@
1
1
  /* eslint-disable jsdoc-js/require-jsdoc, jsdoc-js/require-description, jsdoc-js/require-example */
2
2
  import * as z_Address from './Address.js'
3
3
  import * as z_Hex from './Hex.js'
4
+ import { quantityHex } from './internal/Integer.js'
4
5
  import * as z_Number from './Number.js'
5
6
  import * as z_Uint from './Uint.js'
6
7
  import * as z from 'zod/mini'
7
8
 
8
- const yParityHex = z_Hex.Hex.check(
9
- z.refine(
10
- (value) => value === '0x0' || value === '0x1',
11
- 'expected yParity hex',
12
- ),
13
- )
9
+ // EIP-7702 permits any `y_parity` below 2**8 in an authorization tuple, so
10
+ // every authorization schema accepts an 8-bit `yParity`.
11
+ const yParityHex = quantityHex(8)
14
12
 
15
13
  /** Unsigned EIP-7702 authorization schema. */
16
14
  export const Unsigned = z.object(unsignedFields(z_Number.Number, z_Uint.Uint))
@@ -22,12 +20,12 @@ export const UnsignedToRpc = z.object(
22
20
 
23
21
  /** Signed EIP-7702 authorization schema. */
24
22
  export const Signed = z.object(
25
- signedFields(z_Number.Number, z_Uint.Uint, yParityUint()),
23
+ signedFields(z_Number.Number, z_Uint.Uint, z_Uint.Uint8),
26
24
  )
27
25
 
28
26
  /** Encode-only signed EIP-7702 authorization schema accepting numberish `toRpc` inputs. */
29
27
  export const SignedToRpc = z.object(
30
- signedFields(z_Number.NumberToRpc, z_Uint.UintToRpc, yParityUintToRpc()),
28
+ signedFields(z_Number.NumberToRpc, z_Uint.UintToRpc, z_Uint.Uint8ToRpc),
31
29
  )
32
30
 
33
31
  /** EIP-7702 authorization schema. */
@@ -71,22 +69,6 @@ export const TupleList = z.readonly(z.array(Tuple))
71
69
  /** Signed EIP-7702 authorization tuple list schema. */
72
70
  export const TupleListSigned = z.readonly(z.array(TupleSigned))
73
71
 
74
- function yParityUint() {
75
- return z_Uint.Uint8.check(
76
- z.refine((value) => value === 0 || value === 1, 'expected yParity'),
77
- )
78
- }
79
-
80
- function yParityUintToRpc() {
81
- return z_Uint.Uint8ToRpc.check(
82
- z.refine(
83
- (value) =>
84
- value === 0 || value === 1 || value === '0x0' || value === '0x1',
85
- 'expected yParity',
86
- ),
87
- )
88
- }
89
-
90
72
  function unsignedFields<num extends z.ZodMiniType, uint extends z.ZodMiniType>(
91
73
  num: num,
92
74
  uint: uint,