viem 2.56.0 → 2.56.2

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 (250) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/actions/wallet/sendTransaction.js +9 -1
  3. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  4. package/_cjs/actions/wallet/sendTransactionSync.js +9 -1
  5. package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
  6. package/_cjs/errors/version.js +1 -1
  7. package/_cjs/tempo/Abis.js +11 -23
  8. package/_cjs/tempo/Abis.js.map +1 -1
  9. package/_cjs/tempo/Account.js +66 -61
  10. package/_cjs/tempo/Account.js.map +1 -1
  11. package/_cjs/tempo/Client.js +10 -2
  12. package/_cjs/tempo/Client.js.map +1 -1
  13. package/_cjs/tempo/Decorator.js +2 -1
  14. package/_cjs/tempo/Decorator.js.map +1 -1
  15. package/_cjs/tempo/Formatters.js +29 -9
  16. package/_cjs/tempo/Formatters.js.map +1 -1
  17. package/_cjs/tempo/Multisig.js +990 -0
  18. package/_cjs/tempo/Multisig.js.map +1 -0
  19. package/_cjs/tempo/Selectors.js +2 -3
  20. package/_cjs/tempo/Selectors.js.map +1 -1
  21. package/_cjs/tempo/{Storage.js → Store.js} +34 -9
  22. package/_cjs/tempo/Store.js.map +1 -0
  23. package/_cjs/tempo/Transaction.js +15 -30
  24. package/_cjs/tempo/Transaction.js.map +1 -1
  25. package/_cjs/tempo/Transport.js +51 -5
  26. package/_cjs/tempo/Transport.js.map +1 -1
  27. package/_cjs/tempo/actions/accessKey.js +102 -8
  28. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  29. package/_cjs/tempo/actions/amm.js +6 -0
  30. package/_cjs/tempo/actions/amm.js.map +1 -1
  31. package/_cjs/tempo/actions/channel.js +12 -0
  32. package/_cjs/tempo/actions/channel.js.map +1 -1
  33. package/_cjs/tempo/actions/dex.js +10 -0
  34. package/_cjs/tempo/actions/dex.js.map +1 -1
  35. package/_cjs/tempo/actions/earn/deployment.js +13 -1
  36. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  37. package/_cjs/tempo/actions/earn.js +17 -0
  38. package/_cjs/tempo/actions/earn.js.map +1 -1
  39. package/_cjs/tempo/actions/fee.js +4 -0
  40. package/_cjs/tempo/actions/fee.js.map +1 -1
  41. package/_cjs/tempo/actions/multisig.js +86 -28
  42. package/_cjs/tempo/actions/multisig.js.map +1 -1
  43. package/_cjs/tempo/actions/policy.js +8 -0
  44. package/_cjs/tempo/actions/policy.js.map +1 -1
  45. package/_cjs/tempo/actions/receivePolicy.js +6 -0
  46. package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
  47. package/_cjs/tempo/actions/reward.js +4 -0
  48. package/_cjs/tempo/actions/reward.js.map +1 -1
  49. package/_cjs/tempo/actions/token.js +32 -0
  50. package/_cjs/tempo/actions/token.js.map +1 -1
  51. package/_cjs/tempo/actions/virtualAddress.js +2 -0
  52. package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
  53. package/_cjs/tempo/actions/zone.js +7 -5
  54. package/_cjs/tempo/actions/zone.js.map +1 -1
  55. package/_cjs/tempo/chainConfig.js +180 -69
  56. package/_cjs/tempo/chainConfig.js.map +1 -1
  57. package/_cjs/tempo/index.js +5 -2
  58. package/_cjs/tempo/index.js.map +1 -1
  59. package/_cjs/tempo/internal/utils.js +2 -1
  60. package/_cjs/tempo/internal/utils.js.map +1 -1
  61. package/_cjs/tempo/multisig/Config.js +80 -0
  62. package/_cjs/tempo/multisig/Config.js.map +1 -0
  63. package/_cjs/tempo/multisig/Operation.js +163 -0
  64. package/_cjs/tempo/multisig/Operation.js.map +1 -0
  65. package/_cjs/utils/encoding/fromHex.js +1 -1
  66. package/_cjs/utils/encoding/fromHex.js.map +1 -1
  67. package/_cjs/utils/hash/isHash.js +1 -2
  68. package/_cjs/utils/hash/isHash.js.map +1 -1
  69. package/_esm/actions/wallet/sendTransaction.js +9 -1
  70. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  71. package/_esm/actions/wallet/sendTransactionSync.js +9 -1
  72. package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
  73. package/_esm/errors/version.js +1 -1
  74. package/_esm/tempo/Abis.js +11 -23
  75. package/_esm/tempo/Abis.js.map +1 -1
  76. package/_esm/tempo/Account.js +66 -61
  77. package/_esm/tempo/Account.js.map +1 -1
  78. package/_esm/tempo/Client.js +22 -3
  79. package/_esm/tempo/Client.js.map +1 -1
  80. package/_esm/tempo/Decorator.js +2 -1
  81. package/_esm/tempo/Decorator.js.map +1 -1
  82. package/_esm/tempo/Formatters.js +32 -11
  83. package/_esm/tempo/Formatters.js.map +1 -1
  84. package/_esm/tempo/Multisig.js +1020 -0
  85. package/_esm/tempo/Multisig.js.map +1 -0
  86. package/_esm/tempo/Selectors.js +2 -3
  87. package/_esm/tempo/Selectors.js.map +1 -1
  88. package/_esm/tempo/{Storage.js → Store.js} +37 -26
  89. package/_esm/tempo/Store.js.map +1 -0
  90. package/_esm/tempo/Transaction.js +16 -31
  91. package/_esm/tempo/Transaction.js.map +1 -1
  92. package/_esm/tempo/Transport.js +71 -6
  93. package/_esm/tempo/Transport.js.map +1 -1
  94. package/_esm/tempo/actions/accessKey.js +104 -20
  95. package/_esm/tempo/actions/accessKey.js.map +1 -1
  96. package/_esm/tempo/actions/amm.js +6 -0
  97. package/_esm/tempo/actions/amm.js.map +1 -1
  98. package/_esm/tempo/actions/channel.js +12 -0
  99. package/_esm/tempo/actions/channel.js.map +1 -1
  100. package/_esm/tempo/actions/dex.js +10 -0
  101. package/_esm/tempo/actions/dex.js.map +1 -1
  102. package/_esm/tempo/actions/earn/deployment.js +13 -1
  103. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  104. package/_esm/tempo/actions/earn.js +17 -0
  105. package/_esm/tempo/actions/earn.js.map +1 -1
  106. package/_esm/tempo/actions/fee.js +4 -0
  107. package/_esm/tempo/actions/fee.js.map +1 -1
  108. package/_esm/tempo/actions/multisig.js +129 -63
  109. package/_esm/tempo/actions/multisig.js.map +1 -1
  110. package/_esm/tempo/actions/policy.js +8 -0
  111. package/_esm/tempo/actions/policy.js.map +1 -1
  112. package/_esm/tempo/actions/receivePolicy.js +6 -0
  113. package/_esm/tempo/actions/receivePolicy.js.map +1 -1
  114. package/_esm/tempo/actions/reward.js +4 -0
  115. package/_esm/tempo/actions/reward.js.map +1 -1
  116. package/_esm/tempo/actions/token.js +32 -0
  117. package/_esm/tempo/actions/token.js.map +1 -1
  118. package/_esm/tempo/actions/virtualAddress.js +2 -0
  119. package/_esm/tempo/actions/virtualAddress.js.map +1 -1
  120. package/_esm/tempo/actions/zone.js +8 -6
  121. package/_esm/tempo/actions/zone.js.map +1 -1
  122. package/_esm/tempo/chainConfig.js +188 -86
  123. package/_esm/tempo/chainConfig.js.map +1 -1
  124. package/_esm/tempo/index.js +5 -3
  125. package/_esm/tempo/index.js.map +1 -1
  126. package/_esm/tempo/internal/utils.js +2 -1
  127. package/_esm/tempo/internal/utils.js.map +1 -1
  128. package/_esm/tempo/multisig/Config.js +84 -0
  129. package/_esm/tempo/multisig/Config.js.map +1 -0
  130. package/_esm/tempo/multisig/Operation.js +170 -0
  131. package/_esm/tempo/multisig/Operation.js.map +1 -0
  132. package/_esm/utils/encoding/fromHex.js +1 -1
  133. package/_esm/utils/encoding/fromHex.js.map +1 -1
  134. package/_esm/utils/hash/isHash.js +1 -2
  135. package/_esm/utils/hash/isHash.js.map +1 -1
  136. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  137. package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
  138. package/_types/chains/definitions/tempo.d.ts +72 -92
  139. package/_types/chains/definitions/tempo.d.ts.map +1 -1
  140. package/_types/chains/definitions/tempoDevnet.d.ts +72 -92
  141. package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
  142. package/_types/chains/definitions/tempoLocalnet.d.ts +72 -92
  143. package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
  144. package/_types/chains/definitions/tempoModerato.d.ts +72 -92
  145. package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
  146. package/_types/errors/version.d.ts +1 -1
  147. package/_types/tempo/Abis.d.ts +54 -108
  148. package/_types/tempo/Abis.d.ts.map +1 -1
  149. package/_types/tempo/Account.d.ts +47 -20
  150. package/_types/tempo/Account.d.ts.map +1 -1
  151. package/_types/tempo/Client.d.ts +23 -1
  152. package/_types/tempo/Client.d.ts.map +1 -1
  153. package/_types/tempo/Decorator.d.ts +30 -5
  154. package/_types/tempo/Decorator.d.ts.map +1 -1
  155. package/_types/tempo/Formatters.d.ts.map +1 -1
  156. package/_types/tempo/Multisig.d.ts +32 -0
  157. package/_types/tempo/Multisig.d.ts.map +1 -0
  158. package/_types/tempo/Selectors.d.ts +2 -3
  159. package/_types/tempo/Selectors.d.ts.map +1 -1
  160. package/_types/tempo/Store.d.ts +62 -0
  161. package/_types/tempo/Store.d.ts.map +1 -0
  162. package/_types/tempo/Transaction.d.ts +12 -31
  163. package/_types/tempo/Transaction.d.ts.map +1 -1
  164. package/_types/tempo/Transport.d.ts +37 -5
  165. package/_types/tempo/Transport.d.ts.map +1 -1
  166. package/_types/tempo/Zone.d.ts +468 -598
  167. package/_types/tempo/Zone.d.ts.map +1 -1
  168. package/_types/tempo/actions/accessKey.d.ts +38 -8
  169. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  170. package/_types/tempo/actions/amm.d.ts.map +1 -1
  171. package/_types/tempo/actions/channel.d.ts.map +1 -1
  172. package/_types/tempo/actions/dex.d.ts.map +1 -1
  173. package/_types/tempo/actions/earn/deployment.d.ts +3 -3
  174. package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
  175. package/_types/tempo/actions/earn.d.ts.map +1 -1
  176. package/_types/tempo/actions/fee.d.ts.map +1 -1
  177. package/_types/tempo/actions/multisig.d.ts +139 -136
  178. package/_types/tempo/actions/multisig.d.ts.map +1 -1
  179. package/_types/tempo/actions/policy.d.ts.map +1 -1
  180. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
  181. package/_types/tempo/actions/reward.d.ts.map +1 -1
  182. package/_types/tempo/actions/token.d.ts.map +1 -1
  183. package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
  184. package/_types/tempo/actions/zone.d.ts +4 -4
  185. package/_types/tempo/actions/zone.d.ts.map +1 -1
  186. package/_types/tempo/chainConfig.d.ts +38 -48
  187. package/_types/tempo/chainConfig.d.ts.map +1 -1
  188. package/_types/tempo/index.d.ts +8 -3
  189. package/_types/tempo/index.d.ts.map +1 -1
  190. package/_types/tempo/internal/types.d.ts +1 -1
  191. package/_types/tempo/internal/types.d.ts.map +1 -1
  192. package/_types/tempo/internal/utils.d.ts +1 -0
  193. package/_types/tempo/internal/utils.d.ts.map +1 -1
  194. package/_types/tempo/multisig/Config.d.ts +42 -0
  195. package/_types/tempo/multisig/Config.d.ts.map +1 -0
  196. package/_types/tempo/multisig/Operation.d.ts +32 -0
  197. package/_types/tempo/multisig/Operation.d.ts.map +1 -0
  198. package/_types/types/chain.d.ts +10 -0
  199. package/_types/types/chain.d.ts.map +1 -1
  200. package/_types/utils/hash/isHash.d.ts +1 -2
  201. package/_types/utils/hash/isHash.d.ts.map +1 -1
  202. package/actions/wallet/sendTransaction.ts +9 -1
  203. package/actions/wallet/sendTransactionSync.ts +9 -1
  204. package/errors/version.ts +1 -1
  205. package/package.json +2 -2
  206. package/tempo/Abis.ts +11 -23
  207. package/tempo/Account.ts +136 -105
  208. package/tempo/Client.ts +46 -3
  209. package/tempo/Decorator.ts +40 -8
  210. package/tempo/Formatters.ts +39 -21
  211. package/tempo/Multisig.ts +1349 -0
  212. package/tempo/Selectors.ts +2 -3
  213. package/tempo/Store.ts +170 -0
  214. package/tempo/Transaction.ts +39 -64
  215. package/tempo/Transport.ts +125 -10
  216. package/tempo/actions/accessKey.ts +210 -23
  217. package/tempo/actions/amm.ts +7 -0
  218. package/tempo/actions/channel.ts +12 -0
  219. package/tempo/actions/dex.ts +10 -0
  220. package/tempo/actions/earn/deployment.ts +16 -3
  221. package/tempo/actions/earn.ts +19 -0
  222. package/tempo/actions/fee.ts +4 -0
  223. package/tempo/actions/multisig.ts +192 -94
  224. package/tempo/actions/policy.ts +8 -0
  225. package/tempo/actions/receivePolicy.ts +6 -0
  226. package/tempo/actions/reward.ts +5 -0
  227. package/tempo/actions/token.ts +33 -0
  228. package/tempo/actions/virtualAddress.ts +2 -0
  229. package/tempo/actions/zone.ts +10 -8
  230. package/tempo/chainConfig.ts +259 -100
  231. package/tempo/index.ts +9 -1
  232. package/tempo/internal/types.ts +3 -2
  233. package/tempo/internal/utils.ts +2 -0
  234. package/tempo/multisig/Config.ts +131 -0
  235. package/tempo/multisig/Operation.ts +211 -0
  236. package/types/chain.ts +14 -0
  237. package/utils/encoding/fromHex.ts +1 -1
  238. package/utils/hash/isHash.ts +2 -3
  239. package/_cjs/tempo/Storage.js.map +0 -1
  240. package/_cjs/tempo/internal/multisig.js +0 -56
  241. package/_cjs/tempo/internal/multisig.js.map +0 -1
  242. package/_esm/tempo/Storage.js.map +0 -1
  243. package/_esm/tempo/internal/multisig.js +0 -56
  244. package/_esm/tempo/internal/multisig.js.map +0 -1
  245. package/_types/tempo/Storage.d.ts +0 -42
  246. package/_types/tempo/Storage.d.ts.map +0 -1
  247. package/_types/tempo/internal/multisig.d.ts +0 -13
  248. package/_types/tempo/internal/multisig.d.ts.map +0 -1
  249. package/tempo/Storage.ts +0 -115
  250. package/tempo/internal/multisig.ts +0 -72
