viem 2.57.3 → 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 (246) hide show
  1. package/CHANGELOG.md +34 -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/Abis.js +216 -1
  20. package/_cjs/tempo/Abis.js.map +1 -1
  21. package/_cjs/tempo/Account.js +40 -40
  22. package/_cjs/tempo/Account.js.map +1 -1
  23. package/_cjs/tempo/Addresses.js +2 -1
  24. package/_cjs/tempo/Addresses.js.map +1 -1
  25. package/_cjs/tempo/Decorator.js +9 -8
  26. package/_cjs/tempo/Decorator.js.map +1 -1
  27. package/_cjs/tempo/ExecutionError.js +1 -1
  28. package/_cjs/tempo/ExecutionError.js.map +1 -1
  29. package/_cjs/tempo/Formatters.js +8 -7
  30. package/_cjs/tempo/Formatters.js.map +1 -1
  31. package/_cjs/tempo/KeyAuthorizationManager.js +25 -16
  32. package/_cjs/tempo/KeyAuthorizationManager.js.map +1 -1
  33. package/_cjs/tempo/Relay.js +9 -4
  34. package/_cjs/tempo/Relay.js.map +1 -1
  35. package/_cjs/tempo/Selectors.js +13 -1
  36. package/_cjs/tempo/Selectors.js.map +1 -1
  37. package/_cjs/tempo/Transaction.js +9 -9
  38. package/_cjs/tempo/Transaction.js.map +1 -1
  39. package/_cjs/tempo/Transport.js +21 -11
  40. package/_cjs/tempo/Transport.js.map +1 -1
  41. package/_cjs/tempo/{multisig → accounts}/Config.js +8 -8
  42. package/_cjs/tempo/{multisig → accounts}/Config.js.map +1 -1
  43. package/_cjs/tempo/{multisig → accounts}/Operation.js +10 -10
  44. package/_cjs/tempo/{multisig → accounts}/Operation.js.map +1 -1
  45. package/_cjs/tempo/{multisig → accounts}/Signature.js +2 -2
  46. package/_cjs/tempo/accounts/Signature.js.map +1 -0
  47. package/_cjs/tempo/actions/accessKey.js +60 -37
  48. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  49. package/_cjs/tempo/actions/{multisig.js → accounts.js} +13 -18
  50. package/_cjs/tempo/actions/accounts.js.map +1 -0
  51. package/_cjs/tempo/actions/index.js +2 -2
  52. package/_cjs/tempo/actions/index.js.map +1 -1
  53. package/_cjs/tempo/chainConfig.js +37 -37
  54. package/_cjs/tempo/chainConfig.js.map +1 -1
  55. package/_cjs/tempo/index.js +3 -3
  56. package/_cjs/tempo/index.js.map +1 -1
  57. package/_cjs/tempo/internal/relay/{multisig.js → accounts.js} +90 -93
  58. package/_cjs/tempo/internal/relay/accounts.js.map +1 -0
  59. package/_cjs/tempo/internal/relay/keyAuthorization.js +296 -0
  60. package/_cjs/tempo/internal/relay/keyAuthorization.js.map +1 -0
  61. package/_cjs/tempo/internal/relay/plugin.js +17 -7
  62. package/_cjs/tempo/internal/relay/plugin.js.map +1 -1
  63. package/_cjs/utils/hash/normalizeSignature.js +1 -1
  64. package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
  65. package/_cjs/utils/rpc/http.js +66 -31
  66. package/_cjs/utils/rpc/http.js.map +1 -1
  67. package/_cjs/utils/rpc/socket.js +1 -1
  68. package/_cjs/utils/rpc/socket.js.map +1 -1
  69. package/_esm/actions/public/waitForTransactionReceipt.js +5 -2
  70. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  71. package/_esm/actions/wallet/waitForCallsStatus.js +39 -2
  72. package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
  73. package/_esm/chains/definitions/arcTestnet.js +11 -8
  74. package/_esm/chains/definitions/arcTestnet.js.map +1 -1
  75. package/_esm/chains/definitions/qmsTestnet.js +27 -0
  76. package/_esm/chains/definitions/qmsTestnet.js.map +1 -0
  77. package/_esm/chains/definitions/tempo.js +1 -1
  78. package/_esm/chains/definitions/tempoModerato.js +2 -2
  79. package/_esm/chains/index.js +1 -0
  80. package/_esm/chains/index.js.map +1 -1
  81. package/_esm/clients/transports/ipc.js +21 -10
  82. package/_esm/clients/transports/ipc.js.map +1 -1
  83. package/_esm/clients/transports/webSocket.js +21 -10
  84. package/_esm/clients/transports/webSocket.js.map +1 -1
  85. package/_esm/errors/version.js +1 -1
  86. package/_esm/tempo/Abis.js +216 -0
  87. package/_esm/tempo/Abis.js.map +1 -1
  88. package/_esm/tempo/Account.js +42 -42
  89. package/_esm/tempo/Account.js.map +1 -1
  90. package/_esm/tempo/Addresses.js +1 -0
  91. package/_esm/tempo/Addresses.js.map +1 -1
  92. package/_esm/tempo/Client.js +3 -3
  93. package/_esm/tempo/Decorator.js +9 -8
  94. package/_esm/tempo/Decorator.js.map +1 -1
  95. package/_esm/tempo/ExecutionError.js +1 -1
  96. package/_esm/tempo/ExecutionError.js.map +1 -1
  97. package/_esm/tempo/Formatters.js +11 -10
  98. package/_esm/tempo/Formatters.js.map +1 -1
  99. package/_esm/tempo/KeyAuthorizationManager.js +58 -16
  100. package/_esm/tempo/KeyAuthorizationManager.js.map +1 -1
  101. package/_esm/tempo/Relay.js +49 -8
  102. package/_esm/tempo/Relay.js.map +1 -1
  103. package/_esm/tempo/Selectors.js +12 -0
  104. package/_esm/tempo/Selectors.js.map +1 -1
  105. package/_esm/tempo/Transaction.js +11 -11
  106. package/_esm/tempo/Transaction.js.map +1 -1
  107. package/_esm/tempo/Transport.js +22 -12
  108. package/_esm/tempo/Transport.js.map +1 -1
  109. package/_esm/tempo/{multisig → accounts}/Config.js +14 -14
  110. package/_esm/tempo/{multisig → accounts}/Config.js.map +1 -1
  111. package/_esm/tempo/{multisig → accounts}/Operation.js +17 -17
  112. package/_esm/tempo/{multisig → accounts}/Operation.js.map +1 -1
  113. package/_esm/tempo/accounts/Signature.js +9 -0
  114. package/_esm/tempo/accounts/Signature.js.map +1 -0
  115. package/_esm/tempo/actions/accessKey.js +93 -38
  116. package/_esm/tempo/actions/accessKey.js.map +1 -1
  117. package/_esm/tempo/actions/{multisig.js → accounts.js} +31 -36
  118. package/_esm/tempo/actions/accounts.js.map +1 -0
  119. package/_esm/tempo/actions/index.js +1 -1
  120. package/_esm/tempo/actions/index.js.map +1 -1
  121. package/_esm/tempo/chainConfig.js +38 -38
  122. package/_esm/tempo/chainConfig.js.map +1 -1
  123. package/_esm/tempo/index.js +2 -1
  124. package/_esm/tempo/index.js.map +1 -1
  125. package/_esm/tempo/internal/relay/{multisig.js → accounts.js} +93 -98
  126. package/_esm/tempo/internal/relay/accounts.js.map +1 -0
  127. package/_esm/tempo/internal/relay/feePayer.js +1 -1
  128. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  129. package/_esm/tempo/internal/relay/keyAuthorization.js +334 -0
  130. package/_esm/tempo/internal/relay/keyAuthorization.js.map +1 -0
  131. package/_esm/tempo/internal/relay/plugin.js +15 -6
  132. package/_esm/tempo/internal/relay/plugin.js.map +1 -1
  133. package/_esm/utils/hash/normalizeSignature.js +3 -2
  134. package/_esm/utils/hash/normalizeSignature.js.map +1 -1
  135. package/_esm/utils/rpc/http.js +74 -31
  136. package/_esm/utils/rpc/http.js.map +1 -1
  137. package/_esm/utils/rpc/socket.js +3 -1
  138. package/_esm/utils/rpc/socket.js.map +1 -1
  139. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  140. package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
  141. package/_types/chains/definitions/arcTestnet.d.ts +5 -5
  142. package/_types/chains/definitions/arcTestnet.d.ts.map +1 -1
  143. package/_types/chains/definitions/qmsTestnet.d.ts +50 -0
  144. package/_types/chains/definitions/qmsTestnet.d.ts.map +1 -0
  145. package/_types/chains/definitions/tempo.d.ts +2 -2
  146. package/_types/chains/definitions/tempoModerato.d.ts +4 -4
  147. package/_types/chains/index.d.ts +1 -0
  148. package/_types/chains/index.d.ts.map +1 -1
  149. package/_types/clients/transports/ipc.d.ts.map +1 -1
  150. package/_types/clients/transports/webSocket.d.ts.map +1 -1
  151. package/_types/errors/version.d.ts +1 -1
  152. package/_types/tempo/Abis.d.ts +1935 -899
  153. package/_types/tempo/Abis.d.ts.map +1 -1
  154. package/_types/tempo/Account.d.ts +28 -28
  155. package/_types/tempo/Account.d.ts.map +1 -1
  156. package/_types/tempo/Addresses.d.ts +1 -0
  157. package/_types/tempo/Addresses.d.ts.map +1 -1
  158. package/_types/tempo/Client.d.ts +3 -3
  159. package/_types/tempo/Decorator.d.ts +63 -37
  160. package/_types/tempo/Decorator.d.ts.map +1 -1
  161. package/_types/tempo/Formatters.d.ts.map +1 -1
  162. package/_types/tempo/KeyAuthorizationManager.d.ts +45 -2
  163. package/_types/tempo/KeyAuthorizationManager.d.ts.map +1 -1
  164. package/_types/tempo/Relay.d.ts +62 -12
  165. package/_types/tempo/Relay.d.ts.map +1 -1
  166. package/_types/tempo/Selectors.d.ts +12 -0
  167. package/_types/tempo/Selectors.d.ts.map +1 -1
  168. package/_types/tempo/Transaction.d.ts +14 -11
  169. package/_types/tempo/Transaction.d.ts.map +1 -1
  170. package/_types/tempo/Transport.d.ts +20 -7
  171. package/_types/tempo/Transport.d.ts.map +1 -1
  172. package/_types/tempo/{multisig → accounts}/Config.d.ts +7 -7
  173. package/_types/tempo/accounts/Config.d.ts.map +1 -0
  174. package/_types/tempo/{multisig → accounts}/Operation.d.ts +7 -7
  175. package/_types/tempo/accounts/Operation.d.ts.map +1 -0
  176. package/_types/tempo/{multisig → accounts}/Signature.d.ts +1 -1
  177. package/_types/tempo/accounts/Signature.d.ts.map +1 -0
  178. package/_types/tempo/actions/accessKey.d.ts +59 -17
  179. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  180. package/_types/tempo/actions/{multisig.d.ts → accounts.d.ts} +28 -28
  181. package/_types/tempo/actions/{multisig.d.ts.map → accounts.d.ts.map} +1 -1
  182. package/_types/tempo/actions/index.d.ts +1 -1
  183. package/_types/tempo/actions/index.d.ts.map +1 -1
  184. package/_types/tempo/index.d.ts +3 -2
  185. package/_types/tempo/index.d.ts.map +1 -1
  186. package/_types/tempo/internal/relay/accounts.d.ts +15 -0
  187. package/_types/tempo/internal/relay/accounts.d.ts.map +1 -0
  188. package/_types/tempo/internal/relay/keyAuthorization.d.ts +25 -0
  189. package/_types/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
  190. package/_types/tempo/internal/relay/plugin.d.ts +6 -3
  191. package/_types/tempo/internal/relay/plugin.d.ts.map +1 -1
  192. package/_types/tempo/internal/relay/utils.d.ts +59 -0
  193. package/_types/tempo/internal/relay/utils.d.ts.map +1 -1
  194. package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
  195. package/_types/utils/rpc/http.d.ts.map +1 -1
  196. package/_types/utils/rpc/socket.d.ts.map +1 -1
  197. package/actions/public/waitForTransactionReceipt.ts +8 -2
  198. package/actions/wallet/waitForCallsStatus.ts +41 -2
  199. package/chains/definitions/arcTestnet.ts +11 -8
  200. package/chains/definitions/qmsTestnet.ts +27 -0
  201. package/chains/definitions/tempo.ts +1 -1
  202. package/chains/definitions/tempoModerato.ts +2 -2
  203. package/chains/index.ts +1 -0
  204. package/clients/transports/ipc.ts +38 -29
  205. package/clients/transports/webSocket.ts +42 -33
  206. package/errors/version.ts +1 -1
  207. package/package.json +2 -2
  208. package/tempo/Abis.ts +217 -0
  209. package/tempo/Account.ts +95 -84
  210. package/tempo/Addresses.ts +1 -0
  211. package/tempo/Client.ts +3 -3
  212. package/tempo/Decorator.ts +86 -57
  213. package/tempo/ExecutionError.ts +1 -1
  214. package/tempo/Formatters.ts +14 -13
  215. package/tempo/KeyAuthorizationManager.ts +71 -19
  216. package/tempo/Relay.ts +70 -14
  217. package/tempo/Selectors.ts +13 -0
  218. package/tempo/Transaction.ts +31 -23
  219. package/tempo/Transport.ts +49 -21
  220. package/tempo/{multisig → accounts}/Config.ts +21 -21
  221. package/tempo/{multisig → accounts}/Operation.ts +26 -26
  222. package/tempo/{multisig → accounts}/Signature.ts +5 -3
  223. package/tempo/actions/accessKey.ts +179 -79
  224. package/tempo/actions/{multisig.ts → accounts.ts} +47 -56
  225. package/tempo/actions/index.ts +1 -1
  226. package/tempo/chainConfig.ts +52 -52
  227. package/tempo/index.ts +5 -4
  228. package/tempo/internal/relay/{multisig.ts → accounts.ts} +118 -118
  229. package/tempo/internal/relay/feePayer.ts +1 -1
  230. package/tempo/internal/relay/keyAuthorization.ts +415 -0
  231. package/tempo/internal/relay/plugin.ts +20 -7
  232. package/utils/hash/normalizeSignature.ts +3 -2
  233. package/utils/rpc/http.ts +76 -30
  234. package/utils/rpc/socket.ts +3 -1
  235. package/_cjs/tempo/actions/multisig.js.map +0 -1
  236. package/_cjs/tempo/internal/relay/multisig.js.map +0 -1
  237. package/_cjs/tempo/multisig/Signature.js.map +0 -1
  238. package/_esm/tempo/actions/multisig.js.map +0 -1
  239. package/_esm/tempo/internal/relay/multisig.js.map +0 -1
  240. package/_esm/tempo/multisig/Signature.js +0 -9
  241. package/_esm/tempo/multisig/Signature.js.map +0 -1
  242. package/_types/tempo/internal/relay/multisig.d.ts +0 -4
  243. package/_types/tempo/internal/relay/multisig.d.ts.map +0 -1
  244. package/_types/tempo/multisig/Config.d.ts.map +0 -1
  245. package/_types/tempo/multisig/Operation.d.ts.map +0 -1
  246. package/_types/tempo/multisig/Signature.d.ts.map +0 -1
