viem 2.55.17 → 2.55.19

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 (147) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/chains/definitions/morphTachyon.js +25 -0
  3. package/_cjs/chains/definitions/morphTachyon.js.map +1 -0
  4. package/_cjs/chains/definitions/morphTachyonTestnet.js +26 -0
  5. package/_cjs/chains/definitions/morphTachyonTestnet.js.map +1 -0
  6. package/_cjs/chains/definitions/ynxTestnet.js +26 -0
  7. package/_cjs/chains/definitions/ynxTestnet.js.map +1 -0
  8. package/_cjs/chains/index.js +13 -7
  9. package/_cjs/chains/index.js.map +1 -1
  10. package/_cjs/errors/version.js +1 -1
  11. package/_cjs/tempo/Abis.js +102 -1
  12. package/_cjs/tempo/Abis.js.map +1 -1
  13. package/_cjs/tempo/Account.js +188 -16
  14. package/_cjs/tempo/Account.js.map +1 -1
  15. package/_cjs/tempo/Addresses.js +2 -1
  16. package/_cjs/tempo/Addresses.js.map +1 -1
  17. package/_cjs/tempo/Decorator.js +8 -0
  18. package/_cjs/tempo/Decorator.js.map +1 -1
  19. package/_cjs/tempo/Formatters.js +1 -1
  20. package/_cjs/tempo/Formatters.js.map +1 -1
  21. package/_cjs/tempo/Selectors.js +7 -1
  22. package/_cjs/tempo/Selectors.js.map +1 -1
  23. package/_cjs/tempo/Transaction.js +31 -10
  24. package/_cjs/tempo/Transaction.js.map +1 -1
  25. package/_cjs/tempo/actions/accessKey.js +49 -8
  26. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  27. package/_cjs/tempo/actions/earn.js +12 -4
  28. package/_cjs/tempo/actions/earn.js.map +1 -1
  29. package/_cjs/tempo/actions/index.js +2 -1
  30. package/_cjs/tempo/actions/index.js.map +1 -1
  31. package/_cjs/tempo/actions/multisig.js +95 -0
  32. package/_cjs/tempo/actions/multisig.js.map +1 -0
  33. package/_cjs/tempo/actions/zone.js +16 -16
  34. package/_cjs/tempo/actions/zone.js.map +1 -1
  35. package/_cjs/tempo/chainConfig.js +58 -29
  36. package/_cjs/tempo/chainConfig.js.map +1 -1
  37. package/_cjs/tempo/internal/multisig.js +56 -0
  38. package/_cjs/tempo/internal/multisig.js.map +1 -0
  39. package/_cjs/tempo/zones/Abis.js +2 -2
  40. package/_cjs/tempo/zones/Abis.js.map +1 -1
  41. package/_esm/chains/definitions/morphTachyon.js +22 -0
  42. package/_esm/chains/definitions/morphTachyon.js.map +1 -0
  43. package/_esm/chains/definitions/morphTachyonTestnet.js +23 -0
  44. package/_esm/chains/definitions/morphTachyonTestnet.js.map +1 -0
  45. package/_esm/chains/definitions/ynxTestnet.js +23 -0
  46. package/_esm/chains/definitions/ynxTestnet.js.map +1 -0
  47. package/_esm/chains/index.js +3 -0
  48. package/_esm/chains/index.js.map +1 -1
  49. package/_esm/errors/version.js +1 -1
  50. package/_esm/tempo/Abis.js +101 -0
  51. package/_esm/tempo/Abis.js.map +1 -1
  52. package/_esm/tempo/Account.js +196 -66
  53. package/_esm/tempo/Account.js.map +1 -1
  54. package/_esm/tempo/Addresses.js +1 -0
  55. package/_esm/tempo/Addresses.js.map +1 -1
  56. package/_esm/tempo/Decorator.js +8 -0
  57. package/_esm/tempo/Decorator.js.map +1 -1
  58. package/_esm/tempo/Formatters.js +3 -6
  59. package/_esm/tempo/Formatters.js.map +1 -1
  60. package/_esm/tempo/Selectors.js +6 -0
  61. package/_esm/tempo/Selectors.js.map +1 -1
  62. package/_esm/tempo/Transaction.js +31 -10
  63. package/_esm/tempo/Transaction.js.map +1 -1
  64. package/_esm/tempo/actions/accessKey.js +65 -23
  65. package/_esm/tempo/actions/accessKey.js.map +1 -1
  66. package/_esm/tempo/actions/earn.js +14 -6
  67. package/_esm/tempo/actions/earn.js.map +1 -1
  68. package/_esm/tempo/actions/index.js +1 -0
  69. package/_esm/tempo/actions/index.js.map +1 -1
  70. package/_esm/tempo/actions/multisig.js +245 -0
  71. package/_esm/tempo/actions/multisig.js.map +1 -0
  72. package/_esm/tempo/actions/zone.js +17 -17
  73. package/_esm/tempo/actions/zone.js.map +1 -1
  74. package/_esm/tempo/chainConfig.js +65 -35
  75. package/_esm/tempo/chainConfig.js.map +1 -1
  76. package/_esm/tempo/internal/multisig.js +56 -0
  77. package/_esm/tempo/internal/multisig.js.map +1 -0
  78. package/_esm/tempo/zones/Abis.js +2 -2
  79. package/_esm/tempo/zones/Abis.js.map +1 -1
  80. package/_types/chains/definitions/morphTachyon.d.ts +51 -0
  81. package/_types/chains/definitions/morphTachyon.d.ts.map +1 -0
  82. package/_types/chains/definitions/morphTachyonTestnet.d.ts +51 -0
  83. package/_types/chains/definitions/morphTachyonTestnet.d.ts.map +1 -0
  84. package/_types/chains/definitions/tempo.d.ts +30 -2
  85. package/_types/chains/definitions/tempo.d.ts.map +1 -1
  86. package/_types/chains/definitions/tempoDevnet.d.ts +30 -2
  87. package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
  88. package/_types/chains/definitions/tempoLocalnet.d.ts +30 -2
  89. package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
  90. package/_types/chains/definitions/tempoModerato.d.ts +30 -2
  91. package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
  92. package/_types/chains/definitions/ynxTestnet.d.ts +51 -0
  93. package/_types/chains/definitions/ynxTestnet.d.ts.map +1 -0
  94. package/_types/chains/index.d.ts +3 -0
  95. package/_types/chains/index.d.ts.map +1 -1
  96. package/_types/errors/version.d.ts +1 -1
  97. package/_types/tempo/Abis.d.ts +321 -0
  98. package/_types/tempo/Abis.d.ts.map +1 -1
  99. package/_types/tempo/Account.d.ts +42 -26
  100. package/_types/tempo/Account.d.ts.map +1 -1
  101. package/_types/tempo/Addresses.d.ts +1 -0
  102. package/_types/tempo/Addresses.d.ts.map +1 -1
  103. package/_types/tempo/Decorator.d.ts +34 -2
  104. package/_types/tempo/Decorator.d.ts.map +1 -1
  105. package/_types/tempo/Formatters.d.ts.map +1 -1
  106. package/_types/tempo/Selectors.d.ts +6 -0
  107. package/_types/tempo/Selectors.d.ts.map +1 -1
  108. package/_types/tempo/Transaction.d.ts +17 -2
  109. package/_types/tempo/Transaction.d.ts.map +1 -1
  110. package/_types/tempo/actions/accessKey.d.ts +35 -17
  111. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  112. package/_types/tempo/actions/earn.d.ts +5 -5
  113. package/_types/tempo/actions/earn.d.ts.map +1 -1
  114. package/_types/tempo/actions/index.d.ts +1 -0
  115. package/_types/tempo/actions/index.d.ts.map +1 -1
  116. package/_types/tempo/actions/multisig.d.ts +472 -0
  117. package/_types/tempo/actions/multisig.d.ts.map +1 -0
  118. package/_types/tempo/actions/zone.d.ts +17 -17
  119. package/_types/tempo/actions/zone.d.ts.map +1 -1
  120. package/_types/tempo/chainConfig.d.ts +15 -1
  121. package/_types/tempo/chainConfig.d.ts.map +1 -1
  122. package/_types/tempo/internal/multisig.d.ts +13 -0
  123. package/_types/tempo/internal/multisig.d.ts.map +1 -0
  124. package/_types/tempo/zones/Abis.d.ts +2 -2
  125. package/_types/tempo/zones/zone.d.ts +90 -6
  126. package/_types/tempo/zones/zone.d.ts.map +1 -1
  127. package/chains/definitions/morphTachyon.ts +22 -0
  128. package/chains/definitions/morphTachyonTestnet.ts +23 -0
  129. package/chains/definitions/ynxTestnet.ts +23 -0
  130. package/chains/index.ts +3 -0
  131. package/errors/version.ts +1 -1
  132. package/package.json +2 -2
  133. package/tempo/Abis.ts +102 -0
  134. package/tempo/Account.ts +329 -51
  135. package/tempo/Addresses.ts +1 -0
  136. package/tempo/Decorator.ts +52 -2
  137. package/tempo/Formatters.ts +4 -5
  138. package/tempo/Selectors.ts +7 -0
  139. package/tempo/Transaction.ts +52 -12
  140. package/tempo/actions/accessKey.ts +128 -32
  141. package/tempo/actions/earn.ts +19 -11
  142. package/tempo/actions/index.ts +1 -0
  143. package/tempo/actions/multisig.ts +356 -0
  144. package/tempo/actions/zone.ts +35 -31
  145. package/tempo/chainConfig.ts +82 -35
  146. package/tempo/internal/multisig.ts +72 -0
  147. package/tempo/zones/Abis.ts +2 -2
