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,8 +1,11 @@
1
1
  import type { Address } from 'abitype'
2
+ import type * as RpcSchema from 'ox/RpcSchema'
2
3
  import {
3
- type KeyAuthorization,
4
+ KeyAuthorization,
4
5
  MultisigConfig,
5
- type SignatureEnvelope,
6
+ MultisigOperation,
7
+ type RpcSchemaTempo,
8
+ SignatureEnvelope,
6
9
  } from 'ox/tempo'
7
10
  import type { Account } from '../../accounts/types.js'
8
11
  import { parseAccount } from '../../accounts/utils/parseAccount.js'
@@ -22,24 +25,23 @@ import type { Chain } from '../../types/chain.js'
22
25
  import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js'
23
26
  import type { Log, Log as viem_Log } from '../../types/log.js'
24
27
  import type { Hex } from '../../types/misc.js'
25
- import type { Compute, UnionOmit } from '../../types/utils.js'
28
+ import type { Compute, OneOf, UnionOmit } from '../../types/utils.js'
26
29
  import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
30
+ import { isAddressEqual } from '../../utils/address/isAddressEqual.js'
27
31
  import * as Abis from '../Abis.js'
28
32
  import type {
29
33
  AccessKeyAccount,
30
34
  MultisigAccount,
31
- resolveAccessKey,
35
+ RootAccount,
32
36
  } from '../Account.js'
33
37
  import {
38
+ fromMultisig,
34
39
  getKeyAuthorizationSignPayload,
40
+ resolveAccessKey,
35
41
  signKeyAuthorization,
36
42
  } from '../Account.js'
37
43
  import * as Addresses from '../Addresses.js'
38
44
  import * as Hardfork from '../Hardfork.js'
39
- import {
40
- createMultisigStateResolver,
41
- getMultisigOwnerStates,
42
- } from '../internal/multisig.js'
43
45
  import type {
44
46
  GetAccountParameter,
45
47
  ReadParameters,
@@ -47,7 +49,7 @@ import type {
47
49
  } from '../internal/types.js'
48
50
  import { defineCall } from '../internal/utils.js'
49
51
  import type { TransactionReceipt } from '../Transaction.js'
50
- import * as multisig from './multisig.js'
52
+ import { getConfig } from './multisig.js'
51
53
 
52
54
  /** @internal */
53
55
  const signatureTypes = {
@@ -242,6 +244,8 @@ export async function authorizeSync<
242
244
  ...rest,
243
245
  throwOnReceiptRevert,
244
246
  } as never)
247
+ if ((receipt as TransactionReceipt).status === 'pending')
248
+ return { receipt } as never
245
249
  const { args } = authorize.extractEvent(receipt.logs)
246
250
  return {
247
251
  ...args,
@@ -436,6 +440,8 @@ export async function burnWitnessSync<
436
440
  ...rest,
437
441
  throwOnReceiptRevert,
438
442
  } as never)
443
+ if ((receipt as TransactionReceipt).status === 'pending')
444
+ return { receipt } as never
439
445
  const { args } = burnWitness.extractEvent(receipt.logs)
440
446
  return {
441
447
  ...args,
@@ -989,6 +995,8 @@ export async function revokeSync<
989
995
  ...rest,
990
996
  throwOnReceiptRevert,
991
997
  } as never)
998
+ if ((receipt as TransactionReceipt).status === 'pending')
999
+ return { receipt } as never
992
1000
  const { args } = revoke.extractEvent(receipt.logs)
993
1001
  return {
994
1002
  ...args,
@@ -1053,12 +1061,11 @@ export async function prepareAuthorization<
1053
1061
  if ('multisig' in parameters) return parameters.multisig
1054
1062
  if (parsed.source !== 'multisig') return undefined
1055
1063
  const account = parsed as MultisigAccount
1056
- const getState = createMultisigStateResolver((account) =>
1057
- multisig.getConfig(client, { account }),
1058
- )
1059
- const states = await getMultisigOwnerStates(account, getState)
1060
- const state = states[0]!
1061
- return { init: !state.initialized, states, version: state.version }
1064
+ if (!account.config)
1065
+ throw new Error(
1066
+ 'A multisig config is required to prepare a key authorization.',
1067
+ )
1068
+ return { config: account.config }
1062
1069
  })()