@@ -32,6 +32,7 @@ export const validator = '0xcccccccc00000000000000000000000000000000'
32
32
  export const validatorV2 = '0xcccccccc00000000000000000000000000000001'
33
33
  export const zoneFactory = '0x5aF2000000000000000000000000000000000000'
34
34
  export const zoneMessenger = '0x5A4d000000000000000000000000000000000000'
35
+ export const zoneInbox = '0x1c00000000000000000000000000000000000001'
35
36
  export const zoneOutbox = '0x1c00000000000000000000000000000000000002'
36
37
  export const zonePortalImplementation =
37
38
  '0x5AD1000000000000000000000000000000000000'
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',
@@ -114,7 +114,7 @@ export const messages: Record<`${AbiErrorName}(${string})`, string> = {
114
114
  'InvalidMasterAddress()': 'Invalid master address.',
115
115
  'InvalidMigrationIndex()': 'Invalid migration index.',
116
116
  'InvalidMode()': 'Invalid mode.',
117
- 'InvalidMultisigOwner()': 'Invalid multisig owner.',
117
+ 'InvalidMultisigOwner()': 'Invalid owner.',
118
118
  'InvalidNonceKey()': 'Invalid nonce key.',
119
119
  'InvalidOwner()': 'Invalid owner.',
120
120
  'InvalidOwnerOrder()': 'Invalid owner order.',
@@ -3,7 +3,7 @@
3
3
  import type { Address } from 'abitype'
4
4
  import * as Hex from 'ox/Hex'
5
5
  import {
6
- MultisigOperation,
6
+ AccountOperation,
7
7
  Transaction as ox_Transaction,
8
8
  TransactionRequest as ox_TransactionRequest,
9
9
  } from 'ox/tempo'
@@ -12,7 +12,7 @@ import { parseAccount } from '../accounts/utils/parseAccount.js'
12
12
  import { formatTransaction as viem_formatTransaction } from '../utils/formatters/transaction.js'
13
13
  import { formatTransactionReceipt as viem_formatTransactionReceipt } from '../utils/formatters/transactionReceipt.js'
14
14
  import { formatTransactionRequest as viem_formatTransactionRequest } from '../utils/formatters/transactionRequest.js'
15
- import type { Account, MultisigAccount } from './Account.js'
15
+ import type { Account, ConfigurableAccount } from './Account.js'
16
16
  import {
17
17
  isTempo,
18
18
  type Transaction,
@@ -33,7 +33,7 @@ export function formatTransaction(
33
33
  transaction.blockTimestamp == null
34
34
  ? undefined
35
35
  : BigInt(transaction.blockTimestamp)
36
- const multisig = transaction.multisig
36
+ const operation = transaction.operation
37
37
  const {
38
38
  feePayerSignature,
39
39
  gasPrice: _,
@@ -53,8 +53,8 @@ export function formatTransaction(
53
53
  yParity: feePayerSignature.yParity,
54
54
  }
55
55
  : undefined,
56
- multisig: formatMultisig(multisig),
57
56
  nonce: Number(nonce),
57
+ operation: formatOperation(operation),
58
58
  typeHex:
59
59
  ox_Transaction.toRpcType[
60
60
  tx.type as keyof typeof ox_Transaction.toRpcType
@@ -69,7 +69,7 @@ export function formatTransactionReceipt(
69
69
  const transactionReceipt = viem_formatTransactionReceipt(receipt as never)
70
70
  return {
71
71
  ...transactionReceipt,
72
- multisig: formatMultisig(receipt.multisig),
72
+ operation: formatOperation(receipt.operation),
73
73
  ...(receipt.status === 'pending'
74
74
  ? { status: 'pending', type: 'tempo' }
75
75
  : {}),
@@ -77,11 +77,11 @@ export function formatTransactionReceipt(
77
77
  }
78
78
 
79
79
  /** Formats a transaction operation attached to an RPC result. */
80
- function formatMultisig(value: MultisigOperation.TransactionRpc | undefined) {
80
+ function formatOperation(value: AccountOperation.TransactionRpc | undefined) {
81
81
  if (!value) return undefined
82
- const operation = MultisigOperation.fromRpc(value)
82
+ const operation = AccountOperation.fromRpc(value)
83
83
  if (operation.type !== 'transaction')
84
- throw new Error('Expected a multisig transaction operation.')
84
+ throw new Error('Expected an account transaction operation.')
85
85
  return operation
86
86
  }
87
87
 
@@ -98,21 +98,21 @@ export function formatTransactionRequest(
98
98
  keyData?: Hex.Hex | undefined
99
99
  keyId?: Address | undefined
100
100
  keyType?: 'p256' | 'secp256k1' | 'webAuthn' | undefined
101
- owner?: viem_Account | MultisigAccount | Address | undefined
101
+ owner?: viem_Account | ConfigurableAccount | Address | undefined
102
102
  signatures?: unknown
103
103
  }
104
104
  const account = request.account
105
105
  ? parseAccount<Account | viem_Account | Address>(request.account)
106
106
  : undefined
107
107
  const owner = request.owner
108
- ? parseAccount<Account | MultisigAccount | viem_Account | Address>(
108
+ ? parseAccount<Account | ConfigurableAccount | viem_Account | Address>(
109
109
  request.owner,
110
110
  )
111
111
  : undefined
112
112
 
113
113
  if (owner?.type === 'json-rpc')
114
114
  throw new Error(
115
- 'A local owner account is required to approve a multisig transaction.',
115
+ 'A local owner account is required to approve a configurable account transaction.',
116
116
  )
117
117
 
118
118
  // If the request is not a Tempo transaction, route to Viem formatter.
@@ -147,7 +147,7 @@ export function formatTransactionRequest(
147
147
  if (request.feePayer === true && !request.feePayerSignature)
148
148
  delete request.feeToken
149
149
 
150
- // Client-only TIP-1061 fields drive local signing and envelope assembly.
150
+ // Client-only TIP-1107 fields drive local signing and envelope assembly.
151
151
  const { owner: _owner, signatures: _signatures, ...rpcRequest } = request
152
152
 
153
153
  const rpc = ox_TransactionRequest.toRpc({
@@ -191,7 +191,8 @@ export function formatTransactionRequest(
191
191
  ...(keyData ? { keyData } : {}),
192
192
  ...(keyId ? { keyId } : {}),
193
193
  ...(keyType ? { keyType } : {}),
194
- // Keep the key visible to `extract`; the undefined value never reaches JSON-RPC.
194
+ // Keep client-only keys visible to `extract`; undefined values never reach JSON-RPC.
195
+ ...(request.accountSimulation ? { accountSimulation: undefined } : {}),
195
196
  ...(request.owner ? { owner: undefined } : {}),
196
197
  ...(typeof request.feePayer !== 'undefined'
197
198
  ? {
@@ -1,49 +1,101 @@
1
1
  import type { Address } from 'abitype'
2
- import type { KeyAuthorization } from 'ox/tempo'
2
+ import { KeyAuthorization } from 'ox/tempo'
3
3
  import type { MaybePromise } from '../types/utils.js'
4
+ import * as Store from './Store.js'
4
5
 
6
+ /** Identifies a pending key authorization by account, access key, and chain. */
5
7
  export type Key = {
8
+ /** Account the access key acts for. */
6
9
  address: Address
10
+ /** Access key address. */
7
11
  accessKey: Address
12
+ /** Chain the authorization is for. */
8
13
  chainId: number
9
14
  }
10
15
 
16
+ /** Pending key authorizations that the client attaches to an access key's next transaction. */
11
17
  export type KeyAuthorizationManager = {
18
+ /** Reads the pending authorization for a key. */
12
19
  get(key: Key): MaybePromise<KeyAuthorization.Signed | undefined>
20
+ /** Removes the pending authorization for a key. */
13
21
  remove(key: Key): MaybePromise<void>
22
+ /** Stores a pending authorization for a key. */
14
23
  set(key: Key, keyAuthorization: KeyAuthorization.Signed): MaybePromise<void>
15
24
  }
16
25
 
26
+ /**
27
+ * Creates a key authorization manager backed by a store.
28
+ *
29
+ * Entries use the same keys as the `Relay.keyAuthorization` plugin, so both can
30
+ * share one store.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { Account, KeyAuthorizationManager, Store } from 'viem/tempo'
35
+ *
36
+ * const accessKey = Account.fromP256(privateKey, {
37
+ * access: root,
38
+ * keyAuthorizationManager: KeyAuthorizationManager.from({
39
+ * store: Store.session(),
40
+ * }),
41
+ * })
42
+ * ```
43
+ *
44
+ * @param options - Manager options.
45
+ * @returns A key authorization manager.
46
+ */
17
47
  export function from(options: from.Options): KeyAuthorizationManager {
18
- return options.source
48
+ const { store } = options
49
+ return {
50
+ async get(key) {
51
+ const value = await store.getItem(getStoreKey(key))
52
+ if (!value) return undefined
53
+ try {
54
+ return KeyAuthorization.deserialize(
55
+ value as `0x${string}`,
56
+ ) as KeyAuthorization.Signed
57
+ } catch {
58
+ return undefined
59
+ }
60
+ },
61
+ async remove(key) {
62
+ await store.removeItem(getStoreKey(key))
63
+ },
64
+ async set(key, keyAuthorization) {
65
+ await store.setItem(
66
+ getStoreKey(key),
67
+ KeyAuthorization.serialize(keyAuthorization),
68
+ )
69
+ },
70
+ }
19
71
  }
20
72
 
21
73
  export declare namespace from {
22
74
  type Options = {
23
- source: KeyAuthorizationManager
75
+ /** Store for pending key authorizations. */
76
+ store: Store.Store
24
77
  }
25
78
  }
26
79
 
80
+ /**
81
+ * Creates a key authorization manager backed by a process-local memory store.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * import { KeyAuthorizationManager } from 'viem/tempo'
86
+ *
87
+ * const keyAuthorizationManager = KeyAuthorizationManager.memory()
88
+ * ```
89
+ *
90
+ * @returns A key authorization manager.
91
+ */
27
92
  export function memory(): KeyAuthorizationManager {
28
- const keyAuthorizations = new Map<string, KeyAuthorization.Signed>()
29
-
30
- return from({
31
- source: {
32
- get(key) {
33
- return keyAuthorizations.get(serializeKey(key))
34
- },
35
- remove(key) {
36
- keyAuthorizations.delete(serializeKey(key))
37
- },
38
- set(key, keyAuthorization) {
39
- keyAuthorizations.set(serializeKey(key), keyAuthorization)
40
- },
41
- },
42
- })
93
+ return from({ store: Store.memory() })
43
94
  }
44
95
 
45
- function serializeKey(key: Key) {
96
+ function getStoreKey(key: Key) {
46
97
  return [
98
+ 'keyAuthorization',
47
99
  key.chainId,
48
100
  key.address.toLowerCase(),
49
101
  key.accessKey.toLowerCase(),
package/tempo/Relay.ts CHANGED
@@ -4,9 +4,10 @@ import type { LocalAccount } from '../accounts/types.js'
4
4
  import type { Client as Client_ } from '../clients/createClient.js'
5
5
  import { ChainNotConfiguredError } from '../clients/createClientResolver.js'
6
6
  import type { EIP1193RequestOptions } from '../types/eip1193.js'
7
+ import * as Accounts from './internal/relay/accounts.js'
7
8
  import * as Sponsorship from './internal/relay/feePayer.js'
8
9
  import * as FeeToken from './internal/relay/feeToken.js'
9
- import * as Multisig from './internal/relay/multisig.js'
10
+ import * as KeyAuthorization from './internal/relay/keyAuthorization.js'
10
11
  import * as Request_ from './internal/relay/request.js'
11
12
  import * as Simulate from './internal/relay/simulate.js'
12
13
  import * as internal from './internal/relay.js'
@@ -307,13 +308,19 @@ export declare namespace Plugin {
307
308
  }
308
309
  }
309
310
 
310
- declare const multisigBrand: unique symbol
311
+ declare const accountsBrand: unique symbol
311
312
 
312
313
  /**
313
- * Coordinates native multisig approvals using shared atomic storage.
314
+ * Serves configurable accounts using shared atomic storage.
315
+ *
316
+ * The chain stores only a commitment to each account's config, so the plugin
317
+ * records every config it relays (including configs left by `updateConfig`
318
+ * calls) and serves them through `account_getConfig`. It also collects owner
319
+ * approvals until the account's threshold is met, then submits.
314
320
  *
315
321
  * Memory storage is process-local. Independent clients and multiple server
316
- * instances must use the same persistent store to share pending approvals.
322
+ * instances must use the same persistent store to share configs and pending
323
+ * approvals.
317
324
  *
318
325
  * @example
319
326
  * ```ts
@@ -321,31 +328,31 @@ declare const multisigBrand: unique symbol
321
328
  * import { Relay, Store, withRelay } from 'viem/tempo'
322
329
  *
323
330
  * const transport = withRelay(http(), {
324
- * plugins: [Relay.multisig({ store: Store.memory() })],
331
+ * plugins: [Relay.accounts({ store: Store.memory() })],
325
332
  * })
326
333
  * ```
327
334
  *
328
335
  * @param options - Shared atomic storage.
329
- * @returns A plugin that coordinates multisig requests and forwards other calls.
336
+ * @returns A plugin that handles configurable account requests and forwards other calls.
330
337
  */
331
- export function multisig(options: multisig.Options): multisig.ReturnType {
332
- return Multisig.create(options)
338
+ export function accounts(options: accounts.Options): accounts.ReturnType {
339
+ return Accounts.create(options)
333
340
  }
334
341
 
335
- export declare namespace multisig {
336
- /** Multisig coordination options. */
342
+ export declare namespace accounts {
343
+ /** Configurable account options. */
337
344
  export type Options = {
338
- /** Store shared by multisig coordinators, with atomic compare-and-set support. */
345
+ /** Store shared by relays, with atomic compare-and-set support. */
339
346
  store: Store.Atomic
340
347
  }
341
- /** Middleware advertising native multisig coordination. */
342
- export type ReturnType = Plugin & { readonly [multisigBrand]: true }
348
+ /** Middleware advertising configurable account support. */
349
+ export type ReturnType = Plugin & { readonly [accountsBrand]: true }
343
350
  }
344
351
 
345
352
  /**
346
353
  * Sponsors transactions with a local account or an external fee-payer relay.
347
354
  *
348
- * Place multisig before this plugin and fee-token selection after it.
355
+ * Place accounts before this plugin and fee-token selection after it.
349
356
  *
350
357
  * @example
351
358
  * ```ts
@@ -400,6 +407,55 @@ export function feeToken(): Plugin {
400
407
  return FeeToken.create()
401
408
  }
402
409
 
410
+ declare const keyAuthorizationBrand: unique symbol
411
+
412
+ /**
413
+ * Stores pending key authorizations and attaches them to the next fill that needs them.
414
+ *
415
+ * Signing a key authorization with `Actions.accessKey.signAuthorization` through a
416
+ * relay with this plugin saves it with `relay_saveKeyAuthorization`. Configurable
417
+ * account key authorizations are saved once they reach quorum. The next `eth_fillTransaction`
418
+ * from the access key includes the authorization until the key is active onchain.
419
+ * Remote `withRelay` transports opt in with `keyAuthorization: true`.
420
+ *
421
+ * Place this plugin before `Relay.accounts` so it can observe completed configurable
422
+ * account key authorizations, and before plugins that read the filled transaction.
423
+ *
424
+ * A saved authorization only replaces a pending authorization that expires earlier,
425
+ * so a replayed older authorization cannot replace a newer one.
426
+ *
427
+ * Memory storage is process-local. Multiple server instances must use the same
428
+ * persistent atomic store to share pending authorizations.
429
+ *
430
+ * @example
431
+ * ```ts
432
+ * import { http } from 'viem'
433
+ * import { Relay, Store, withRelay } from 'viem/tempo'
434
+ *
435
+ * const transport = withRelay(http(), {
436
+ * plugins: [Relay.keyAuthorization({ store: Store.memory() })],
437
+ * })
438
+ * ```
439
+ *
440
+ * @param options - Pending key authorization storage.
441
+ * @returns A plugin that stores and attaches pending key authorizations.
442
+ */
443
+ export function keyAuthorization(
444
+ options: keyAuthorization.Options = {},
445
+ ): keyAuthorization.ReturnType {
446
+ return KeyAuthorization.create(options)
447
+ }
448
+
449
+ export declare namespace keyAuthorization {
450
+ /** Key authorization storage options. */
451
+ export type Options = {
452
+ /** Store for pending key authorizations, with atomic compare-and-set support. Defaults to a process-local memory store. */
453
+ store?: Store.Atomic | undefined
454
+ }
455
+ /** Middleware advertising pending key authorization storage. */
456
+ export type ReturnType = Plugin & { readonly [keyAuthorizationBrand]: true }
457
+ }
458
+
403
459
  /**
404
460
  * Adds balance changes, estimated fees, and execution errors to fill capabilities.
405
461
  *
@@ -439,3 +439,16 @@ export const zoneOutbox = {
439
439
  export const zoneMessenger = {
440
440
  relayMessage: '0x11da5261',
441
441
  } as const satisfies FunctionSelectors<typeof Abis.zoneMessenger>
442
+
443
+ export const zoneInbox = {
444
+ advanceTempo: '0x86516ec0',
445
+ advanceTempoHeaders: '0xae58328d',
446
+ claimRefund: '0xbffa55d5',
447
+ processedDepositNumber: '0x2d488482',
448
+ processedDepositQueueHash: '0x82648c3b',
449
+ processedEnabledTokenCount: '0x1b366d74',
450
+ processedTokenEnablementHash: '0x8f2e461a',
451
+ refunds: '0x857e85f8',
452
+ tempoPortal: '0xa21de6d9',
453
+ tempoState: '0x1fbb25ad',
454
+ } as const satisfies FunctionSelectors<typeof Abis.zoneInbox>