@@ -118,15 +118,14 @@ export function formatTransactionRequest(
118
118
  if (request.feePayer === true && !request.feePayerSignature)
119
119
  delete request.feeToken
120
120
 
121
- // `multisig` / `signatures` are client-side only (TIP-1061). They drive
122
- // sender derivation, owner signing, and final envelope assembly, but are
123
- // never sent as raw RPC fields — the wire payload is the serialized tx.
124
- // `multisigInit` / `multisigSignatureCount` are wire fields: the node
125
- // prices multisig gas from them during simulation.
121
+ // Client-only TIP-1061 fields drive local signing and envelope assembly.
122
+ // `multisigInit` and `multisigSignatureCount` remain wire fields for gas modeling.
126
123
  const {
127
124
  multisig: _multisig,
128
125
  multisigInit,
126
+ multisigOwnerStates: _multisigOwnerStates,
129
127
  multisigSignatureCount,
128
+ multisigVersion: _multisigVersion,
130
129
  signatures: _signatures,
131
130
  ...rpcRequest
132
131
  } = request
@@ -49,6 +49,13 @@ export const addressRegistry = {
49
49
  resolveVirtualAddress: '0xe2fc56ef',
50
50
  } as const satisfies FunctionSelectors<typeof Abis.addressRegistry>
51
51
 
52
+ export const nativeMultisig = {
53
+ deriveAccount: '0xce8e071c',
54
+ getConfig: '0xe48a5f7b',
55
+ isMultisigAccount: '0x9fbf029a',
56
+ updateConfig: '0xe175d479',
57
+ } as const satisfies FunctionSelectors<typeof Abis.nativeMultisig>
58
+
52
59
  export const nonce = {
53
60
  getNonce: '0x89535803',
54
61
  } as const satisfies FunctionSelectors<typeof Abis.nonce>
@@ -112,6 +112,14 @@ export type TransactionReceiptRpc = TransactionReceipt<
112
112
  ox_TransactionReceipt.RpcType
113
113
  >
114
114
 
115
+ /** @internal */
116
+ export type MultisigOwnerState = {
117
+ account: Address
118
+ config?: Pick<MultisigConfig.Config, 'owners' | 'threshold'> | undefined
119
+ initialized: boolean
120
+ version: bigint
121
+ }
122
+
115
123
  export type TransactionRequestTempo<
116
124
  quantity = bigint,
117
125
  index = number,
@@ -124,7 +132,7 @@ export type TransactionRequestTempo<
124
132
  feePayer?: Account | true | undefined
125
133
  feeToken?: TempoAddress.Address | bigint | undefined
126
134
  keyAuthorization?: KeyAuthorization.Signed<quantity, index> | undefined
127
- multisig?: MultisigConfig.Config<index> | undefined
135
+ multisig?: Address | MultisigConfig.Config<index> | undefined
128
136
  /** Bootstrap multisig config hint for node-side gas modeling (TIP-1061). Attached automatically when `multisig` is present; the node ignores it for registered senders. */
129
137
  multisigInit?:
130
138
  | {
@@ -133,8 +141,12 @@ export type TransactionRequestTempo<
133
141
  owners: readonly { owner: Address; weight: number }[]
134
142
  }
135
143
  | undefined
144
+ /** @internal Local signing state for nested multisig owner accounts. */
145
+ multisigOwnerStates?: readonly MultisigOwnerState[] | undefined
136
146
  /** Modeled owner approval count for node-side gas modeling (TIP-1061). */
137
147
  multisigSignatureCount?: number | undefined
148
+ /** Current multisig config version. Inferred during request preparation; defaults to `0n` for bootstrap. */
149
+ multisigVersion?: bigint | undefined
138
150
  nonceKey?: 'expiring' | quantity | undefined
139
151
  signatures?: readonly SignatureEnvelope.Serialized[] | undefined
140
152
  validBefore?: index | undefined
@@ -157,7 +169,11 @@ export type TransactionSerializableTempo<
157
169
  feePayerSignature?: viem_Signature | null | undefined
158
170
  from?: Address | undefined
159
171
  keyAuthorization?: KeyAuthorization.Signed<quantity, index> | undefined
160
- multisig?: MultisigConfig.Config<index> | undefined
172
+ multisig?: Address | MultisigConfig.Config<index> | undefined
173
+ /** @internal Local signing state for nested multisig owner accounts. */
174
+ multisigOwnerStates?: readonly MultisigOwnerState[] | undefined
175
+ /** Current multisig config version. Inferred during request preparation; defaults to `0n` for bootstrap. */
176
+ multisigVersion?: bigint | undefined
161
177
  nonceKey?: quantity | undefined
162
178
  signature?: SignatureEnvelope.SignatureEnvelope<quantity, index> | undefined
163
179
  signatures?: readonly SignatureEnvelope.Serialized[] | undefined
@@ -191,6 +207,7 @@ export function getType(
191
207
  typeof transaction.feeToken !== 'undefined' ||
192
208
  typeof transaction.keyAuthorization !== 'undefined' ||
193
209
  typeof transaction.multisig !== 'undefined' ||
210
+ typeof transaction.multisigVersion !== 'undefined' ||
194
211
  typeof transaction.nonceKey !== 'undefined' ||
195
212
  typeof transaction.signature !== 'undefined' ||
196
213
  typeof transaction.signatures !== 'undefined' ||
@@ -325,14 +342,17 @@ async function serializeTempo(
325
342
  const hasPrefilledFeePayerSignature =
326
343
  typeof transaction.feePayerSignature !== 'undefined' &&
327
344
  transaction.feePayerSignature !== null
345
+ const hasSenderSignature =
346
+ typeof signature_provided !== 'undefined' ||
347
+ Boolean(transaction.multisig && transaction.signatures)
328
348
  // Sponsorship sender signatures omit `feeToken`.
329
349
  const shouldStripFeeTokenForSponsorship =
330
350
  // Relay fills a partial sender envelope first.
331
- (feePayer === true && (!signature_provided || !feePayerSignature)) ||
351
+ (feePayer === true && (!hasSenderSignature || !feePayerSignature)) ||
332
352
  // Local fee-payer accounts sign after sender serialization.
333
- (typeof feePayer === 'object' && !signature_provided) ||
353
+ (typeof feePayer === 'object' && !hasSenderSignature) ||
334
354
  // Filled transactions can already include fee-payer approval.
335
- (!signature_provided && hasPrefilledFeePayerSignature)
355
+ (!hasSenderSignature && hasPrefilledFeePayerSignature)
336
356
 
337
357
  const transaction_ox = {
338
358
  ...rest,
@@ -371,15 +391,35 @@ async function serializeTempo(
371
391
  const signatures = transaction.signatures.map((approval) =>
372
392
  SignatureEnvelope.from(approval),
373
393
  )
374
- const sorted = SignatureEnvelope.sortMultisigApprovals({
375
- payload,
376
- signatures,
377
- genesisConfig: transaction.multisig,
378
- })
394
+ const sorted =
395
+ typeof transaction.multisig === 'string'
396
+ ? SignatureEnvelope.sortMultisigApprovals({
397
+ account: transaction.multisig,
398
+ payload,
399
+ signatures,
400
+ version: transaction.multisigVersion,
401
+ })
402
+ : SignatureEnvelope.sortMultisigApprovals({
403
+ initialConfig: transaction.multisig,
404
+ payload,
405
+ signatures,
406
+ version: transaction.multisigVersion,
407
+ })
408
+ const keyAuthorizationSignature = transaction.keyAuthorization?.signature
409
+ const keyAuthorizationInitializes =
410
+ keyAuthorizationSignature?.type === 'multisig' &&
411
+ typeof keyAuthorizationSignature.init !== 'undefined'
412
+ if (typeof transaction.multisig === 'string')
413
+ return SignatureEnvelope.from({
414
+ account: transaction.multisig,
415
+ signatures: sorted,
416
+ })
379
417
  return SignatureEnvelope.from({
380
- genesisConfig: transaction.multisig,
418
+ initialConfig: transaction.multisig,
381
419
  signatures: sorted,
382
- ...(nonce || transaction.nonceKey ? {} : { init: true }),
420
+ ...(nonce || transaction.nonceKey || keyAuthorizationInitializes
421
+ ? {}
422
+ : { init: true }),
383
423
  })
384
424
  })()
385
425
 
@@ -1,5 +1,9 @@
1
1
  import type { Address } from 'abitype'
2
- import type { KeyAuthorization } from 'ox/tempo'
2
+ import {
3
+ type KeyAuthorization,
4
+ MultisigConfig,
5
+ type SignatureEnvelope,
6
+ } from 'ox/tempo'
3
7
  import type { Account } from '../../accounts/types.js'
4
8
  import { parseAccount } from '../../accounts/utils/parseAccount.js'
5
9
  import type { ReadContractReturnType } from '../../actions/public/readContract.js'
@@ -21,10 +25,21 @@ import type { Hex } from '../../types/misc.js'
21
25
  import type { Compute, UnionOmit } from '../../types/utils.js'
22
26
  import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
23
27
  import * as Abis from '../Abis.js'
24
- import type { AccessKeyAccount, resolveAccessKey } from '../Account.js'
25
- import { signKeyAuthorization } from '../Account.js'
28
+ import type {
29
+ AccessKeyAccount,
30
+ MultisigAccount,
31
+ resolveAccessKey,
32
+ } from '../Account.js'
33
+ import {
34
+ getKeyAuthorizationSignPayload,
35
+ signKeyAuthorization,
36
+ } from '../Account.js'
26
37
  import * as Addresses from '../Addresses.js'
27
38
  import * as Hardfork from '../Hardfork.js'
39
+ import {
40
+ createMultisigStateResolver,
41
+ getMultisigOwnerStates,
42
+ } from '../internal/multisig.js'
28
43
  import type {
29
44
  GetAccountParameter,
30
45
  ReadParameters,
@@ -32,6 +47,7 @@ import type {
32
47
  } from '../internal/types.js'
33
48
  import { defineCall } from '../internal/utils.js'
34
49
  import type { TransactionReceipt } from '../Transaction.js'
50
+ import * as multisig from './multisig.js'
35
51
 
36
52
  /** @internal */
37
53
  const signatureTypes = {
@@ -155,10 +171,10 @@ export namespace authorize {
155
171
  const account_ = rest.account ?? client.account
156
172
  if (!account_) throw new Error('account is required.')
157
173
  if (!chainId) throw new Error('chainId is required.')
158
- const parsed = parseAccount(account_)
159
- const keyAuthorization = await signKeyAuthorization(parsed as never, {
160
- chainId: BigInt(chainId),
161
- key: accessKey,
174
+ const keyAuthorization = await signAuthorization(client, {
175
+ account: account_,
176
+ accessKey,
177
+ chainId,
162
178
  admin,
163
179
  expiry,
164
180
  limits,
@@ -1003,52 +1019,73 @@ export namespace revokeSync {
1003
1019
  }
1004
1020
 
1005
1021
  /**
1006
- * Signs a key authorization for an access key.
1022
+ * Prepares a key authorization for signing.
1007
1023
  *
1008
1024
  * @example
1009
1025
  * ```ts
1010
- * import { generatePrivateKey } from 'viem/accounts'
1011
- * import { Account, Actions } from 'viem/tempo'
1012
- *
1013
- * const account = Account.from({ privateKey: '0x...' })
1014
- * const accessKey = Account.fromP256(generatePrivateKey(), {
1015
- * access: account,
1026
+ * const authorization = await Actions.accessKey.prepareAuthorization(client, {
1027
+ * account,
1028
+ * accessKey,
1016
1029
  * })
1017
- *
1018
1030
  * const keyAuthorization = await Actions.accessKey.signAuthorization(
1019
1031
  * client,
1020
- * {
1021
- * account,
1022
- * accessKey,
1023
- * expiry: Math.floor((Date.now() + 30_000) / 1000),
1024
- * },
1032
+ * authorization,
1025
1033
  * )
1026
1034
  * ```
1027
1035
  *
1028
1036
  * @param client - Client.
1029
1037
  * @param parameters - Parameters.
1030
- * @returns The signed key authorization.
1038
+ * @returns Prepared key authorization parameters.
1031
1039
  */
1032
- export async function signAuthorization<
1040
+ export async function prepareAuthorization<
1033
1041
  chain extends Chain | undefined,
1034
1042
  account extends Account | undefined,
1035
1043
  >(
1036
1044
  client: Client<Transport, chain, account>,
1037
- parameters: signAuthorization.Parameters<account>,
1038
- ): Promise<signAuthorization.ReturnValue> {
1039
- const { accessKey, chainId = client.chain?.id, ...rest } = parameters
1040
- const account_ = rest.account ?? client.account
1045
+ parameters: prepareAuthorization.Parameters<account>,
1046
+ ): Promise<prepareAuthorization.ReturnValue> {
1047
+ const { chainId = client.chain?.id } = parameters
1048
+ const account_ = parameters.account ?? client.account
1041
1049
  if (!account_) throw new Error('account is required.')
1042
1050
  if (!chainId) throw new Error('chainId is required.')
1043
1051
  const parsed = parseAccount(account_)
1044
- return signKeyAuthorization(parsed as never, {
1045
- chainId: BigInt(chainId),
1046
- key: accessKey,
1047
- ...rest,
1048
- })
1052
+ const multisigState = await (async () => {
1053
+ if ('multisig' in parameters) return parameters.multisig
1054
+ if (parsed.source !== 'multisig') return undefined
1055
+ 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 }
1062
+ })()
1063
+ const authorizationSignPayload = getKeyAuthorizationSignPayload(
1064
+ parsed as never,
1065
+ {
1066
+ ...parameters,
1067
+ chainId: BigInt(chainId),
1068
+ key: parameters.accessKey,
1069
+ },
1070
+ )
1071
+ const signPayload =
1072
+ parsed.source === 'multisig' && multisigState
1073
+ ? MultisigConfig.getSignPayload({
1074
+ account: parsed.address,
1075
+ payload: authorizationSignPayload,
1076
+ version: multisigState.version,
1077
+ })
1078
+ : authorizationSignPayload
1079
+ return {
1080
+ ...parameters,
1081
+ account: parsed,
1082
+ chainId,
1083
+ multisig: multisigState,
1084
+ signPayload,
1085
+ } as never
1049
1086
  }
1050
1087
 
1051
- export namespace signAuthorization {
1088
+ export namespace prepareAuthorization {
1052
1089
  export type Parameters<
1053
1090
  account extends Account | undefined = Account | undefined,
1054
1091
  > = GetAccountParameter<account> & {
@@ -1070,6 +1107,8 @@ export namespace signAuthorization {
1070
1107
  limits?:
1071
1108
  | { token: Address; limit: bigint; period?: number | undefined }[]
1072
1109
  | undefined
1110
+ /** @internal Prepared multisig state. */
1111
+ multisig?: signKeyAuthorization.Parameters['multisig']
1073
1112
  /** Call scopes restricting which contracts/selectors this key can call. */
1074
1113
  scopes?: KeyAuthorization.Scope[] | undefined
1075
1114
  /**
@@ -1085,6 +1124,63 @@ export namespace signAuthorization {
1085
1124
  witness?: Hex | undefined
1086
1125
  }
1087
1126
 
1127
+ export type ReturnValue = Compute<
1128
+ Omit<Parameters<Account | undefined>, 'account' | 'chainId'> & {
1129
+ account: Account
1130
+ chainId: number
1131
+ multisig: signKeyAuthorization.Parameters['multisig']
1132
+ /** Payload that the authorizing account or multisig owners sign. */
1133
+ signPayload: Hex
1134
+ }
1135
+ >
1136
+ }
1137
+
1138
+ /**
1139
+ * Signs a key authorization for an access key.
1140
+ *
1141
+ * Use {@link prepareAuthorization} before this action when signing requires
1142
+ * transient user activation.
1143
+ *
1144
+ * @param client - Client.
1145
+ * @param parameters - Parameters or the prepared result.
1146
+ * @returns The signed key authorization.
1147
+ */
1148
+ export async function signAuthorization<
1149
+ chain extends Chain | undefined,
1150
+ account extends Account | undefined,
1151
+ >(
1152
+ client: Client<Transport, chain, account>,
1153
+ parameters: signAuthorization.Parameters<account>,
1154
+ ): Promise<signAuthorization.ReturnValue> {
1155
+ const prepared = (
1156
+ 'multisig' in parameters
1157
+ ? parameters
1158
+ : await prepareAuthorization(client, parameters)
1159
+ ) as prepareAuthorization.ReturnValue
1160
+ const {
1161
+ accessKey,
1162
+ account: account_,
1163
+ chainId,
1164
+ multisig: multisigState,
1165
+ signPayload: _,
1166
+ ...rest
1167
+ } = prepared
1168
+ return signKeyAuthorization(account_ as never, {
1169
+ chainId: BigInt(chainId),
1170
+ key: accessKey,
1171
+ multisig: multisigState,
1172
+ ...rest,
1173
+ })
1174
+ }
1175
+
1176
+ export namespace signAuthorization {
1177
+ export type Parameters<
1178
+ account extends Account | undefined = Account | undefined,
1179
+ > = prepareAuthorization.Parameters<account> & {
1180
+ /** Serialized approvals from external multisig owners. */
1181
+ signatures?: readonly SignatureEnvelope.Serialized[] | undefined
1182
+ }
1183
+
1088
1184
  export type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>
1089
1185
  }
1090
1186
 
@@ -968,8 +968,8 @@ export namespace depositSharesSync {
968
968
  * assetToken: '0x...',
969
969
  * gateway: '0x...',
970
970
  * recipient: '0x...',
971
- * recoveryRecipient: '0x...',
972
971
  * shareAmountMin: 99_500_000n,
972
+ * tempoRefundRecipient: '0x...',
973
973
  * vault: '0x...',
974
974
  * vaultAssetAmountMin: 99_000_000n,
975
975
  * zoneId: 7,
@@ -1019,11 +1019,11 @@ export namespace privateDeposit {
1019
1019
  actionId = Hex.random(32),
1020
1020
  assetAmount,
1021
1021
  callbackGas = zoneGatewayCallbackGas,
1022
- fallbackRecipient = parameters.recoveryRecipient,
1022
+ tempoRefundRecipient,
1023
+ fallbackRecipient = tempoRefundRecipient,
1023
1024
  gateway,
1024
1025
  portalAddress: portalAddress_,
1025
1026
  recipient,
1026
- recoveryRecipient,
1027
1027
  returnMemo,
1028
1028
  vault,
1029
1029
  withdrawalMemo,
@@ -1062,7 +1062,11 @@ export namespace privateDeposit {
1062
1062
  minEarnShares: shareAmountMin,
1063
1063
  minOutputAmount: 0n,
1064
1064
  minVaultAssets: parameters.vaultAssetAmountMin ?? assetAmount,
1065
- zoneReturn: { encrypted, keyIndex, refundRecipient: recoveryRecipient },
1065
+ zoneReturn: {
1066
+ encrypted,
1067
+ keyIndex,
1068
+ refundRecipient: tempoRefundRecipient,
1069
+ },
1066
1070
  },
1067
1071
  ])
1068
1072
  return {
@@ -2346,9 +2350,9 @@ export namespace redeemSync {
2346
2350
  * const prepared = await Actions.earn.privateRedeem.prepare(parentClient, {
2347
2351
  * gateway: '0x...',
2348
2352
  * recipient: '0x...',
2349
- * recoveryRecipient: '0x...',
2350
2353
  * shareAmount: 100_000_000n,
2351
2354
  * slippageBps: 50,
2355
+ * tempoRefundRecipient: '0x...',
2352
2356
  * vault: '0x...',
2353
2357
  * zoneId: 7,
2354
2358
  * })
@@ -2396,11 +2400,11 @@ export namespace privateRedeem {
2396
2400
  const {
2397
2401
  actionId = Hex.random(32),
2398
2402
  callbackGas = zoneGatewayCallbackGas,
2399
- fallbackRecipient = parameters.recoveryRecipient,
2403
+ tempoRefundRecipient,
2404
+ fallbackRecipient = tempoRefundRecipient,
2400
2405
  gateway,
2401
2406
  portalAddress: portalAddress_,
2402
2407
  recipient,
2403
- recoveryRecipient,
2404
2408
  returnMemo,
2405
2409
  shareAmount,
2406
2410
  vault,
@@ -2456,7 +2460,11 @@ export namespace privateRedeem {
2456
2460
  minEarnShares: 0n,
2457
2461
  minOutputAmount: assetAmountMin,
2458
2462
  minVaultAssets: assetAmountMin,
2459
- zoneReturn: { encrypted, keyIndex, refundRecipient: recoveryRecipient },
2463
+ zoneReturn: {
2464
+ encrypted,
2465
+ keyIndex,
2466
+ refundRecipient: tempoRefundRecipient,
2467
+ },
2460
2468
  },
2461
2469
  ])
2462
2470
  return {
@@ -3016,7 +3024,7 @@ type PrivatePreparationParameters = {
3016
3024
  actionId?: Hex.Hex | undefined
3017
3025
  /** Gas reserved for the parent-chain callback. @default `10_000_000n` */
3018
3026
  callbackGas?: bigint | undefined
3019
- /** Public recipient if the parent-chain callback fails. @default `recoveryRecipient` */
3027
+ /** Public recipient if the parent-chain callback fails. @default `tempoRefundRecipient` */
3020
3028
  fallbackRecipient?: Address | undefined
3021
3029
  /** Zone gateway address. */
3022
3030
  gateway: Address
@@ -3024,10 +3032,10 @@ type PrivatePreparationParameters = {
3024
3032
  portalAddress?: Address | undefined
3025
3033
  /** Encrypted recipient for the returned tokens. */
3026
3034
  recipient: Address
3027
- /** Public recipient if the encrypted return fails. */
3028
- recoveryRecipient: Address
3029
3035
  /** Optional memo encrypted with the returned Zone deposit. */
3030
3036
  returnMemo?: Hex.Hex | undefined
3037
+ /** Refund recipient on the parent chain if the return deposit bounces. */
3038
+ tempoRefundRecipient: Address
3031
3039
  /** Vault address. */
3032
3040
  vault: Address
3033
3041
  /** Optional memo attached to the Zone withdrawal. */
@@ -6,6 +6,7 @@ export * as dex from './dex.js'
6
6
  export * as earn from './earn.js'
7
7
  export * as faucet from './faucet.js'
8
8
  export * as fee from './fee.js'
9
+ export * as multisig from './multisig.js'
9
10
  export * as nonce from './nonce.js'
10
11
  export * as policy from './policy.js'
11
12
  export * as receivePolicy from './receivePolicy.js'