ox 0.14.56 → 0.14.57

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 (43) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/_cjs/tempo/AccountConfig.js +16 -5
  3. package/_cjs/tempo/AccountConfig.js.map +1 -1
  4. package/_cjs/tempo/AccountSimulation.js +13 -4
  5. package/_cjs/tempo/AccountSimulation.js.map +1 -1
  6. package/_cjs/tempo/KeyAuthorization.js +2 -11
  7. package/_cjs/tempo/KeyAuthorization.js.map +1 -1
  8. package/_cjs/tempo/TransactionRequest.js +7 -5
  9. package/_cjs/tempo/TransactionRequest.js.map +1 -1
  10. package/_cjs/version.js +1 -1
  11. package/_esm/tempo/AccountConfig.js +58 -9
  12. package/_esm/tempo/AccountConfig.js.map +1 -1
  13. package/_esm/tempo/AccountSimulation.js +15 -5
  14. package/_esm/tempo/AccountSimulation.js.map +1 -1
  15. package/_esm/tempo/KeyAuthorization.js +8 -12
  16. package/_esm/tempo/KeyAuthorization.js.map +1 -1
  17. package/_esm/tempo/TransactionRequest.js +7 -5
  18. package/_esm/tempo/TransactionRequest.js.map +1 -1
  19. package/_esm/version.js +1 -1
  20. package/_types/tempo/AccountConfig.d.ts +46 -3
  21. package/_types/tempo/AccountConfig.d.ts.map +1 -1
  22. package/_types/tempo/AccountSimulation.d.ts +6 -2
  23. package/_types/tempo/AccountSimulation.d.ts.map +1 -1
  24. package/_types/tempo/KeyAuthorization.d.ts +18 -13
  25. package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
  26. package/_types/tempo/TransactionRequest.d.ts +3 -3
  27. package/_types/tempo/TransactionRequest.d.ts.map +1 -1
  28. package/_types/version.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/tempo/AccountConfig.test-d.ts +10 -0
  31. package/tempo/AccountConfig.test.ts +143 -10
  32. package/tempo/AccountConfig.ts +80 -9
  33. package/tempo/AccountOperation.test.ts +32 -32
  34. package/tempo/AccountSimulation.test.ts +44 -0
  35. package/tempo/AccountSimulation.ts +19 -5
  36. package/tempo/KeyAuthorization.test-d.ts +8 -18
  37. package/tempo/KeyAuthorization.test.ts +95 -39
  38. package/tempo/KeyAuthorization.ts +20 -43
  39. package/tempo/RpcSchemaTempo.test-d.ts +2 -2
  40. package/tempo/TransactionRequest.test-d.ts +3 -3
  41. package/tempo/TransactionRequest.test.ts +10 -8
  42. package/tempo/TransactionRequest.ts +10 -8
  43. package/version.ts +1 -1
@@ -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
 
@@ -51,37 +51,27 @@ test('accepts configurable signatures and account-bound grants', () => {
51
51
  ).toMatchTypeOf<KeyAuthorization.Rpc>()
52
52
  })
53
53
 
54
- test('requires an account for configurable grants', () => {
54
+ test('allows configurable grants without an account', () => {
55
55
  type Configurable = Extract<KeyAuthorization.Input, { type: 'configurable' }>
56
- expectTypeOf<Configurable['account']>().toEqualTypeOf<TempoAddress.Address>()
56
+ expectTypeOf<Configurable['account']>().toEqualTypeOf<
57
+ TempoAddress.Address | undefined
58
+ >()
57
59
  expectTypeOf<
58
60
  Extract<KeyAuthorization.Signed, { type: 'configurable' }>['account']
59
- >().toEqualTypeOf<`0x${string}`>()
60
- expectTypeOf<
61
- Omit<Extract<KeyAuthorization.Rpc, { keyType: 'multisig' }>, 'account'>
62
- >().not.toExtend<KeyAuthorization.Rpc>()
61
+ >().toEqualTypeOf<`0x${string}` | undefined>()
63
62
  expectTypeOf<{
64
63
  address: `0x${string}`
65
64
  chainId: bigint
66
65
  type: 'configurable'
67
- }>().not.toExtend<KeyAuthorization.Input>()
68
- expectTypeOf<{
69
- account: undefined
70
- address: `0x${string}`
71
- chainId: bigint
72
- type: 'configurable'
73
- }>().not.toExtend<KeyAuthorization.Input>()
66
+ }>().toExtend<KeyAuthorization.Input>()
74
67
  expectTypeOf<{
75
68
  account: null
76
69
  chainId: '0x1'
77
70
  expiry: null
78
71
  keyId: `0x${string}`
79
- keyType: 'multisig'
72
+ keyType: 'configurableAccount'
80
73
  signature: KeyAuthorization.SignatureRpc
81
- }>().not.toExtend<KeyAuthorization.Rpc>()
82
- expectTypeOf<
83
- Extract<KeyAuthorization.Rpc, { keyType: 'multisig' }>['account']
84
- >().toEqualTypeOf<`0x${string}`>()
74
+ }>().toExtend<KeyAuthorization.Rpc>()
85
75
  })