1063
1070
  const authorizationSignPayload = getKeyAuthorizationSignPayload(
1064
1071
  parsed as never,
@@ -1072,8 +1079,8 @@ export async function prepareAuthorization<
1072
1079
  parsed.source === 'multisig' && multisigState
1073
1080
  ? MultisigConfig.getSignPayload({
1074
1081
  account: parsed.address,
1082
+ config: multisigState.config,
1075
1083
  payload: authorizationSignPayload,
1076
- version: multisigState.version,
1077
1084
  })
1078
1085
  : authorizationSignPayload
1079
1086
  return {
@@ -1142,20 +1149,154 @@ export namespace prepareAuthorization {
1142
1149
  * transient user activation.
1143
1150
  *
1144
1151
  * @param client - Client.
1145
- * @param parameters - Parameters or the prepared result.
1146
- * @returns The signed key authorization.
1152
+ * @param parameters - Authorization fields, or a stored operation hash.
1153
+ * @returns A signed key authorization with multisig operation metadata when coordinated.
1147
1154
  */
1155
+ export function signAuthorization<
1156
+ chain extends Chain | undefined,
1157
+ account extends Account | undefined,
1158
+ >(
1159
+ client: Client<Transport, chain, account>,
1160
+ parameters: signAuthorization.CoordinatedParameters,
1161
+ ): Promise<signAuthorization.CoordinatedReturnValue>
1162
+ export function signAuthorization<
1163
+ chain extends Chain | undefined,
1164
+ account extends Account | undefined,
1165
+ >(
1166
+ client: Client<Transport, chain, account>,
1167
+ parameters: signAuthorization.LocalParameters<account>,
1168
+ ): Promise<signAuthorization.ReturnValue>
1148
1169
  export async function signAuthorization<
1149
1170
  chain extends Chain | undefined,
1150
1171
  account extends Account | undefined,
1151
1172
  >(
1152
1173
  client: Client<Transport, chain, account>,
1153
1174
  parameters: signAuthorization.Parameters<account>,
1154
- ): Promise<signAuthorization.ReturnValue> {
1175
+ ): Promise<
1176
+ signAuthorization.CoordinatedReturnValue | signAuthorization.ReturnValue
1177
+ > {
1178
+ const coordinated =
1179
+ ('hash' in parameters && parameters.hash) ||
1180
+ ('owner' in parameters && parameters.owner)
1181
+
1182
+ if (coordinated) {
1183
+ const parameters_ = parameters as signAuthorization.CoordinatedParameters
1184
+ const owner_ = parameters_.owner
1185
+ if (!owner_ || typeof owner_ === 'string')
1186
+ throw new Error(
1187
+ 'A local owner account is required to approve a multisig key authorization.',
1188
+ )
1189
+ const owner = parseAccount(owner_)
1190
+ const sign = owner.sign
1191
+ if (!sign)
1192
+ throw new Error(
1193
+ 'A local owner account is required to approve a multisig key authorization.',
1194
+ )
1195
+
1196
+ const request = await (async () => {
1197
+ if ('hash' in parameters_ && parameters_.hash) {
1198
+ const signature = SignatureEnvelope.serialize(
1199
+ SignatureEnvelope.from(await sign({ hash: parameters_.hash })),
1200
+ )
1201
+ return { hash: parameters_.hash, signature }
1202
+ }
1203
+
1204
+ const {
1205
+ account: account_,
1206
+ owner: _,
1207
+ ...authorization
1208
+ } = parameters_ as signAuthorization.CoordinatedInitialParameters
1209
+ const address = typeof account_ === 'string' ? account_ : account_.address
1210
+ const config = await (async () => {
1211
+ if (typeof account_ !== 'string' && account_.config)
1212
+ return account_.config
1213
+ const config = await getConfig(client, { address })
1214
+ if (config) return config
1215
+ throw new Error(
1216
+ `No current multisig config is cached for account ${address}. Provide the current config.`,
1217
+ )
1218
+ })()
1219
+ const account = (() => {
1220
+ if (config.version !== 0n) return fromMultisig({ address, ...config })
1221
+ const { version: _, ...initialConfig } = config
1222
+ return fromMultisig({ address: 'infer', ...initialConfig })
1223
+ })()
1224
+ if (!isAddressEqual(account.address, address))
1225
+ throw new Error('Initial multisig config does not match the account.')
1226
+ const prepared = await prepareAuthorization(client, {
1227
+ ...authorization,
1228
+ account,
1229
+ } as never)
1230
+ const signature = SignatureEnvelope.serialize(
1231
+ SignatureEnvelope.from(await sign({ hash: prepared.signPayload })),
1232
+ )
1233
+ const { accessKey, admin, chainId, expiry, limits, scopes, witness } =
1234
+ prepared
1235
+ const { accessKeyAddress, keyType: type } = resolveAccessKey(accessKey)
1236
+ const keyAuthorization = KeyAuthorization.from({
1237
+ account: account.address,
1238
+ address: accessKeyAddress,
1239
+ chainId: BigInt(chainId),
1240
+ signature: SignatureEnvelope.from({
1241
+ account: account.address,
1242
+ config,
1243
+ signatures: [SignatureEnvelope.from(signature)],
1244
+ }),
1245
+ type,
1246
+ ...(witness ? { witness } : {}),
1247
+ ...(admin ? { isAdmin: true } : { expiry, limits, scopes }),
1248
+ } as never)
1249
+ return { keyAuthorization: KeyAuthorization.toRpc(keyAuthorization) }
1250
+ })()
1251
+
1252
+ type multisig_approveKeyAuthorization = Extract<
1253
+ RpcSchema.ToViem<RpcSchemaTempo.Multisig>[number],
1254
+ { Method: 'multisig_approveKeyAuthorization' }
1255
+ >
1256
+ const operation = await client.request<multisig_approveKeyAuthorization>({
1257
+ method: 'multisig_approveKeyAuthorization',
1258
+ params: [request],
1259
+ })
1260
+ const multisig = MultisigOperation.fromRpc(operation)
1261
+ const keyAuthorization = KeyAuthorization.deserialize(
1262
+ await (async () => {
1263
+ if (multisig.status === 'success') return multisig.keyAuthorization
1264
+ const approvals = await MultisigOperation.selectApprovals({
1265
+ account: multisig.account,
1266
+ approvals: multisig.approvals,
1267
+ config: multisig.config,
1268
+ hash: multisig.hash,
1269
+ })
1270
+ return MultisigOperation.serializeKeyAuthorization(
1271
+ multisig.keyAuthorization,
1272
+ {
1273
+ account: multisig.account,
1274
+ approvals:
1275
+ approvals.selectedApprovals.length > 0
1276
+ ? approvals.selectedApprovals
1277
+ : approvals.approvals.slice(0, 1),
1278
+ config: multisig.config,
1279
+ },
1280
+ )
1281
+ })(),
1282
+ )
1283
+ if (!keyAuthorization.signature)
1284
+ throw new Error('Expected a signed multisig key authorization.')
1285
+ return {
1286
+ ...keyAuthorization,
1287
+ hash: multisig.hash,
1288
+ multisig,
1289
+ status: multisig.status,
1290
+ } as never
1291
+ }
1292
+
1155
1293
  const prepared = (
1156
- 'multisig' in parameters
1294
+ 'signPayload' in parameters
1157
1295
  ? parameters
1158
- : await prepareAuthorization(client, parameters)
1296
+ : await prepareAuthorization(
1297
+ client,
1298
+ parameters as signAuthorization.LocalParameters<account>,
1299
+ )
1159
1300
  ) as prepareAuthorization.ReturnValue
1160
1301
  const {
1161
1302
  accessKey,
@@ -1170,18 +1311,62 @@ export async function signAuthorization<
1170
1311
  key: accessKey,
1171
1312
  multisig: multisigState,
1172
1313
  ...rest,
1173
- })
1314
+ }) as never
1174
1315
  }
