ox 1.8.7 → 1.8.9

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 (59) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/core/internal/abiItem.d.ts.map +1 -1
  3. package/dist/core/internal/abiItem.js +3 -2
  4. package/dist/core/internal/abiItem.js.map +1 -1
  5. package/dist/tempo/AccountConfig.d.ts +46 -3
  6. package/dist/tempo/AccountConfig.d.ts.map +1 -1
  7. package/dist/tempo/AccountConfig.js +58 -9
  8. package/dist/tempo/AccountConfig.js.map +1 -1
  9. package/dist/tempo/AccountSimulation.d.ts +6 -2
  10. package/dist/tempo/AccountSimulation.d.ts.map +1 -1
  11. package/dist/tempo/AccountSimulation.js +15 -5
  12. package/dist/tempo/AccountSimulation.js.map +1 -1
  13. package/dist/tempo/KeyAuthorization.d.ts +14 -9
  14. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  15. package/dist/tempo/KeyAuthorization.js +8 -12
  16. package/dist/tempo/KeyAuthorization.js.map +1 -1
  17. package/dist/tempo/TransactionRequest.d.ts +3 -3
  18. package/dist/tempo/TransactionRequest.d.ts.map +1 -1
  19. package/dist/tempo/TransactionRequest.js +10 -6
  20. package/dist/tempo/TransactionRequest.js.map +1 -1
  21. package/dist/zod/tempo/AccountSimulation.d.ts +4 -0
  22. package/dist/zod/tempo/AccountSimulation.d.ts.map +1 -1
  23. package/dist/zod/tempo/AccountSimulation.js +2 -0
  24. package/dist/zod/tempo/AccountSimulation.js.map +1 -1
  25. package/dist/zod/tempo/KeyAuthorization.d.ts +5 -5
  26. package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
  27. package/dist/zod/tempo/KeyAuthorization.js +10 -13
  28. package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
  29. package/dist/zod/tempo/RpcSchemaTempo.d.ts +16 -8
  30. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  31. package/dist/zod/tempo/Transaction.d.ts +6 -6
  32. package/dist/zod/tempo/TransactionRequest.d.ts +23 -9
  33. package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
  34. package/dist/zod/tempo/TransactionRequest.js +13 -9
  35. package/dist/zod/tempo/TransactionRequest.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/core/_test/AbiEvent.test.ts +7 -0
  38. package/src/core/_test/AbiFunction.test.ts +3 -0
  39. package/src/core/_test/AbiItem.test.ts +20 -0
  40. package/src/core/internal/abiItem.ts +3 -2
  41. package/src/tempo/AccountConfig.test-d.ts +10 -0
  42. package/src/tempo/AccountConfig.test.ts +143 -10
  43. package/src/tempo/AccountConfig.ts +80 -9
  44. package/src/tempo/AccountOperation.test.ts +32 -32
  45. package/src/tempo/AccountSimulation.test.ts +43 -0
  46. package/src/tempo/AccountSimulation.ts +19 -5
  47. package/src/tempo/KeyAuthorization.test.ts +91 -32
  48. package/src/tempo/KeyAuthorization.ts +16 -39
  49. package/src/tempo/RpcSchemaTempo.test-d.ts +2 -2
  50. package/src/tempo/TransactionRequest.test-d.ts +5 -5
  51. package/src/tempo/TransactionRequest.test.ts +11 -9
  52. package/src/tempo/TransactionRequest.ts +13 -9
  53. package/src/version.ts +1 -1
  54. package/src/zod/tempo/AccountSimulation.ts +2 -0
  55. package/src/zod/tempo/KeyAuthorization.ts +28 -46
  56. package/src/zod/tempo/TransactionRequest.ts +17 -9
  57. package/src/zod/tempo/_test/AccountOperation.test.ts +1 -1
  58. package/src/zod/tempo/_test/KeyAuthorization.test.ts +5 -5
  59. package/src/zod/tempo/_test/TransactionRequest.test.ts +12 -7
