viem 2.57.4 → 2.57.5

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 (223) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/_cjs/actions/public/waitForTransactionReceipt.js +5 -2
  3. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  4. package/_cjs/actions/wallet/waitForCallsStatus.js +25 -2
  5. package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -1
  6. package/_cjs/chains/definitions/arcTestnet.js +11 -8
  7. package/_cjs/chains/definitions/arcTestnet.js.map +1 -1
  8. package/_cjs/chains/definitions/qmsTestnet.js +30 -0
  9. package/_cjs/chains/definitions/qmsTestnet.js.map +1 -0
  10. package/_cjs/chains/definitions/tempo.js +1 -1
  11. package/_cjs/chains/definitions/tempoModerato.js +2 -2
  12. package/_cjs/chains/index.js +7 -5
  13. package/_cjs/chains/index.js.map +1 -1
  14. package/_cjs/clients/transports/ipc.js +19 -10
  15. package/_cjs/clients/transports/ipc.js.map +1 -1
  16. package/_cjs/clients/transports/webSocket.js +19 -10
  17. package/_cjs/clients/transports/webSocket.js.map +1 -1
  18. package/_cjs/errors/version.js +1 -1
  19. package/_cjs/tempo/Account.js +40 -40
  20. package/_cjs/tempo/Account.js.map +1 -1
  21. package/_cjs/tempo/Decorator.js +9 -8
  22. package/_cjs/tempo/Decorator.js.map +1 -1
  23. package/_cjs/tempo/ExecutionError.js +1 -1
  24. package/_cjs/tempo/ExecutionError.js.map +1 -1
  25. package/_cjs/tempo/Formatters.js +8 -7
  26. package/_cjs/tempo/Formatters.js.map +1 -1
  27. package/_cjs/tempo/KeyAuthorizationManager.js +25 -16
  28. package/_cjs/tempo/KeyAuthorizationManager.js.map +1 -1
  29. package/_cjs/tempo/Relay.js +9 -4
  30. package/_cjs/tempo/Relay.js.map +1 -1
  31. package/_cjs/tempo/Transaction.js +9 -9
  32. package/_cjs/tempo/Transaction.js.map +1 -1
  33. package/_cjs/tempo/Transport.js +21 -11
  34. package/_cjs/tempo/Transport.js.map +1 -1
  35. package/_cjs/tempo/{multisig → accounts}/Config.js +8 -8
  36. package/_cjs/tempo/{multisig → accounts}/Config.js.map +1 -1
  37. package/_cjs/tempo/{multisig → accounts}/Operation.js +10 -10
  38. package/_cjs/tempo/{multisig → accounts}/Operation.js.map +1 -1
  39. package/_cjs/tempo/{multisig → accounts}/Signature.js +2 -2
  40. package/_cjs/tempo/accounts/Signature.js.map +1 -0
  41. package/_cjs/tempo/actions/accessKey.js +60 -37
  42. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  43. package/_cjs/tempo/actions/{multisig.js → accounts.js} +13 -18
  44. package/_cjs/tempo/actions/accounts.js.map +1 -0
  45. package/_cjs/tempo/actions/index.js +2 -2
  46. package/_cjs/tempo/actions/index.js.map +1 -1
  47. package/_cjs/tempo/chainConfig.js +37 -37
  48. package/_cjs/tempo/chainConfig.js.map +1 -1
  49. package/_cjs/tempo/index.js +3 -3
  50. package/_cjs/tempo/index.js.map +1 -1
  51. package/_cjs/tempo/internal/relay/{multisig.js → accounts.js} +90 -93
  52. package/_cjs/tempo/internal/relay/accounts.js.map +1 -0
  53. package/_cjs/tempo/internal/relay/keyAuthorization.js +296 -0
  54. package/_cjs/tempo/internal/relay/keyAuthorization.js.map +1 -0
  55. package/_cjs/tempo/internal/relay/plugin.js +17 -7
  56. package/_cjs/tempo/internal/relay/plugin.js.map +1 -1
  57. package/_cjs/utils/hash/normalizeSignature.js +1 -1
  58. package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
  59. package/_cjs/utils/rpc/http.js +66 -31
  60. package/_cjs/utils/rpc/http.js.map +1 -1
  61. package/_cjs/utils/rpc/socket.js +1 -1
  62. package/_cjs/utils/rpc/socket.js.map +1 -1
  63. package/_esm/actions/public/waitForTransactionReceipt.js +5 -2
  64. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  65. package/_esm/actions/wallet/waitForCallsStatus.js +39 -2
  66. package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
  67. package/_esm/chains/definitions/arcTestnet.js +11 -8
  68. package/_esm/chains/definitions/arcTestnet.js.map +1 -1
  69. package/_esm/chains/definitions/qmsTestnet.js +27 -0
  70. package/_esm/chains/definitions/qmsTestnet.js.map +1 -0
  71. package/_esm/chains/definitions/tempo.js +1 -1
  72. package/_esm/chains/definitions/tempoModerato.js +2 -2
  73. package/_esm/chains/index.js +1 -0
  74. package/_esm/chains/index.js.map +1 -1
  75. package/_esm/clients/transports/ipc.js +21 -10
  76. package/_esm/clients/transports/ipc.js.map +1 -1
  77. package/_esm/clients/transports/webSocket.js +21 -10
  78. package/_esm/clients/transports/webSocket.js.map +1 -1
  79. package/_esm/errors/version.js +1 -1
  80. package/_esm/tempo/Account.js +42 -42
  81. package/_esm/tempo/Account.js.map +1 -1
  82. package/_esm/tempo/Client.js +3 -3
  83. package/_esm/tempo/Decorator.js +9 -8
  84. package/_esm/tempo/Decorator.js.map +1 -1
  85. package/_esm/tempo/ExecutionError.js +1 -1
  86. package/_esm/tempo/ExecutionError.js.map +1 -1
  87. package/_esm/tempo/Formatters.js +11 -10
  88. package/_esm/tempo/Formatters.js.map +1 -1
  89. package/_esm/tempo/KeyAuthorizationManager.js +58 -16
  90. package/_esm/tempo/KeyAuthorizationManager.js.map +1 -1
  91. package/_esm/tempo/Relay.js +49 -8
  92. package/_esm/tempo/Relay.js.map +1 -1
  93. package/_esm/tempo/Transaction.js +11 -11
  94. package/_esm/tempo/Transaction.js.map +1 -1
  95. package/_esm/tempo/Transport.js +22 -12
  96. package/_esm/tempo/Transport.js.map +1 -1
  97. package/_esm/tempo/{multisig → accounts}/Config.js +14 -14
  98. package/_esm/tempo/{multisig → accounts}/Config.js.map +1 -1
  99. package/_esm/tempo/{multisig → accounts}/Operation.js +17 -17
  100. package/_esm/tempo/{multisig → accounts}/Operation.js.map +1 -1
  101. package/_esm/tempo/accounts/Signature.js +9 -0
  102. package/_esm/tempo/accounts/Signature.js.map +1 -0
  103. package/_esm/tempo/actions/accessKey.js +93 -38
  104. package/_esm/tempo/actions/accessKey.js.map +1 -1
  105. package/_esm/tempo/actions/{multisig.js → accounts.js} +31 -36
  106. package/_esm/tempo/actions/accounts.js.map +1 -0
  107. package/_esm/tempo/actions/index.js +1 -1
  108. package/_esm/tempo/actions/index.js.map +1 -1
  109. package/_esm/tempo/chainConfig.js +38 -38
  110. package/_esm/tempo/chainConfig.js.map +1 -1
  111. package/_esm/tempo/index.js +2 -1
  112. package/_esm/tempo/index.js.map +1 -1
  113. package/_esm/tempo/internal/relay/{multisig.js → accounts.js} +93 -98
  114. package/_esm/tempo/internal/relay/accounts.js.map +1 -0
  115. package/_esm/tempo/internal/relay/feePayer.js +1 -1
  116. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  117. package/_esm/tempo/internal/relay/keyAuthorization.js +334 -0
  118. package/_esm/tempo/internal/relay/keyAuthorization.js.map +1 -0
  119. package/_esm/tempo/internal/relay/plugin.js +15 -6
  120. package/_esm/tempo/internal/relay/plugin.js.map +1 -1
  121. package/_esm/utils/hash/normalizeSignature.js +3 -2
  122. package/_esm/utils/hash/normalizeSignature.js.map +1 -1
  123. package/_esm/utils/rpc/http.js +74 -31
  124. package/_esm/utils/rpc/http.js.map +1 -1
  125. package/_esm/utils/rpc/socket.js +3 -1
  126. package/_esm/utils/rpc/socket.js.map +1 -1
  127. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  128. package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
  129. package/_types/chains/definitions/arcTestnet.d.ts +5 -5
  130. package/_types/chains/definitions/arcTestnet.d.ts.map +1 -1
  131. package/_types/chains/definitions/qmsTestnet.d.ts +50 -0
  132. package/_types/chains/definitions/qmsTestnet.d.ts.map +1 -0
  133. package/_types/chains/definitions/tempo.d.ts +2 -2
  134. package/_types/chains/definitions/tempoModerato.d.ts +4 -4
  135. package/_types/chains/index.d.ts +1 -0
  136. package/_types/chains/index.d.ts.map +1 -1
  137. package/_types/clients/transports/ipc.d.ts.map +1 -1
  138. package/_types/clients/transports/webSocket.d.ts.map +1 -1
  139. package/_types/errors/version.d.ts +1 -1
  140. package/_types/tempo/Account.d.ts +28 -28
  141. package/_types/tempo/Account.d.ts.map +1 -1
  142. package/_types/tempo/Client.d.ts +3 -3
  143. package/_types/tempo/Decorator.d.ts +63 -37
  144. package/_types/tempo/Decorator.d.ts.map +1 -1
  145. package/_types/tempo/Formatters.d.ts.map +1 -1
  146. package/_types/tempo/KeyAuthorizationManager.d.ts +45 -2
  147. package/_types/tempo/KeyAuthorizationManager.d.ts.map +1 -1
  148. package/_types/tempo/Relay.d.ts +62 -12
  149. package/_types/tempo/Relay.d.ts.map +1 -1
  150. package/_types/tempo/Transaction.d.ts +14 -11
  151. package/_types/tempo/Transaction.d.ts.map +1 -1
  152. package/_types/tempo/Transport.d.ts +20 -7
  153. package/_types/tempo/Transport.d.ts.map +1 -1
  154. package/_types/tempo/{multisig → accounts}/Config.d.ts +7 -7
  155. package/_types/tempo/accounts/Config.d.ts.map +1 -0
  156. package/_types/tempo/{multisig → accounts}/Operation.d.ts +7 -7
  157. package/_types/tempo/accounts/Operation.d.ts.map +1 -0
  158. package/_types/tempo/{multisig → accounts}/Signature.d.ts +1 -1
  159. package/_types/tempo/accounts/Signature.d.ts.map +1 -0
  160. package/_types/tempo/actions/accessKey.d.ts +59 -17
  161. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  162. package/_types/tempo/actions/{multisig.d.ts → accounts.d.ts} +28 -28
  163. package/_types/tempo/actions/{multisig.d.ts.map → accounts.d.ts.map} +1 -1
  164. package/_types/tempo/actions/index.d.ts +1 -1
  165. package/_types/tempo/actions/index.d.ts.map +1 -1
  166. package/_types/tempo/index.d.ts +3 -2
  167. package/_types/tempo/index.d.ts.map +1 -1
  168. package/_types/tempo/internal/relay/accounts.d.ts +15 -0
  169. package/_types/tempo/internal/relay/accounts.d.ts.map +1 -0
  170. package/_types/tempo/internal/relay/keyAuthorization.d.ts +25 -0
  171. package/_types/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
  172. package/_types/tempo/internal/relay/plugin.d.ts +6 -3
  173. package/_types/tempo/internal/relay/plugin.d.ts.map +1 -1
  174. package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
  175. package/_types/utils/rpc/http.d.ts.map +1 -1
  176. package/_types/utils/rpc/socket.d.ts.map +1 -1
  177. package/actions/public/waitForTransactionReceipt.ts +8 -2
  178. package/actions/wallet/waitForCallsStatus.ts +41 -2
  179. package/chains/definitions/arcTestnet.ts +11 -8
  180. package/chains/definitions/qmsTestnet.ts +27 -0
  181. package/chains/definitions/tempo.ts +1 -1
  182. package/chains/definitions/tempoModerato.ts +2 -2
  183. package/chains/index.ts +1 -0
  184. package/clients/transports/ipc.ts +38 -29
  185. package/clients/transports/webSocket.ts +42 -33
  186. package/errors/version.ts +1 -1
  187. package/package.json +2 -2
  188. package/tempo/Account.ts +95 -84
  189. package/tempo/Client.ts +3 -3
  190. package/tempo/Decorator.ts +86 -57
  191. package/tempo/ExecutionError.ts +1 -1
  192. package/tempo/Formatters.ts +14 -13
  193. package/tempo/KeyAuthorizationManager.ts +71 -19
  194. package/tempo/Relay.ts +70 -14
  195. package/tempo/Transaction.ts +31 -23
  196. package/tempo/Transport.ts +49 -21
  197. package/tempo/{multisig → accounts}/Config.ts +21 -21
  198. package/tempo/{multisig → accounts}/Operation.ts +26 -26
  199. package/tempo/{multisig → accounts}/Signature.ts +5 -3
  200. package/tempo/actions/accessKey.ts +179 -79
  201. package/tempo/actions/{multisig.ts → accounts.ts} +47 -56
  202. package/tempo/actions/index.ts +1 -1
  203. package/tempo/chainConfig.ts +52 -52
  204. package/tempo/index.ts +5 -4
  205. package/tempo/internal/relay/{multisig.ts → accounts.ts} +118 -118
  206. package/tempo/internal/relay/feePayer.ts +1 -1
  207. package/tempo/internal/relay/keyAuthorization.ts +415 -0
  208. package/tempo/internal/relay/plugin.ts +20 -7
  209. package/utils/hash/normalizeSignature.ts +3 -2
  210. package/utils/rpc/http.ts +76 -30
  211. package/utils/rpc/socket.ts +3 -1
  212. package/_cjs/tempo/actions/multisig.js.map +0 -1
  213. package/_cjs/tempo/internal/relay/multisig.js.map +0 -1
  214. package/_cjs/tempo/multisig/Signature.js.map +0 -1
  215. package/_esm/tempo/actions/multisig.js.map +0 -1
  216. package/_esm/tempo/internal/relay/multisig.js.map +0 -1
  217. package/_esm/tempo/multisig/Signature.js +0 -9
  218. package/_esm/tempo/multisig/Signature.js.map +0 -1
  219. package/_types/tempo/internal/relay/multisig.d.ts +0 -4
  220. package/_types/tempo/internal/relay/multisig.d.ts.map +0 -1
  221. package/_types/tempo/multisig/Config.d.ts.map +0 -1
  222. package/_types/tempo/multisig/Operation.d.ts.map +0 -1
  223. package/_types/tempo/multisig/Signature.d.ts.map +0 -1