86
76
 
87
77
  test('rejects keychain signatures', () => {
@@ -117,49 +117,84 @@ describe('configurable account binding', () => {
117
117
  ).toMatchInlineSnapshot(`"0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c"`)
118
118
  })
119
119
 
120
- test('rejects unbound grants before signing or encoding', () => {
121
- const authorization = {
122
- address,
123
- chainId: 1n,
124
- type: 'configurable',
125
- } as const
126
- const signed = {
127
- ...authorization,
128
- signature: SignatureEnvelope.from(signature_secp256k1),
129
- }
130
- for (const encode of [
131
- // @ts-expect-error Deliberately unbound configurable grant.
132
- () => KeyAuthorization.from(authorization),
133
- // @ts-expect-error Deliberately unbound configurable grant.
134
- () => KeyAuthorization.toTuple(authorization),
135
- // @ts-expect-error Deliberately unbound configurable grant.
136
- () => KeyAuthorization.getSignPayload(authorization),
137
- // @ts-expect-error Deliberately unbound configurable grant.
138
- () => KeyAuthorization.serialize(authorization),
139
- // @ts-expect-error Deliberately unbound configurable grant.
140
- () => KeyAuthorization.toRpc(signed),
141
- ])
142
- expect(encode).toThrowErrorMatchingInlineSnapshot(
143
- `[KeyAuthorization.MissingAccountError: Configurable account key grants require a parent account binding.]`,
144
- )
120
+ test('behavior: accepts unbound configurable grants', () => {
121
+ // The node binds a root-signed grant to its signer, so only admin-signed
122
+ // grants need `account` (TIP-1049).
123
+ const signed = KeyAuthorization.from(
124
+ { address, chainId: 1n, type: 'configurable' },
125
+ { signature: signature_secp256k1 },
126
+ )
127
+ const rpc = KeyAuthorization.toRpc(signed)
128
+ expect({
129
+ deserialized: KeyAuthorization.deserialize(
130
+ KeyAuthorization.serialize(signed),
131
+ ),
132
+ fromRpc: KeyAuthorization.fromRpc(rpc),
133
+ fromTuple: KeyAuthorization.fromTuple([['0x01', '0x03', address]]),
134
+ rpc,
135
+ }).toMatchInlineSnapshot(`
136
+ {
137
+ "deserialized": {
138
+ "account": undefined,
139
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
140
+ "chainId": 1n,
141
+ "signature": {
142
+ "signature": {
143
+ "r": 113291597329930009559670063131885256927775966057121513567941051428123344285399n,
144
+ "s": 54293712598725100598138577281441749550405991478212695085505730636505228583888n,
145
+ "yParity": 1,
146
+ },
147
+ "type": "secp256k1",
148
+ },
149
+ "type": "configurable",
150
+ },
151
+ "fromRpc": {
152
+ "account": undefined,
153
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
154
+ "chainId": 1n,
155
+ "limits": undefined,
156
+ "signature": {
157
+ "signature": {
158
+ "r": 113291597329930009559670063131885256927775966057121513567941051428123344285399n,
159
+ "s": 54293712598725100598138577281441749550405991478212695085505730636505228583888n,
160
+ "yParity": 1,
161
+ },
162
+ "type": "secp256k1",
163
+ },
164
+ "type": "configurable",
165
+ },
166
+ "fromTuple": {
167
+ "account": undefined,
168
+ "address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
169
+ "chainId": 1n,
170
+ "type": "configurable",
171
+ },
172
+ "rpc": {
173
+ "account": undefined,
174
+ "chainId": "0x1",
175
+ "expiry": null,
176
+ "keyId": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
177
+ "keyType": "configurableAccount",
178
+ "limits": undefined,
179
+ "signature": {
180
+ "r": "0xfa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7",
181
+ "s": "0x780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d0",
182
+ "type": "secp256k1",
183
+ "yParity": "0x1",
184
+ },
185
+ },
186
+ }
187
+ `)
145
188
  })
146
189
 
147
- test('rejects unbound RPC and RLP grants', () => {
190
+ test('behavior: preserves a bound account', () => {
148
191
  const signed = KeyAuthorization.from(
149
192
  { account: address, address, chainId: 1n, type: 'configurable' },
150
193
  { signature: signature_secp256k1 },
151
194
  )
152
- const rpc = KeyAuthorization.toRpc(signed)
153
- for (const account of [undefined, null]) {
154
- // @ts-expect-error Deliberately unbound configurable grant.
155
- expect(() => KeyAuthorization.fromRpc({ ...rpc, account })).toThrowError(
156
- KeyAuthorization.MissingAccountError,
157
- )
158
- }
159
- expect(() =>
160
- KeyAuthorization.fromTuple([['0x01', '0x03', address]]),
161
- ).toThrowError(KeyAuthorization.MissingAccountError)
162
- expect(KeyAuthorization.fromRpc(rpc).account).toBe(address)
195
+ expect(
196
+ KeyAuthorization.fromRpc(KeyAuthorization.toRpc(signed)).account,
197
+ ).toBe(address)
163
198
  expect(
164
199
  KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)).account,
165
200
  ).toBe(address)
@@ -1512,13 +1547,13 @@ describe('serialize', () => {
1512
1547
  })
1513
1548
 
1514
1549
  describe('toRpc', () => {
1515
- test('behavior: configurable key type uses the RPC multisig key type', () => {
1550
+ test('behavior: configurable key type uses the RPC configurableAccount key type', () => {
1516
1551
  const authorization = KeyAuthorization.from(
1517
1552
  { account: address, address, chainId: 1n, type: 'configurable' },
1518
1553
  { signature: signature_secp256k1 },
1519
1554
  )
1520
1555
  const rpc = KeyAuthorization.toRpc(authorization)
1521
- expect(rpc.keyType).toMatchInlineSnapshot(`"multisig"`)
1556
+ expect(rpc.keyType).toMatchInlineSnapshot(`"configurableAccount"`)
1522
1557
  expect(KeyAuthorization.fromRpc(rpc).type).toMatchInlineSnapshot(
1523
1558
  `"configurable"`,
1524
1559
  )
@@ -2891,4 +2926,25 @@ describe('admin keys (TIP-1049)', () => {
2891
2926
  })
2892
2927
  expect(KeyAuthorization.hash(a)).not.toBe(KeyAuthorization.hash(b))
2893
2928
  })
2929
+
2930
+ describe('configurable admin keys', () => {
2931
+ test('behavior: a configurable account may sign or be granted an admin key', () => {
2932
+ const signed = KeyAuthorization.from(
2933
+ {
2934
+ account: signature_configurable.account,
2935
+ address,
2936
+ chainId: 1n,
2937
+ isAdmin: true,
2938
+ type: 'configurable',
2939
+ },
2940
+ { signature: signature_configurable },
2941
+ )
2942
+ expect(
2943
+ KeyAuthorization.deserialize(KeyAuthorization.serialize(signed)),
2944
+ ).toEqual(signed)
2945
+ expect(
2946
+ KeyAuthorization.fromRpc(KeyAuthorization.toRpc(signed)),
2947
+ ).toMatchObject({ isAdmin: true, type: 'configurable' })
2948
+ })
2949
+ })
2894
2950
  })
@@ -77,14 +77,14 @@ export type KeyAuthorization<
77
77
  witness?: Hex.Hex | undefined
78
78
  } & (
79
79
  | {
80
- /** Optional account address binding. */
80
+ /** Account address this authorization is bound to. Required when an admin access key signs the grant (TIP-1049). */
81
81
  account?: addressType | undefined
82
82
  /** Primitive key type. */
83
83
  type: SignatureEnvelope.Type
84
84
  }
85
85
  | {
86
- /** Required parent account binding for a configurable account grant. */
87
- account: addressType
86
+ /** Account address this authorization is bound to. Required when an admin access key signs the grant (TIP-1049). */
87
+ account?: addressType | undefined
88
88
  /** Configurable account key type. */
89
89
  type: 'configurable'
90
90
  }
@@ -146,10 +146,10 @@ export type Rpc = {
146
146
  keyType: SignatureEnvelope.Type
147
147
  }
148
148
  | {
149
- /** Required parent account binding for a configurable account grant. */
150
- account: Address.Address
151
- /** Configurable account key type, named `multisig` by the node. */
152
- keyType: 'multisig'
149
+ /** Optional account address binding (TIP-1049). */
150
+ account?: Address.Address | null | undefined
151
+ /** Configurable account key type, named `configurableAccount` by the node. */
152
+ keyType: 'configurableAccount'
153
153
  }
154
154
  )
155
155
 
@@ -449,7 +449,6 @@ export function from<
449
449
  options: from.Options<signature> = {},
450
450
  ): from.ReturnType<authorization, signature> {
451
451
  if ('keyId' in authorization) return fromRpc(authorization as Rpc) as never
452
- assertAccountBinding(authorization.type, authorization.account)
453
452
  const auth = authorization as KeyAuthorization & {
454
453
  limits?: readonly { token: TempoAddress.Address; limit: bigint }[]
455
454
  scopes?: readonly {
@@ -535,10 +534,7 @@ export declare namespace from {
535
534
  >
536
535
  >
537
536
 
538
- type ErrorType =
539
- | InvalidSignatureTypeError
540
- | MissingAccountError
541
- | Errors.GlobalErrorType
537
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
542
538
  }
543
539
 
544
540
  /**
@@ -572,8 +568,7 @@ export function fromRpc(authorization: Rpc): Signed {
572
568
  const witness = authorization.witness ?? undefined
573
569
  const isAdmin = authorization.isAdmin ?? undefined
574
570
  const account = authorization.account ?? undefined
575
- const type = keyType === 'multisig' ? 'configurable' : keyType
576
- assertAccountBinding(type, account)
571
+ const type = keyType === 'configurableAccount' ? 'configurable' : keyType
577
572
  const signature = SignatureEnvelope.fromRpc(authorization.signature)
578
573
  assertSignature(signature)
579
574
  if (witness !== undefined) assertWitness(witness)
@@ -616,10 +611,7 @@ export function fromRpc(authorization: Rpc): Signed {
616
611
  }
617
612
 
618
613
  export declare namespace fromRpc {
619
- type ErrorType =
620
- | InvalidSignatureTypeError
621
- | MissingAccountError
622
- | Errors.GlobalErrorType
614
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
623
615
  }
624
616
 
625
617
  /**
@@ -739,7 +731,6 @@ export function fromTuple<const tuple extends Tuple>(
739
731
  const account = isAbsent(rawAccount)
740
732
  ? undefined
741
733
  : (rawAccount as Address.Address)
742
- assertAccountBinding(keyType, account)
743
734
  const args: KeyAuthorization = {
744
735
  address: keyId,
745
736
  chainId: chainId === '0x' ? 0n : Hex.toBigInt(chainId),
@@ -766,10 +757,7 @@ export declare namespace fromTuple {
766
757
  KeyAuthorization<authorization extends Tuple<true> ? true : false>
767
758
  >
768
759
 
769
- type ErrorType =
770
- | InvalidSignatureTypeError
771
- | MissingAccountError
772
- | Errors.GlobalErrorType
760
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
773
761
  }
774
762
 
775
763
  /**
@@ -961,7 +949,6 @@ export declare namespace serialize {
961
949
  * @returns An RPC-formatted Key Authorization.
962
950
  */
963
951
  export function toRpc(authorization: Signed): Rpc {
964
- assertAccountBinding(authorization.type, authorization.account)
965
952
  const {
966
953
  address,
967
954
  scopes,
@@ -1006,7 +993,7 @@ export function toRpc(authorization: Signed): Rpc {
1006
993
  expiry: typeof expiry === 'number' ? Hex.fromNumber(expiry) : null,
1007
994
  keyId: TempoAddress.resolve(address),
1008
995
  ...(type === 'configurable'
1009
- ? { account, keyType: 'multisig' as const }
996
+ ? { account, keyType: 'configurableAccount' as const }
1010
997
  : { keyType: type }),
1011
998
  limits: limits?.map(({ token, limit, period }) => ({
1012
999
  token,
@@ -1024,10 +1011,7 @@ export function toRpc(authorization: Signed): Rpc {
1024
1011
  }
1025
1012
 
1026
1013
  export declare namespace toRpc {
1027
- type ErrorType =
1028
- | InvalidSignatureTypeError
1029
- | MissingAccountError
1030
- | Errors.GlobalErrorType
1014
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
1031
1015
  }
1032
1016
 
1033
1017
  /**
@@ -1064,7 +1048,6 @@ export declare namespace toRpc {
1064
1048
  export function toTuple<const authorization extends KeyAuthorization>(
1065
1049
  authorization: authorization,
1066
1050
  ): toTuple.ReturnType<authorization> {
1067
- assertAccountBinding(authorization.type, authorization.account)
1068
1051
  const {
1069
1052
  address,
1070
1053
  chainId,
@@ -1173,10 +1156,7 @@ export declare namespace toTuple {
1173
1156
  type ReturnType<authorization extends KeyAuthorization = KeyAuthorization> =
1174
1157
  Compute<Tuple<authorization extends KeyAuthorization<true> ? true : false>>
1175
1158
 
1176
- type ErrorType =
1177
- | InvalidSignatureTypeError
1178
- | MissingAccountError
1179
- | Errors.GlobalErrorType
1159
+ type ErrorType = InvalidSignatureTypeError | Errors.GlobalErrorType
1180
1160
  }
1181
1161
 
1182
1162
  function bigintToHex(value: bigint): Hex.Hex {
@@ -1210,14 +1190,6 @@ function resolveSelector(
1210
1190
  return AbiItem.getSelector(selector)
1211
1191
  }
1212
1192
 
1213
- function assertAccountBinding(
1214
- type: KeyAuthorization['type'],
1215
- account: TempoAddress.Address | null | undefined,
1216
- ): void {
1217
- if (type === 'configurable' && account == null)
1218
- throw new MissingAccountError()
1219
- }
1220
-
1221
1193
  function assertWitness(witness: Hex.Hex): void {
1222
1194
  if (Hex.size(witness) !== 32) throw new InvalidWitnessSizeError(witness)
1223
1195
  }
@@ -1263,7 +1235,12 @@ export class InvalidSignatureTypeError extends Error {
1263
1235
  }
1264
1236
  }
1265
1237
 
1266
- /** Thrown when a configurable account key grant omits its parent account binding. */
1238
+ /**
1239
+ * Thrown when a configurable account key grant omits its parent account binding.
1240
+ *
1241
+ * @deprecated No longer thrown. The Tempo node only requires `account` on grants
1242
+ * signed by an admin access key, which it checks against the transaction sender.
1243
+ */
1267
1244
  export class MissingAccountError extends Error {
1268
1245
  override readonly name = 'KeyAuthorization.MissingAccountError'
1269
1246
  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
  },
@@ -19,16 +19,16 @@ test('transaction requests use domain account simulation specs', () => {
19
19
  })
20
20
 
21
21
  test('RPC requests use encoded account configurations', () => {
22
- expectTypeOf(rpc.multisigSimulation?.config).toEqualTypeOf<
22
+ expectTypeOf(rpc.configurableAccountSimulation?.config).toEqualTypeOf<
23
23
  `0x${string}` | undefined
24
24
  >()
25
25
  })
26
26
 
27
- test('maps the configurable key type to the RPC multisig key type', () => {
27
+ test('maps the configurable key type to the RPC configurableAccount key type', () => {
28
28
  expectTypeOf(request.keyType).toEqualTypeOf<
29
29
  'configurable' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
30
30
  >()
31
31
  expectTypeOf(rpc.keyType).toEqualTypeOf<
32
- 'multisig' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
32
+ 'configurableAccount' | 'p256' | 'secp256k1' | 'webAuthn' | undefined
33
33
  >()
34
34
  })
@@ -109,9 +109,9 @@ describe('fromRpc', () => {
109
109
  expect(request.nonceKey).toBe(255n)
110
110
  })
111
111
 
112
- test('behavior: multisig key type decodes as configurable', () => {
112
+ test('behavior: configurableAccount key type decodes as configurable', () => {
113
113
  const request = TransactionRequest.fromRpc({
114
- keyType: 'multisig',
114
+ keyType: 'configurableAccount',
115
115
  type: '0x76',
116
116
  })
117
117
  expect(request.keyType).toMatchInlineSnapshot(`"configurable"`)
@@ -120,7 +120,7 @@ describe('fromRpc', () => {
120
120
  test('behavior: account simulation', () => {
121
121
  const request = TransactionRequest.fromRpc({
122
122
  from: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
123
- multisigSimulation: accountSimulationRpc,
123
+ configurableAccountSimulation: accountSimulationRpc,
124
124
  type: '0x76',
125
125
  })
126
126
 
@@ -214,8 +214,7 @@ describe('toRpc', () => {
214
214
 
215
215
  expect(request).toMatchInlineSnapshot(`
216
216
  {
217
- "from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
218
- "multisigSimulation": {
217
+ "configurableAccountSimulation": {
219
218
  "approvals": [
220
219
  {
221
220
  "keyData": "0x0005",
@@ -225,9 +224,10 @@ describe('toRpc', () => {
225
224
  ],
226
225
  "config": "0xf852a011111111111111111111111111111111111111111111111111111111111111118002eed694111111111111111111111111111111111111111101d694bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb01",
227
226
  },
227
+ "from": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
228
228
  "type": "0x76",
229
229
  }
230
- `)
230
+ `)
231
231
  })
232
232
  })
233
233
 
@@ -295,7 +295,7 @@ describe('roundtrip', () => {
295
295
  nonceKey: '0xff',
296
296
  gas: '0x186a0',
297
297
  keyAuthorizationSimulation: accountSimulationRpc,
298
- multisigSimulation: accountSimulationRpc,
298
+ configurableAccountSimulation: accountSimulationRpc,
299
299
  type: '0x76',
300
300
  }
301
301
 
@@ -311,7 +311,9 @@ describe('roundtrip', () => {
311
311
  expect(rpc.keyAuthorizationSimulation).toEqual(
312
312
  original.keyAuthorizationSimulation,
313
313
  )
314
- expect(rpc.multisigSimulation).toEqual(original.multisigSimulation)
314
+ expect(rpc.configurableAccountSimulation).toEqual(
315
+ original.configurableAccountSimulation,
316
+ )
315
317
  expect(rpc.type).toBe('0x76')
316
318
  })
317
319
  })
@@ -62,9 +62,9 @@ export type Rpc = Omit<
62
62
  feeToken?: Hex.Hex | undefined
63
63
  keyAuthorization?: KeyAuthorization.Rpc | undefined
64
64
  keyAuthorizationSimulation?: AccountSimulation.Rpc | undefined
65
- /** Key type. Configurable accounts use the node's `multisig` key type. */
66
- keyType?: SignatureEnvelope.Type | 'multisig' | undefined
67
- multisigSimulation?: AccountSimulation.Rpc | undefined
65
+ /** Key type. Configurable accounts use the node's `configurableAccount` key type. */
66
+ keyType?: SignatureEnvelope.Type | 'configurableAccount' | undefined
67
+ configurableAccountSimulation?: AccountSimulation.Rpc | undefined
68
68
  nonceKey?: Hex.Hex | undefined
69
69
  }
70
70
 
@@ -93,7 +93,7 @@ export function fromRpc(request: Rpc): TransactionRequest {
93
93
  authorizationList: _,
94
94
  keyAuthorizationSimulation: __,
95
95
  keyType: ___,
96
- multisigSimulation: ____,
96
+ configurableAccountSimulation: ____,
97
97
  ...rest
98
98
  } = request
99
99
  const request_ = ox_TransactionRequest.fromRpc(
@@ -132,10 +132,12 @@ export function fromRpc(request: Rpc): TransactionRequest {
132
132
  )
133
133
  if (typeof request.keyType !== 'undefined')
134
134
  request_.keyType =
135
- request.keyType === 'multisig' ? 'configurable' : request.keyType
136
- if (request.multisigSimulation)
135
+ request.keyType === 'configurableAccount'
136
+ ? 'configurable'
137
+ : request.keyType
138
+ if (request.configurableAccountSimulation)
137
139
  request_.accountSimulation = AccountSimulation.fromRpc(
138
- request.multisigSimulation,
140
+ request.configurableAccountSimulation,
139
141
  )
140
142
  if (typeof request.validBefore !== 'undefined')
141
143
  request_.validBefore = Hex.toNumber(request.validBefore as Hex.Hex)
@@ -240,7 +242,7 @@ export function toRpc(request: TransactionRequest): Rpc {
240
242
  request.keyAuthorizationSimulation,
241
243
  )
242
244
  if (request.accountSimulation)
243
- request_rpc.multisigSimulation = AccountSimulation.toRpc(
245
+ request_rpc.configurableAccountSimulation = AccountSimulation.toRpc(
244
246
  request.accountSimulation,
245
247
  )
246
248
  if (typeof request.validBefore !== 'undefined')
package/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '0.14.56'
2
+ export const version = '0.14.57'