1175
1316
 
1176
1317
  export namespace signAuthorization {
1177
- export type Parameters<
1318
+ /** Initial coordinated key authorization parameters. */
1319
+ export type CoordinatedInitialParameters = Omit<
1320
+ prepareAuthorization.Parameters<Account>,
1321
+ 'account' | 'multisig'
1322
+ > & {
1323
+ /** Multisig account being authorized. */
1324
+ account: Address | MultisigAccount
1325
+ /** Local owner that approves the authorization. */
1326
+ owner: RootAccount | MultisigAccount
1327
+ }
1328
+
1329
+ /** Coordinated key authorization parameters. */
1330
+ export type CoordinatedParameters = OneOf<
1331
+ | CoordinatedInitialParameters
1332
+ | {
1333
+ /** Stored multisig operation hash. */
1334
+ hash: Hex
1335
+ /** Local owner that approves the authorization. */
1336
+ owner: RootAccount | MultisigAccount
1337
+ }
1338
+ >
1339
+
1340
+ /** Locally signed key authorization parameters. */
1341
+ export type LocalParameters<
1178
1342
  account extends Account | undefined = Account | undefined,
1179
1343
  > = prepareAuthorization.Parameters<account> & {
1180
1344
  /** Serialized approvals from external multisig owners. */
1181
1345
  signatures?: readonly SignatureEnvelope.Serialized[] | undefined
1182
1346
  }
1183
1347
 
1348
+ /** Parameters for {@link signAuthorization}. */
1349
+ export type Parameters<
1350
+ account extends Account | undefined = Account | undefined,
1351
+ > = CoordinatedParameters | LocalParameters<account>
1352
+
1353
+ /** Local return value for {@link signAuthorization}. */
1184
1354
  export type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>
1355
+
1356
+ /** Coordinated return value for {@link signAuthorization}. */
1357
+ export type CoordinatedReturnValue = Compute<
1358
+ ReturnValue & {
1359
+ /** Deterministic multisig operation hash. */
1360
+ hash: Hex
1361
+ /** Current multisig operation. */
1362
+ multisig: MultisigOperation.KeyAuthorizationOperation
1363
+ /** Current multisig operation status. */
1364
+ status: MultisigOperation.KeyAuthorizationOperation['status']
1365
+ }
1366
+ >
1367
+
1368
+ /** Error type for {@link signAuthorization}. */
1369
+ export type ErrorType = BaseErrorType
1185
1370
  }