@@ -28,6 +28,8 @@ export type Rpc = Compute<{
28
28
  approvals: readonly ApprovalRpc[]
29
29
  /** Canonical RLP-encoded applicable configuration. */
30
30
  config: Hex.Hex
31
+ /** Account that signs the modeled key authorization. Omitted for a direct signature. */
32
+ signer?: Address.Address | undefined
31
33
  }>
32
34
 
33
35
  /** Account simulation spec used to construct an RPC simulation signature. */
@@ -36,6 +38,8 @@ export type Spec = Compute<{
36
38
  approvals: readonly Approval[]
37
39
  /** Complete applicable configuration. */
38
40
  config: AccountConfig.Config
41
+ /** Account that signs the modeled key authorization. Omitted for a direct signature. */
42
+ signer?: Address.Address | undefined
39
43
  }>
40
44
 
41
45
  /**
@@ -53,14 +57,20 @@ export type Spec = Compute<{
53
57
  * @returns The account simulation spec with decoded configurations.
54
58
  */
55
59
  export function fromRpc(spec: Rpc): Spec {
56
- const { approvals, config } = spec
60
+ const { approvals, config, signer } = spec
57
61
  assertApprovals(approvals)
58
- return { approvals, config: deserializeConfig(config) }
62
+ if (signer !== undefined) Address.assert(signer)
63
+ return {
64
+ approvals,
65
+ config: deserializeConfig(config),
66
+ ...(signer !== undefined ? { signer } : {}),
67
+ }
59
68
  }
60
69
 
