viem 2.55.18 → 2.56.0

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 (225) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/_cjs/chains/definitions/berachainBepolia.js +1 -1
  3. package/_cjs/chains/definitions/morphTachyon.js +25 -0
  4. package/_cjs/chains/definitions/morphTachyon.js.map +1 -0
  5. package/_cjs/chains/definitions/morphTachyonTestnet.js +26 -0
  6. package/_cjs/chains/definitions/morphTachyonTestnet.js.map +1 -0
  7. package/_cjs/chains/definitions/ynxTestnet.js +26 -0
  8. package/_cjs/chains/definitions/ynxTestnet.js.map +1 -0
  9. package/_cjs/chains/index.js +13 -7
  10. package/_cjs/chains/index.js.map +1 -1
  11. package/_cjs/errors/version.js +1 -1
  12. package/_cjs/errors/version.js.map +1 -1
  13. package/_cjs/tempo/Abis.js +5314 -2528
  14. package/_cjs/tempo/Abis.js.map +1 -1
  15. package/_cjs/tempo/Account.js +188 -16
  16. package/_cjs/tempo/Account.js.map +1 -1
  17. package/_cjs/tempo/Addresses.js +32 -1
  18. package/_cjs/tempo/Addresses.js.map +1 -1
  19. package/_cjs/tempo/Decorator.js +11 -2
  20. package/_cjs/tempo/Decorator.js.map +1 -1
  21. package/_cjs/tempo/Formatters.js +1 -1
  22. package/_cjs/tempo/Formatters.js.map +1 -1
  23. package/_cjs/tempo/Selectors.js +203 -61
  24. package/_cjs/tempo/Selectors.js.map +1 -1
  25. package/_cjs/tempo/Storage.js +6 -6
  26. package/_cjs/tempo/Storage.js.map +1 -1
  27. package/_cjs/tempo/Transaction.js +31 -10
  28. package/_cjs/tempo/Transaction.js.map +1 -1
  29. package/_cjs/tempo/Transport.js +21 -0
  30. package/_cjs/tempo/Transport.js.map +1 -1
  31. package/_cjs/tempo/Zone.js +51 -0
  32. package/_cjs/tempo/Zone.js.map +1 -0
  33. package/_cjs/tempo/actions/accessKey.js +49 -8
  34. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  35. package/_cjs/tempo/actions/earn/deployment.js +59 -21
  36. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  37. package/_cjs/tempo/actions/earn.js +2 -3
  38. package/_cjs/tempo/actions/earn.js.map +1 -1
  39. package/_cjs/tempo/actions/index.js +2 -1
  40. package/_cjs/tempo/actions/index.js.map +1 -1
  41. package/_cjs/tempo/actions/multisig.js +95 -0
  42. package/_cjs/tempo/actions/multisig.js.map +1 -0
  43. package/_cjs/tempo/actions/zone.js +65 -28
  44. package/_cjs/tempo/actions/zone.js.map +1 -1
  45. package/_cjs/tempo/chainConfig.js +58 -29
  46. package/_cjs/tempo/chainConfig.js.map +1 -1
  47. package/_cjs/tempo/index.js +3 -3
  48. package/_cjs/tempo/index.js.map +1 -1
  49. package/_cjs/tempo/internal/multisig.js +56 -0
  50. package/_cjs/tempo/internal/multisig.js.map +1 -0
  51. package/_esm/chains/definitions/berachainBepolia.js +1 -1
  52. package/_esm/chains/definitions/morphTachyon.js +22 -0
  53. package/_esm/chains/definitions/morphTachyon.js.map +1 -0
  54. package/_esm/chains/definitions/morphTachyonTestnet.js +23 -0
  55. package/_esm/chains/definitions/morphTachyonTestnet.js.map +1 -0
  56. package/_esm/chains/definitions/ynxTestnet.js +23 -0
  57. package/_esm/chains/definitions/ynxTestnet.js.map +1 -0
  58. package/_esm/chains/index.js +3 -0
  59. package/_esm/chains/index.js.map +1 -1
  60. package/_esm/errors/version.js +1 -1
  61. package/_esm/errors/version.js.map +1 -1
  62. package/_esm/tempo/Abis.js +5302 -2514
  63. package/_esm/tempo/Abis.js.map +1 -1
  64. package/_esm/tempo/Account.js +196 -66
  65. package/_esm/tempo/Account.js.map +1 -1
  66. package/_esm/tempo/Addresses.js +37 -0
  67. package/_esm/tempo/Addresses.js.map +1 -1
  68. package/_esm/tempo/Decorator.js +11 -2
  69. package/_esm/tempo/Decorator.js.map +1 -1
  70. package/_esm/tempo/Formatters.js +3 -6
  71. package/_esm/tempo/Formatters.js.map +1 -1
  72. package/_esm/tempo/Selectors.js +203 -61
  73. package/_esm/tempo/Selectors.js.map +1 -1
  74. package/_esm/tempo/Storage.js +7 -7
  75. package/_esm/tempo/Storage.js.map +1 -1
  76. package/_esm/tempo/Transaction.js +31 -10
  77. package/_esm/tempo/Transaction.js.map +1 -1
  78. package/_esm/tempo/Transport.js +37 -0
  79. package/_esm/tempo/Transport.js.map +1 -1
  80. package/_esm/tempo/Zone.js +48 -0
  81. package/_esm/tempo/Zone.js.map +1 -0
  82. package/_esm/tempo/actions/accessKey.js +65 -23
  83. package/_esm/tempo/actions/accessKey.js.map +1 -1
  84. package/_esm/tempo/actions/earn/deployment.js +66 -25
  85. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  86. package/_esm/tempo/actions/earn.js +2 -3
  87. package/_esm/tempo/actions/earn.js.map +1 -1
  88. package/_esm/tempo/actions/index.js +1 -0
  89. package/_esm/tempo/actions/index.js.map +1 -1
  90. package/_esm/tempo/actions/multisig.js +245 -0
  91. package/_esm/tempo/actions/multisig.js.map +1 -0
  92. package/_esm/tempo/actions/zone.js +111 -66
  93. package/_esm/tempo/actions/zone.js.map +1 -1
  94. package/_esm/tempo/chainConfig.js +65 -35
  95. package/_esm/tempo/chainConfig.js.map +1 -1
  96. package/_esm/tempo/index.js +2 -2
  97. package/_esm/tempo/index.js.map +1 -1
  98. package/_esm/tempo/internal/multisig.js +56 -0
  99. package/_esm/tempo/internal/multisig.js.map +1 -0
  100. package/_types/chains/definitions/berachainBepolia.d.ts +1 -1
  101. package/_types/chains/definitions/morphTachyon.d.ts +51 -0
  102. package/_types/chains/definitions/morphTachyon.d.ts.map +1 -0
  103. package/_types/chains/definitions/morphTachyonTestnet.d.ts +51 -0
  104. package/_types/chains/definitions/morphTachyonTestnet.d.ts.map +1 -0
  105. package/_types/chains/definitions/tempo.d.ts +30 -2
  106. package/_types/chains/definitions/tempo.d.ts.map +1 -1
  107. package/_types/chains/definitions/tempoDevnet.d.ts +30 -2
  108. package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
  109. package/_types/chains/definitions/tempoLocalnet.d.ts +30 -2
  110. package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
  111. package/_types/chains/definitions/tempoModerato.d.ts +30 -2
  112. package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
  113. package/_types/chains/definitions/ynxTestnet.d.ts +51 -0
  114. package/_types/chains/definitions/ynxTestnet.d.ts.map +1 -0
  115. package/_types/chains/index.d.ts +3 -0
  116. package/_types/chains/index.d.ts.map +1 -1
  117. package/_types/errors/version.d.ts +1 -1
  118. package/_types/errors/version.d.ts.map +1 -1
  119. package/_types/tempo/Abis.d.ts +31485 -6119
  120. package/_types/tempo/Abis.d.ts.map +1 -1
  121. package/_types/tempo/Account.d.ts +42 -26
  122. package/_types/tempo/Account.d.ts.map +1 -1
  123. package/_types/tempo/Addresses.d.ts +12 -0
  124. package/_types/tempo/Addresses.d.ts.map +1 -1
  125. package/_types/tempo/Decorator.d.ts +62 -22
  126. package/_types/tempo/Decorator.d.ts.map +1 -1
  127. package/_types/tempo/Formatters.d.ts.map +1 -1
  128. package/_types/tempo/Selectors.d.ts +202 -60
  129. package/_types/tempo/Selectors.d.ts.map +1 -1
  130. package/_types/tempo/Storage.d.ts +1 -1
  131. package/_types/tempo/Storage.d.ts.map +1 -1
  132. package/_types/tempo/Transaction.d.ts +17 -2
  133. package/_types/tempo/Transaction.d.ts.map +1 -1
  134. package/_types/tempo/Transport.d.ts +24 -0
  135. package/_types/tempo/Transport.d.ts.map +1 -1
  136. package/_types/tempo/Zone.d.ts +6824 -0
  137. package/_types/tempo/Zone.d.ts.map +1 -0
  138. package/_types/tempo/actions/accessKey.d.ts +35 -17
  139. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  140. package/_types/tempo/actions/channel.d.ts +72 -0
  141. package/_types/tempo/actions/channel.d.ts.map +1 -1
  142. package/_types/tempo/actions/dex.d.ts +260 -0
  143. package/_types/tempo/actions/dex.d.ts.map +1 -1
  144. package/_types/tempo/actions/earn/deployment.d.ts +86 -278
  145. package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
  146. package/_types/tempo/actions/earn.d.ts +540 -16
  147. package/_types/tempo/actions/earn.d.ts.map +1 -1
  148. package/_types/tempo/actions/index.d.ts +1 -0
  149. package/_types/tempo/actions/index.d.ts.map +1 -1
  150. package/_types/tempo/actions/multisig.d.ts +472 -0
  151. package/_types/tempo/actions/multisig.d.ts.map +1 -0
  152. package/_types/tempo/actions/policy.d.ts +108 -0
  153. package/_types/tempo/actions/policy.d.ts.map +1 -1
  154. package/_types/tempo/actions/receivePolicy.d.ts +27 -0
  155. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
  156. package/_types/tempo/actions/zone.d.ts +165 -82
  157. package/_types/tempo/actions/zone.d.ts.map +1 -1
  158. package/_types/tempo/chainConfig.d.ts +15 -1
  159. package/_types/tempo/chainConfig.d.ts.map +1 -1
  160. package/_types/tempo/index.d.ts +3 -2
  161. package/_types/tempo/index.d.ts.map +1 -1
  162. package/_types/tempo/internal/multisig.d.ts +13 -0
  163. package/_types/tempo/internal/multisig.d.ts.map +1 -0
  164. package/chains/definitions/berachainBepolia.ts +1 -1
  165. package/chains/definitions/morphTachyon.ts +22 -0
  166. package/chains/definitions/morphTachyonTestnet.ts +23 -0
  167. package/chains/definitions/ynxTestnet.ts +23 -0
  168. package/chains/index.ts +3 -0
  169. package/errors/version.ts +1 -1
  170. package/package.json +2 -7
  171. package/tempo/Abis.ts +5337 -2537
  172. package/tempo/Account.ts +329 -51
  173. package/tempo/Addresses.ts +41 -0
  174. package/tempo/Decorator.ts +89 -28
  175. package/tempo/Formatters.ts +4 -5
  176. package/tempo/Selectors.ts +225 -71
  177. package/tempo/Storage.ts +5 -8
  178. package/tempo/Transaction.ts +52 -12
  179. package/tempo/Transport.ts +57 -0
  180. package/tempo/Zone.ts +60 -0
  181. package/tempo/actions/accessKey.ts +128 -32
  182. package/tempo/actions/earn/deployment.ts +74 -30
  183. package/tempo/actions/earn.ts +2 -3
  184. package/tempo/actions/index.ts +1 -0
  185. package/tempo/actions/multisig.ts +356 -0
  186. package/tempo/actions/zone.ts +188 -84
  187. package/tempo/chainConfig.ts +82 -35
  188. package/tempo/index.ts +12 -6
  189. package/tempo/internal/multisig.ts +72 -0
  190. package/_cjs/tempo/zones/Abis.js +0 -213
  191. package/_cjs/tempo/zones/Abis.js.map +0 -1
  192. package/_cjs/tempo/zones/Addresses.js +0 -17
  193. package/_cjs/tempo/zones/Addresses.js.map +0 -1
  194. package/_cjs/tempo/zones/index.js +0 -13
  195. package/_cjs/tempo/zones/index.js.map +0 -1
  196. package/_cjs/tempo/zones/transport.js +0 -24
  197. package/_cjs/tempo/zones/transport.js.map +0 -1
  198. package/_cjs/tempo/zones/zone.js +0 -82
  199. package/_cjs/tempo/zones/zone.js.map +0 -1
  200. package/_esm/tempo/zones/Abis.js +0 -210
  201. package/_esm/tempo/zones/Abis.js.map +0 -1
  202. package/_esm/tempo/zones/Addresses.js +0 -14
  203. package/_esm/tempo/zones/Addresses.js.map +0 -1
  204. package/_esm/tempo/zones/index.js +0 -6
  205. package/_esm/tempo/zones/index.js.map +0 -1
  206. package/_esm/tempo/zones/transport.js +0 -39
  207. package/_esm/tempo/zones/transport.js.map +0 -1
  208. package/_esm/tempo/zones/zone.js +0 -78
  209. package/_esm/tempo/zones/zone.js.map +0 -1
  210. package/_types/tempo/zones/Abis.d.ts +0 -383
  211. package/_types/tempo/zones/Abis.d.ts.map +0 -1
  212. package/_types/tempo/zones/Addresses.d.ts +0 -13
  213. package/_types/tempo/zones/Addresses.d.ts.map +0 -1
  214. package/_types/tempo/zones/index.d.ts +0 -5
  215. package/_types/tempo/zones/index.d.ts.map +0 -1
  216. package/_types/tempo/zones/transport.d.ts +0 -26
  217. package/_types/tempo/zones/transport.d.ts.map +0 -1
  218. package/_types/tempo/zones/zone.d.ts +0 -3092
  219. package/_types/tempo/zones/zone.d.ts.map +0 -1
  220. package/tempo/zones/Abis.ts +0 -211
  221. package/tempo/zones/Addresses.ts +0 -15
  222. package/tempo/zones/index.ts +0 -10
  223. package/tempo/zones/package.json +0 -6
  224. package/tempo/zones/transport.ts +0 -58
  225. package/tempo/zones/zone.ts +0 -113