1186
1371
 
1187
1372
  /**
@@ -1353,6 +1538,8 @@ export async function updateLimitSync<
1353
1538
  ...rest,
1354
1539
  throwOnReceiptRevert,
1355
1540
  } as never)
1541
+ if ((receipt as TransactionReceipt).status === 'pending')
1542
+ return { receipt } as never
1356
1543
  const { args } = updateLimit.extractEvent(receipt.logs)
1357
1544
  return {
1358
1545
  account: args.account,
@@ -23,6 +23,7 @@ import * as Abis from '../Abis.js'
23
23
  import * as Addresses from '../Addresses.js'
24
24
  import type { ReadParameters, WriteParameters } from '../internal/types.js'
25
25
  import { defineCall } from '../internal/utils.js'
26
+ import type { TransactionReceipt as TempoTransactionReceipt } from '../Transaction.js'
26
27
 
27
28
  /**
28
29
  * Gets the reserves for a liquidity pool.
@@ -405,6 +406,8 @@ export async function rebalanceSwapSync<
405
406
  ...rest,
406
407
  throwOnReceiptRevert,
407
408
  } as never)
409
+ if ((receipt as TempoTransactionReceipt).status === 'pending')
410
+ return { receipt } as never
408
411
  const { args } = rebalanceSwap.extractEvent(receipt.logs)
409
412
  return {
410
413
  ...args,
@@ -636,6 +639,8 @@ export async function mintSync<
636
639
  ...rest,
637
640
  throwOnReceiptRevert,
638
641
  } as never)
642
+ if ((receipt as TempoTransactionReceipt).status === 'pending')
643
+ return { receipt } as never
639
644
  const { args } = mint.extractEvent(receipt.logs)
640
645
  return {
641
646
  ...args,
@@ -851,6 +856,8 @@ export async function burnSync<
851
856
  ...rest,
852
857
  throwOnReceiptRevert,
853
858
  } as never)
859
+ if ((receipt as TempoTransactionReceipt).status === 'pending')
860
+ return { receipt } as never
854
861
  const { args } = burn.extractEvent(receipt.logs)
855
862
  return {
856
863
  ...args,
@@ -171,6 +171,8 @@ export async function closeSync<
171
171
  ...rest,
172
172
  throwOnReceiptRevert,
173
173
  } as never)
174
+ if ((receipt as TransactionReceipt).status === 'pending')
175
+ return { receipt } as never
174
176
  const { args } = close.extractEvent(receipt.logs)
175
177
  return { ...args, receipt } as never
176
178
  }
@@ -511,6 +513,8 @@ export async function openSync<
511
513
  ...rest,
512
514
  throwOnReceiptRevert,
513
515
  } as never)
516
+ if ((receipt as TransactionReceipt).status === 'pending')
517
+ return { receipt } as never
514
518
  const { args } = open.extractEvent(receipt.logs)
515
519
  return { ...args, receipt } as never
516
520
  }
@@ -656,6 +660,8 @@ export async function requestCloseSync<
656
660
  ...rest,
657
661
  throwOnReceiptRevert,
658
662
  } as never)
663
+ if ((receipt as TransactionReceipt).status === 'pending')
664
+ return { receipt } as never
659
665
  const { args } = requestClose.extractEvent(receipt.logs)
660
666
  return { ...args, receipt } as never
661
667
  }
@@ -811,6 +817,8 @@ export async function settleSync<
811
817
  ...rest,
812
818
  throwOnReceiptRevert,
813
819
  } as never)
820
+ if ((receipt as TransactionReceipt).status === 'pending')
821
+ return { receipt } as never
814
822
  const { args } = settle.extractEvent(receipt.logs)
815
823
  return { ...args, receipt } as never
816
824
  }
@@ -1026,6 +1034,8 @@ export async function topUpSync<
1026
1034
  ...rest,
1027
1035
  throwOnReceiptRevert,
1028
1036
  } as never)
1037
+ if ((receipt as TransactionReceipt).status === 'pending')
1038
+ return { receipt } as never
1029
1039
  const { args } = topUp.extractEvent(receipt.logs)
1030
1040
  return { ...args, receipt } as never
1031
1041
  }
@@ -1172,6 +1182,8 @@ export async function withdrawSync<
1172
1182
  ...rest,
1173
1183
  throwOnReceiptRevert,
1174
1184
  } as never)
1185
+ if ((receipt as TransactionReceipt).status === 'pending')
1186
+ return { receipt } as never
1175
1187
  const { args } = withdraw.extractEvent(receipt.logs)
1176
1188
  return { ...args, receipt } as never
1177
1189
  }
@@ -387,6 +387,8 @@ export async function cancelSync<
387
387
  ...rest,
388
388
  throwOnReceiptRevert,
389
389
  } as never)
390
+ if ((receipt as TransactionReceipt).status === 'pending')
391
+ return { receipt } as never
390
392
  const { args } = cancel.extractEvent(receipt.logs)
391
393
  return {
392
394
  ...args,
@@ -588,6 +590,8 @@ export async function cancelStaleSync<
588
590
  ...rest,
589
591
  throwOnReceiptRevert,
590
592
  } as never)
593
+ if ((receipt as TransactionReceipt).status === 'pending')
594
+ return { receipt } as never
591
595
  const { args } = cancelStale.extractEvent(receipt.logs)
592
596
  return {
593
597
  ...args,
@@ -783,6 +787,8 @@ export async function createPairSync<
783
787
  ...rest,
784
788
  throwOnReceiptRevert,
785
789
  } as never)
790
+ if ((receipt as TransactionReceipt).status === 'pending')
791
+ return { receipt } as never
786
792
  const { args } = createPair.extractEvent(receipt.logs)
787
793
  return {
788
794
  ...args,
@@ -1567,6 +1573,8 @@ export async function placeFlipSync<
1567
1573
  ...rest,
1568
1574
  throwOnReceiptRevert,
1569
1575
  } as never)
1576
+ if ((receipt as TransactionReceipt).status === 'pending')
1577
+ return { receipt } as never
1570
1578
  const { args } = placeFlip.extractEvent(receipt.logs)
1571
1579
  return {
1572
1580
  ...args,
@@ -1637,6 +1645,8 @@ export async function placeSync<
1637
1645
  ...rest,
1638
1646
  throwOnReceiptRevert,
1639
1647
  } as never)
1648
+ if ((receipt as TransactionReceipt).status === 'pending')
1649
+ return { receipt } as never
1640
1650
  const { args } = place.extractEvent(receipt.logs)
1641
1651
  return {
1642
1652
  ...args,
@@ -184,7 +184,7 @@ export namespace createErc4626Engine {
184
184
  export type Parameters<
185
185
  chain extends Chain | undefined = Chain | undefined,
186
186
  account extends Account | undefined = Account | undefined,
187
- > = WriteParameters<chain, account> &
187
+ > = Omit<WriteParameters<chain, account>, 'owner'> &
188
188
  Omit<Args, 'owner'> & {
189
189
  /** Final engine owner. @default `account.address` */