package/tempo/Account.ts CHANGED
@@ -5,9 +5,9 @@ import * as PublicKey from 'ox/PublicKey'
5
5
  import * as Secp256k1 from 'ox/Secp256k1'
6
6
  import * as Signature from 'ox/Signature'
7
7
  import {
8
+ AccountConfig,
8
9
  Channel,
9
10
  KeyAuthorization,
10
- MultisigConfig,
11
11
  SignatureEnvelope,
12
12
  } from 'ox/tempo'
13
13
  import * as WebAuthnP256 from 'ox/WebAuthnP256'
@@ -25,8 +25,8 @@ import { hashMessage } from '../utils/signature/hashMessage.js'
25
25
  import { hashTypedData } from '../utils/signature/hashTypedData.js'
26
26
  import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
27
27
  import { nativeMultisigFactory } from './Addresses.js'
28
+ import { parseApproval } from './accounts/Signature.js'
28
29
  import type { KeyAuthorizationManager } from './KeyAuthorizationManager.js'
29
- import { parseApproval } from './multisig/Signature.js'
30
30
  import * as Transaction from './Transaction.js'
31
31
 
32
32
  export type Account_base<source extends string = string> = RequiredBy<
@@ -277,7 +277,7 @@ export declare namespace fromSecp256k1 {
277
277
  }
