viem 2.55.19 → 2.56.1

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 (134) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/_cjs/chains/definitions/berachainBepolia.js +1 -1
  3. package/_cjs/errors/version.js +1 -1
  4. package/_cjs/errors/version.js.map +1 -1
  5. package/_cjs/tempo/Abis.js +4851 -2166
  6. package/_cjs/tempo/Abis.js.map +1 -1
  7. package/_cjs/tempo/Addresses.js +31 -1
  8. package/_cjs/tempo/Addresses.js.map +1 -1
  9. package/_cjs/tempo/Decorator.js +3 -2
  10. package/_cjs/tempo/Decorator.js.map +1 -1
  11. package/_cjs/tempo/Selectors.js +197 -61
  12. package/_cjs/tempo/Selectors.js.map +1 -1
  13. package/_cjs/tempo/Storage.js +6 -6
  14. package/_cjs/tempo/Storage.js.map +1 -1
  15. package/_cjs/tempo/Transport.js +21 -0
  16. package/_cjs/tempo/Transport.js.map +1 -1
  17. package/_cjs/tempo/Zone.js +51 -0
  18. package/_cjs/tempo/Zone.js.map +1 -0
  19. package/_cjs/tempo/actions/earn/deployment.js +59 -21
  20. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  21. package/_cjs/tempo/actions/earn.js +2 -3
  22. package/_cjs/tempo/actions/earn.js.map +1 -1
  23. package/_cjs/tempo/actions/zone.js +65 -28
  24. package/_cjs/tempo/actions/zone.js.map +1 -1
  25. package/_cjs/tempo/index.js +3 -3
  26. package/_cjs/tempo/index.js.map +1 -1
  27. package/_esm/chains/definitions/berachainBepolia.js +1 -1
  28. package/_esm/errors/version.js +1 -1
  29. package/_esm/errors/version.js.map +1 -1
  30. package/_esm/tempo/Abis.js +5419 -2732
  31. package/_esm/tempo/Abis.js.map +1 -1
  32. package/_esm/tempo/Addresses.js +36 -0
  33. package/_esm/tempo/Addresses.js.map +1 -1
  34. package/_esm/tempo/Decorator.js +3 -2
  35. package/_esm/tempo/Decorator.js.map +1 -1
  36. package/_esm/tempo/Selectors.js +197 -61
  37. package/_esm/tempo/Selectors.js.map +1 -1
  38. package/_esm/tempo/Storage.js +7 -7
  39. package/_esm/tempo/Storage.js.map +1 -1
  40. package/_esm/tempo/Transport.js +37 -0
  41. package/_esm/tempo/Transport.js.map +1 -1
  42. package/_esm/tempo/Zone.js +48 -0
  43. package/_esm/tempo/Zone.js.map +1 -0
  44. package/_esm/tempo/actions/earn/deployment.js +66 -25
  45. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  46. package/_esm/tempo/actions/earn.js +2 -3
  47. package/_esm/tempo/actions/earn.js.map +1 -1
  48. package/_esm/tempo/actions/zone.js +111 -66
  49. package/_esm/tempo/actions/zone.js.map +1 -1
  50. package/_esm/tempo/index.js +2 -2
  51. package/_esm/tempo/index.js.map +1 -1
  52. package/_types/chains/definitions/berachainBepolia.d.ts +1 -1
  53. package/_types/errors/version.d.ts +1 -1
  54. package/_types/errors/version.d.ts.map +1 -1
  55. package/_types/tempo/Abis.d.ts +31049 -6004
  56. package/_types/tempo/Abis.d.ts.map +1 -1
  57. package/_types/tempo/Addresses.d.ts +11 -0
  58. package/_types/tempo/Addresses.d.ts.map +1 -1
  59. package/_types/tempo/Decorator.d.ts +30 -22
  60. package/_types/tempo/Decorator.d.ts.map +1 -1
  61. package/_types/tempo/Selectors.d.ts +196 -60
  62. package/_types/tempo/Selectors.d.ts.map +1 -1
  63. package/_types/tempo/Storage.d.ts +1 -1
  64. package/_types/tempo/Storage.d.ts.map +1 -1
  65. package/_types/tempo/Transport.d.ts +24 -0
  66. package/_types/tempo/Transport.d.ts.map +1 -1
  67. package/_types/tempo/Zone.d.ts +6824 -0
  68. package/_types/tempo/Zone.d.ts.map +1 -0
  69. package/_types/tempo/actions/channel.d.ts +72 -0
  70. package/_types/tempo/actions/channel.d.ts.map +1 -1
  71. package/_types/tempo/actions/dex.d.ts +260 -0
  72. package/_types/tempo/actions/dex.d.ts.map +1 -1
  73. package/_types/tempo/actions/earn/deployment.d.ts +86 -278
  74. package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
  75. package/_types/tempo/actions/earn.d.ts +540 -16
  76. package/_types/tempo/actions/earn.d.ts.map +1 -1
  77. package/_types/tempo/actions/policy.d.ts +108 -0
  78. package/_types/tempo/actions/policy.d.ts.map +1 -1
  79. package/_types/tempo/actions/receivePolicy.d.ts +27 -0
  80. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
  81. package/_types/tempo/actions/zone.d.ts +165 -82
  82. package/_types/tempo/actions/zone.d.ts.map +1 -1
  83. package/_types/tempo/index.d.ts +8 -2
  84. package/_types/tempo/index.d.ts.map +1 -1
  85. package/chains/definitions/berachainBepolia.ts +1 -1
  86. package/errors/version.ts +1 -1
  87. package/package.json +1 -6
  88. package/tempo/Abis.ts +5408 -2710
  89. package/tempo/Addresses.ts +40 -0
  90. package/tempo/Decorator.ts +39 -28
  91. package/tempo/Selectors.ts +218 -71
  92. package/tempo/Storage.ts +5 -8
  93. package/tempo/Transport.ts +57 -0
  94. package/tempo/Zone.ts +60 -0
  95. package/tempo/actions/earn/deployment.ts +74 -30
  96. package/tempo/actions/earn.ts +2 -3
  97. package/tempo/actions/zone.ts +188 -84
  98. package/tempo/index.ts +19 -6
  99. package/_cjs/tempo/zones/Abis.js +0 -213
  100. package/_cjs/tempo/zones/Abis.js.map +0 -1
  101. package/_cjs/tempo/zones/Addresses.js +0 -17
  102. package/_cjs/tempo/zones/Addresses.js.map +0 -1
  103. package/_cjs/tempo/zones/index.js +0 -13
  104. package/_cjs/tempo/zones/index.js.map +0 -1
  105. package/_cjs/tempo/zones/transport.js +0 -24
  106. package/_cjs/tempo/zones/transport.js.map +0 -1
  107. package/_cjs/tempo/zones/zone.js +0 -82
  108. package/_cjs/tempo/zones/zone.js.map +0 -1
  109. package/_esm/tempo/zones/Abis.js +0 -210
  110. package/_esm/tempo/zones/Abis.js.map +0 -1
  111. package/_esm/tempo/zones/Addresses.js +0 -14
  112. package/_esm/tempo/zones/Addresses.js.map +0 -1
  113. package/_esm/tempo/zones/index.js +0 -6
  114. package/_esm/tempo/zones/index.js.map +0 -1
  115. package/_esm/tempo/zones/transport.js +0 -39
  116. package/_esm/tempo/zones/transport.js.map +0 -1
  117. package/_esm/tempo/zones/zone.js +0 -78
  118. package/_esm/tempo/zones/zone.js.map +0 -1
  119. package/_types/tempo/zones/Abis.d.ts +0 -383
  120. package/_types/tempo/zones/Abis.d.ts.map +0 -1
  121. package/_types/tempo/zones/Addresses.d.ts +0 -13
  122. package/_types/tempo/zones/Addresses.d.ts.map +0 -1
  123. package/_types/tempo/zones/index.d.ts +0 -5
  124. package/_types/tempo/zones/index.d.ts.map +0 -1
  125. package/_types/tempo/zones/transport.d.ts +0 -26
  126. package/_types/tempo/zones/transport.d.ts.map +0 -1
  127. package/_types/tempo/zones/zone.d.ts +0 -3176
  128. package/_types/tempo/zones/zone.d.ts.map +0 -1
  129. package/tempo/zones/Abis.ts +0 -211
  130. package/tempo/zones/Addresses.ts +0 -15
  131. package/tempo/zones/index.ts +0 -10
  132. package/tempo/zones/package.json +0 -6
  133. package/tempo/zones/transport.ts +0 -58
  134. package/tempo/zones/zone.ts +0 -113