190
190
  owner?: Account | Address | undefined
@@ -366,6 +366,8 @@ export async function createErc4626EngineSync<
366
366
  ...parameters,
367
367
  throwOnReceiptRevert,
368
368
  } as never)
369
+ if ((receipt as TransactionReceipt).status === 'pending')
370
+ return { receipt } as never
369
371
  const { args } = createErc4626Engine.extractEvent(receipt.logs, { factory })
370
372
  return { ...args, receipt }
371
373
  }
@@ -449,7 +451,7 @@ export namespace createStack {
449
451
  export type Parameters<
450
452
  chain extends Chain | undefined = Chain | undefined,
451
453
  account extends Account | undefined = Account | undefined,
452
- > = WriteParameters<chain, account> &
454
+ > = Omit<WriteParameters<chain, account>, 'owner'> &
453
455
  Omit<Args, 'owner'> & {
454
456
  /** Final stack owner and operator. @default `account.address` */
455
457
  owner?: Account | Address | undefined
@@ -632,6 +634,8 @@ export async function createStackSync<
632
634
  ...parameters,
633
635
  throwOnReceiptRevert,
634
636
  } as never)
637
+ if ((receipt as TransactionReceipt).status === 'pending')
638
+ return { receipt } as never
635
639
  const { args } = createStack.extractEvent(receipt.logs, { factory })