@@ -1,5 +1,11 @@
1
1
  import type { Address } from 'abitype'
2
- import { MultisigConfig } from 'ox/tempo'
2
+ import type * as Hex from 'ox/Hex'
3
+ import type * as RpcSchema from 'ox/RpcSchema'
4
+ import {
5
+ MultisigConfig,
6
+ MultisigOperation,
7
+ type RpcSchemaTempo,
8
+ } from 'ox/tempo'
3
9
  import type { Account } from '../../accounts/types.js'
4
10
  import type { ReadContractReturnType } from '../../actions/public/readContract.js'
5
11
  import { readContract } from '../../actions/public/readContract.js'
@@ -10,87 +16,65 @@ import type { Client } from '../../clients/createClient.js'
10
16
  import type { Transport } from '../../clients/transports/createTransport.js'
11
17
  import type { BaseErrorType } from '../../errors/base.js'
12
18
  import type { Chain } from '../../types/chain.js'
13
- import type { GetEventArgs } from '../../types/contract.js'
14
19
  import type { Log } from '../../types/log.js'
15
20
  import type { Compute } from '../../types/utils.js'
16
21
  import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
17
22
  import * as Abis from '../Abis.js'
23
+ import { fromMultisig, type MultisigAccount } from '../Account.js'
18
24
  import * as Addresses from '../Addresses.js'