@@ -38,6 +38,32 @@ import {
38
38
  } from '../../internal/utils.js'
39
39
  import type { TransactionReceipt } from '../../Transaction.js'
40
40
 
41
+ const engineBindingAbi = [
42
+ {
43
+ type: 'function',
44
+ name: 'initializeEarnVault',
45
+ inputs: [
46
+ { name: 'earnVault_', type: 'address' },
47
+ { name: 'finalOwner_', type: 'address' },
48
+ ],
49
+ outputs: [],
50
+ stateMutability: 'nonpayable',
51
+ },
52
+ {
53
+ type: 'function',
54
+ name: 'initializeEarnVault',
55
+ inputs: [{ name: 'earnVault_', type: 'address' }],
56
+ outputs: [],
57
+ stateMutability: 'nonpayable',
58
+ },
59
+ {
60
+ type: 'event',
61
+ name: 'EarnVaultInitialized',
62
+ inputs: [{ name: 'earnVault', type: 'address', indexed: true }],
63
+ anonymous: false,
64
+ },
65
+ ] as const
66
+
41
67
  /** @experimental Factory addresses for one reviewed Tempo Earn release. */
42
68
  export type EarnFactoryAddresses = {
43
69
  /** `ERC4626EngineFactory` address. */
@@ -629,7 +655,7 @@ export namespace createStackSync {
629
655
  }
630
656
 
631
657
  /**
632
- * Permanently binds an ERC-4626 engine to its EarnVault.
658
+ * Permanently binds an engine to its EarnVault.
633
659
  *
634
660
  * @experimental
635
661
  *
@@ -645,8 +671,9 @@ export namespace createStackSync {
645
671
  * chain: tempoModerato,
646
672
  * transport: http(),
647
673
  * })
648
- * const hash = await Actions.earn.bindErc4626Engine(client, {
674
+ * const hash = await Actions.earn.bindEngine(client, {
649
675
  * engine: '0x...',
676
+ * finalOwner: '0x...',
650
677
  * vault: '0x...',
651
678
  * })
652
679
  * ```
@@ -655,20 +682,22 @@ export namespace createStackSync {
655
682
  * @param parameters - Parameters.
656
683
  * @returns The transaction hash.
657
684
  */
658
- export async function bindErc4626Engine<
685
+ export async function bindEngine<
659
686
  chain extends Chain | undefined,
660
687
  account extends Account | undefined,
661
688
  >(
662
689
  client: Client<Transport, chain, account>,
663
- parameters: bindErc4626Engine.Parameters<chain, account>,
664
- ): Promise<bindErc4626Engine.ReturnValue> {
665
- return bindErc4626Engine.inner(writeContract, client, parameters)
690
+ parameters: bindEngine.Parameters<chain, account>,
691
+ ): Promise<bindEngine.ReturnValue> {
692
+ return bindEngine.inner(writeContract, client, parameters)
666
693
  }
667
694
 
668
- export namespace bindErc4626Engine {
695
+ export namespace bindEngine {
669
696
  export type Args = {
670
- /** ERC-4626 engine address. */
697
+ /** Engine address. */
671
698
  engine: Address
699
+ /** Address that will own the initialized engine. Omit to retain the current owner. */
700
+ finalOwner?: Address | undefined
672
701
  /** Factory-created EarnVault address. */
673
702
  vault: Address
674
703
  }
@@ -690,15 +719,15 @@ export namespace bindErc4626Engine {
690
719
  client: Client<Transport, chain, account>,
691
720
  parameters: Parameters<chain, account>,
692
721
  ): Promise<ReturnType<action>> {
693
- const { engine, vault, ...rest } = parameters
722
+ const { engine, finalOwner, vault, ...rest } = parameters
694
723
  return (await action(client, {
695
724
  ...rest,
696
- ...bindErc4626Engine.call({ engine, vault }),
725
+ ...bindEngine.call({ engine, finalOwner, vault }),
697
726
  } as never)) as never
698
727
  }
699
728
 
700
729
  /**
701
- * Defines a call to `ERC4626Engine.initializeEarnVault`.
730
+ * Defines a call to `initializeEarnVault` on an Earn engine.
702
731
  *
703
732
  * Can be passed as a parameter to:
704
733
  * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
@@ -714,8 +743,9 @@ export namespace bindErc4626Engine {
714
743
  * const client = createClient({ chain: tempoModerato, transport: http() })
715
744
  * .extend(walletActions)
716
745
  * await client.sendTransaction({
717
- * calls: [Actions.earn.bindErc4626Engine.call({
746
+ * calls: [Actions.earn.bindEngine.call({
718
747
  * engine: '0x...',
748
+ * finalOwner: '0x...',
719
749
  * vault: '0x...',
720
750
  * })],
721
751
  * })
@@ -725,11 +755,19 @@ export namespace bindErc4626Engine {
725
755
  * @returns The call.
726
756
  */
727
757
  export function call(args: Args) {
758
+ const { engine, finalOwner, vault } = args
759
+ if (finalOwner)
760
+ return defineCall({
761
+ address: engine,
762
+ abi: engineBindingAbi,
763
+ functionName: 'initializeEarnVault',
764
+ args: [vault, finalOwner],
765
+ })
728
766
  return defineCall({
729
- address: args.engine,
730
- abi: Abis.erc4626Engine,
767
+ address: engine,
768
+ abi: engineBindingAbi,
731
769
  functionName: 'initializeEarnVault',
732
- args: [args.vault],
770
+ args: [vault],
733
771
  })
734
772
  }
735
773
 
@@ -742,7 +780,7 @@ export namespace bindErc4626Engine {
742
780
  */
743
781
  export function extractEvent(logs: Log[], parameters: { engine: Address }) {
744
782
  const [log] = parseEventLogs({
745
- abi: Abis.erc4626Engine,
783
+ abi: engineBindingAbi,
746
784
  eventName: 'EarnVaultInitialized',
747
785
  logs: logs.filter((log) =>
748
786
  isAddressEqual(log.address, parameters.engine),
@@ -755,7 +793,7 @@ export namespace bindErc4626Engine {
755
793
  }
756
794
 
757
795
  /**
758
- * Binds an ERC-4626 engine and waits for confirmation.
796
+ * Binds an engine and waits for confirmation.
759
797
  *
760
798
  * @experimental
761
799
  *
@@ -771,8 +809,9 @@ export namespace bindErc4626Engine {
771
809
  * chain: tempoModerato,
772
810
  * transport: http(),
773
811
  * })
774
- * const result = await Actions.earn.bindErc4626EngineSync(client, {
812
+ * const result = await Actions.earn.bindEngineSync(client, {
775
813
  * engine: '0x...',
814
+ * finalOwner: '0x...',
776
815
  * vault: '0x...',
777
816
  * })
778
817
  * ```
@@ -781,31 +820,31 @@ export namespace bindErc4626Engine {
781
820
  * @param parameters - Parameters.
782
821
  * @returns The receipt and bound addresses.
783
822
  */
784
- export async function bindErc4626EngineSync<
823
+ export async function bindEngineSync<
785
824
  chain extends Chain | undefined,
786
825
  account extends Account | undefined,
787
826
  >(
788
827
  client: Client<Transport, chain, account>,
789
- parameters: bindErc4626EngineSync.Parameters<chain, account>,
790
- ): Promise<bindErc4626EngineSync.ReturnValue> {
828
+ parameters: bindEngineSync.Parameters<chain, account>,
829
+ ): Promise<bindEngineSync.ReturnValue> {
791
830
  const { engine, throwOnReceiptRevert = true } = parameters
792
- const receipt = await bindErc4626Engine.inner(writeContractSync, client, {
831
+ const receipt = await bindEngine.inner(writeContractSync, client, {
793
832
  ...parameters,
794
833
  throwOnReceiptRevert,
795
834
  } as never)
796
- const { args } = bindErc4626Engine.extractEvent(receipt.logs, { engine })
835
+ const { args } = bindEngine.extractEvent(receipt.logs, { engine })
797
836
  return { engine, vault: args.earnVault, receipt }
798
837
  }
799
838
 
800
- export namespace bindErc4626EngineSync {
801
- export type Args = bindErc4626Engine.Args
839
+ export namespace bindEngineSync {
840
+ export type Args = bindEngine.Args
802
841
  export type Parameters<
803
842
  chain extends Chain | undefined = Chain | undefined,
804
843
  account extends Account | undefined = Account | undefined,
805
- > = bindErc4626Engine.Parameters<chain, account> &
844
+ > = bindEngine.Parameters<chain, account> &
806
845
  WriteSyncParameters<chain, account>
807
846
  export type ReturnValue = {
808
- /** ERC-4626 engine address. */
847
+ /** Engine address. */
809
848
  engine: Address
810
849
  /** Transaction receipt. */
811
850
  receipt: TransactionReceipt
@@ -1091,20 +1130,25 @@ export async function deployErc4626StackSync<
1091
1130
  ...writeParameters,
1092
1131
  account: bindingAccount,
1093
1132
  engine: predictedEngine,
1133
+ finalOwner: owner,
1094
1134
  vault,
1095
1135
  }
1096
1136
  await simulateContract(client, {
1097
1137
  ...sharedWriteParameters,
1098
1138
  account: bindingAccount,
1099
- ...bindErc4626Engine.call({ engine: predictedEngine, vault }),
1139
+ ...bindEngine.call({
1140
+ engine: predictedEngine,
1141
+ finalOwner: owner,
1142
+ vault,
1143
+ }),
1100
1144
  } as never)
1101
- const receipt = await bindErc4626Engine.inner(
1145
+ const receipt = await bindEngine.inner(
1102
1146
  writeContractSync,
1103
1147
  client,
1104
1148
  bindingParameters as never,
1105
1149
  )
1106
1150
  receipts.binding = receipt
1107
- bindErc4626Engine.extractEvent(receipt.logs, { engine: predictedEngine })
1151
+ bindEngine.extractEvent(receipt.logs, { engine: predictedEngine })
1108
1152
  } else if (!isAddressEqual(boundVault, vault)) {
1109
1153
  throw new Error(`Engine is already bound to ${boundVault}.`)
1110
1154
  }
@@ -62,7 +62,6 @@ import {
62
62
  resolveTokenWithDecimals,
63
63
  } from '../internal/utils.js'
64
64
  import type { TransactionReceipt } from '../Transaction.js'
65
- import { getPortalAddress } from '../zones/zone.js'
66
65
  import * as policyActions from './policy.js'
67
66
  import * as tokenActions from './token.js'
68
67
  import * as zoneActions from './zone.js'
@@ -1029,7 +1028,7 @@ export namespace privateDeposit {
1029
1028
  withdrawalMemo,
1030
1029
  zoneId,
1031
1030
  } = parameters
1032
- const portalAddress = portalAddress_ ?? getPortalAddress(chainId, zoneId)
1031
+ const portalAddress = portalAddress_ ?? Addresses.zonePortal(zoneId)
1033
1032
  const readParameters = pickReadParameters(parameters)
1034
1033
  const [fromBlock, config] = await Promise.all([
1035
1034
  getBlockNumber(client, { cacheTime: 0 }),
@@ -2411,7 +2410,7 @@ export namespace privateRedeem {
2411
2410
  withdrawalMemo,
2412
2411
  zoneId,
2413
2412
  } = parameters
2414
- const portalAddress = portalAddress_ ?? getPortalAddress(chainId, zoneId)
2413
+ const portalAddress = portalAddress_ ?? Addresses.zonePortal(zoneId)
2415
2414
  const readParameters = pickReadParameters(parameters)
2416
2415
  const [fromBlock, config] = await Promise.all([
2417
2416
  getBlockNumber(client, { cacheTime: 0 }),
@@ -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'
@@ -0,0 +1,356 @@
1
+ import type { Address } from 'abitype'
2
+ import { MultisigConfig } from 'ox/tempo'
3
+ import type { Account } from '../../accounts/types.js'
4
+ import type { ReadContractReturnType } from '../../actions/public/readContract.js'
5
+ import { readContract } from '../../actions/public/readContract.js'
6
+ import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js'
7
+ import { writeContract } from '../../actions/wallet/writeContract.js'
8
+ import { writeContractSync } from '../../actions/wallet/writeContractSync.js'
9
+ import type { Client } from '../../clients/createClient.js'
10
+ import type { Transport } from '../../clients/transports/createTransport.js'
11
+ import type { BaseErrorType } from '../../errors/base.js'
12
+ import type { Chain } from '../../types/chain.js'
13
+ import type { GetEventArgs } from '../../types/contract.js'
14
+ import type { Log } from '../../types/log.js'
15
+ import type { Compute } from '../../types/utils.js'
16
+ import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
17
+ import * as Abis from '../Abis.js'
18
+ import * as Addresses from '../Addresses.js'
19
+ import type { ReadParameters, WriteParameters } from '../internal/types.js'
20
+ import { defineCall } from '../internal/utils.js'
21
+ import type { TransactionReceipt } from '../Transaction.js'
22
+
23
+ /**
24
+ * Checks whether an address is an initialized native multisig account.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { createClient, http } from 'viem'
29
+ * import { tempo } from 'viem/chains'
30
+ * import { Actions } from 'viem/tempo'
31
+ *
32
+ * const client = createClient({
33
+ * chain: tempo,
34
+ * transport: http(),
35
+ * })
36
+ *
37
+ * const initialized = await Actions.multisig.isInitialized(client, {
38
+ * account: '0x...',
39
+ * })
40
+ * ```
41
+ *
42
+ * @param client - Client.
43
+ * @param parameters - Parameters.
44
+ * @returns Whether the account is an initialized native multisig account.
45
+ */
46
+ export async function isInitialized<
47
+ chain extends Chain | undefined,
48
+ account extends Account | undefined,
49
+ >(
50
+ client: Client<Transport, chain, account>,
51
+ parameters: isInitialized.Parameters,
52
+ ): Promise<isInitialized.ReturnValue> {
53
+ const { account, ...rest } = parameters
54
+ return readContract(client, {
55
+ ...rest,
56
+ ...isInitialized.call({ account }),
57
+ })
58
+ }
59
+
60
+ export namespace isInitialized {
61
+ export type Parameters = ReadParameters & Args
62
+
63
+ export type Args = {
64
+ /** Account address. */
65
+ account: Address
66
+ }
67
+
68
+ export type ReturnValue = ReadContractReturnType<
69
+ typeof Abis.nativeMultisig,
70
+ 'isMultisigAccount',
71
+ never
72
+ >
73
+
74
+ /**
75
+ * Defines a call to the precompile's `isMultisigAccount` function.
76
+ *
77
+ * Can be passed to [`multicall`](https://viem.sh/docs/contract/multicall).
78
+ *
79
+ * @param args - Arguments.
80
+ * @returns The call.
81
+ */
82
+ export function call(args: Args) {
83
+ return defineCall({
84
+ address: Addresses.nativeMultisig,
85
+ abi: Abis.nativeMultisig,
86
+ args: [args.account],
87
+ functionName: 'isMultisigAccount',
88
+ })
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Gets the current configuration for an initialized native multisig account.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { createClient, http } from 'viem'
98
+ * import { tempo } from 'viem/chains'
99
+ * import { Actions } from 'viem/tempo'
100
+ *
101
+ * const client = createClient({
102
+ * chain: tempo,
103
+ * transport: http(),
104
+ * })
105
+ *
106
+ * const config = await Actions.multisig.getConfig(client, {
107
+ * account: '0x...',
108
+ * })
109
+ * ```
110
+ *
111
+ * @param client - Client.
112
+ * @param parameters - Parameters.
113
+ * @returns The current version, threshold, and owners.
114
+ */
115
+ export async function getConfig<
116
+ chain extends Chain | undefined,
117
+ account extends Account | undefined,
118
+ >(
119
+ client: Client<Transport, chain, account>,
120
+ parameters: getConfig.Parameters,
121
+ ): Promise<getConfig.ReturnValue> {
122
+ const { account, ...rest } = parameters
123
+ return readContract(client, {
124
+ ...rest,
125
+ ...getConfig.call({ account }),
126
+ })
127
+ }
128
+
129
+ export namespace getConfig {
130
+ export type Parameters = ReadParameters & Args
131
+
132
+ export type Args = {
133
+ /** Initialized multisig account address. */
134
+ account: Address
135
+ }
136
+
137
+ export type ReturnValue = ReadContractReturnType<
138
+ typeof Abis.nativeMultisig,
139
+ 'getConfig',
140
+ never
141
+ >
142
+
143
+ /**
144
+ * Defines a call to the `getConfig` function.
145
+ *
146
+ * Can be passed to [`multicall`](https://viem.sh/docs/contract/multicall).
147
+ *
148
+ * @param args - Arguments.
149
+ * @returns The call.
150
+ */
151
+ export function call(args: Args) {
152
+ return defineCall({
153
+ address: Addresses.nativeMultisig,
154
+ abi: Abis.nativeMultisig,
155
+ args: [args.account],
156
+ functionName: 'getConfig',
157
+ })
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Replaces the current configuration for a native multisig account.
163
+ *
164
+ * The transaction must be authorized directly by the account's current owner
165
+ * quorum. Local owner-signing flows can include {@link updateConfig.call} in a
166
+ * prepared transaction before collecting approvals.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * import { createClient, http } from 'viem'
171
+ * import { sendTransactionSync } from 'viem/actions'
172
+ * import { tempoLocalnet } from 'viem/chains'
173
+ * import { Account, Actions } from 'viem/tempo'
174
+ *
175
+ * const owner = Account.fromSecp256k1(
176
+ * '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
177
+ * )
178
+ * const account = Account.fromMultisig({ owners: [owner] })
179
+ * const client = createClient({
180
+ * chain: tempoLocalnet,
181
+ * transport: http(),
182
+ * })
183
+ *
184
+ * await sendTransactionSync(client, {
185
+ * account,
186
+ * to: account.address,
187
+ * })
188
+ *
189
+ * const hash = await Actions.multisig.updateConfig(client, {
190
+ * account,
191
+ * threshold: 1,
192
+ * owners: [{ owner: owner.address, weight: 1 }],
193
+ * })
194
+ * ```
195
+ *
196
+ * @param client - Client.
197
+ * @param parameters - Parameters.
198
+ * @returns The transaction hash.
199
+ */
200
+ export async function updateConfig<
201
+ chain extends Chain | undefined,
202
+ account extends Account | undefined,
203
+ >(
204
+ client: Client<Transport, chain, account>,
205
+ parameters: updateConfig.Parameters<chain, account>,
206
+ ): Promise<updateConfig.ReturnValue> {
207
+ return updateConfig.inner(writeContract, client, parameters)
208
+ }
209
+
210
+ export namespace updateConfig {
211
+ export type Parameters<
212
+ chain extends Chain | undefined = Chain | undefined,
213
+ account extends Account | undefined = Account | undefined,
214
+ > = WriteParameters<chain, account> & Args
215
+
216
+ export type Args = {
217
+ /** New multisig owners and their weights. */
218
+ owners: MultisigConfig.Config['owners']
219
+ /** New signature weight required to authorize the account. */
220
+ threshold: MultisigConfig.Config['threshold']
221
+ }
222
+
223
+ export type ReturnValue = WriteContractReturnType
224
+
225
+ // TODO: exhaustive error type
226
+ export type ErrorType = BaseErrorType
227
+
228
+ /** @internal */
229
+ export async function inner<
230
+ action extends typeof writeContract | typeof writeContractSync,
231
+ chain extends Chain | undefined,
232
+ account extends Account | undefined,
233
+ >(
234
+ action: action,
235
+ client: Client<Transport, chain, account>,
236
+ parameters: Parameters<chain, account>,
237
+ ): Promise<ReturnType<action>> {
238
+ const { owners, threshold, ...rest } = parameters
239
+ return (await action(client, {
240
+ ...rest,
241
+ ...updateConfig.call({ owners, threshold }),
242
+ } as never)) as never
243
+ }
244
+
245
+ /**
246
+ * Defines a call to the `updateConfig` function.
247
+ *
248
+ * Can be passed as a parameter to:
249
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate gas
250
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the update
251
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): include the update in a call batch
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * import { Actions } from 'viem/tempo'
256
+ *
257
+ * const call = Actions.multisig.updateConfig.call({
258
+ * threshold: 1,
259
+ * owners: [{ owner: '0x...', weight: 1 }],
260
+ * })
261
+ * ```
262
+ *
263
+ * @param args - New multisig configuration.
264
+ * @returns The call.
265
+ */
266
+ export function call(args: Args) {
267
+ const config = MultisigConfig.from(args)
268
+ return defineCall({
269
+ address: Addresses.nativeMultisig,
270
+ abi: Abis.nativeMultisig,
271
+ args: [config.threshold, config.owners],
272
+ functionName: 'updateConfig',
273
+ })
274
+ }
275
+
276
+ /**
277
+ * Extracts the `MultisigConfigUpdated` event from logs.
278
+ *
279
+ * @param logs - Transaction logs.
280
+ * @returns The configuration update event.
281
+ */
282
+ export function extractEvent(logs: Log[]) {
283
+ const [log] = parseEventLogs({
284
+ abi: Abis.nativeMultisig,
285
+ logs,
286
+ eventName: 'MultisigConfigUpdated',
287
+ strict: true,
288
+ })
289
+ if (!log) throw new Error('`MultisigConfigUpdated` event not found.')
290
+ return log
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Replaces a native multisig configuration and waits for confirmation.
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * import { createWalletClient, custom, type EIP1193Provider } from 'viem'
300
+ * import { tempo } from 'viem/chains'
301
+ * import { Actions } from 'viem/tempo'
302
+ *
303
+ * declare const provider: EIP1193Provider
304
+ *
305
+ * const client = createWalletClient({
306
+ * account: '0x...',
307
+ * chain: tempo,
308
+ * transport: custom(provider),
309
+ * })
310
+ *
311
+ * const { receipt } = await Actions.multisig.updateConfigSync(client, {
312
+ * threshold: 1,
313
+ * owners: [{ owner: '0x...', weight: 1 }],
314
+ * })
315
+ * ```
316
+ *
317
+ * @param client - Client.
318
+ * @param parameters - Parameters.
319
+ * @returns The updated configuration event and transaction receipt.
320
+ */
321
+ export async function updateConfigSync<
322
+ chain extends Chain | undefined,
323
+ account extends Account | undefined,
324
+ >(
325
+ client: Client<Transport, chain, account>,
326
+ parameters: updateConfigSync.Parameters<chain, account>,
327
+ ): Promise<updateConfigSync.ReturnValue> {
328
+ const { throwOnReceiptRevert = true, ...rest } = parameters
329
+ const receipt = await updateConfig.inner(writeContractSync, client, {
330
+ ...rest,
331
+ throwOnReceiptRevert,
332
+ } as never)
333
+ const { args } = updateConfig.extractEvent(receipt.logs)
334
+ return { ...args, receipt } as never
335
+ }
336
+
337
+ export namespace updateConfigSync {
338
+ export type Parameters<
339
+ chain extends Chain | undefined = Chain | undefined,
340
+ account extends Account | undefined = Account | undefined,
341
+ > = updateConfig.Parameters<chain, account>
342
+
343
+ export type Args = updateConfig.Args
344
+
345
+ export type ReturnValue = Compute<
346
+ GetEventArgs<
347
+ typeof Abis.nativeMultisig,
348
+ 'MultisigConfigUpdated',
349
+ { IndexedOnly: false; Required: true }
350
+ > & {
351
+ receipt: TransactionReceipt
352
+ }
353
+ >
354
+
355
+ export type ErrorType = updateConfig.ErrorType
356
+ }