636
640
  return { ...args, receipt }
637
641
  }
@@ -832,6 +836,8 @@ export async function bindEngineSync<
832
836
  ...parameters,
833
837
  throwOnReceiptRevert,
834
838
  } as never)
839
+ if ((receipt as TransactionReceipt).status === 'pending')
840
+ return { receipt } as never
835
841
  const { args } = bindEngine.extractEvent(receipt.logs, { engine })
836
842
  return { engine, vault: args.earnVault, receipt }
837
843
  }
@@ -956,6 +962,7 @@ export async function deployErc4626StackSync<
956
962
  gas: _,
957
963
  keyAuthorization: __,
958
964
  nonce: ___,
965
+ owner: ____,
959
966
  ...sharedWriteParameters
960
967
  } = pickWriteParameters(parameters as never)
961
968
  const writeParameters = {
@@ -1018,6 +1025,8 @@ export async function deployErc4626StackSync<
1018
1025
  } as never,
1019
1026
  )
1020
1027
  receipts.engine = receipt
1028
+ if ((receipt as TransactionReceipt).status === 'pending')
1029
+ return { receipt } as never
1021
1030
  createErc4626Engine.extractEvent(receipt.logs, {
1022
1031
  factory: parameters.factories.erc4626Engine,
1023
1032
  })
@@ -1072,6 +1081,8 @@ export async function deployErc4626StackSync<
1072
1081
  ...stackArgs,
1073
1082
  } as never)
1074
1083
  receipts.stack = receipt
1084
+ if ((receipt as TransactionReceipt).status === 'pending')
1085
+ return { receipt } as never
1075
1086
  const { args } = createStack.extractEvent(receipt.logs, {
1076
1087
  factory: parameters.factories.earn,
1077
1088
  })
@@ -1148,6 +1159,8 @@ export async function deployErc4626StackSync<
1148
1159
  bindingParameters as never,
1149
1160
  )
1150
1161
  receipts.binding = receipt
1162
+ if ((receipt as TransactionReceipt).status === 'pending')
1163
+ return { receipt } as never
1151
1164
  bindEngine.extractEvent(receipt.logs, { engine: predictedEngine })