@@ -6,12 +6,19 @@ import * as Secp256k1 from 'ox/Secp256k1'
6
6
  import { TokenId, ZoneId, ZoneRpcAuthentication } from 'ox/tempo'
7
7
  import type { Account } from '../../accounts/types.js'
8
8
  import { parseAccount } from '../../accounts/utils/parseAccount.js'
9
+ import {
10
+ type GetContractReturnType,
11
+ getContract,
12
+ } from '../../actions/getContract.js'
9
13
  import {
10
14
  type MulticallErrorType,
11
15
  type MulticallParameters,
12
16
  multicall,
13
17
  } from '../../actions/public/multicall.js'
14
- import { readContract } from '../../actions/public/readContract.js'
18
+ import {
19
+ type ReadContractErrorType,
20
+ readContract,
21
+ } from '../../actions/public/readContract.js'
15
22
  import {
16
23
  type PrepareTransactionRequestErrorType,
17
24
  type PrepareTransactionRequestRequest,
@@ -24,6 +31,7 @@ import {
24
31
  } from '../../actions/wallet/sendTransaction.js'
25
32
  import { sendTransactionSync } from '../../actions/wallet/sendTransactionSync.js'
26
33
  import type { Client } from '../../clients/createClient.js'
34
+ import type { PublicClient } from '../../clients/createPublicClient.js'
27
35
  import type { Transport } from '../../clients/transports/createTransport.js'
28
36
  import { zeroHash } from '../../constants/bytes.js'
29
37
  import type { BaseErrorType } from '../../errors/base.js'
@@ -60,11 +68,24 @@ import {
60
68
  import * as WithdrawalSenderTag from '../internal/WithdrawalSenderTag.js'
61
69
  import * as Storage from '../Storage.js'
62
70
  import type { TransactionReceipt } from '../Transaction.js'
63
- import * as ZoneAbis from '../zones/Abis.js'
64
- import { getPortalAddress } from '../zones/zone.js'
65
71
 
66
72
  const defaultWithdrawalGas = 10_000_000n
67
73
 
74
+ // TODO: Remove this compatibility ABI when T10 support is retired.
75
+ // Later Zone deployments append the derived address to these two values.
76
+ const sequencerEncryptionKeyAbi = [
77
+ {
78
+ name: 'sequencerEncryptionKey',
79
+ type: 'function',
80
+ stateMutability: 'view',
81
+ inputs: [],
82
+ outputs: [
83
+ { type: 'bytes32', name: 'x' },
84
+ { type: 'uint8', name: 'yParity' },
85
+ ],
86
+ },
87
+ ] as const
88
+
68
89
  export type EncryptedPayload = {
69
90
  ciphertext: Hex.Hex
70
91
  ephemeralPubkeyX: Hex.Hex
@@ -144,9 +165,6 @@ export async function deposit<
144
165
  client: Client<Transport, chain, account>,
145
166
  parameters: deposit.Parameters<chain, account>,
146
167
  ): Promise<deposit.ReturnValue> {
147
- const chainId = client.chain?.id
148
- if (!chainId) throw new Error('`chain` is required.')
149
-
150
168
  const { account = client.account, ...rest } = parameters
151
169
 
152
170
  const account_ = account ? parseAccount(account) : undefined
@@ -157,7 +175,6 @@ export async function deposit<
157
175
  parameters.tempoRefundRecipient ?? account_.address
158
176
  const args = {
159
177
  ...parameters,
160
- chainId,
161
178
  recipient,
162
179
  tempoRefundRecipient,
163
180
  }
@@ -173,7 +190,7 @@ export namespace deposit {
173
190
  chain extends Chain | undefined = Chain | undefined,
174
191
  account extends Account | undefined = Account | undefined,
175
192
  > = WriteParameters<chain, account> &
176
- Omit<Args, 'chainId' | 'recipient' | 'tempoRefundRecipient'> & {
193
+ Omit<Args, 'recipient' | 'tempoRefundRecipient'> & {
177
194
  /** Recipient address in the zone. @default `account.address` */
178
195
  recipient?: Address | undefined
179
196
  /** Refund recipient on the parent chain. @default `account.address` */
@@ -183,11 +200,9 @@ export namespace deposit {
183
200
  export type Args = {
184
201
  /** Amount of tokens to deposit. */
185
202
  amount: bigint
186
- /** Parent chain ID (e.g. `42431` for moderato). */
187
- chainId: number
188
203
  /** Optional deposit memo. @default `0x00...00` */
189
204
  memo?: Hex.Hex | undefined
190
- /** Zone portal address. @default resolved via the portal registry. */
205
+ /** Zone portal address. @default derived from `zoneId`. */
191
206
  portalAddress?: Address | undefined
192
207
  /** Recipient address in the zone. */
193
208
  recipient: Address
@@ -213,15 +228,13 @@ export namespace deposit {
213
228
  export function calls(args: Args) {
214
229
  const {
215
230
  amount,
216
- chainId,
217
231
  memo = zeroHash,
218
232
  recipient,
219
233
  tempoRefundRecipient,
220
234
  token,
221
235
  zoneId,
222
236
  } = args
223
- const portalAddress =
224
- args.portalAddress ?? getPortalAddress(chainId, zoneId)
237
+ const portalAddress = args.portalAddress ?? Addresses.zonePortal(zoneId)
225
238
  const tokenAddress = TokenId.toAddress(token)
226
239
  const approveCall = defineCall({
227
240
  address: tokenAddress,
@@ -231,7 +244,7 @@ export namespace deposit {
231
244
  })
232
245
  const depositCall = defineCall({
233
246
  address: portalAddress,
234
- abi: ZoneAbis.zonePortal,
247
+ abi: Abis.zonePortal,
235
248
  functionName: 'deposit',
236
249
  args: [tokenAddress, recipient, amount, memo, tempoRefundRecipient],
237
250
  })
@@ -274,9 +287,6 @@ export async function depositSync<
274
287
  client: Client<Transport, chain, account>,
275
288
  parameters: depositSync.Parameters<chain, account>,
276
289
  ): Promise<depositSync.ReturnValue> {
277
- const chainId = client.chain?.id
278
- if (!chainId) throw new Error('`chain` is required.')
279
-
280
290
  const {
281
291
  account = client.account,
282
292
  throwOnReceiptRevert = true,
@@ -291,7 +301,6 @@ export async function depositSync<
291
301
  parameters.tempoRefundRecipient ?? account_.address
292
302
  const args = {
293
303
  ...parameters,
294
- chainId,
295
304
  recipient,
296
305
  tempoRefundRecipient,
297
306
  }
@@ -348,11 +357,8 @@ export async function getEncryptionKey<chain extends Chain | undefined>(
348
357
  client: Client<Transport, chain>,
349
358
  parameters: getEncryptionKey.Parameters,
350
359
  ): Promise<getEncryptionKey.ReturnValue> {
351
- const chainId = client.chain?.id
352
- if (!chainId) throw new Error('`chain` is required.')
353
-
354
360
  const { account, portalAddress: portalAddress_, zoneId, ...rest } = parameters
355
- const portalAddress = portalAddress_ ?? getPortalAddress(chainId, zoneId)
361
+ const portalAddress = portalAddress_ ?? Addresses.zonePortal(zoneId)
356
362
  const [keyCountResult, publicKeyResult] = await multicall(client, {
357
363
  ...rest,
358
364
  account: account ? parseAccount(account).address : undefined,
@@ -392,7 +398,7 @@ export namespace getEncryptionKey {
392
398
  }
393
399
 
394
400
  export type Args = {
395
- /** Zone portal address. @default resolved via the portal registry. */
401
+ /** Zone portal address. @default derived from `zoneId`. */
396
402
  portalAddress?: Address | undefined
397
403
  /** Zone ID (e.g. `7`). */
398
404
  zoneId: number
@@ -424,18 +430,140 @@ export namespace getEncryptionKey {
424
430
  return [
425
431
  defineCall({
426
432
  address: args.portalAddress,
427
- abi: ZoneAbis.zonePortal,
433
+ abi: Abis.zonePortal,
428
434
  functionName: 'encryptionKeyCount',
429
435
  }),
430
436
  defineCall({
431
437
  address: args.portalAddress,
432
- abi: ZoneAbis.zonePortal,
438
+ abi: sequencerEncryptionKeyAbi,
433
439
  functionName: 'sequencerEncryptionKey',
434
440
  }),
435
441
  ] as const
436
442
  }
437
443
  }
438
444
 
445
+ /**
446
+ * Gets metadata and configuration for a zone portal.
447
+ *
448
+ * @example
449
+ * ```ts
450
+ * import { createClient, http } from 'viem'
451
+ * import { tempoModerato } from 'viem/chains'
452
+ * import { Actions } from 'viem/tempo'
453
+ *
454
+ * const client = createClient({
455
+ * chain: tempoModerato,
456
+ * transport: http(),
457
+ * })
458
+ *
459
+ * const info = await Actions.zone.getPortalInfo(client, {
460
+ * zoneId: 7,
461
+ * })
462
+ * ```
463
+ *
464
+ * @param client - Public client connected to the parent Tempo chain.
465
+ * @param parameters - Zone portal parameters.
466
+ * @returns The portal metadata and configuration.
467
+ */
468
+ export async function getPortalInfo<chain extends Chain | undefined>(
469
+ client: Client<Transport, chain>,
470
+ parameters: getPortalInfo.Parameters,
471
+ ): Promise<getPortalInfo.ReturnValue> {
472
+ const { portalAddress: portalAddress_, zoneId, ...rest } = parameters
473
+ const portal = getContract({
474
+ abi: Abis.zonePortal,
475
+ address: portalAddress_ ?? Addresses.zonePortal(zoneId),
476
+ client,
477
+ }) as unknown as GetContractReturnType<
478
+ typeof Abis.zonePortal,
479
+ PublicClient<Transport, Chain>
480
+ >
481
+ const [
482
+ admin,
483
+ enabledTokenCount,
484
+ messenger,
485
+ pauseExpiry,
486
+ paused,
487
+ pendingAdmin,
488
+ sequencerCount,
489
+ sequencerSetVersion,
490
+ sequencerThreshold,
491
+ verifier,
492
+ ] = await Promise.all([
493
+ portal.read.admin(rest),
494
+ portal.read.enabledTokenCount(rest),
495
+ portal.read.messenger(rest),
496
+ portal.read.pauseExpiry(rest),
497
+ portal.read.paused(rest),
498
+ portal.read.pendingAdmin(rest),
499
+ portal.read.sequencerCount(rest),
500
+ portal.read.sequencerSetVersion(rest),
501
+ portal.read.sequencerThreshold(rest),
502
+ portal.read.verifier(rest),
503
+ ])
504
+ const [sequencers, enabledTokens] = await Promise.all([
505
+ Promise.all(
506
+ Array.from({ length: Number(sequencerCount) }, (_, index) =>
507
+ portal.read.sequencerAt([BigInt(index)], rest),
508
+ ),
509
+ ),
510
+ Promise.all(
511
+ Array.from({ length: Number(enabledTokenCount) }, (_, index) =>
512
+ portal.read.enabledTokenAt([BigInt(index)], rest),
513
+ ),
514
+ ),
515
+ ])
516
+
517
+ return {
518
+ admin,
519
+ enabledTokens,
520
+ messenger,
521
+ pauseExpiry,
522
+ paused,
523
+ pendingAdmin,
524
+ sequencers,
525
+ sequencerSetVersion,
526
+ sequencerThreshold,
527
+ verifier,
528
+ }
529
+ }
530
+
531
+ export namespace getPortalInfo {
532
+ export type Parameters = ReadParameters & Args
533
+
534
+ export type Args = {
535
+ /** Zone portal address. @default derived from `zoneId`. */
536
+ portalAddress?: Address | undefined
537
+ /** Zone ID (e.g. `7`). */
538
+ zoneId: number
539
+ }
540
+
541
+ export type ReturnValue = Compute<{
542
+ /** Portal governance admin. */
543
+ admin: Address
544
+ /** Tokens enabled for deposits into the zone. */
545
+ enabledTokens: readonly Address[]
546
+ /** Zone messenger assigned to the portal. */
547
+ messenger: Address
548
+ /** Timestamp when the current emergency pause expires. */
549
+ pauseExpiry: bigint
550
+ /** Whether the portal is paused. */
551
+ paused: boolean
552
+ /** Pending governance admin. */
553
+ pendingAdmin: Address
554
+ /** Active sequencer addresses. */
555
+ sequencers: readonly Address[]
556
+ /** Version of the active sequencer set. */
557
+ sequencerSetVersion: bigint
558
+ /** Number of sequencers required to attest to a settlement. */
559
+ sequencerThreshold: number
560
+ /** Settlement verifier assigned to the portal. */
561
+ verifier: Address
562
+ }>
563
+
564
+ export type ErrorType = ReadContractErrorType | BaseErrorType
565
+ }
566
+
439
567
  /**
440
568
  * Deposits tokens into a zone on the parent Tempo chain with encrypted
441
569
  * recipient and memo. Batches approve and depositEncrypted into a single
@@ -550,7 +678,7 @@ export namespace encryptedDeposit {
550
678
  keyIndex: bigint
551
679
  /** Optional deposit memo. @default `0x00...00` */
552
680
  memo?: Hex.Hex | undefined
553
- /** Zone portal address. @default resolved via the portal registry. */
681
+ /** Zone portal address. @default derived from `zoneId`. */
554
682
  portalAddress?: Address | undefined
555
683
  /** Recipient address in the zone. */
556
684
  recipient: Address
@@ -618,7 +746,7 @@ export namespace encryptedDeposit {
618
746
  } = parameters
619
747
  if (!sender_) throw new Error('`sender` is required.')
620
748
  const sender = sender_
621
- const portalAddress = portalAddress_ ?? getPortalAddress(chainId, zoneId)
749
+ const portalAddress = portalAddress_ ?? Addresses.zonePortal(zoneId)
622
750
 
623
751
  const { keyIndex, publicKey } = await getEncryptionKey(client, {
624
752
  ...rest,
@@ -666,7 +794,7 @@ export namespace encryptedDeposit {
666
794
  amount: bigint
667
795
  /** Optional deposit memo. @default `0x00...00` */
668
796
  memo?: Hex.Hex | undefined
669
- /** Zone portal address. @default resolved via the portal registry. */
797
+ /** Zone portal address. @default derived from `zoneId`. */
670
798
  portalAddress?: Address | undefined
671
799
  /** Recipient address in the zone. */
672
800
  recipient: Address
@@ -734,7 +862,7 @@ export namespace encryptedDeposit {
734
862
  } = parameters
735
863
  if (!sender_) throw new Error('`sender` is required.')
736
864
  const sender = sender_
737
- const portalAddress = portalAddress_ ?? getPortalAddress(chainId, zoneId)
865
+ const portalAddress = portalAddress_ ?? Addresses.zonePortal(zoneId)
738
866
  const { keyIndex, publicKey } = await getEncryptionKey(client, {
739
867
  ...rest,
740
868
  portalAddress,
@@ -775,7 +903,7 @@ export namespace encryptedDeposit {
775
903
  export type Args = {
776
904
  /** Optional deposit memo. @default `0x00...00` */
777
905
  memo?: Hex.Hex | undefined
778
- /** Zone portal address. @default resolved via the portal registry. */
906
+ /** Zone portal address. @default derived from `zoneId`. */
779
907
  portalAddress?: Address | undefined
780
908
  /** Recipient address in the zone. */
781
909
  recipient: Address
@@ -797,17 +925,9 @@ export namespace encryptedDeposit {
797
925
  * @returns The calls.
798
926
  */
799
927
  export function calls(args: Args | PreparedEncryptedDeposit) {
800
- const {
801
- amount,
802
- chainId,
803
- encrypted,
804
- keyIndex,
805
- tempoRefundRecipient,
806
- token,
807
- zoneId,
808
- } = args
809
- const portalAddress =
810
- args.portalAddress ?? getPortalAddress(chainId, zoneId)
928
+ const { amount, encrypted, keyIndex, tempoRefundRecipient, token, zoneId } =
929
+ args
930
+ const portalAddress = args.portalAddress ?? Addresses.zonePortal(zoneId)
811
931
  const tokenAddress = TokenId.toAddress(token)
812
932
  const encryptedPayload = {
813
933
  ephemeralPubkeyX: encrypted.ephemeralPubkeyX,
@@ -824,7 +944,7 @@ export namespace encryptedDeposit {
824
944
  })
825
945
  const depositCall = defineCall({
826
946
  address: portalAddress,
827
- abi: ZoneAbis.zonePortal,
947
+ abi: Abis.zonePortal,
828
948
  functionName: 'depositEncrypted',
829
949
  args: [
830
950
  tokenAddress,
@@ -951,11 +1071,10 @@ export namespace encryptedDepositSync {
951
1071
  * @example
952
1072
  * ```ts
953
1073
  * import { createClient } from 'viem'
954
- * import { http, zoneModerato } from 'viem/tempo/zones'
955
- * import { Actions } from 'viem/tempo'
1074
+ * import { Actions, http, Zone } from 'viem/tempo'
956
1075
  *
957
1076
  * const client = createClient({
958
- * chain: zoneModerato(7),
1077
+ * chain: Zone.a,
959
1078
  * transport: http(),
960
1079
  * })
961
1080
  *
@@ -1009,11 +1128,10 @@ export namespace getAuthorizationTokenInfo {
1009
1128
  * @example
1010
1129
  * ```ts
1011
1130
  * import { createClient } from 'viem'
1012
- * import { http, zoneModerato } from 'viem/tempo/zones'
1013
- * import { Actions } from 'viem/tempo'
1131
+ * import { Actions, http, Zone } from 'viem/tempo'
1014
1132
  *
1015
1133
  * const client = createClient({
1016
- * chain: zoneModerato(7),
1134
+ * chain: Zone.a,
1017
1135
  * transport: http(),
1018
1136
  * })
1019
1137
  *
@@ -1035,7 +1153,7 @@ export async function getWithdrawalFee<
1035
1153
  return readContract(client, {
1036
1154
  ...rest,
1037
1155
  address: Addresses.zoneOutbox,
1038
- abi: ZoneAbis.zoneOutbox,
1156
+ abi: Abis.zoneOutbox,
1039
1157
  functionName: 'calculateWithdrawalFee',
1040
1158
  args: [callbackGas],
1041
1159
  })
@@ -1058,11 +1176,10 @@ export namespace getWithdrawalFee {
1058
1176
  * @example
1059
1177
  * ```ts
1060
1178
  * import { createClient } from 'viem'
1061
- * import { http, zoneModerato } from 'viem/tempo/zones'
1062
- * import { Actions } from 'viem/tempo'
1179
+ * import { Actions, http, Zone } from 'viem/tempo'
1063
1180
  *
1064
1181
  * const client = createClient({
1065
- * chain: zoneModerato(7),
1182
+ * chain: Zone.a,
1066
1183
  * transport: http(),
1067
1184
  * })
1068
1185
  *
@@ -1149,11 +1266,10 @@ export namespace getZoneInfo {
1149
1266
  * @example
1150
1267
  * ```ts
1151
1268
  * import { createClient } from 'viem'
1152
- * import { Actions } from 'viem/tempo'
1153
- * import { http, zoneModerato } from 'viem/tempo/zones'
1269
+ * import { Actions, http, Zone } from 'viem/tempo'
1154
1270
  *
1155
1271
  * const client = createClient({
1156
- * chain: zoneModerato(7),
1272
+ * chain: Zone.a,
1157
1273
  * transport: http(),
1158
1274
  * })
1159
1275
  *
@@ -1253,12 +1369,11 @@ export namespace waitForTempoBlock {
1253
1369
  * ```ts
1254
1370
  * import { createClient } from 'viem'
1255
1371
  * import { privateKeyToAccount } from 'viem/accounts'
1256
- * import { http, zoneModerato } from 'viem/tempo/zones'
1257
- * import { Actions } from 'viem/tempo'
1372
+ * import { Actions, http, Zone } from 'viem/tempo'
1258
1373
  *
1259
1374
  * const client = createClient({
1260
1375
  * account: privateKeyToAccount('0x...'),
1261
- * chain: zoneModerato(7),
1376
+ * chain: Zone.a,
1262
1377
  * transport: http(),
1263
1378
  * })
1264
1379
  *
@@ -1352,7 +1467,7 @@ export namespace requestWithdrawal {
1352
1467
  }),
1353
1468
  defineCall({
1354
1469
  address: Addresses.zoneOutbox,
1355
- abi: ZoneAbis.zoneOutbox,
1470
+ abi: Abis.zoneOutbox,
1356
1471
  functionName: 'requestWithdrawal',
1357
1472
  args: [
1358
1473
  TokenId.toAddress(token),
@@ -1377,11 +1492,10 @@ export namespace requestWithdrawal {
1377
1492
  * @example
1378
1493
  * ```ts
1379
1494
  * import { createClient } from 'viem'
1380
- * import { http, zoneModerato } from 'viem/tempo/zones'
1381
- * import { Actions } from 'viem/tempo'
1495
+ * import { Actions, http, Zone } from 'viem/tempo'
1382
1496
  *
1383
1497
  * const client = createClient({
1384
- * chain: zoneModerato(7),
1498
+ * chain: Zone.a,
1385
1499
  * transport: http(),
1386
1500
  * })
1387
1501
  *
@@ -1537,17 +1651,11 @@ type WithdrawalCalls = ReturnType<typeof requestWithdrawal.calls>
1537
1651
  * import { createClient, createPublicClient, http } from 'viem'
1538
1652
  * import { privateKeyToAccount } from 'viem/accounts'
1539
1653
  * import { tempoModerato } from 'viem/chains'
1540
- * import { Actions } from 'viem/tempo'
1541
- * import {
1542
- * Abis,
1543
- * getPortalAddress,
1544
- * http as zoneHttp,
1545
- * zoneModerato,
1546
- * } from 'viem/tempo/zones'
1654
+ * import { Abis, Actions, Addresses, http as zoneHttp, Zone } from 'viem/tempo'
1547
1655
  *
1548
1656
  * const client = createClient({
1549
1657
  * account: privateKeyToAccount('0x...'),
1550
- * chain: zoneModerato(7),
1658
+ * chain: Zone.a,
1551
1659
  * transport: zoneHttp(),
1552
1660
  * })
1553
1661
  *
@@ -1564,7 +1672,7 @@ type WithdrawalCalls = ReturnType<typeof requestWithdrawal.calls>
1564
1672
  * transport: http(),
1565
1673
  * })
1566
1674
  * const [withdrawal] = await tempoClient.getContractEvents({
1567
- * address: getPortalAddress(tempoModerato.id, 7),
1675
+ * address: Addresses.zonePortal(Zone.a.id),
1568
1676
  * abi: Abis.zonePortal,
1569
1677
  * eventName: 'WithdrawalProcessed',
1570
1678
  * args: { senderTag },
@@ -1600,7 +1708,7 @@ export async function requestWithdrawalSync<
1600
1708
  throwOnReceiptRevert,
1601
1709
  } as never)
1602
1710
  const [event] = parseEventLogs({
1603
- abi: ZoneAbis.zoneOutbox,
1711
+ abi: Abis.zoneOutbox,
1604
1712
  logs: receipt.logs,
1605
1713
  eventName: 'WithdrawalRequested',
1606
1714
  strict: true,
@@ -1645,12 +1753,11 @@ export namespace requestWithdrawalSync {
1645
1753
  * ```ts
1646
1754
  * import { createClient } from 'viem'
1647
1755
  * import { privateKeyToAccount } from 'viem/accounts'
1648
- * import { http, zoneModerato } from 'viem/tempo/zones'
1649
- * import { Actions } from 'viem/tempo'
1756
+ * import { Actions, http, Zone } from 'viem/tempo'
1650
1757
  *
1651
1758
  * const client = createClient({
1652
1759
  * account: privateKeyToAccount('0x...'),
1653
- * chain: zoneModerato(7),
1760
+ * chain: Zone.a,
1654
1761
  * transport: http(),
1655
1762
  * })
1656
1763
  *
@@ -1734,7 +1841,7 @@ export namespace requestVerifiableWithdrawal {
1734
1841
  }),
1735
1842
  defineCall({
1736
1843
  address: Addresses.zoneOutbox,
1737
- abi: ZoneAbis.zoneOutbox,
1844
+ abi: Abis.zoneOutbox,
1738
1845
  functionName: 'requestWithdrawal',
1739
1846
  args: [
1740
1847
  TokenId.toAddress(token),
@@ -1759,12 +1866,11 @@ export namespace requestVerifiableWithdrawal {
1759
1866
  * ```ts
1760
1867
  * import { createClient } from 'viem'
1761
1868
  * import { privateKeyToAccount } from 'viem/accounts'
1762
- * import { http, zoneModerato } from 'viem/tempo/zones'
1763
- * import { Actions } from 'viem/tempo'
1869
+ * import { Actions, http, Zone } from 'viem/tempo'
1764
1870
  *
1765
1871
  * const client = createClient({
1766
1872
  * account: privateKeyToAccount('0x...'),
1767
- * chain: zoneModerato(7),
1873
+ * chain: Zone.a,
1768
1874
  * transport: http(),
1769
1875
  * })
1770
1876
  *
@@ -1826,19 +1932,17 @@ export namespace requestVerifiableWithdrawalSync {
1826
1932
  /**
1827
1933
  * Signs a zone authorization token and stores it for the zone HTTP transport.
1828
1934
  *
1829
- * Zone chains should define `contracts.zonePortal` with the portal address.
1830
1935
  * The `zoneId` is derived from `ZoneId.fromChainId(chain.id)` and can be overridden.
1831
1936
  *
1832
1937
  * @example
1833
1938
  * ```ts
1834
1939
  * import { createClient } from 'viem'
1835
1940
  * import { privateKeyToAccount } from 'viem/accounts'
1836
- * import { http, zoneModerato } from 'viem/tempo/zones'
1837
- * import { Actions } from 'viem/tempo'
1941
+ * import { Actions, http, Zone } from 'viem/tempo'
1838
1942
  *
1839
1943
  * const client = createClient({
1840
1944
  * account: privateKeyToAccount('0x...'),
1841
- * chain: zoneModerato(7),
1945
+ * chain: Zone.a,
1842
1946
  * transport: http(),
1843
1947
  * })
1844
1948
  *
package/tempo/index.ts CHANGED
@@ -23,6 +23,11 @@ export {
23
23
  VirtualAddress,
24
24
  VirtualMaster,
25
25
  } from 'ox/tempo'
26
+ // TODO: remove
27
+ export type {
28
+ /** @deprecated */
29
+ Owner as z_MultisigConfigOwner,
30
+ } from 'ox/tempo/MultisigConfig'
26
31
  export {
27
32
  type CustomTransport,
28
33
  type CustomTransportConfig,
@@ -35,11 +40,10 @@ export {
35
40
  type FallbackTransportErrorType,
36
41
  fallback,
37
42
  } from '../clients/transports/fallback.js'
38
- export {
39
- type HttpTransport,
40
- type HttpTransportConfig,
41
- type HttpTransportErrorType,
42
- http,
43
+ export type {
44
+ HttpTransport,
45
+ HttpTransportConfig,
46
+ HttpTransportErrorType,
43
47
  } from '../clients/transports/http.js'
44
48
  export {
45
49
  type WebSocketTransport,
@@ -77,6 +81,8 @@ export * as Storage from './Storage.js'
77
81
  export * as TokenIds from './TokenIds.js'
78
82
  // Export types required for inference.
79
83
  export type {
84
+ /** @deprecated */
85
+ MultisigOwnerState as z_MultisigOwnerState,
80
86
  /** @deprecated */
81
87
  Transaction as z_Transaction,
82
88
  /** @deprecated */
@@ -106,6 +112,13 @@ export type {
106
112
  } from './Transaction.js'
107
113
  export * as Transaction from './Transaction.js'
108
114
  export * as Transport from './Transport.js'
109
- export { walletNamespaceCompat, withFeePayer, withRelay } from './Transport.js'
115
+ export {
116
+ type HttpConfig,
117
+ http,
118
+ walletNamespaceCompat,
119
+ withFeePayer,
120
+ withRelay,
121
+ } from './Transport.js'
110
122
  export * as WebAuthnP256 from './WebAuthnP256.js'
111
123
  export * as WebCryptoP256 from './WebCryptoP256.js'
124
+ export * as Zone from './Zone.js'