278
278
 
279
279
  /**
280
- * Instantiates an Account for a native multisig (TIP-1061) config.
280
+ * Instantiates an Account for a configurable account (TIP-1107) config.
281
281
  *
282
282
  * The returned account does not hold a key itself. Omit `address` or set it to
283
283
  * `infer` to derive an account address from its initial config. For a current
@@ -290,39 +290,39 @@ export declare namespace fromSecp256k1 {
290
290
  * Configs containing only owner addresses require external approvals through
291
291
  * `signatures`.
292
292
  *
293
- * Normalizes supplied config fields with `MultisigConfig.from`, so callers do
293
+ * Normalizes supplied config fields with `AccountConfig.from`, so callers do
294
294
  * not need to normalize owner ordering themselves.
295
295
  *
296
296
  * @example
297
297
  * ```ts
298
298
  * import { Account } from 'viem/tempo'
299
299
  *
300
- * const account = Account.fromMultisig({
300
+ * const account = Account.fromConfig({
301
301
  * address: 'infer',
302
302
  * owners: [owner_1, owner_2],
303
303
  * threshold: 2,
304
304
  * })
305
305
  *
306
- * // The multisig config is inferred from the account.
306
+ * // The account config is inferred from the account.
307
307
  * const request = await client.prepareTransactionRequest({ account, ...rest })
308
308
  *
309
309
  * const transaction = await client.signTransaction(request)
310
310
  * ```
311
311
  *
312
- * @param value Initial config, current config, or multisig address.
313
- * @returns Multisig account.
312
+ * @param value Initial config, current config, or account address.
313
+ * @returns Configurable account.
314
314
  */