1152
1165
  } else if (!isAddressEqual(boundVault, vault)) {
1153
1166
  throw new Error(`Engine is already bound to ${boundVault}.`)
@@ -1179,7 +1192,7 @@ export namespace deployErc4626StackSync {
1179
1192
  account extends Account | undefined = Account | undefined,
1180
1193
  > = Omit<
1181
1194
  WriteParameters<chain, account>,
1182
- 'gas' | 'keyAuthorization' | 'nonce' | 'throwOnReceiptRevert'
1195
+ 'gas' | 'keyAuthorization' | 'nonce' | 'owner' | 'throwOnReceiptRevert'
1183
1196
  > &
1184
1197
  WriteSyncParameters<chain, account> & {
1185
1198
  /** Account used only for the final owner binding. */
@@ -152,6 +152,8 @@ export async function configureExitSafePolicy<
152
152
  chain: client.chain,
153
153
  type: 'whitelist',
154
154
  } as never)
155
+ if ((eligibility.receipt as TransactionReceipt).status === 'pending')
156
+ return { receipt: eligibility.receipt } as never
155
157
  const compoundPolicy = await writeContractSync(client, {
156
158
  account,
157
159
  abi: Abis.tip403Registry,
@@ -161,6 +163,8 @@ export async function configureExitSafePolicy<
161
163
  functionName: 'createCompoundPolicy',
162
164
  throwOnReceiptRevert: true,
163
165
  } as never)
166
+ if ((compoundPolicy as TransactionReceipt).status === 'pending')
167
+ return { receipt: compoundPolicy } as never
164
168
  const [compoundEvent] = parseEventLogs({
165
169
  abi: Abis.tip403Registry,
166
170
  eventName: 'CompoundPolicyCreated',
@@ -176,6 +180,8 @@ export async function configureExitSafePolicy<
176
180
  policyId: compoundEvent.args.policyId,
177
181
  token: parameters.shareToken,
178
182
  } as never)
183
+ if ((tokenPolicy.receipt as TransactionReceipt).status === 'pending')
184
+ return { receipt: tokenPolicy.receipt } as never
179
185
  const policyAdmin = isAddressEqual(
180
186
  parameters.accessAdministrator,
181
187
  account.address,
@@ -187,6 +193,11 @@ export async function configureExitSafePolicy<
187
193
  chain: client.chain,
188
194
  policyId: eligibility.policyId,
189
195
  } as never)
196
+ if (
197
+ policyAdmin &&
198
+ (policyAdmin.receipt as TransactionReceipt).status === 'pending'
199
+ )
200
+ return { receipt: policyAdmin.receipt } as never
190
201
 
191
202
  return {
192
203
  policy: {
@@ -617,6 +628,8 @@ export async function depositSync<
617
628
  ...parameters,
618
629
  throwOnReceiptRevert,
619
630
  } as never)
631
+ if ((receipt as TransactionReceipt).status === 'pending')
632
+ return { receipt } as never
620
633
  const { args } = deposit.extractEvent(receipt.logs, { vault })
621
634
  return {
622
635
  assetAmount: args.assets,
@@ -920,6 +933,8 @@ export async function depositSharesSync<
920
933
  ...parameters,
921
934
  throwOnReceiptRevert,
922
935
  } as never)
936
+ if ((receipt as TransactionReceipt).status === 'pending')
937
+ return { receipt } as never
923
938
  const { args } = depositShares.extractEvent(receipt.logs, { vault })
924
939
  return {
925
940
  caller: args.caller,
@@ -2308,6 +2323,8 @@ export async function redeemSync<
2308
2323
  ...parameters,
2309
2324
  throwOnReceiptRevert,
2310
2325
  } as never)
2326
+ if ((receipt as TransactionReceipt).status === 'pending')
2327
+ return { receipt } as never
2311
2328
  const { args } = redeem.extractEvent(receipt.logs, { vault })
2312
2329
  return {
2313
2330
  assetAmount: args.assets,
@@ -2972,6 +2989,8 @@ export async function withdrawExactSync<
2972
2989
  ...parameters,
2973
2990
  throwOnReceiptRevert,
2974
2991
  } as never)
2992
+ if ((receipt as TransactionReceipt).status === 'pending')
2993
+ return { receipt } as never
2975
2994
  const { args } = withdrawExact.extractEvent(receipt.logs, { vault })
2976
2995
  return {
2977
2996
  assetAmount: args.assets,
@@ -383,6 +383,8 @@ export async function setUserTokenSync<
383
383
  ...rest,
384
384
  throwOnReceiptRevert,
385
385
  } as never)
386
+ if ((receipt as TransactionReceipt).status === 'pending')
387
+ return { receipt } as never
386
388
  const { args } = setUserToken.extractEvent(receipt.logs)
387
389
  return {
388
390
  ...args,
@@ -715,6 +717,8 @@ export async function setValidatorTokenSync<
715
717
  ...rest,
716
718
  throwOnReceiptRevert,
717
719
  } as never)
720
+ if ((receipt as TransactionReceipt).status === 'pending')
721
+ return { receipt } as never
718
722
  const { args } = setValidatorToken.extractEvent(receipt.logs)
719
723
  return {
720
724
  ...args,