19
25
  import type { ReadParameters, WriteParameters } from '../internal/types.js'
20
26
  import { defineCall } from '../internal/utils.js'
21
- import type { TransactionReceipt } from '../Transaction.js'
27
+ import type * as Transaction from '../Transaction.js'
22
28
 
23
29
  /**
24
- * Checks whether an address is an initialized native multisig account.
30
+ * Gets the current cached config for a multisig account.
31
+ *
32
+ * The coordinator reads the account's current onchain commitment and returns
33
+ * the matching config from its store. It returns `null` when the config is not
34
+ * cached.
25
35
  *
26
36
  * @example
27
37
  * ```ts
28
- * import { createClient, http } from 'viem'
29
- * import { tempo } from 'viem/chains'
30
- * import { Actions } from 'viem/tempo'
31
- *
32
- * const client = createClient({
33
- * chain: tempo,
34
- * transport: http(),
35
- * })
36
- *
37
- * const initialized = await Actions.multisig.isInitialized(client, {
38
- * account: '0x...',
38
+ * const config = await client.multisig.getConfig({
39
+ * address: '0x...',
39
40
  * })
40
41
  * ```
41
42
  *
42
43
  * @param client - Client.
43
44
  * @param parameters - Parameters.
44
- * @returns Whether the account is an initialized native multisig account.
45
+ * @returns The config, or `null` when it is unknown.
45
46
  */