315
- export function fromMultisig(
316
- value: fromMultisig.InitialConfig,
317
- ): MultisigAccount<MultisigConfig.Config>
318
- export function fromMultisig(
319
- value: fromMultisig.CurrentConfig,
320
- ): MultisigAccount<MultisigConfig.Config>
321
- export function fromMultisig(
315
+ export function fromConfig(
316
+ value: fromConfig.InitialConfig,
317
+ ): ConfigurableAccount<AccountConfig.Config>
318
+ export function fromConfig(
319
+ value: fromConfig.CurrentConfig,
320
+ ): ConfigurableAccount<AccountConfig.Config>
321
+ export function fromConfig(
322
322
  address: Address.Address,
323
- ): MultisigAccount<undefined>
324
- export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount
325
- export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
323
+ ): ConfigurableAccount<undefined>
324
+ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount
325
+ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
326
326
  const configInput = (() => {
327
327
  if (typeof value === 'string') return undefined
328
328
  const { address: _, ...config } = value
@@ -335,7 +335,7 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
335
335
  ? { owner: value, weight: 1 }
336
336
  : value,
337
337
  )
338
- return MultisigConfig.from({
338
+ return AccountConfig.from({
339
339
  ...configInput,
340
340
  owners: ownerEntries.map(({ owner, weight }) => ({
341
341
  owner: typeof owner === 'string' ? owner : owner.address,
@@ -349,19 +349,19 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
349
349
  (value.address === undefined || value.address === 'infer') &&
350
350
  config!.version !== 0n
351
351
  )
352
- throw new Error('An initial multisig config must have version zero.')
352
+ throw new Error('An initial account config must have version zero.')
353
353
  if (
354
354
  value.address !== undefined &&
355
355
  value.address !== 'infer' &&
356
356
  config!.version === 0n
357
357
  )
358
- throw new Error('A current multisig config must have a version.')
358
+ throw new Error('A current account config must have a version.')
359
359
  }
360
360
  const address = Address.checksum(
361
361
  (() => {
362
362
  if (typeof value === 'string') return value
363
363
  if (value.address === undefined || value.address === 'infer')
364
- return MultisigConfig.getAddress(config!, {
364
+ return AccountConfig.getAddress(config!, {
365
365
  factory: nativeMultisigFactory,
366
366
  })
367
367
  return value.address
@@ -377,10 +377,12 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
377
377
  })()
378
378
  if (
379
379
  ownerAccounts.some(
380
- (owner) => owner.source === 'multisig' || isAccessKeyAccount(owner),
380
+ (owner) => owner.source === 'configurable' || isAccessKeyAccount(owner),
381
381
  )
382
382
  )
383
- throw new Error('Multisig owners must use primitive signatures.')
383
+ throw new Error(
384
+ 'Configurable account owners must use primitive signatures.',
385
+ )
384
386
  const owners =
385
387
  config?.owners.flatMap(({ owner }) => {
386
388
  const account = ownerAccounts.find((account) =>
@@ -389,20 +391,22 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
389
391
  return account ? [account] : []
390
392
  }) ?? []
391
393
 
392
- const account: MultisigAccount = {
394
+ const account: ConfigurableAccount = {
393
395
  address,
394
396
  config,
395
397
  owners,
396
398
  publicKey: '0x',
397
- source: 'multisig',
399
+ source: 'configurable',
398
400
  type: 'local',
399
401
  async sign({ hash }) {
400
402
  return SignatureEnvelope.serialize(
401
- await signMultisig(account, { payload: hash }),
403
+ await signConfigurable(account, { payload: hash }),
402
404
  )
403
405
  },
404
406
  async signMessage() {
405
- throw new Error('`signMessage` is not supported for multisig accounts.')
407
+ throw new Error(
408
+ '`signMessage` is not supported for configurable accounts.',
409
+ )
406
410
  },
407
411
  async signTransaction(transaction, options) {
408
412
  const { serializer = Transaction.serialize } = options ?? {}
@@ -411,11 +415,11 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
411
415
  const owner = parseAccount(request.owner)
412
416
  if (owner.type !== 'local')
413
417
  throw new Error(
414
- 'A local owner account is required to approve a multisig transaction.',
418
+ 'A local owner account is required to approve a configurable account transaction.',
415
419
  )
416
420
  if (owner.source !== 'root')
417
421
  throw new Error(
418
- 'A Tempo owner account is required to approve a multisig transaction.',
422
+ 'A Tempo owner account is required to approve a configurable account transaction.',
419
423
  )
420
424
  const { owner: _, ...ownerRequest } = request
421
425
  return await owner.signTransaction(ownerRequest as never, options)
@@ -431,13 +435,13 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
431
435
  : { feePayerSignature: null }),
432
436
  }
433
437
  const payload = keccak256(await serializer(presign as never))
434
- const simulation = request.multisigSimulation
438
+ const simulation = request.accountSimulation
435
439
  if (request.from && !Address.isEqual(request.from, address))
436
440
  throw new Error(
437
- 'Multisig account does not match the transaction sender.',
441
+ 'Configurable account does not match the transaction sender.',
438
442
  )
439
443
 
440
- const signature = await signMultisig(account, {
444
+ const signature = await signConfigurable(account, {
441
445
  config: simulation?.config,
442
446
  payload,
443
447
  signatures: request.signatures?.map((signature) =>
@@ -450,86 +454,90 @@ export function fromMultisig(value: fromMultisig.Parameters): MultisigAccount {
450
454
  )) as Hex.Hex
451
455
  },
452
456
  async signTypedData() {
453
- throw new Error('`signTypedData` is not supported for multisig accounts.')
457
+ throw new Error(
458
+ '`signTypedData` is not supported for configurable accounts.',
459
+ )
454
460
  },
455
461
  }
456
462
  return account
457
463
  }
458
464
 
459
- export declare namespace fromMultisig {
460
- /** Initial version-zero multisig config. */
465
+ export declare namespace fromConfig {
466
+ /** Initial version-zero account config. */
461
467
  export type Config = InitialConfig
462
468
 
463
- /** Stable multisig account address and its current config. */
469
+ /** Stable configurable account address and its current config. */
464
470
  export type CurrentConfig = {
465
- /** Stable multisig account address. */
471
+ /** Stable configurable account address. */
466
472
  address: Address.Address
467
473
  /** Weighted owners. */
468
474
  owners: readonly Owner[]
469
475
  /** Caller-chosen 32-byte salt. */
470
- salt: MultisigConfig.Config['salt']
476
+ salt: AccountConfig.Config['salt']
471
477
  /** Minimum total owner weight required for authorization. */
472
- threshold: MultisigConfig.Config['threshold']
478
+ threshold: AccountConfig.Config['threshold']
473
479
  /** Current configuration version. */
474
- version: MultisigConfig.Config<bigint | number>['version']
480
+ version: AccountConfig.Config<bigint | number>['version']
475
481
  }
476
482
 
477
- /** Initial version-zero multisig config. */
483
+ /** Initial version-zero account config. */
478
484
  export type InitialConfig = {
479
485
  /** Derives the stable account address from this initial config. */
480
486
  address?: 'infer' | undefined
481
487
  /** Weighted owners. */
482
488
  owners: readonly Owner[]
483
489
  /** Caller-chosen 32-byte salt. */
484
- salt?: MultisigConfig.Input['salt'] | undefined
490
+ salt?: AccountConfig.Input['salt'] | undefined
485
491
  /** Minimum owner weight required for authorization. */
486
492
  threshold?: number | undefined
487
493
  /** Initial configuration version. */
488
494
  version?: 0 | 0n | undefined
489
495
  }
490
496
 
491
- /** Multisig owner account or address, optionally with an explicit weight. */
497
+ /** Configurable account owner account or address, optionally with an explicit weight. */
492
498
  export type Owner =
493
499
  | Address.Address
494
500
  | (LocalAccount & { accessKeyAddress?: never; owners?: never })
495
- | (Omit<MultisigConfig.Owner, 'owner'> & {
501
+ | (Omit<AccountConfig.Owner, 'owner'> & {
496
502
  owner:
497
503
  | Address.Address
498
504
  | (LocalAccount & { accessKeyAddress?: never; owners?: never })
499
505
  })
500
506
 
501
- /** Parameters for {@link fromMultisig}. */
507
+ /** Parameters for {@link fromConfig}. */
502
508
  export type Parameters = Address.Address | CurrentConfig | InitialConfig
503
509
  }
504
510
 
505
- export type MultisigAccount<
506
- config extends MultisigConfig.Config | undefined =
507
- | MultisigConfig.Config
511
+ export type ConfigurableAccount<
512
+ config extends AccountConfig.Config | undefined =
513
+ | AccountConfig.Config
508
514
  | undefined,
509
- > = RequiredBy<LocalAccount<'multisig'>, 'sign'> & {
515
+ > = RequiredBy<LocalAccount<'configurable'>, 'sign'> & {
510
516
  /** Normalized config, or `undefined` for an address-only account. */
511
517
  config: config
512
518
  /** @internal Local owner accounts available for signing. */
513
519
  owners: readonly LocalAccount[]
514
520
  }
515
521
 
516
- function isMultisigAccount(account: LocalAccount): account is MultisigAccount {
517
- return account.source === 'multisig'
522
+ function isConfigurableAccount(
523
+ account: LocalAccount,
524
+ ): account is ConfigurableAccount {
525
+ return account.source === 'configurable'
518
526
  }
519
527
 
520
- async function signMultisig(
521
- account: MultisigAccount,
528
+ async function signConfigurable(
529
+ account: ConfigurableAccount,
522
530
  parameters: {
523
- config?: MultisigConfig.Config | undefined
531
+ config?: AccountConfig.Config | undefined
524
532
  payload: Hex.Hex
525
533
  signatures?: readonly SignatureEnvelope.Primitive[] | undefined
526
534
  },
527
- ): Promise<SignatureEnvelope.Multisig> {
535
+ ): Promise<SignatureEnvelope.Configurable> {
528
536
  const { config, payload, signatures: providedSignatures = [] } = parameters
529
537
  const currentConfig = config ?? account.config
530
538
  if (!currentConfig)
531
- throw new Error('A current multisig config is required for local signing.')
532
- const digest = MultisigConfig.getSignPayload({
539
+ throw new Error('A current account config is required for local signing.')
540
+ const digest = AccountConfig.getSignPayload({
533
541
  account: account.address,
534
542
  config: currentConfig,
535
543
  payload,
@@ -566,7 +574,7 @@ async function signMultisig(
566
574
  if (!ownerAccount) continue
567
575
 
568
576
  if (!ownerAccount.sign)
569
- throw new Error('Multisig owner account cannot sign.')
577
+ throw new Error('Configurable account owner account cannot sign.')
570
578
  signatures.push(parseApproval(await ownerAccount.sign({ hash: digest })))
571
579
 
572
580
  signedOwners.add(address)
@@ -575,18 +583,18 @@ async function signMultisig(
575
583
  }
576
584
 
577
585
  if (weight < Number(currentConfig.threshold))
578
- throw new Error('Local multisig owners do not meet the threshold.')
586
+ throw new Error('Local owners do not meet the threshold.')
579
587
 
580
588
  return SignatureEnvelope.from({
581
589
  account: account.address,
582
590
  config: currentConfig,
583
- signatures: SignatureEnvelope.sortMultisigApprovals({
591
+ signatures: SignatureEnvelope.sortApprovals({
584
592
  account: account.address,
585
593
  config: currentConfig,
586
594
  payload,
587
595
  signatures,
588
596
  }),
589
- }) as SignatureEnvelope.Multisig
597
+ }) as SignatureEnvelope.Configurable
590
598
  }
591
599
 
592
600
  /**
@@ -789,7 +797,7 @@ export function getKeyAuthorizationSignPayload(
789
797
  const { admin, chainId, expiry, key, limits, scopes, witness } = parameters
790
798
  const { accessKeyAddress, keyType: type } = resolveAccessKey(key)
791
799
  const boundFields =
792
- isAccessKeyAccount(account) || isMultisigAccount(account)
800
+ isAccessKeyAccount(account) || isConfigurableAccount(account)
793
801
  ? { account: account.address }
794
802
  : {}
795
803
  const restrictions = admin ? {} : { expiry, limits, scopes }
@@ -814,7 +822,7 @@ export async function signKeyAuthorization(
814
822
  expiry,
815
823
  key,
816
824
  limits,
817
- multisig: multisigState,
825
+ configurable: configurableState,
818
826
  scopes,
819
827
  signatures,
820
828
  witness,
@@ -826,9 +834,9 @@ export async function signKeyAuthorization(
826
834
  // on behalf of, so the signed payload cannot be replayed against another
827
835
  // account. [TIP-1049]
828
836
  const isAccessKey = isAccessKeyAccount(account)
829
- const isMultisig = isMultisigAccount(account)
837
+ const isConfigurable = isConfigurableAccount(account)
830
838
  const boundFields =
831
- isAccessKey || isMultisig ? { account: account.address } : {}
839
+ isAccessKey || isConfigurable ? { account: account.address } : {}
832
840
 
833
841
  // Admin key authorizations are unrestricted and must not carry expiry,
834
842
  // limits, or call scopes (the protocol rejects them). [TIP-1049]
@@ -837,14 +845,14 @@ export async function signKeyAuthorization(
837
845
  const hash = getKeyAuthorizationSignPayload(account, parameters)
838
846
  const signature = await (async () => {
839
847
  if (isAccessKey) return account.sign({ hash, raw: true })
840
- if (isMultisig) {
841
- if (!multisigState)
848
+ if (isConfigurable) {
849
+ if (!configurableState)
842
850
  throw new Error(
843
- 'Multisig state is required to sign a key authorization.',
851
+ 'Configurable account state is required to sign a key authorization.',
844
852
  )
845
853
  return SignatureEnvelope.serialize(
846
- await signMultisig(account, {
847
- config: multisigState.config,
854
+ await signConfigurable(account, {
855
+ config: configurableState.config,
848
856
  payload: hash,
849
857
  signatures: signatures?.map((signature) => parseApproval(signature)),
850
858
  }),
@@ -878,13 +886,13 @@ export declare namespace signKeyAuthorization {
878
886
  */
879
887
  admin?: boolean | undefined
880
888
  key: resolveAccessKey.Parameters
881
- /** @internal Current state used when a multisig account signs the authorization. */
882
- multisig?:
889
+ /** @internal Current state used when a configurable account signs the authorization. */
890
+ configurable?:
883
891
  | {
884
- config: MultisigConfig.Config
892
+ config: AccountConfig.Config
885
893
  }
886
894
  | undefined
887
- /** Serialized approvals from external multisig owners. */
895
+ /** Serialized approvals from external owners. */
888
896
  signatures?: readonly SignatureEnvelope.Serialized[] | undefined
889
897
  }
890
898
 
@@ -966,20 +974,23 @@ function fromBase(parameters: fromBase.Parameters): Account_base {
966
974
 
967
975
  const payload = keccak256(await serializer(presign))
968
976
 
969
- // Native multisig (TIP-1061): return this owner's approval, a serialized
970
- // primitive signature over the multisig owner approval digest, instead of
977
+ // Configurable account (TIP-1107): return this owner's approval, a serialized
978
+ // primitive signature over the owner approval digest, instead of
971
979
  // a full serialized transaction. Approvals are combined later in
972
980
  // `sendTransaction({ signatures })`.
973
- const { multisigSimulation, from } = transaction as {
981
+ const { accountSimulation, from } = transaction as {
974
982
  from?: Address.Address
975
- multisigSimulation?: {
976
- config: MultisigConfig.Config
983
+ accountSimulation?: {
984
+ config: AccountConfig.Config
977
985
  }
978
986
  }
979
- if (multisigSimulation) {
980
- if (!from) throw new Error('A multisig sender is required for signing.')
981
- const config = MultisigConfig.from(multisigSimulation.config)
982
- const digest = MultisigConfig.getSignPayload({
987
+ if (accountSimulation) {
988
+ if (!from)
989
+ throw new Error(
990
+ 'A configurable account sender is required for signing.',
991
+ )
992
+ const config = AccountConfig.from(accountSimulation.config)
993
+ const digest = AccountConfig.getSignPayload({
983
994
  account: from,
984
995
  config,
985
996
  payload,
package/tempo/Client.ts CHANGED
@@ -107,7 +107,7 @@ export type CreateClientErrorType = ErrorType
107
107
  * client can be created with `createClient()`. Pass `testnet` to use the
108
108
  * Tempo testnet, or `chain` to override the chain entirely. Pass `feeToken`
109
109
  * to set a default fee token for every transaction. Use `withRelay` with a
110
- * `Relay.multisig` plugin to coordinate multisig owner approvals.
110
+ * `Relay.accounts` plugin to coordinate owner approvals.
111
111
  *
112
112
  * @example
113
113
  * ```ts
@@ -143,10 +143,10 @@ export type CreateClientErrorType = ErrorType
143
143
  * ```ts
144
144
  * import { createClient, http, Relay, Store, withRelay } from 'viem/tempo'
145
145
  *
146
- * // Multisig coordination with a client-local in-memory store.
146
+ * // Account coordination with a client-local in-memory store.
147
147
  * const client = createClient({
148
148
  * transport: withRelay(http(), {
149
- * plugins: [Relay.multisig({ store: Store.memory() })],
149
+ * plugins: [Relay.accounts({ store: Store.memory() })],
150
150
  * }),
151
151
  * })
152
152
  * ```
@@ -4,13 +4,13 @@ import { bindActionDecorators, type Client } from '../clients/createClient.js'
4
4
  import type { Transport } from '../clients/transports/createTransport.js'
5
5
  import type { Chain } from '../types/chain.js'
6
6
  import * as accessKeyActions from './actions/accessKey.js'
7
+ import * as accountsActions from './actions/accounts.js'
7
8
  import * as ammActions from './actions/amm.js'
8
9
  import * as channelActions from './actions/channel.js'
9
10
  import * as dexActions from './actions/dex.js'
10
11
  import * as earnActions from './actions/earn.js'
11
12
  import * as faucetActions from './actions/faucet.js'
12
13
  import * as feeActions from './actions/fee.js'
13
- import * as multisigActions from './actions/multisig.js'
14
14
  import * as nonceActions from './actions/nonce.js'
15
15
  import * as policyActions from './actions/policy.js'
16
16
  import * as propAmmActions from './actions/propAmm.js'
@@ -308,13 +308,41 @@ type DecoratorBase<
308
308
  parameters: accessKeyActions.revokeSync.Parameters<chain, account>,
309
309
  ) => Promise<accessKeyActions.revokeSync.ReturnValue>
310
310
  /**
311
- * Signs a key authorization or adds one coordinated multisig approval.
311
+ * Saves a signed key authorization to a relay with key authorization storage.
312
+ *
313
+ * The relay attaches the authorization to the access key's next transaction
314
+ * until the key is active onchain. Requires a relay running the
315
+ * `Relay.keyAuthorization` plugin.
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { createClient, http } from 'viem'
320
+ * import { tempo } from 'viem/chains'
321
+ * import { tempoActions, withRelay } from 'viem/tempo'
322
+ *
323
+ * const client = createClient({
324
+ * chain: tempo,
325
+ * transport: withRelay(http(), http('https://relay.example.com'), {
326
+ * keyAuthorization: true,
327
+ * }),
328
+ * }).extend(tempoActions())
329
+ *
330
+ * await client.accessKey.saveAuthorization({ keyAuthorization })
331
+ * ```
332
+ *
333
+ * @param parameters - Parameters.
334
+ */
335
+ saveAuthorization: (
336
+ parameters: accessKeyActions.saveAuthorization.Parameters,
337
+ ) => Promise<accessKeyActions.saveAuthorization.ReturnValue>
338
+ /**
339
+ * Signs a key authorization or adds one coordinated owner approval.
312
340
  *
313
341
  * @example
314
342
  * ```ts
315
343
  * const pending = await client.accessKey.signAuthorization({
316
344
  * accessKey,
317
- * account: multisig,
345
+ * account: configurable,
318
346
  * owner: owner_1,
319
347
  * })
320
348
  * const success = await client.accessKey.signAuthorization({
@@ -324,7 +352,7 @@ type DecoratorBase<
324
352
  * ```
325
353
  *
326
354
  * @param parameters - Authorization fields, or a stored operation hash.
327
- * @returns A signed key authorization with multisig operation metadata when coordinated.
355
+ * @returns A signed key authorization with account operation metadata when coordinated.
328
356
  */
329
357
  signAuthorization: {
330
358
  (
@@ -474,6 +502,48 @@ type DecoratorBase<
474
502
  parameters: accessKeyActions.watchWitnessBurned.Parameters,
475
503
  ) => ReturnType<typeof accessKeyActions.watchWitnessBurned>
476
504
  }
505
+ accounts: {
506
+ /**
507
+ * Gets the current cached config for a configurable account.
508
+ *
509
+ * @param parameters - Parameters.
510
+ * @returns The config, or `null` when it is unknown.
511
+ */
512
+ getConfig: (
513
+ parameters: accountsActions.getConfig.Parameters,
514
+ ) => Promise<accountsActions.getConfig.ReturnValue>
515
+ /** Gets the current configuration commitment for a configurable account. */
516
+ getConfigCommitment: (
517
+ parameters: accountsActions.getConfigCommitment.Parameters,
518
+ ) => Promise<accountsActions.getConfigCommitment.ReturnValue>
519
+ /**
520
+ * Gets a coordinated account operation by its hash.
521
+ *
522
+ * @param parameters - Parameters.
523
+ * @returns The operation, or `null` when it is unknown.
524
+ */
525
+ getOperation: (
526
+ parameters: accountsActions.getOperation.Parameters,
527
+ ) => Promise<accountsActions.getOperation.ReturnValue>
528
+ /**
529
+ * Replaces the current configuration for a configurable account.
530
+ *
531
+ * @param parameters - New configuration and transaction parameters.
532
+ * @returns The transaction hash.
533
+ */
534
+ updateConfig: (
535
+ parameters: accountsActions.updateConfig.Parameters<chain, account>,
536
+ ) => Promise<accountsActions.updateConfig.ReturnValue>
537
+ /**
538
+ * Replaces a configurable account configuration and waits for confirmation.
539
+ *
540
+ * @param parameters - New configuration and transaction parameters.
541
+ * @returns The update event and transaction receipt.
542
+ */
543
+ updateConfigSync: (
544
+ parameters: accountsActions.updateConfigSync.Parameters<chain, account>,
545
+ ) => Promise<accountsActions.updateConfigSync.ReturnValue>
546
+ }
477
547
  amm: {
478
548
  /**
479
549
  * Gets the reserves for a liquidity pool.
@@ -2392,48 +2462,6 @@ type DecoratorBase<
2392
2462
  parameters: faucetActions.fundSync.Parameters,
2393
2463
  ) => Promise<faucetActions.fundSync.ReturnValue>
2394
2464
  }
2395
- multisig: {
2396
- /**
2397
- * Gets the current cached config for a multisig account.
2398
- *
2399
- * @param parameters - Parameters.
2400
- * @returns The config, or `null` when it is unknown.
2401
- */
2402
- getConfig: (
2403
- parameters: multisigActions.getConfig.Parameters,
2404
- ) => Promise<multisigActions.getConfig.ReturnValue>
2405
- /** Gets the current configuration commitment for a multisig account. */
2406
- getConfigCommitment: (
2407
- parameters: multisigActions.getConfigCommitment.Parameters,
2408
- ) => Promise<multisigActions.getConfigCommitment.ReturnValue>
2409
- /**
2410
- * Gets a coordinated multisig operation by its hash.
2411
- *
2412
- * @param parameters - Parameters.
2413
- * @returns The operation, or `null` when it is unknown.
2414
- */
2415
- getOperation: (
2416
- parameters: multisigActions.getOperation.Parameters,
2417
- ) => Promise<multisigActions.getOperation.ReturnValue>
2418
- /**
2419
- * Replaces the current configuration for a native multisig account.
2420
- *
2421
- * @param parameters - New configuration and transaction parameters.
2422
- * @returns The transaction hash.
2423
- */
2424
- updateConfig: (
2425
- parameters: multisigActions.updateConfig.Parameters<chain, account>,
2426
- ) => Promise<multisigActions.updateConfig.ReturnValue>
2427
- /**
2428
- * Replaces a native multisig configuration and waits for confirmation.
2429
- *
2430
- * @param parameters - New configuration and transaction parameters.
2431
- * @returns The update event and transaction receipt.
2432
- */
2433
- updateConfigSync: (
2434
- parameters: multisigActions.updateConfigSync.Parameters<chain, account>,
2435
- ) => Promise<multisigActions.updateConfigSync.ReturnValue>
2436
- }
2437
2465
  nonce: {
2438
2466
  /**
2439
2467
  * Gets the nonce for an account and nonce key.
@@ -6064,6 +6092,10 @@ export type Decorator<
6064
6092
  DecoratorBase<chain, account>['accessKey'],
6065
6093
  typeof accessKeyActions
6066
6094
  >
6095
+ accounts: DecorateNamespace<
6096
+ DecoratorBase<chain, account>['accounts'],
6097
+ typeof accountsActions
6098
+ >
6067
6099
  amm: DecorateNamespace<
6068
6100
  DecoratorBase<chain, account>['amm'],
6069
6101
  typeof ammActions
@@ -6084,10 +6116,6 @@ export type Decorator<
6084
6116
  DecoratorBase<chain, account>['faucet'],
6085
6117
  typeof faucetActions
6086
6118
  >
6087
- multisig: DecorateNamespace<
6088
- DecoratorBase<chain, account>['multisig'],
6089
- typeof multisigActions
6090
- >
6091
6119
  nonce: DecorateNamespace<
6092
6120
  DecoratorBase<chain, account>['nonce'],
6093
6121
  typeof nonceActions
@@ -6166,6 +6194,7 @@ export function decorator() {
6166
6194
  'prepareAuthorization',
6167
6195
  'revoke',
6168
6196
  'revokeSync',
6197
+ 'saveAuthorization',
6169
6198
  'signAuthorization',
6170
6199
  'updateLimit',
6171
6200
  'updateLimitSync',
@@ -6174,6 +6203,13 @@ export function decorator() {
6174
6203
  'watchWitness',
6175
6204
  'watchWitnessBurned',
6176
6205
  ]),
6206
+ accounts: bindActions(client, accountsActions, [
6207
+ 'getConfig',
6208
+ 'getConfigCommitment',
6209
+ 'getOperation',
6210
+ 'updateConfig',
6211
+ 'updateConfigSync',
6212
+ ]),
6177
6213
  amm: bindActions(client, ammActions, [
6178
6214
  'getPool',
6179
6215
  'getLiquidityBalance',
@@ -6262,13 +6298,6 @@ export function decorator() {
6262
6298
  'withdrawExactSync',
6263
6299
  ]),
6264
6300
  faucet: bindActions(client, faucetActions, ['fund', 'fundSync']),
6265
- multisig: bindActions(client, multisigActions, [
6266
- 'getConfig',
6267
- 'getConfigCommitment',
6268
- 'getOperation',
6269
- 'updateConfig',
6270
- 'updateConfigSync',
6271
- ]),
6272
6301
  nonce: bindActions(client, nonceActions, [
6273
6302
  'getNonce',
6274
6303
  'watchNonceIncremented',