ox 0.14.55 → 0.14.56

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 (95) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/_cjs/tempo/{MultisigConfig.js → AccountConfig.js} +16 -4
  3. package/_cjs/tempo/AccountConfig.js.map +1 -0
  4. package/_cjs/tempo/{MultisigOperation.js → AccountOperation.js} +29 -29
  5. package/_cjs/tempo/AccountOperation.js.map +1 -0
  6. package/_cjs/tempo/{MultisigSimulation.js → AccountSimulation.js} +9 -9
  7. package/_cjs/tempo/AccountSimulation.js.map +1 -0
  8. package/_cjs/tempo/KeyAuthorization.js +12 -11
  9. package/_cjs/tempo/KeyAuthorization.js.map +1 -1
  10. package/_cjs/tempo/SignatureEnvelope.js +64 -64
  11. package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
  12. package/_cjs/tempo/TransactionRequest.js +12 -9
  13. package/_cjs/tempo/TransactionRequest.js.map +1 -1
  14. package/_cjs/tempo/index.js +4 -4
  15. package/_cjs/tempo/index.js.map +1 -1
  16. package/_cjs/version.js +1 -1
  17. package/_esm/tempo/{MultisigConfig.js → AccountConfig.js} +103 -55
  18. package/_esm/tempo/AccountConfig.js.map +1 -0
  19. package/_esm/tempo/{MultisigOperation.js → AccountOperation.js} +64 -64
  20. package/_esm/tempo/AccountOperation.js.map +1 -0
  21. package/_esm/tempo/{MultisigSimulation.js → AccountSimulation.js} +20 -20
  22. package/_esm/tempo/AccountSimulation.js.map +1 -0
  23. package/_esm/tempo/KeyAuthorization.js +13 -12
  24. package/_esm/tempo/KeyAuthorization.js.map +1 -1
  25. package/_esm/tempo/SignatureEnvelope.js +71 -71
  26. package/_esm/tempo/SignatureEnvelope.js.map +1 -1
  27. package/_esm/tempo/TransactionRequest.js +12 -9
  28. package/_esm/tempo/TransactionRequest.js.map +1 -1
  29. package/_esm/tempo/index.js +50 -48
  30. package/_esm/tempo/index.js.map +1 -1
  31. package/_esm/version.js +1 -1
  32. package/_types/tempo/{MultisigConfig.d.ts → AccountConfig.d.ts} +110 -63
  33. package/_types/tempo/AccountConfig.d.ts.map +1 -0
  34. package/_types/tempo/{MultisigOperation.d.ts → AccountOperation.d.ts} +62 -62
  35. package/_types/tempo/AccountOperation.d.ts.map +1 -0
  36. package/_types/tempo/{MultisigSimulation.d.ts → AccountSimulation.d.ts} +21 -21
  37. package/_types/tempo/AccountSimulation.d.ts.map +1 -0
  38. package/_types/tempo/KeyAuthorization.d.ts +14 -14
  39. package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
  40. package/_types/tempo/RpcSchemaTempo.d.ts +13 -13
  41. package/_types/tempo/RpcSchemaTempo.d.ts.map +1 -1
  42. package/_types/tempo/SignatureEnvelope.d.ts +36 -33
  43. package/_types/tempo/SignatureEnvelope.d.ts.map +1 -1
  44. package/_types/tempo/TransactionRequest.d.ts +11 -9
  45. package/_types/tempo/TransactionRequest.d.ts.map +1 -1
  46. package/_types/tempo/index.d.ts +50 -48
  47. package/_types/tempo/index.d.ts.map +1 -1
  48. package/_types/version.d.ts +1 -1
  49. package/package.json +31 -31
  50. package/tempo/AccountConfig/package.json +6 -0
  51. package/tempo/AccountConfig.test-d/package.json +6 -0
  52. package/tempo/{MultisigConfig.test-d.ts → AccountConfig.test-d.ts} +22 -12
  53. package/tempo/{MultisigConfig.test.ts → AccountConfig.test.ts} +155 -37
  54. package/tempo/{MultisigConfig.ts → AccountConfig.ts} +132 -66
  55. package/tempo/AccountOperation/package.json +6 -0
  56. package/tempo/AccountOperation.test-d/package.json +6 -0
  57. package/tempo/AccountOperation.test-d.ts +71 -0
  58. package/tempo/{MultisigOperation.test.ts → AccountOperation.test.ts} +97 -97
  59. package/tempo/{MultisigOperation.ts → AccountOperation.ts} +95 -97
  60. package/tempo/AccountSimulation/package.json +6 -0
  61. package/tempo/AccountSimulation.test-d/package.json +6 -0
  62. package/tempo/{MultisigSimulation.test-d.ts → AccountSimulation.test-d.ts} +7 -9
  63. package/tempo/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +29 -29
  64. package/tempo/{MultisigSimulation.ts → AccountSimulation.ts} +28 -30
  65. package/tempo/KeyAuthorization.test-d.ts +14 -14
  66. package/tempo/KeyAuthorization.test.ts +70 -49
  67. package/tempo/KeyAuthorization.ts +29 -27
  68. package/tempo/RpcSchemaTempo.test-d.ts +19 -19
  69. package/tempo/RpcSchemaTempo.ts +13 -13
  70. package/tempo/SignatureEnvelope.test-d.ts +7 -7
  71. package/tempo/SignatureEnvelope.test.ts +34 -34
  72. package/tempo/SignatureEnvelope.ts +107 -103
  73. package/tempo/Transaction.test.ts +4 -4
  74. package/tempo/TransactionRequest.test-d.ts +16 -7
  75. package/tempo/TransactionRequest.test.ts +25 -17
  76. package/tempo/TransactionRequest.ts +25 -18
  77. package/tempo/{multisig.e2e.test.ts → configurableAccounts.e2e.test.ts} +16 -16
  78. package/tempo/index.ts +50 -48
  79. package/version.ts +1 -1
  80. package/_cjs/tempo/MultisigConfig.js.map +0 -1
  81. package/_cjs/tempo/MultisigOperation.js.map +0 -1
  82. package/_cjs/tempo/MultisigSimulation.js.map +0 -1
  83. package/_esm/tempo/MultisigConfig.js.map +0 -1
  84. package/_esm/tempo/MultisigOperation.js.map +0 -1
  85. package/_esm/tempo/MultisigSimulation.js.map +0 -1
  86. package/_types/tempo/MultisigConfig.d.ts.map +0 -1
  87. package/_types/tempo/MultisigOperation.d.ts.map +0 -1
  88. package/_types/tempo/MultisigSimulation.d.ts.map +0 -1
  89. package/tempo/MultisigConfig/package.json +0 -6
  90. package/tempo/MultisigConfig.test-d/package.json +0 -6
  91. package/tempo/MultisigOperation/package.json +0 -6
  92. package/tempo/MultisigOperation.test-d/package.json +0 -6
  93. package/tempo/MultisigOperation.test-d.ts +0 -71
  94. package/tempo/MultisigSimulation/package.json +0 -6
  95. package/tempo/MultisigSimulation.test-d/package.json +0 -6