61
70
  export declare namespace fromRpc {
62
71
  /** Error type for `fromRpc`. */
63
72
  export type ErrorType =
73
+ | Address.assert.ErrorType
64
74
  | Hex.isEqual.ErrorType
65
75
  | InvalidSimulationError
66
76
  | AccountConfig.assert.ErrorType
@@ -84,8 +94,9 @@ export declare namespace fromRpc {
84
94
  * @returns The JSON-RPC account simulation spec with encoded configurations.
85
95
  */
86
96
  export function toRpc(spec: Spec): Rpc {
87
- const { approvals, config } = spec
97
+ const { approvals, config, signer } = spec
88
98
  assertApprovals(approvals)
99
+ if (signer !== undefined) Address.assert(signer)
89
100
  return {
90
101
  approvals: approvals.map(({ keyData, keyType, owner }) => ({
91
102
  ...(keyData !== undefined ? { keyData: shimKeyData(keyData) } : {}),
@@ -93,12 +104,14 @@ export function toRpc(spec: Spec): Rpc {
93
104
  owner,
94
105
  })),
95
106
  config: serializeConfig(config),
107
+ ...(signer !== undefined ? { signer } : {}),
96
108
  }
97
109
  }
98
110
 
99
111
  export declare namespace toRpc {
100
112
  /** Error type for `toRpc`. */
101
113
  export type ErrorType =
114
+ | Address.assert.ErrorType
102
115
  | Hex.fromNumber.ErrorType
103
116
  | InvalidSimulationError
104
117
  | AccountConfig.assert.ErrorType
@@ -164,12 +177,13 @@ function serializeConfig(config: AccountConfig.Input): Hex.Hex {
164
177
  }
165
178
 
166
179
  /**
167
- * Shims long key data into the length hint accepted by Tempo's gas estimator.
180
+ * Shims key data into the 1-, 2-, or 4-byte length hint accepted by Tempo's
181
+ * gas estimator. Other sizes are replaced by a 2-byte hint of their length.
168
182
  * @internal
169
183
  */
170
184
  function shimKeyData(data: Hex.Hex): Hex.Hex {
171
185
  const size = Hex.size(data)
172
- if (size <= 4) return data
186
+ if (size === 1 || size === 2 || size === 4) return data
173
187
  return Hex.fromNumber(size, { size: 2 })
174
188
  }
175
189
 
@@ -96,42 +96,80 @@ const signature_keychain = {
96
96
  } as const satisfies SignatureEnvelope.Keychain
97
97
 
98
98
  describe('configurable account binding', () => {
99
- test('rejects unbound grants before signing or encoding', () => {
100
- const authorization = {
101
- address,
102
- chainId: 1n,
103
- type: 'configurable',
104
- } as const
105
- const signed = {
106
- ...authorization,
107
- signature: SignatureEnvelope.from(signature_secp256k1),
108
- }
109
- for (const encode of [
110
- () => KeyAuthorization.from(authorization),
111
- () => KeyAuthorization.toTuple(authorization),
112
- () => KeyAuthorization.getSignPayload(authorization),
113
- () => KeyAuthorization.serialize(authorization),
114
- () => KeyAuthorization.toRpc(signed),
115
- ])
116
- expect(encode).toThrowErrorMatchingInlineSnapshot(
117
- `[KeyAuthorization.MissingAccountError: Configurable account key grants require a parent account binding.]`,
118
- )
99
+ test('behavior: accepts unbound configurable grants', () => {
100
+ // The node binds a root-signed grant to its signer, so only admin-signed
101
+ // grants need `account` (TIP-1049).
102
+ const signed = KeyAuthorization.from(
103
+ { address, chainId: 1n, type: 'configurable' },
104
+ { signature: signature_secp256k1 },
105
+ )
106
+ const rpc = KeyAuthorization.toRpc(signed)
107
+ expect({
108
+ deserialized: KeyAuthorization.deserialize(
109
+ KeyAuthorization.serialize(signed),
110
+ ),
111
+ fromRpc: KeyAuthorization.fromRpc(rpc),
112
+ fromTuple: KeyAuthorization.fromTuple([['0x01', '0x03', address]]),
113
+ rpc,
114
+ }).toMatchInlineSnapshot(`
115
+ {
116
+ "deserialized": {
117
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
118
+ "chainId": 1n,
119
+ "signature": {
120
+ "signature": {
121
+ "r": "0xfa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7",
122
+ "s": "0x780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d0",
123
+ "yParity": 1,
124
+ },
125
+ "type": "secp256k1",
126
+ },
127
+ "type": "configurable",
128
+ },
129
+ "fromRpc": {
130
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
131
+ "chainId": 1n,
132
+ "limits": undefined,
133
+ "signature": {
134
+ "signature": {
135
+ "r": "0xfa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7",
136
+ "s": "0x780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d0",
137
+ "yParity": 1,
138
+ },
139
+ "type": "secp256k1",
140
+ },
141
+ "type": "configurable",
142
+ },
143
+ "fromTuple": {
144
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
145
+ "chainId": 1n,
146
+ "type": "configurable",
147
+ },
148
+ "rpc": {
149
+ "chainId": "0x1",
150
+ "expiry": null,
151
+ "keyId": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
152
+ "keyType": "configurableAccount",
153
+ "limits": undefined,
154
+ "signature": {
155
+ "r": "0xfa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7",
156
+ "s": "0x780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d0",
157
+ "type": "secp256k1",
158
+ "yParity": "0x1",
159
+ },
160
+ },
161
+ }
162
+ `)
119
163
  })
120
164
 
121
- test('rejects unbound RPC and RLP grants', () => {
165
+ test('behavior: preserves a bound account', () => {
122
166
  const signed = KeyAuthorization.from(
123
167
  { account: address, address, chainId: 1n, type: 'configurable' },
124
168
  { signature: signature_secp256k1 },
125
169
  )
126
- const rpc = KeyAuthorization.toRpc(signed)
127
- for (const account of [undefined, null])
128
- expect(() => KeyAuthorization.fromRpc({ ...rpc, account })).toThrowError(
129
- KeyAuthorization.MissingAccountError,
130
- )
131
- expect(() =>
132
- KeyAuthorization.fromTuple([['0x01', '0x03', address]]),
133
- ).toThrowError(KeyAuthorization.MissingAccountError)
134
- expect(KeyAuthorization.fromRpc(rpc).account).toBe(address)
170
+ expect(
171
+ KeyAuthorization.fromRpc(KeyAuthorization.toRpc(signed)).account,
172
+ ).toBe(address)
135
173
  expect(
136
174
  KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)).account,
137
175
  ).toBe(address)
@@ -1450,13 +1488,13 @@ describe('serialize', () => {
1450
1488
  })
1451
1489
 
1452
1490
  describe('toRpc', () => {
1453
- test('behavior: configurable key type uses the RPC multisig key type', () => {
1491
+ test('behavior: configurable key type uses the RPC configurableAccount key type', () => {
1454
1492
  const authorization = KeyAuthorization.from(
1455
1493
  { account: address, address, chainId: 1n, type: 'configurable' },
1456
1494
  { signature: signature_secp256k1 },
1457
1495
  )
1458
1496
  const rpc = KeyAuthorization.toRpc(authorization)
1459
- expect(rpc.keyType).toMatchInlineSnapshot(`"multisig"`)
1497
+ expect(rpc.keyType).toMatchInlineSnapshot(`"configurableAccount"`)
1460
1498
  expect(KeyAuthorization.fromRpc(rpc).type).toMatchInlineSnapshot(
1461
1499
  `"configurable"`,
1462
1500
  )
@@ -2818,4 +2856,25 @@ describe('admin keys (TIP-1049)', () => {
2818
2856
  })
2819
2857
  expect(KeyAuthorization.hash(a)).not.toBe(KeyAuthorization.hash(b))
2820
2858
  })
2859
+
2860
+ describe('configurable admin keys', () => {
2861
+ test('behavior: a configurable account may sign or be granted an admin key', () => {
2862
+ const signed = KeyAuthorization.from(
2863
+ {
2864
+ account: signature_configurable.account,
2865
+ address,
2866
+ chainId: 1n,
2867
+ isAdmin: true,
2868
+ type: 'configurable',
2869
+ },
2870
+ { signature: signature_configurable },
2871
+ )
2872
+ expect(
2873
+ KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)),
2874
+ ).toEqual(signed)
2875
+ expect(
2876
+ KeyAuthorization.fromRpc(KeyAuthorization.toRpc(signed)),
2877
+ ).toMatchObject({ isAdmin: true, type: 'configurable' })
2878
+ })
2879
+ })
2821
2880
  })
@@ -38,7 +38,7 @@ export type KeyAuthorization<
38
38
  bigintType = bigint,
39
39
  numberType = number,
40
40
  > = {
41
- /** Account address this authorization is bound to. Required for configurable account grants. */
41
+ /** Account address this authorization is bound to. Required when an admin access key signs the grant (TIP-1049). */
42
42
  account?: Address.Address | undefined
43
43
  /** Address derived from the public key of the key type. */
44
44
  address: Address.Address
@@ -116,8 +116,8 @@ export type Rpc = {
116
116
  isAdmin?: boolean | null | undefined
117
117
  /** Key identifier. */
118
118
  keyId: Address.Address
119
- /** Key type. Configurable accounts use the node's `multisig` key type. */
120
- keyType: SignatureEnvelope.Type | 'multisig'
119
+ /** Key type. Configurable accounts use the node's `configurableAccount` key type. */
120
+ keyType: SignatureEnvelope.Type | 'configurableAccount'
121
121
  /** Token spending limits (`null`/`undefined` = unlimited, `[]` = no spending allowed). */
122
122
  limits?: readonly RpcTokenLimit[] | null | undefined
123
123
  /** Primitive or configurable account signature authorizing this key. */
@@ -445,7 +445,6 @@ export function from<
445
445
  options: from.Options<signature> = {},
446
446
  ): from.ReturnType<authorization, signature> {
447
447
  if ('keyId' in authorization) return fromRpc(authorization as Rpc) as never
448
- assertAccountBinding(authorization.type, authorization.account)
449
448
  const auth = authorization as KeyAuthorization & {
450
449
  limits?: readonly { limit: bigint; token: Address.Address }[]
451
450
  scopes?: readonly {
@@ -509,10 +508,7 @@ export declare namespace from {
509
508
  : {})
510
509
  >
511
510
 
512
- type ErrorType =
513
- | InvalidSignatureTypeError
514
- | MissingAccountError
515
- | Errors.GlobalErrorType
511
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
516
512
  }
517
513
 
518
514
  /**
@@ -551,8 +547,7 @@ export function fromRpc(authorization: Rpc): Signed {
551
547
  const witness = authorization.witness ?? undefined
552
548
  const isAdmin = authorization.isAdmin ?? undefined
553
549
  const account = authorization.account ?? undefined
554
- const type = keyType === 'multisig' ? 'configurable' : keyType
555
- assertAccountBinding(type, account)
550
+ const type = keyType === 'configurableAccount' ? 'configurable' : keyType
556
551
  const signature = SignatureEnvelope.fromRpc(authorization.signature)
557
552
  assertSignature(signature)
558
553
  if (witness !== undefined) assertWitness(witness)
@@ -595,10 +590,7 @@ export function fromRpc(authorization: Rpc): Signed {
595
590
  }
596
591
 
597
592
  export declare namespace fromRpc {
598
- type ErrorType =
599
- | InvalidSignatureTypeError
600
- | MissingAccountError
601
- | Errors.GlobalErrorType
593
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
602
594
  }
603
595
 
604
596
  /**
@@ -728,7 +720,6 @@ export function fromTuple<const tuple extends Tuple>(
728
720
  const account = isAbsent(rawAccount)
729
721
  ? undefined
730
722
  : (rawAccount as Address.Address)
731
- assertAccountBinding(keyType, account)
732
723
  const args: KeyAuthorization = {
733
724
  address: keyId,
734
725
  chainId: chainId === '0x' ? 0n : Hex.toBigInt(chainId),
@@ -753,10 +744,7 @@ export declare namespace fromTuple {
753
744
  KeyAuthorization<authorization extends Tuple<true> ? true : false>
754
745
  >
755
746
 
756
- type ErrorType =
757
- | InvalidSignatureTypeError
758
- | MissingAccountError
759
- | Errors.GlobalErrorType
747
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
760
748
  }
761
749
 
762
750
  /**
@@ -962,7 +950,6 @@ export declare namespace serialize {
962
950
  * @returns An RPC-formatted Key Authorization.
963
951
  */
964
952
  export function toRpc(authorization: toRpc.Input): Rpc {
965
- assertAccountBinding(authorization.type, authorization.account)
966
953
  const {
967
954
  address,
968
955
  scopes,
@@ -1008,7 +995,7 @@ export function toRpc(authorization: toRpc.Input): Rpc {
1008
995
  chainId: chainIdHex === '0x0' ? '0x' : chainIdHex,
1009
996
  expiry: expiry != null ? Quantity.fromNumberish(expiry) : null,
1010
997
  keyId: address,
1011
- keyType: type === 'configurable' ? 'multisig' : type,
998
+ keyType: type === 'configurable' ? 'configurableAccount' : type,
1012
999
  limits: limits?.map(({ token, limit, period }) => ({
1013
1000
  token,
1014
1001
  limit: Quantity.fromNumberish(limit),
@@ -1028,10 +1015,7 @@ export declare namespace toRpc {
1028
1015
  /** Numberish input accepted by {@link ox#KeyAuthorization.(toRpc:function)}. */
1029
1016
  type Input = Signed<Hex.Hex | bigint | number, Hex.Hex | number>
1030
1017
 
1031
- type ErrorType =
1032
- | InvalidSignatureTypeError
1033
- | MissingAccountError
1034
- | Errors.GlobalErrorType
1018
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
1035
1019
  }
1036
1020
 
1037
1021
  /**
@@ -1070,7 +1054,6 @@ export declare namespace toRpc {
1070
1054
  export function toTuple<const authorization extends KeyAuthorization>(
1071
1055
  authorization: authorization,
1072
1056
  ): toTuple.ReturnType<authorization> {
1073
- assertAccountBinding(authorization.type, authorization.account)
1074
1057
  const {
1075
1058
  address,
1076
1059
  chainId,
@@ -1178,10 +1161,7 @@ export declare namespace toTuple {
1178
1161
  type ReturnType<authorization extends KeyAuthorization = KeyAuthorization> =
1179
1162
  Compute<Tuple<authorization extends KeyAuthorization<true> ? true : false>>
1180
1163
 
1181
- type ErrorType =
1182
- | InvalidSignatureTypeError
1183
- | MissingAccountError
1184
- | Errors.GlobalErrorType
1164
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
1185
1165
  }
1186
1166
 
1187
1167
  function bigintToHex(value: bigint): Hex.Hex {
@@ -1215,14 +1195,6 @@ function resolveSelector(
1215
1195
  return AbiItem.getSelector(selector)
1216
1196
  }
1217
1197
 
1218
- function assertAccountBinding(
1219
- type: KeyAuthorization['type'],
1220
- account: Address.Address | null | undefined,
1221
- ): void {
1222
- if (type === 'configurable' && account == null)
1223
- throw new MissingAccountError()
1224
- }
1225
-
1226
1198
  function assertWitness(witness: Hex.Hex): void {
1227
1199
  if (Hex.size(witness) !== 32) throw new InvalidWitnessSizeError(witness)
1228
1200
  }
@@ -1270,7 +1242,12 @@ export class InvalidSignatureTypeError extends Error {
1270
1242
  }
1271
1243
  }
1272
1244
 
1273
- /** Thrown when a configurable account key grant omits its parent account binding. */
1245
+ /**
1246
+ * Thrown when a configurable account key grant omits its parent account binding.
1247
+ *
1248
+ * @deprecated No longer thrown. The Tempo node only requires `account` on grants
1249
+ * signed by an admin access key, which it checks against the transaction sender.
1250
+ */
1274
1251
  export class MissingAccountError extends Error {
1275
1252
  override readonly name = 'KeyAuthorization.MissingAccountError'
1276
1253
  constructor() {
@@ -17,7 +17,7 @@ declare const tempoProvider: Provider.Provider<{
17
17
  declare const address: Address.Address
18
18
  declare const hash: Hex.Hex
19
19
  declare const keyAuthorization: KeyAuthorization.Rpc
20
- declare const multisigSimulation: AccountSimulation.Rpc
20
+ declare const configurableAccountSimulation: AccountSimulation.Rpc
21
21
  declare const serializedTransaction: Hex.Hex
22
22
  declare const signature: Hex.Hex
23
23
 
@@ -79,7 +79,7 @@ test('tempo simulation accepts account simulation specs', () => {
79
79
  {
80
80
  calls: [
81
81
  {
82
- multisigSimulation,
82
+ configurableAccountSimulation,
83
83
  },
84
84
  ],
85
85
  },
@@ -53,19 +53,19 @@ describe('TransactionRequest type', () => {
53
53
  expectTypeOf<
54
54
  TransactionRequest.TransactionRequest['accountSimulation']
55
55
  >().toEqualTypeOf<AccountSimulation.Spec | undefined>()
56
- expectTypeOf<TransactionRequest.Rpc['multisigSimulation']>().toEqualTypeOf<
57
- AccountSimulation.Rpc | undefined
58
- >()
56
+ expectTypeOf<
57
+ TransactionRequest.Rpc['configurableAccountSimulation']
58
+ >().toEqualTypeOf<AccountSimulation.Rpc | undefined>()
59
59
  })
60
60
 
61
- test('maps the configurable key type to the RPC multisig key type', () => {
61
+ test('maps the configurable key type to the RPC configurableAccount key type', () => {
62
62
  expectTypeOf<
63
63
  TransactionRequest.TransactionRequest['keyType']
64
64
  >().toEqualTypeOf<
65
65
  'configurable' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
66
66
  >()
67
67
  expectTypeOf<TransactionRequest.Rpc['keyType']>().toEqualTypeOf<
68
- 'multisig' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
68
+ 'configurableAccount' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
69
69
  >()
70
70
  })
71
71
  })
@@ -139,9 +139,9 @@ describe('fromRpc', () => {
139
139
  `)
140
140
  })
141
141
 
142
- test('behavior: multisig key type decodes as configurable', () => {
142
+ test('behavior: configurableAccount key type decodes as configurable', () => {
143
143
  const request = TransactionRequest.fromRpc({
144
- keyType: 'multisig',
144
+ keyType: 'configurableAccount',
145
145
  type: '0x76',
146
146
  })
147
147
  expect(request.keyType).toMatchInlineSnapshot(`"configurable"`)
@@ -150,7 +150,7 @@ describe('fromRpc', () => {
150
150
  test('behavior: account simulation', () => {
151
151
  const request = TransactionRequest.fromRpc({
152
152
  from: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
153
- multisigSimulation: accountSimulationRpc,
153
+ configurableAccountSimulation: accountSimulationRpc,
154
154
  type: '0x76',
155
155
  })
156
156
 
@@ -266,11 +266,11 @@ describe('toRpc', () => {
266
266
  `)
267
267
  })
268
268
 
269
- test('behavior: configurable key type encodes as multisig', () => {
269
+ test('behavior: configurable key type encodes as configurableAccount', () => {
270
270
  const request = TransactionRequest.toRpc({
271
271
  keyType: 'configurable',
272
272
  })
273
- expect(request.keyType).toMatchInlineSnapshot(`"multisig"`)
273
+ expect(request.keyType).toMatchInlineSnapshot(`"configurableAccount"`)
274
274
  })
275
275
 
276
276
  test('behavior: account simulation', () => {
@@ -288,8 +288,7 @@ describe('toRpc', () => {
288
288
  "value": "0x",
289
289
  },
290
290
  ],
291
- "from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
292
- "multisigSimulation": {
291
+ "configurableAccountSimulation": {
293
292
  "approvals": [
294
293
  {
295
294
  "keyData": "0x0005",
@@ -299,6 +298,7 @@ describe('toRpc', () => {
299
298
  ],
300
299
  "config": "0xf852a011111111111111111111111111111111111111111111111111111111111111118002eed694111111111111111111111111111111111111111101d694bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb01",
301
300
  },
301
+ "from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
302
302
  "type": "0x76",
303
303
  }
304
304
  `)
@@ -445,7 +445,7 @@ describe('roundtrip', () => {
445
445
  nonceKey: '0xff',
446
446
  gas: '0x186a0',
447
447
  keyAuthorizationSimulation: accountSimulationRpc,
448
- multisigSimulation: accountSimulationRpc,
448
+ configurableAccountSimulation: accountSimulationRpc,
449
449
  type: '0x76',
450
450
  }
451
451
 
@@ -461,7 +461,9 @@ describe('roundtrip', () => {
461
461
  expect(rpc.keyAuthorizationSimulation).toEqual(
462
462
  original.keyAuthorizationSimulation,
463
463
  )
464
- expect(rpc.multisigSimulation).toEqual(original.multisigSimulation)
464
+ expect(rpc.configurableAccountSimulation).toEqual(
465
+ original.configurableAccountSimulation,
466
+ )
465
467
  expect(rpc.type).toBe('0x76')
466
468
  })
467
469
  })
@@ -70,9 +70,9 @@ export type Rpc = Omit<
70
70
  feeToken?: Hex.Hex | undefined
71
71
  keyAuthorization?: KeyAuthorization.Rpc | undefined
72
72
  keyAuthorizationSimulation?: AccountSimulation.Rpc | undefined
73
- /** Key type. Configurable accounts use the node's `multisig` key type. */
74
- keyType?: SignatureEnvelope.Type | 'multisig' | undefined
75
- multisigSimulation?: AccountSimulation.Rpc | undefined
73
+ /** Key type. Configurable accounts use the node's `configurableAccount` key type. */
74
+ keyType?: SignatureEnvelope.Type | 'configurableAccount' | undefined
75
+ configurableAccountSimulation?: AccountSimulation.Rpc | undefined
76
76
  nonceKey?: Hex.Hex | undefined
77
77
  signature?: SignatureEnvelope.SignatureEnvelopeRpc | undefined
78
78
  }
@@ -104,7 +104,7 @@ export function fromRpc(request: Rpc): TransactionRequest {
104
104
  authorizationList: _,
105
105
  keyAuthorizationSimulation: __,
106
106
  keyType: ___,
107
- multisigSimulation: ____,
107
+ configurableAccountSimulation: ____,
108
108
  ...rest
109
109
  } = request
110
110
  const request_ = ox_TransactionRequest.fromRpc(
@@ -147,10 +147,12 @@ export function fromRpc(request: Rpc): TransactionRequest {
147
147
  )
148
148
  if (typeof request.keyType !== 'undefined')
149
149
  request_.keyType =
150
- request.keyType === 'multisig' ? 'configurable' : request.keyType
151
- if (request.multisigSimulation)
150
+ request.keyType === 'configurableAccount'
151
+ ? 'configurable'
152
+ : request.keyType
153
+ if (request.configurableAccountSimulation)
152
154
  request_.accountSimulation = AccountSimulation.fromRpc(
153
- request.multisigSimulation,
155
+ request.configurableAccountSimulation,
154
156
  )
155
157
  if (typeof request.validBefore !== 'undefined')
156
158
  request_.validBefore = Hex.toNumber(request.validBefore as Hex.Hex)
@@ -292,13 +294,15 @@ export function toRpc(request: toRpc.Input): Rpc {
292
294
  if (typeof request.keyId !== 'undefined') request_rpc.keyId = request.keyId
293
295
  if (typeof request.keyType !== 'undefined')
294
296
  request_rpc.keyType =
295
- request.keyType === 'configurable' ? 'multisig' : request.keyType
297
+ request.keyType === 'configurable'
298
+ ? 'configurableAccount'
299
+ : request.keyType
296
300
  if (typeof request.keyAuthorizationSimulation !== 'undefined')
297
301
  request_rpc.keyAuthorizationSimulation = AccountSimulation.toRpc(
298
302
  request.keyAuthorizationSimulation,
299
303
  )
300
304
  if (typeof request.accountSimulation !== 'undefined')
301
- request_rpc.multisigSimulation = AccountSimulation.toRpc(
305
+ request_rpc.configurableAccountSimulation = AccountSimulation.toRpc(
302
306
  request.accountSimulation,
303
307
  )
304
308
  if (typeof request.validBefore !== 'undefined')
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '1.8.7'
2
+ export const version = '1.8.9'
@@ -21,6 +21,7 @@ export const Domain = z.object({
21
21
  .check(z.maxLength(core_AccountConfig.maxSignatures)),
22
22
  ),
23
23
  config: z_AccountConfig.Config,
24
+ signer: z.optional(z_Address.Address),
24
25
  })
25
26
 
26
27
  const Rpc_ = z
@@ -31,6 +32,7 @@ const Rpc_ = z
31
32
  .check(z.maxLength(core_AccountConfig.maxSignatures)),
32
33
  ),
33
34
  config: z_Hex.Hex,
35
+ signer: z.optional(z_Address.Address),
34
36
  })
35
37
  .check(
36
38
  z.refine((value) => {