46
- export async function isInitialized<
47
- chain extends Chain | undefined,
48
- account extends Account | undefined,
49
- >(
50
- client: Client<Transport, chain, account>,
51
- parameters: isInitialized.Parameters,
52
- ): Promise<isInitialized.ReturnValue> {
53
- const { account, ...rest } = parameters
54
- return readContract(client, {
55
- ...rest,
56
- ...isInitialized.call({ account }),
47
+ export async function getConfig(
48
+ client: Client,
49
+ parameters: getConfig.Parameters,
50
+ ): Promise<getConfig.ReturnValue> {
51
+ const config = await client.request<{
52
+ Method: 'multisig_getConfig'
53
+ Parameters: [{ address: Address }]
54
+ ReturnType: MultisigConfig.Rpc | null
55
+ }>({
56
+ method: 'multisig_getConfig',
57
+ params: [{ address: parameters.address }],
57
58
  })
59
+ return config ? MultisigConfig.fromRpc(config) : null
58
60
  }
59
61
 
60
- export namespace isInitialized {
61
- export type Parameters = ReadParameters & Args
62
-
63
- export type Args = {
64
- /** Account address. */
65
- account: Address
62
+ export declare namespace getConfig {
63
+ /** Parameters for {@link getConfig}. */
64
+ export type Parameters = {
65
+ /** Multisig account address. */
66
+ address: Address
66
67
  }
67
68
 
68
- export type ReturnValue = ReadContractReturnType<
69
- typeof Abis.nativeMultisig,
70
- 'isMultisigAccount',
71
- never
72
- >
69
+ /** Return value for {@link getConfig}. */
70
+ export type ReturnValue = MultisigConfig.Config | null
73
71
 
74
- /**
75
- * Defines a call to the precompile's `isMultisigAccount` function.
76
- *
77
- * Can be passed to [`multicall`](https://viem.sh/docs/contract/multicall).
78
- *
79
- * @param args - Arguments.
80
- * @returns The call.
81
- */
82
- export function call(args: Args) {
83
- return defineCall({
84
- address: Addresses.nativeMultisig,
85
- abi: Abis.nativeMultisig,
86
- args: [args.account],
87
- functionName: 'isMultisigAccount',
88
- })
89
- }
72
+ /** Error type for {@link getConfig}. */
73
+ export type ErrorType = BaseErrorType
90
74
  }
91
75
 
92
76
  /**
93
- * Gets the current configuration for an initialized native multisig account.
77
+ * Gets the current configuration commitment for a native multisig account.
94
78
  *
95
79
  * @example
96
80
  * ```ts
@@ -103,30 +87,31 @@ export namespace isInitialized {
103
87
  * transport: http(),
104
88
  * })
105
89
  *
106
- * const config = await Actions.multisig.getConfig(client, {
90
+ * const commitment = await Actions.multisig.getConfigCommitment(client, {
107
91
  * account: '0x...',
108
92
  * })
109
93
  * ```
110
94
  *
111
95
  * @param client - Client.
112
96
  * @param parameters - Parameters.
113
- * @returns The current version, threshold, and owners.
97
+ * @returns The current configuration commitment, or zero when no config has
98
+ * been committed.
114
99
  */
115
- export async function getConfig<
100
+ export async function getConfigCommitment<
116
101
  chain extends Chain | undefined,
117
102
  account extends Account | undefined,
118
103
  >(
119
104
  client: Client<Transport, chain, account>,
120
- parameters: getConfig.Parameters,
121
- ): Promise<getConfig.ReturnValue> {
105
+ parameters: getConfigCommitment.Parameters,
106
+ ): Promise<getConfigCommitment.ReturnValue> {
122
107
  const { account, ...rest } = parameters
123
108
  return readContract(client, {
124
109
  ...rest,
125
- ...getConfig.call({ account }),
110
+ ...getConfigCommitment.call({ account }),
126
111
  })
127
112
  }
128
113
 
129
- export namespace getConfig {
114
+ export namespace getConfigCommitment {
130
115
  export type Parameters = ReadParameters & Args
131
116
 
132
117
  export type Args = {
@@ -136,12 +121,12 @@ export namespace getConfig {
136
121
 
137
122
  export type ReturnValue = ReadContractReturnType<
138
123
  typeof Abis.nativeMultisig,
139
- 'getConfig',
124
+ 'getConfigCommitment',
140
125
  never
141
126
  >
142
127
 
143
128
  /**
144
- * Defines a call to the `getConfig` function.
129
+ * Defines a call to the `getConfigCommitment` function.
145
130
  *
146
131
  * Can be passed to [`multicall`](https://viem.sh/docs/contract/multicall).
147
132
  *
@@ -153,11 +138,47 @@ export namespace getConfig {
153
138
  address: Addresses.nativeMultisig,
154
139
  abi: Abis.nativeMultisig,
155
140
  args: [args.account],
156
- functionName: 'getConfig',
141
+ functionName: 'getConfigCommitment',
157
142
  })
158
143
  }
159
144
  }
160
145
 
146
+ /**
147
+ * Gets a coordinated multisig operation by its hash.
148
+ *
149
+ * @param client - Client.
150
+ * @param parameters - Parameters.
151
+ * @returns The operation, or `null` when it is unknown.
152
+ */
153
+ export async function getOperation(
154
+ client: Client,
155
+ parameters: getOperation.Parameters,
156
+ ): Promise<getOperation.ReturnValue> {
157
+ type multisig_getOperation = Extract<
158
+ RpcSchema.ToViem<RpcSchemaTempo.Multisig>[number],
159
+ { Method: 'multisig_getOperation' }
160
+ >
161
+ const operation = await client.request<multisig_getOperation>({
162
+ method: 'multisig_getOperation',
163
+ params: [parameters.hash],
164
+ })
165
+ return operation ? MultisigOperation.fromRpc(operation) : null
166
+ }
167
+
168
+ export declare namespace getOperation {
169
+ /** Parameters for {@link getOperation}. */
170
+ export type Parameters = {
171
+ /** Multisig operation hash. */
172
+ hash: Hex.Hex
173
+ }
174
+
175
+ /** Return value for {@link getOperation}. */
176
+ export type ReturnValue = MultisigOperation.Operation | null
177
+
178
+ /** Error type for {@link getOperation}. */
179
+ export type ErrorType = BaseErrorType
180
+ }
181
+
161
182
  /**
162
183
  * Replaces the current configuration for a native multisig account.
163
184
  *
@@ -175,7 +196,10 @@ export namespace getConfig {
175
196
  * const owner = Account.fromSecp256k1(
176
197
  * '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
177
198
  * )
178
- * const account = Account.fromMultisig({ owners: [owner] })
199
+ * const account = Account.fromMultisig({
200
+ * address: 'infer',
201
+ * owners: [owner],
202
+ * })
179
203
  * const client = createClient({
180
204
  * chain: tempoLocalnet,
181
205
  * transport: http(),
@@ -188,8 +212,10 @@ export namespace getConfig {
188
212
  *
189
213
  * const hash = await Actions.multisig.updateConfig(client, {
190
214
  * account,
191
- * threshold: 1,
192
- * owners: [{ owner: owner.address, weight: 1 }],
215
+ * nextConfig: {
216
+ * owners: [{ owner: owner.address, weight: 1 }],
217
+ * threshold: 1,
218
+ * },
193
219
  * })
194
220
  * ```
195
221
  *
@@ -211,13 +237,18 @@ export namespace updateConfig {
211
237
  export type Parameters<
212
238
  chain extends Chain | undefined = Chain | undefined,
213
239
  account extends Account | undefined = Account | undefined,
214
- > = WriteParameters<chain, account> & Args
240
+ > = WriteParameters<chain, account> & {
241
+ /** Complete current config. Inferred from the account or coordinator when omitted. */
242
+ currentConfig?: MultisigConfig.Config | undefined
243
+ /** Replacement owners and threshold. */
244
+ nextConfig: Pick<MultisigConfig.Config, 'owners' | 'threshold'>
245
+ }
215
246
 
216
247
  export type Args = {
217
- /** New multisig owners and their weights. */
218
- owners: MultisigConfig.Config['owners']
219
- /** New signature weight required to authorize the account. */
220
- threshold: MultisigConfig.Config['threshold']
248
+ /** Complete current config. */
249
+ currentConfig: MultisigConfig.Config
250
+ /** Replacement owners and threshold. */
251
+ nextConfig: Pick<MultisigConfig.Config, 'owners' | 'threshold'>
221
252
  }
222
253
 
223
254
  export type ReturnValue = WriteContractReturnType
@@ -235,10 +266,55 @@ export namespace updateConfig {
235
266
  client: Client<Transport, chain, account>,
236
267
  parameters: Parameters<chain, account>,
237
268
  ): Promise<ReturnType<action>> {
238
- const { owners, threshold, ...rest } = parameters
269
+ const {
270
+ account: account_,
271
+ currentConfig: currentConfig_,
272
+ nextConfig,
273
+ ...rest
274
+ } = parameters
275
+ const accountValue = account_ ?? client.account
276
+ const account = (() => {
277
+ if (
278
+ typeof accountValue === 'object' &&
279
+ accountValue.source === 'multisig'
280
+ )
281
+ return accountValue as MultisigAccount
282
+ return undefined
283
+ })()
284
+ const config = (() => {
285
+ if (currentConfig_) return currentConfig_
286
+ if (account?.config) return account.config
287
+ return undefined
288
+ })()
289
+ const address = (() => {
290
+ if (account) return account.address
291
+ if (typeof accountValue === 'string') return accountValue as Address
292
+ if (accountValue) return accountValue.address
293
+ return undefined
294
+ })()
295
+ const currentConfig = await (async () => {
296
+ if (config) return MultisigConfig.from(config)
297
+ if (!address)
298
+ throw new Error(
299
+ 'A multisig account address or current config is required.',
300
+ )
301
+ const cachedConfig = await getConfig(client, { address })
302
+ if (!cachedConfig)
303
+ throw new Error(
304
+ `No current multisig config is cached for account ${address}. Provide the current config.`,
305
+ )
306
+ return cachedConfig
307
+ })()
308
+ const resolvedAccount = (() => {
309
+ if (account) return { ...account, config: currentConfig }
310
+ if (typeof accountValue === 'object') return accountValue
311
+ if (address) return fromMultisig({ address, ...currentConfig })
312
+ return undefined
313
+ })()
239
314
  return (await action(client, {
240
315
  ...rest,
241
- ...updateConfig.call({ owners, threshold }),
316
+ ...(resolvedAccount ? { account: resolvedAccount } : {}),
317
+ ...updateConfig.call({ currentConfig, nextConfig }),
242
318
  } as never)) as never
243
319
  }
244
320
 
@@ -252,23 +328,34 @@ export namespace updateConfig {
252
328
  *
253
329
  * @example
254
330
  * ```ts
255
- * import { Actions } from 'viem/tempo'
331
+ * import { Actions, type MultisigConfig } from 'viem/tempo'
332
+ *
333
+ * declare const currentConfig: MultisigConfig.Config
256
334
  *
257
335
  * const call = Actions.multisig.updateConfig.call({
258
- * threshold: 1,
259
- * owners: [{ owner: '0x...', weight: 1 }],
336
+ * currentConfig,
337
+ * nextConfig: {
338
+ * owners: [{ owner: '0x...', weight: 1 }],
339
+ * threshold: 1,
340
+ * },
260
341
  * })
261
342
  * ```
262
343
  *
263
- * @param args - New multisig configuration.
344
+ * @param args - Current and replacement multisig configurations.
264
345
  * @returns The call.
265
346
  */
266
347
  export function call(args: Args) {
267
- const config = MultisigConfig.from(args)
348
+ const currentConfig = MultisigConfig.from(args.currentConfig)
349
+ const nextConfig = MultisigConfig.from({
350
+ owners: args.nextConfig.owners,
351
+ salt: currentConfig.salt,
352
+ threshold: args.nextConfig.threshold,
353
+ version: currentConfig.version + 1n,
354
+ })
268
355
  return defineCall({
269
356
  address: Addresses.nativeMultisig,
270
357
  abi: Abis.nativeMultisig,
271
- args: [config.threshold, config.owners],
358
+ args: [currentConfig, nextConfig.threshold, nextConfig.owners],
272
359
  functionName: 'updateConfig',
273
360
  })
274
361
  }
@@ -298,9 +385,10 @@ export namespace updateConfig {
298
385
  * ```ts
299
386
  * import { createWalletClient, custom, type EIP1193Provider } from 'viem'
300
387
  * import { tempo } from 'viem/chains'
301
- * import { Actions } from 'viem/tempo'
388
+ * import { Actions, type MultisigConfig } from 'viem/tempo'
302
389
  *
303
390
  * declare const provider: EIP1193Provider
391
+ * declare const currentConfig: MultisigConfig.Config
304
392
  *
305
393
  * const client = createWalletClient({
306
394
  * account: '0x...',
@@ -309,8 +397,11 @@ export namespace updateConfig {
309
397
  * })
310
398
  *
311
399
  * const { receipt } = await Actions.multisig.updateConfigSync(client, {
312
- * threshold: 1,
313
- * owners: [{ owner: '0x...', weight: 1 }],
400
+ * currentConfig,
401
+ * nextConfig: {
402
+ * owners: [{ owner: '0x...', weight: 1 }],
403
+ * threshold: 1,
404
+ * },
314
405
  * })
315
406
  * ```
316
407
  *
@@ -330,8 +421,19 @@ export async function updateConfigSync<
330
421
  ...rest,
331
422
  throwOnReceiptRevert,
332
423
  } as never)
424
+ if ((receipt as Transaction.TransactionReceipt).status === 'pending')
425
+ return { receipt } as never
333
426
  const { args } = updateConfig.extractEvent(receipt.logs)
334
- return { ...args, receipt } as never
427
+ return {
428
+ account: args.account,
429
+ config: MultisigConfig.from({
430
+ owners: args.owners,
431
+ salt: args.salt,
432
+ threshold: args.threshold,
433
+ version: args.version,
434
+ }),
435
+ receipt,
436
+ } as never
335
437
  }
336
438
 
337
439
  export namespace updateConfigSync {
@@ -342,15 +444,11 @@ export namespace updateConfigSync {
342
444
 
343
445
  export type Args = updateConfig.Args
344
446
 
345
- export type ReturnValue = Compute<
346
- GetEventArgs<
347
- typeof Abis.nativeMultisig,
348
- 'MultisigConfigUpdated',
349
- { IndexedOnly: false; Required: true }
350
- > & {
351
- receipt: TransactionReceipt
352
- }
353
- >
447
+ export type ReturnValue = Compute<{
448
+ account: Address
449
+ config: MultisigConfig.Config
450
+ receipt: Transaction.TransactionReceipt
451
+ }>
354
452
 
355
453
  export type ErrorType = updateConfig.ErrorType
356
454
  }
@@ -233,6 +233,8 @@ export async function createSync<
233
233
  ...rest,
234
234
  throwOnReceiptRevert,
235
235
  } as never)
236
+ if ((receipt as TransactionReceipt).status === 'pending')
237
+ return { receipt } as never
236
238
  const { args } = create.extractEvent(receipt.logs)
237
239
  return {
238
240
  ...args,
@@ -436,6 +438,8 @@ export async function setAdminSync<
436
438
  ...rest,
437
439
  throwOnReceiptRevert,
438
440
  } as never)
441
+ if ((receipt as TransactionReceipt).status === 'pending')
442
+ return { receipt } as never
439
443
  const { args } = setAdmin.extractEvent(receipt.logs)
440
444
  return {
441
445
  ...args,
@@ -649,6 +653,8 @@ export async function modifyWhitelistSync<
649
653
  ...rest,
650
654
  throwOnReceiptRevert,
651
655
  } as never)
656
+ if ((receipt as TransactionReceipt).status === 'pending')
657
+ return { receipt } as never
652
658
  const { args } = modifyWhitelist.extractEvent(receipt.logs)
653
659
  return {
654
660
  ...args,
@@ -862,6 +868,8 @@ export async function modifyBlacklistSync<
862
868
  ...rest,
863
869
  throwOnReceiptRevert,
864
870
  } as never)
871
+ if ((receipt as TransactionReceipt).status === 'pending')
872
+ return { receipt } as never
865
873
  const { args } = modifyBlacklist.extractEvent(receipt.logs)
866
874
  return {
867
875
  ...args,
@@ -239,6 +239,8 @@ export async function burnSync<
239
239
  ...rest,
240
240
  throwOnReceiptRevert,
241
241
  } as never)
242
+ if ((receipt as TransactionReceipt).status === 'pending')
243
+ return { receipt } as never
242
244
  const { args } = burn.extractEvent(receipt.logs)
243
245
  return {
244
246
  ...args,
@@ -423,6 +425,8 @@ export async function claimSync<
423
425
  ...rest,
424
426
  throwOnReceiptRevert,
425
427
  } as never)
428
+ if ((receipt as TransactionReceipt).status === 'pending')
429
+ return { receipt } as never
426
430
  const { args } = claim.extractEvent(receipt.logs)
427
431
  return {
428
432
  ...args,
@@ -805,6 +809,8 @@ export async function setSync<
805
809
  ...rest,
806
810
  throwOnReceiptRevert,
807
811
  } as never)