@@ -15,24 +15,24 @@ const envelope = SignatureEnvelope.from({
15
15
  signatures: [primitive],
16
16
  })
17
17
 
18
- test('preserves primitive and multisig RPC types', () => {
18
+ test('preserves primitive and configurable RPC types', () => {
19
19
  expectTypeOf(
20
20
  SignatureEnvelope.toRpc(primitive),
21
21
  ).toEqualTypeOf<SignatureEnvelope.Secp256k1Rpc>()
22
22
  expectTypeOf(SignatureEnvelope.toRpc(envelope)).toEqualTypeOf<Hex.Hex>()
23
23
  expectTypeOf<
24
24
  SignatureEnvelope.GetType<typeof envelope>
25
- >().toEqualTypeOf<'multisig'>()
26
- expectTypeOf(envelope).toMatchTypeOf<SignatureEnvelope.Multisig>()
25
+ >().toEqualTypeOf<'configurable'>()
26
+ expectTypeOf(envelope).toMatchTypeOf<SignatureEnvelope.Configurable>()
27
27
  })
28
28
 
29
29
  test('requires config and primitive approvals', () => {
30
- // @ts-expect-error Every multisig signature carries its current config.
30
+ // @ts-expect-error Every configurable signature carries its current config.
31
31
  SignatureEnvelope.from({ account: envelope.account, signatures: [primitive] })
32
- // @ts-expect-error Multisig owners cannot recursively approve with multisigs.
32
+ // @ts-expect-error Configurable owners cannot recursively approve with configurable signatures.
33
33
  SignatureEnvelope.from({ ...envelope, signatures: [envelope] })
34
- // @ts-expect-error Multisig RPC signatures are hex-encoded RLP.
35
- const rpc: SignatureEnvelope.MultisigRpc = {
34
+ // @ts-expect-error Configurable RPC signatures are hex-encoded RLP.
35
+ const rpc: SignatureEnvelope.ConfigurableRpc = {
36
36
  account: envelope.account,
37
37
  signatures: [],
38
38
  }
@@ -10,7 +10,7 @@ import {
10
10
  WebCryptoP256,
11
11
  } from 'ox'
12
12
  import { describe, expect, test } from 'vitest'
13
- import * as MultisigConfig from './MultisigConfig.js'
13
+ import * as AccountConfig from './AccountConfig.js'
14
14
  import * as SignatureEnvelope from './SignatureEnvelope.js'
15
15
 
16
16
  const publicKey = PublicKey.from({
@@ -514,7 +514,7 @@ describe('deserialize', () => {
514
514
  SignatureEnvelope.deserialize('0xdeadbeef'),
515
515
  ).toThrowErrorMatchingInlineSnapshot(
516
516
  `
517
- [SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xde. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Multisig)
517
+ [SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xde. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Configurable)
518
518
 
519
519
  Serialized: 0xdeadbeef]
520
520
  `,
@@ -674,7 +674,7 @@ describe('deserialize', () => {
674
674
  SignatureEnvelope.deserialize(unknownType),
675
675
  ).toThrowErrorMatchingInlineSnapshot(
676
676
  `
677
- [SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xff. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Multisig)
677
+ [SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xff. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Configurable)
678
678
 
679
679
  Serialized: 0xff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
680
680
  `,
@@ -1099,7 +1099,7 @@ describe('from', () => {
1099
1099
  })
1100
1100
  })
1101
1101
 
1102
- describe('multisig', () => {
1102
+ describe('configurable', () => {
1103
1103
  test('normalizes the current config', () => {
1104
1104
  const envelope = SignatureEnvelope.from({
1105
1105
  account: '0x2222222222222222222222222222222222222222',
@@ -1726,7 +1726,7 @@ describe('serialize', () => {
1726
1726
  })
1727
1727
  })
1728
1728
 
1729
- describe('sortMultisigApprovals', () => {
1729
+ describe('sortApprovals', () => {
1730
1730
  // Build owner key pairs first so we can construct a real genesis config
1731
1731
  // whose owner set matches the keys that produce the approvals below.
1732
1732
  const ownerKeys = Array.from({ length: 3 }, () => {
@@ -1740,16 +1740,16 @@ describe('sortMultisigApprovals', () => {
1740
1740
  Hex.toBigInt(a.address) < Hex.toBigInt(b.address) ? -1 : 1,
1741
1741
  )
1742
1742
 
1743
- const genesisConfig = MultisigConfig.from({
1743
+ const genesisConfig = AccountConfig.from({
1744
1744
  threshold: 2,
1745
1745
  owners: ascendingOwners.map((o) => ({ owner: o.address, weight: 1 })),
1746
1746
  })
1747
1747
  const payload = `0x${'42'.repeat(32)}` as const
1748
- const account = MultisigConfig.getAddress(genesisConfig, {
1748
+ const account = AccountConfig.getAddress(genesisConfig, {
1749
1749
  factory: '0x7171717171717171717171717171717171717171',
1750
1750
  })
1751
1751
  const version = 3n
1752
- const digest = MultisigConfig.getSignPayload({
1752
+ const digest = AccountConfig.getSignPayload({
1753
1753
  payload,
1754
1754
  account,
1755
1755
  config: { version },
@@ -1767,7 +1767,7 @@ describe('sortMultisigApprovals', () => {
1767
1767
  }))
1768
1768
 
1769
1769
  test('behavior: orders approvals ascending by recovered owner address', () => {
1770
- const ordered = SignatureEnvelope.sortMultisigApprovals({
1770
+ const ordered = SignatureEnvelope.sortApprovals({
1771
1771
  account,
1772
1772
  config: { version },
1773
1773
  payload,
@@ -1780,7 +1780,7 @@ describe('sortMultisigApprovals', () => {
1780
1780
  test('behavior: already-sorted input is unchanged', () => {
1781
1781
  const signatures = ascending.map((owner) => owner.signature)
1782
1782
  expect(
1783
- SignatureEnvelope.sortMultisigApprovals({
1783
+ SignatureEnvelope.sortApprovals({
1784
1784
  account,
1785
1785
  config: { version },
1786
1786
  payload,
@@ -1790,7 +1790,7 @@ describe('sortMultisigApprovals', () => {
1790
1790
  })
1791
1791
 
1792
1792
  test('behavior: recovered order matches the config owner order', () => {
1793
- const ordered = SignatureEnvelope.sortMultisigApprovals({
1793
+ const ordered = SignatureEnvelope.sortApprovals({
1794
1794
  account,
1795
1795
  config: { version },
1796
1796
  payload,
@@ -2804,9 +2804,9 @@ describe('CoercionError', () => {
2804
2804
  })
2805
2805
  })
2806
2806
 
2807
- describe('multisig', () => {
2807
+ describe('configurable', () => {
2808
2808
  const account = '0x2222222222222222222222222222222222222222'
2809
- const config = MultisigConfig.from({
2809
+ const config = AccountConfig.from({
2810
2810
  threshold: 1,
2811
2811
  owners: [
2812
2812
  { owner: '0x1111111111111111111111111111111111111111', weight: 1 },
@@ -2825,7 +2825,7 @@ describe('multisig', () => {
2825
2825
  expect(Rlp.toHex(Hex.slice(serialized, 1))).toEqual([
2826
2826
  account,
2827
2827
  [
2828
- MultisigConfig.zeroSalt,
2828
+ AccountConfig.zeroSalt,
2829
2829
  '0x',
2830
2830
  '0x01',
2831
2831
  [['0x1111111111111111111111111111111111111111', '0x01']],
@@ -2866,7 +2866,7 @@ describe('multisig', () => {
2866
2866
  })
2867
2867
 
2868
2868
  test('rejects old wire and RPC shapes', () => {
2869
- for (const first of [account, MultisigConfig.toTuple(config)] as const)
2869
+ for (const first of [account, AccountConfig.toTuple(config)] as const)
2870
2870
  expect(() =>
2871
2871
  SignatureEnvelope.deserialize(
2872
2872
  Hex.concat(
@@ -2881,7 +2881,7 @@ describe('multisig', () => {
2881
2881
  })
2882
2882
 
2883
2883
  test('rejects malformed configs', () => {
2884
- const valid = MultisigConfig.toTuple(config)
2884
+ const valid = AccountConfig.toTuple(config)
2885
2885
  for (const tuple of [
2886
2886
  ['0x00', ...valid.slice(1)],
2887
2887
  [valid[0], '0x00', valid[2], valid[3]],
@@ -2901,7 +2901,7 @@ describe('multisig', () => {
2901
2901
  ]),
2902
2902
  ),
2903
2903
  ),
2904
- ).toThrowError(MultisigConfig.InvalidConfigError)
2904
+ ).toThrowError(AccountConfig.InvalidConfigError)
2905
2905
  })
2906
2906
 
2907
2907
  test('rejects invalid accounts, missing configs, and invalid approval counts', () => {
@@ -2927,7 +2927,7 @@ describe('multisig', () => {
2927
2927
  config: { ...config, owners: [{ owner: account, weight: 1 }] },
2928
2928
  } as const
2929
2929
  expect(() => SignatureEnvelope.assert(self)).toThrowError(
2930
- SignatureEnvelope.InvalidMultisigApprovalError,
2930
+ SignatureEnvelope.InvalidApprovalError,
2931
2931
  )
2932
2932
  expect(() =>
2933
2933
  SignatureEnvelope.assert({
@@ -2944,12 +2944,12 @@ describe('multisig', () => {
2944
2944
  ...envelope,
2945
2945
  signatures: [signature],
2946
2946
  } as never),
2947
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
2947
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
2948
2948
  const wire = Hex.concat(
2949
2949
  '0x05',
2950
2950
  Rlp.fromHex([
2951
2951
  account,
2952
- MultisigConfig.toTuple(config),
2952
+ AccountConfig.toTuple(config),
2953
2953
  [SignatureEnvelope.serialize(signature)],
2954
2954
  ]),
2955
2955
  )
@@ -2969,9 +2969,9 @@ describe('multisig', () => {
2969
2969
  }
2970
2970
  expect(() =>
2971
2971
  SignatureEnvelope.assert({ ...envelope, signatures: [oversized] }),
2972
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
2972
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
2973
2973
  })
2974
- test('requires keychain V2 for multisig delegates', () => {
2974
+ test('requires keychain V2 for configurable delegates', () => {
2975
2975
  const keychain = SignatureEnvelope.from({
2976
2976
  userAddress: account,
2977
2977
  version: 'v2',
@@ -2981,12 +2981,12 @@ describe('multisig', () => {
2981
2981
  expect(SignatureEnvelope.deserialize(serialized)).toEqual(keychain)
2982
2982
  expect(() =>
2983
2983
  SignatureEnvelope.serialize({ ...keychain, version: 'v1' }),
2984
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
2984
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
2985
2985
  expect(() =>
2986
2986
  SignatureEnvelope.deserialize(
2987
2987
  Hex.concat('0x03', Hex.slice(serialized, 1)),
2988
2988
  ),
2989
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
2989
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
2990
2990
  expect(() =>
2991
2991
  SignatureEnvelope.fromRpc({
2992
2992
  type: 'keychain',
@@ -2994,9 +2994,9 @@ describe('multisig', () => {
2994
2994
  version: 'v1',
2995
2995
  signature: SignatureEnvelope.toRpc(envelope),
2996
2996
  }),
2997
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
2997
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
2998
2998
  })
2999
- test('rejects V1 wrappers around recursively nested multisig delegates', () => {
2999
+ test('rejects V1 wrappers around recursively nested configurable delegates', () => {
3000
3000
  let inner: SignatureEnvelope.SignatureEnvelope = envelope
3001
3001
  for (let depth = 0; depth < 3; depth++) {
3002
3002
  inner = { inner, type: 'keychain', userAddress: account, version: 'v2' }
@@ -3010,10 +3010,10 @@ describe('multisig', () => {
3010
3010
  expect(SignatureEnvelope.validate(valid)).toBe(true)
3011
3011
  expect(SignatureEnvelope.validate(invalid)).toBe(false)
3012
3012
  expect(() => SignatureEnvelope.serialize(invalid)).toThrowError(
3013
- SignatureEnvelope.InvalidMultisigApprovalError,
3013
+ SignatureEnvelope.InvalidApprovalError,
3014
3014
  )
3015
3015
  expect(() => SignatureEnvelope.toRpc(invalid)).toThrowError(
3016
- SignatureEnvelope.InvalidMultisigApprovalError,
3016
+ SignatureEnvelope.InvalidApprovalError,
3017
3017
  )
3018
3018
  expect(() =>
3019
3019
  SignatureEnvelope.fromRpc({
@@ -3022,15 +3022,15 @@ describe('multisig', () => {
3022
3022
  version: 'v1',
3023
3023
  signature: SignatureEnvelope.toRpc(inner),
3024
3024
  }),
3025
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
3025
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
3026
3026
  expect(() =>
3027
3027
  SignatureEnvelope.deserialize(
3028
3028
  Hex.concat('0x03', account, SignatureEnvelope.serialize(inner)),
3029
3029
  ),
3030
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
3030
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
3031
3031
  expect(() =>
3032
3032
  SignatureEnvelope.serialize({ ...valid, inner: invalid }),
3033
- ).toThrowError(SignatureEnvelope.InvalidMultisigApprovalError)
3033
+ ).toThrowError(SignatureEnvelope.InvalidApprovalError)
3034
3034
  }
3035
3035
  expect(
3036
3036
  SignatureEnvelope.validate({
@@ -3072,7 +3072,7 @@ describe('multisig', () => {
3072
3072
  })
3073
3073
  })
3074
3074
 
3075
- describe('multisig vectors', () => {
3075
+ describe('configurable vectors', () => {
3076
3076
  const initial =
3077
3077
  '0x05f89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b' as const
3078
3078
  const current =
@@ -3105,7 +3105,7 @@ describe('multisig vectors', () => {
3105
3105
  "type": "secp256k1",
3106
3106
  },
3107
3107
  ],
3108
- "type": "multisig",
3108
+ "type": "configurable",
3109
3109
  }
3110
3110
  `)
3111
3111
  expect(SignatureEnvelope.serialize(envelope)).toBe(initial)
@@ -3138,7 +3138,7 @@ describe('multisig vectors', () => {
3138
3138
  "type": "secp256k1",
3139
3139
  },
3140
3140
  ],
3141
- "type": "multisig",
3141
+ "type": "configurable",
3142
3142
  }
3143
3143
  `)
3144
3144
  expect(SignatureEnvelope.serialize(envelope)).toBe(current)