812
+ if ((receipt as TransactionReceipt).status === 'pending')
813
+ return { receipt } as never
808
814
  const { tokenFilterId, ...args } = set.extractEvent(receipt.logs).args
809
815
  return {
810
816
  ...args,
@@ -21,6 +21,7 @@ import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
21
21
  import * as Abis from '../Abis.js'
22
22
  import type { ReadParameters, WriteParameters } from '../internal/types.js'
23
23
  import { defineCall } from '../internal/utils.js'
24
+ import type { TransactionReceipt } from '../Transaction.js'
24
25
 
25
26
  /**
26
27
  * Claims accumulated rewards for a recipient.
@@ -305,6 +306,8 @@ export async function distributeSync<
305
306
  ...rest,
306
307
  throwOnReceiptRevert,
307
308
  } as never)
309
+ if ((receipt as TransactionReceipt).status === 'pending')
310
+ return { receipt } as never
308
311
  const { args } = distribute.extractEvent(receipt.logs)
309
312
  return {
310
313
  ...args,
@@ -725,6 +728,8 @@ export async function setRecipientSync<
725
728
  ...rest,
726
729
  throwOnReceiptRevert,
727
730
  } as never)
731
+ if ((receipt as TransactionReceipt).status === 'pending')
732
+ return { receipt } as never
728
733
  const { args } = setRecipient.extractEvent(receipt.logs)
729
734
  return {
730
735
  ...args,
@@ -254,6 +254,8 @@ export async function approveSync<
254
254
  ...parameters,
255
255
  throwOnReceiptRevert,
256
256
  } as never)
257
+ if ((receipt as TransactionReceipt).status === 'pending')
258
+ return { receipt } as never
257
259
  const { args } = approve.extractEvent(receipt.logs)
258
260
  return {
259
261
  ...args,
@@ -469,6 +471,8 @@ export async function burnBlockedSync<
469
471
  ...rest,
470
472
  throwOnReceiptRevert,
471
473
  } as never)
474
+ if ((receipt as TransactionReceipt).status === 'pending')
475
+ return { receipt } as never
472
476
  const { args } = burnBlocked.extractEvent(receipt.logs)
473
477
  return {
474
478
  ...args,
@@ -686,6 +690,8 @@ export async function burnSync<
686
690
  ...rest,
687
691
  throwOnReceiptRevert,
688
692
  } as never)
693
+ if ((receipt as TransactionReceipt).status === 'pending')
694
+ return { receipt } as never
689
695
  const { args } = burn.extractEvent(receipt.logs)
690
696
  return {
691
697
  ...args,
@@ -890,6 +896,8 @@ export async function changeTransferPolicySync<
890
896
  ...rest,
891
897
  throwOnReceiptRevert,
892
898
  } as never)
899
+ if ((receipt as TransactionReceipt).status === 'pending')
900
+ return { receipt } as never
893
901
  const { args } = changeTransferPolicy.extractEvent(receipt.logs)
894
902
  return {
895
903
  ...args,
@@ -1157,6 +1165,9 @@ export async function createSync<
1157
1165
  throwOnReceiptRevert,
1158
1166
  } as never)
1159
1167
 
1168
+ if ((receipt as TransactionReceipt).status === 'pending')
1169
+ return { receipt } as never
1170
+
1160
1171
  const { args } = create.extractEvent(receipt.logs)
1161
1172
  const tokenId = TokenId.fromAddress(args.token)
1162
1173
 
@@ -2068,6 +2079,8 @@ export async function grantRolesSync<
2068
2079
  ...rest,
2069
2080
  throwOnReceiptRevert,
2070
2081
  } as never)
2082
+ if ((receipt as TransactionReceipt).status === 'pending')
2083
+ return { receipt } as never
2071
2084
  const events = grantRoles.extractEvents(receipt.logs)
2072
2085
  const value = events.map((event) => event.args)
2073
2086
  return {
@@ -2286,6 +2299,8 @@ export async function mintSync<
2286
2299
  ...rest,
2287
2300
  throwOnReceiptRevert,
2288
2301
  } as never)
2302
+ if ((receipt as TransactionReceipt).status === 'pending')
2303
+ return { receipt } as never
2289
2304
  const { args } = mint.extractEvent(receipt.logs)
2290
2305
  return {
2291
2306
  ...args,
@@ -2485,6 +2500,8 @@ export async function pauseSync<
2485
2500
  ...rest,
2486
2501
  throwOnReceiptRevert,
2487
2502
  } as never)
2503
+ if ((receipt as TransactionReceipt).status === 'pending')
2504
+ return { receipt } as never
2488
2505
  const { args } = pause.extractEvent(receipt.logs)
2489
2506
  return {
2490
2507
  ...args,
@@ -2694,6 +2711,8 @@ export async function renounceRolesSync<
2694
2711
  ...rest,
2695
2712
  throwOnReceiptRevert,
2696
2713
  } as never)
2714
+ if ((receipt as TransactionReceipt).status === 'pending')
2715
+ return { receipt } as never
2697
2716
  const events = renounceRoles.extractEvents(receipt.logs)
2698
2717
  const value = events.map((event) => event.args)
2699
2718
  return {
@@ -2911,6 +2930,8 @@ export async function revokeRolesSync<
2911
2930
  ...rest,
2912
2931
  throwOnReceiptRevert,
2913
2932
  } as never)
2933
+ if ((receipt as TransactionReceipt).status === 'pending')
2934
+ return { receipt } as never
2914
2935
  const events = revokeRoles.extractEvents(receipt.logs)
2915
2936
  const value = events.map((event) => event.args)
2916
2937
  return {
@@ -3112,6 +3133,8 @@ export async function setSupplyCapSync<
3112
3133
  ...rest,
3113
3134
  throwOnReceiptRevert,
3114
3135
  } as never)
3136
+ if ((receipt as TransactionReceipt).status === 'pending')
3137
+ return { receipt } as never
3115
3138
  const { args } = setSupplyCap.extractEvent(receipt.logs)
3116
3139
  return {
3117
3140
  ...args,
@@ -3318,6 +3341,8 @@ export async function setRoleAdminSync<
3318
3341
  ...rest,
3319
3342
  throwOnReceiptRevert,
3320
3343
  } as never)
3344
+ if ((receipt as TransactionReceipt).status === 'pending')
3345
+ return { receipt } as never
3321
3346
  const { args } = setRoleAdmin.extractEvent(receipt.logs)
3322
3347
  return {
3323
3348
  ...args,
@@ -3568,6 +3593,8 @@ export async function transferSync<
3568
3593
  ...parameters,
3569
3594
  throwOnReceiptRevert,
3570
3595
  } as never)
3596
+ if ((receipt as TransactionReceipt).status === 'pending')
3597
+ return { receipt } as never
3571
3598
  const { args } = transfer.extractEvent(receipt.logs)
3572
3599
  return {
3573
3600
  ...args,
@@ -3769,6 +3796,8 @@ export async function unpauseSync<
3769
3796
  ...rest,
3770
3797
  throwOnReceiptRevert,
3771
3798
  } as never)
3799
+ if ((receipt as TransactionReceipt).status === 'pending')
3800
+ return { receipt } as never
3772
3801
  const { args } = unpause.extractEvent(receipt.logs)
3773
3802
  return {
3774
3803
  ...args,
@@ -3968,6 +3997,8 @@ export async function prepareUpdateQuoteTokenSync<
3968
3997
  client,
3969
3998
  parameters,
3970
3999
  )
4000
+ if ((receipt as TransactionReceipt).status === 'pending')
4001
+ return { receipt } as never
3971
4002
  const { args } = prepareUpdateQuoteToken.extractEvent(receipt.logs)
3972
4003
  return {
3973
4004
  ...args,
@@ -4167,6 +4198,8 @@ export async function updateQuoteTokenSync<
4167
4198
  client,
4168
4199
  parameters,
4169
4200
  )
4201
+ if ((receipt as TransactionReceipt).status === 'pending')
4202
+ return { receipt } as never
4170
4203
  const { args } = updateQuoteToken.extractEvent(receipt.logs)
4171
4204
  return {
4172
4205
  ...args,
@@ -301,6 +301,8 @@ export async function registerMasterSync<
301
301
  ...rest,
302
302
  throwOnReceiptRevert,
303
303
  } as never)
304
+ if ((receipt as TransactionReceipt).status === 'pending')
305
+ return { receipt } as never
304
306
  const { args } = registerMaster.extractEvent(receipt.logs)
305
307
  return {
306
308
  ...args,