@hyperlane-xyz/deploy-sdk 1.3.6 → 1.4.0-beta.c18552aafdcb7b75f759e8a85ebac103cfe26ec4

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 (41) hide show
  1. package/LICENSE.md +27 -25
  2. package/dist/core/core-artifact-reader.d.ts +66 -0
  3. package/dist/core/core-artifact-reader.d.ts.map +1 -0
  4. package/dist/core/core-artifact-reader.js +105 -0
  5. package/dist/core/core-artifact-reader.js.map +1 -0
  6. package/dist/core/core-writer.d.ts +76 -0
  7. package/dist/core/core-writer.d.ts.map +1 -0
  8. package/dist/core/core-writer.js +287 -0
  9. package/dist/core/core-writer.js.map +1 -0
  10. package/dist/hook/hook-reader.d.ts.map +1 -1
  11. package/dist/hook/hook-reader.js.map +1 -1
  12. package/dist/index.d.ts +2 -3
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -3
  15. package/dist/index.js.map +1 -1
  16. package/dist/ism/generic-ism.d.ts +5 -0
  17. package/dist/ism/generic-ism.d.ts.map +1 -1
  18. package/dist/ism/generic-ism.js +3 -3
  19. package/dist/ism/generic-ism.js.map +1 -1
  20. package/dist/ism/routing-ism.d.ts.map +1 -1
  21. package/dist/ism/routing-ism.js.map +1 -1
  22. package/dist/protocol.d.ts.map +1 -1
  23. package/dist/protocol.js +5 -0
  24. package/dist/protocol.js.map +1 -1
  25. package/dist/protocol.test.d.ts +2 -0
  26. package/dist/protocol.test.d.ts.map +1 -0
  27. package/dist/protocol.test.js +14 -0
  28. package/dist/protocol.test.js.map +1 -0
  29. package/package.json +13 -13
  30. package/dist/AltVMCoreModule.d.ts +0 -94
  31. package/dist/AltVMCoreModule.d.ts.map +0 -1
  32. package/dist/AltVMCoreModule.js +0 -368
  33. package/dist/AltVMCoreModule.js.map +0 -1
  34. package/dist/AltVMCoreReader.d.ts +0 -18
  35. package/dist/AltVMCoreReader.d.ts.map +0 -1
  36. package/dist/AltVMCoreReader.js +0 -35
  37. package/dist/AltVMCoreReader.js.map +0 -1
  38. package/dist/core-module.d.ts +0 -5
  39. package/dist/core-module.d.ts.map +0 -1
  40. package/dist/core-module.js +0 -28
  41. package/dist/core-module.js.map +0 -1
package/LICENSE.md CHANGED
@@ -1,4 +1,5 @@
1
- # Apache License
1
+ Apache License
2
+ ==============
2
3
 
3
4
  _Version 2.0, January 2004_
4
5
  _&lt;<http://www.apache.org/licenses/>&gt;_
@@ -88,27 +89,27 @@ You may reproduce and distribute copies of the Work or Derivative Works thereof
88
89
  in any medium, with or without modifications, and in Source or Object form,
89
90
  provided that You meet the following conditions:
90
91
 
91
- - **(a)** You must give any other recipients of the Work or Derivative Works a copy of
92
- this License; and
93
- - **(b)** You must cause any modified files to carry prominent notices stating that You
94
- changed the files; and
95
- - **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
96
- all copyright, patent, trademark, and attribution notices from the Source form
97
- of the Work, excluding those notices that do not pertain to any part of the
98
- Derivative Works; and
99
- - **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
100
- Derivative Works that You distribute must include a readable copy of the
101
- attribution notices contained within such NOTICE file, excluding those notices
102
- that do not pertain to any part of the Derivative Works, in at least one of the
103
- following places: within a NOTICE text file distributed as part of the
104
- Derivative Works; within the Source form or documentation, if provided along
105
- with the Derivative Works; or, within a display generated by the Derivative
106
- Works, if and wherever such third-party notices normally appear. The contents of
107
- the NOTICE file are for informational purposes only and do not modify the
108
- License. You may add Your own attribution notices within Derivative Works that
109
- You distribute, alongside or as an addendum to the NOTICE text from the Work,
110
- provided that such additional attribution notices cannot be construed as
111
- modifying the License.
92
+ * **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+ this License; and
94
+ * **(b)** You must cause any modified files to carry prominent notices stating that You
95
+ changed the files; and
96
+ * **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+ all copyright, patent, trademark, and attribution notices from the Source form
98
+ of the Work, excluding those notices that do not pertain to any part of the
99
+ Derivative Works; and
100
+ * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+ Derivative Works that You distribute must include a readable copy of the
102
+ attribution notices contained within such NOTICE file, excluding those notices
103
+ that do not pertain to any part of the Derivative Works, in at least one of the
104
+ following places: within a NOTICE text file distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if provided along
106
+ with the Derivative Works; or, within a display generated by the Derivative
107
+ Works, if and wherever such third-party notices normally appear. The contents of
108
+ the NOTICE file are for informational purposes only and do not modify the
109
+ License. You may add Your own attribution notices within Derivative Works that
110
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+ provided that such additional attribution notices cannot be construed as
112
+ modifying the License.
112
113
 
113
114
  You may add Your own copyright statement to Your modifications and may provide
114
115
  additional or different license terms and conditions for use, reproduction, or
@@ -179,15 +180,16 @@ the same “printed page” as the copyright notice for easier identification wi
179
180
  third-party archives.
180
181
 
181
182
  Copyright [yyyy] [name of copyright owner]
182
-
183
+
183
184
  Licensed under the Apache License, Version 2.0 (the "License");
184
185
  you may not use this file except in compliance with the License.
185
186
  You may obtain a copy of the License at
186
-
187
+
187
188
  http://www.apache.org/licenses/LICENSE-2.0
188
-
189
+
189
190
  Unless required by applicable law or agreed to in writing, software
190
191
  distributed under the License is distributed on an "AS IS" BASIS,
191
192
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192
193
  See the License for the specific language governing permissions and
193
194
  limitations under the License.
195
+
@@ -0,0 +1,66 @@
1
+ import { ChainMetadataForAltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ArtifactReader } from '@hyperlane-xyz/provider-sdk/artifact';
3
+ import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
4
+ import { DerivedCoreConfig } from '@hyperlane-xyz/provider-sdk/core';
5
+ import { DeployedMailboxAddress, DeployedMailboxArtifact, IRawMailboxArtifactManager, MailboxOnChain } from '@hyperlane-xyz/provider-sdk/mailbox';
6
+ import { Logger } from '@hyperlane-xyz/utils';
7
+ import { HookReader } from '../hook/hook-reader.js';
8
+ /**
9
+ * Factory function to create a CoreArtifactReader instance.
10
+ * Follows pattern of createHookReader() and createIsmReader().
11
+ *
12
+ * @param chainMetadata Chain metadata for target chain
13
+ * @param chainLookup Chain lookup for domain resolution
14
+ * @returns CoreArtifactReader instance
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const reader = createCoreReader(chainMetadata, chainLookup);
19
+ * const coreConfig = await reader.deriveCoreConfig(mailboxAddress);
20
+ * ```
21
+ */
22
+ export declare function createCoreReader(chainMetadata: ChainMetadataForAltVM, chainLookup: ChainLookup): CoreArtifactReader;
23
+ /**
24
+ * Core Artifact Reader - composite artifact reader that orchestrates mailbox, ISM, and hook readers.
25
+ *
26
+ * This implements the artifact API pattern at the "composite" level in deploy-sdk.
27
+ * It takes a mailbox address and returns a fully expanded MailboxOnChain artifact with
28
+ * all nested ISM and hook configurations read from the chain.
29
+ *
30
+ * Architecture:
31
+ * - Raw level: IRawMailboxArtifactManager (protocol-specific, in radix-sdk, cosmos-sdk, etc.)
32
+ * - Composite level: CoreArtifactReader (this class, in deploy-sdk)
33
+ *
34
+ * The raw mailbox reader returns UNDERIVED ISM/hook references (just addresses).
35
+ * This composite reader expands them into full DEPLOYED artifacts with complete configs.
36
+ */
37
+ export declare class CoreArtifactReader implements ArtifactReader<MailboxOnChain, DeployedMailboxAddress> {
38
+ protected readonly mailboxArtifactManager: IRawMailboxArtifactManager;
39
+ protected readonly chainMetadata: ChainMetadataForAltVM;
40
+ protected readonly chainLookup: ChainLookup;
41
+ protected readonly logger: Logger;
42
+ private readonly ismReader;
43
+ protected readonly hookReader: HookReader;
44
+ constructor(mailboxArtifactManager: IRawMailboxArtifactManager, chainMetadata: ChainMetadataForAltVM, chainLookup: ChainLookup);
45
+ /**
46
+ * Read mailbox configuration and expand all nested ISM/hook configs.
47
+ *
48
+ * Takes a mailbox address, reads the raw mailbox config (which has UNDERIVED ISM/hook references),
49
+ * then recursively reads and expands all nested ISM and hook artifacts.
50
+ *
51
+ * @param mailboxAddress The deployed mailbox address
52
+ * @returns Fully expanded mailbox artifact with all nested configs in DEPLOYED state
53
+ */
54
+ read(mailboxAddress: string): Promise<DeployedMailboxArtifact>;
55
+ /**
56
+ * Backward compatibility method: convert deployed mailbox artifact to DerivedCoreConfig.
57
+ *
58
+ * This allows CoreArtifactReader to be used as a drop-in replacement for AltVMCoreReader.
59
+ * Existing code expects the deriveCoreConfig() method returning DerivedCoreConfig format.
60
+ *
61
+ * @param mailboxAddress The deployed mailbox address
62
+ * @returns DerivedCoreConfig in the legacy format
63
+ */
64
+ deriveCoreConfig(mailboxAddress: string): Promise<DerivedCoreConfig>;
65
+ }
66
+ //# sourceMappingURL=core-artifact-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-artifact-reader.d.ts","sourceRoot":"","sources":["../../src/core/core-artifact-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,cAAc,EAEf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,cAAc,EAEf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAoB,MAAM,wBAAwB,CAAC;AAOtE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,qBAAqB,EACpC,WAAW,EAAE,WAAW,GACvB,kBAAkB,CAUpB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBACX,YAAW,cAAc,CAAC,cAAc,EAAE,sBAAsB,CAAC;IAS/D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,0BAA0B;IACrE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB;IACvD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAT7C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;gBAGrB,sBAAsB,EAAE,0BAA0B,EAClD,aAAa,EAAE,qBAAqB,EACpC,WAAW,EAAE,WAAW;IAM7C;;;;;;;;OAQG;IACG,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA2BpE;;;;;;;;OAQG;IACG,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQ3E"}
@@ -0,0 +1,105 @@
1
+ import { getProtocolProvider, } from '@hyperlane-xyz/provider-sdk';
2
+ import { ArtifactState, } from '@hyperlane-xyz/provider-sdk/artifact';
3
+ import { hookArtifactToDerivedConfig } from '@hyperlane-xyz/provider-sdk/hook';
4
+ import { mailboxArtifactToDerivedCoreConfig, } from '@hyperlane-xyz/provider-sdk/mailbox';
5
+ import { rootLogger } from '@hyperlane-xyz/utils';
6
+ import { createHookReader } from '../hook/hook-reader.js';
7
+ import { createIsmReader, ismArtifactToDerivedConfig, } from '../ism/generic-ism.js';
8
+ /**
9
+ * Factory function to create a CoreArtifactReader instance.
10
+ * Follows pattern of createHookReader() and createIsmReader().
11
+ *
12
+ * @param chainMetadata Chain metadata for target chain
13
+ * @param chainLookup Chain lookup for domain resolution
14
+ * @returns CoreArtifactReader instance
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const reader = createCoreReader(chainMetadata, chainLookup);
19
+ * const coreConfig = await reader.deriveCoreConfig(mailboxAddress);
20
+ * ```
21
+ */
22
+ export function createCoreReader(chainMetadata, chainLookup) {
23
+ const protocolProvider = getProtocolProvider(chainMetadata.protocol);
24
+ const mailboxArtifactManager = protocolProvider.createMailboxArtifactManager(chainMetadata);
25
+ return new CoreArtifactReader(mailboxArtifactManager, chainMetadata, chainLookup);
26
+ }
27
+ /**
28
+ * Core Artifact Reader - composite artifact reader that orchestrates mailbox, ISM, and hook readers.
29
+ *
30
+ * This implements the artifact API pattern at the "composite" level in deploy-sdk.
31
+ * It takes a mailbox address and returns a fully expanded MailboxOnChain artifact with
32
+ * all nested ISM and hook configurations read from the chain.
33
+ *
34
+ * Architecture:
35
+ * - Raw level: IRawMailboxArtifactManager (protocol-specific, in radix-sdk, cosmos-sdk, etc.)
36
+ * - Composite level: CoreArtifactReader (this class, in deploy-sdk)
37
+ *
38
+ * The raw mailbox reader returns UNDERIVED ISM/hook references (just addresses).
39
+ * This composite reader expands them into full DEPLOYED artifacts with complete configs.
40
+ */
41
+ export class CoreArtifactReader {
42
+ mailboxArtifactManager;
43
+ chainMetadata;
44
+ chainLookup;
45
+ logger = rootLogger.child({
46
+ module: CoreArtifactReader.name,
47
+ });
48
+ ismReader;
49
+ hookReader;
50
+ constructor(mailboxArtifactManager, chainMetadata, chainLookup) {
51
+ this.mailboxArtifactManager = mailboxArtifactManager;
52
+ this.chainMetadata = chainMetadata;
53
+ this.chainLookup = chainLookup;
54
+ this.hookReader = createHookReader(this.chainMetadata, this.chainLookup);
55
+ this.ismReader = createIsmReader(this.chainMetadata, this.chainLookup);
56
+ }
57
+ /**
58
+ * Read mailbox configuration and expand all nested ISM/hook configs.
59
+ *
60
+ * Takes a mailbox address, reads the raw mailbox config (which has UNDERIVED ISM/hook references),
61
+ * then recursively reads and expands all nested ISM and hook artifacts.
62
+ *
63
+ * @param mailboxAddress The deployed mailbox address
64
+ * @returns Fully expanded mailbox artifact with all nested configs in DEPLOYED state
65
+ */
66
+ async read(mailboxAddress) {
67
+ // 1. Read raw mailbox config - returns UNDERIVED ISM/hook references (just addresses)
68
+ const rawMailbox = await this.mailboxArtifactManager.readMailbox(mailboxAddress);
69
+ // 2. Expand nested ISM and hooks using specialized readers
70
+ // The readers handle type detection and recursive expansion automatically
71
+ const [defaultIsmArtifact, defaultHookArtifact, requiredHookArtifact] = await Promise.all([
72
+ this.ismReader.read(rawMailbox.config.defaultIsm.deployed.address),
73
+ this.hookReader.read(rawMailbox.config.defaultHook.deployed.address),
74
+ this.hookReader.read(rawMailbox.config.requiredHook.deployed.address),
75
+ ]);
76
+ // 3. Return fully expanded mailbox artifact
77
+ return {
78
+ artifactState: ArtifactState.DEPLOYED,
79
+ config: {
80
+ owner: rawMailbox.config.owner,
81
+ defaultIsm: defaultIsmArtifact, // Now DEPLOYED with full config
82
+ defaultHook: defaultHookArtifact, // Now DEPLOYED with full config
83
+ requiredHook: requiredHookArtifact, // Now DEPLOYED with full config
84
+ },
85
+ deployed: rawMailbox.deployed,
86
+ };
87
+ }
88
+ /**
89
+ * Backward compatibility method: convert deployed mailbox artifact to DerivedCoreConfig.
90
+ *
91
+ * This allows CoreArtifactReader to be used as a drop-in replacement for AltVMCoreReader.
92
+ * Existing code expects the deriveCoreConfig() method returning DerivedCoreConfig format.
93
+ *
94
+ * @param mailboxAddress The deployed mailbox address
95
+ * @returns DerivedCoreConfig in the legacy format
96
+ */
97
+ async deriveCoreConfig(mailboxAddress) {
98
+ const artifact = await this.read(mailboxAddress);
99
+ return mailboxArtifactToDerivedCoreConfig(artifact, this.chainLookup, {
100
+ ismArtifactToDerivedConfig,
101
+ hookArtifactToDerivedConfig,
102
+ });
103
+ }
104
+ }
105
+ //# sourceMappingURL=core-artifact-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-artifact-reader.js","sourceRoot":"","sources":["../../src/core/core-artifact-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,aAAa,GACd,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAKL,kCAA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QAEhE,2DAA2D;QAC3D,0EAA0E;QAC1E,MAAM,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,GACnE,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;YAClE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;YACpE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;SACtE,CAAC,CAAC;QAEL,4CAA4C;QAC5C,OAAO;YACL,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,MAAM,EAAE;gBACN,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK;gBAC9B,UAAU,EAAE,kBAAkB,EAAE,gCAAgC;gBAChE,WAAW,EAAE,mBAAmB,EAAE,gCAAgC;gBAClE,YAAY,EAAE,oBAAoB,EAAE,gCAAgC;aACrE;YACD,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC9B,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,gBAAgB,CAAC,cAAsB;QAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEjD,OAAO,kCAAkC,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YACpE,0BAA0B;YAC1B,2BAA2B;SAC5B,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,76 @@
1
+ import { ChainMetadataForAltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ISigner } from '@hyperlane-xyz/provider-sdk/altvm';
3
+ import { ArtifactNew } from '@hyperlane-xyz/provider-sdk/artifact';
4
+ import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
5
+ import { DeployedMailboxArtifact, IRawMailboxArtifactManager, MailboxConfig } from '@hyperlane-xyz/provider-sdk/mailbox';
6
+ import { AnnotatedTx, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
7
+ import { DeployedValidatorAnnounceArtifact, IRawValidatorAnnounceArtifactManager } from '@hyperlane-xyz/provider-sdk/validator-announce';
8
+ import { Logger } from '@hyperlane-xyz/utils';
9
+ import { CoreArtifactReader } from './core-artifact-reader.js';
10
+ /**
11
+ * Factory function to create a CoreWriter instance.
12
+ * Follows pattern of createHookWriter() and createIsmWriter().
13
+ *
14
+ * @param chainMetadata Chain metadata for target chain
15
+ * @param chainLookup Chain lookup for domain resolution
16
+ * @param signer Signer for transaction signing
17
+ * @returns CoreWriter instance
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const writer = createCoreWriter(chainMetadata, chainLookup, signer);
22
+ * const { mailbox, validatorAnnounce } = await writer.create(coreArtifact);
23
+ * ```
24
+ */
25
+ export declare function createCoreWriter(chainMetadata: ChainMetadataForAltVM, chainLookup: ChainLookup, signer: ISigner<AnnotatedTx, TxReceipt>): CoreWriter;
26
+ /**
27
+ * CoreWriter orchestrates full core deployment using the Artifact API.
28
+ * Handles mailbox, ISM, hook, and validator announce deployment.
29
+ *
30
+ * Extends CoreArtifactReader to inherit read() functionality.
31
+ * Follows same pattern as HookWriter, IsmWriter, and WarpTokenWriter.
32
+ *
33
+ * Deployment flow:
34
+ * 1. Deploy ISM if NEW (via IsmWriter)
35
+ * 2. Create Mailbox with ISM + zero hooks (via mailboxWriter)
36
+ * 3. Deploy hooks if NEW with mailbox context (via HookWriter)
37
+ * 4. Update mailbox with hooks + owner (via mailboxWriter.update + signer)
38
+ * 5. Deploy validator announce (via vaWriter)
39
+ */
40
+ export declare class CoreWriter extends CoreArtifactReader {
41
+ protected readonly validatorAnnounceArtifactManager: IRawValidatorAnnounceArtifactManager | null;
42
+ protected readonly signer: ISigner<AnnotatedTx, TxReceipt>;
43
+ protected readonly logger: Logger;
44
+ private readonly ismWriter;
45
+ constructor(mailboxArtifactManager: IRawMailboxArtifactManager, validatorAnnounceArtifactManager: IRawValidatorAnnounceArtifactManager | null, chainMetadata: ChainMetadataForAltVM, chainLookup: ChainLookup, signer: ISigner<AnnotatedTx, TxReceipt>);
46
+ /**
47
+ * Deploys full core contracts: ISM, hooks, mailbox, validator announce.
48
+ *
49
+ * @param artifact Mailbox artifact with nested ISM and hook artifacts
50
+ * @returns Object containing deployed mailbox, validator announce artifacts, and receipts
51
+ */
52
+ create(artifact: ArtifactNew<MailboxConfig>): Promise<{
53
+ mailbox: DeployedMailboxArtifact;
54
+ validatorAnnounce: DeployedValidatorAnnounceArtifact | null;
55
+ receipts: TxReceipt[];
56
+ }>;
57
+ /**
58
+ * Updates existing core deployment.
59
+ *
60
+ * @param mailboxAddress Existing mailbox address
61
+ * @param expectedArtifact Expected mailbox artifact with nested ISM/hook artifacts
62
+ * @returns Array of update transactions
63
+ */
64
+ update(mailboxAddress: string, expectedArtifact: ArtifactNew<MailboxConfig>): Promise<AnnotatedTx[]>;
65
+ /**
66
+ * Helper: Deploy or update ISM based on current vs expected.
67
+ * Uses IsmWriter internally, follows merge pattern from WarpTokenWriter.
68
+ */
69
+ private deployOrUpdateIsm;
70
+ /**
71
+ * Helper: Deploy or update hook based on current vs expected.
72
+ * Uses HookWriter internally, follows merge pattern from WarpTokenWriter.
73
+ */
74
+ private deployOrUpdateHook;
75
+ }
76
+ //# sourceMappingURL=core-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-writer.d.ts","sourceRoot":"","sources":["../../src/core/core-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAEL,WAAW,EAMZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,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ACG,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,WAAW,CAAC,aAAa,CAAC,GAC3C,OAAO,CAAC,WAAW,EAAE,CAAC;IAoFzB;;;OAGG;YACW,iBAAiB;IA0C/B;;;OAGG;YACW,kBAAkB;CA8CjC"}
@@ -0,0 +1,287 @@
1
+ import { getProtocolProvider, } from '@hyperlane-xyz/provider-sdk';
2
+ import { ArtifactState, isArtifactDeployed, isArtifactNew, isArtifactUnderived, } from '@hyperlane-xyz/provider-sdk/artifact';
3
+ import { mergeHookArtifacts, } from '@hyperlane-xyz/provider-sdk/hook';
4
+ import { mergeIsmArtifacts, } from '@hyperlane-xyz/provider-sdk/ism';
5
+ import { ZERO_ADDRESS_HEX_32, assert, rootLogger, } from '@hyperlane-xyz/utils';
6
+ import { createHookWriter } from '../hook/hook-writer.js';
7
+ import { createIsmWriter } from '../ism/generic-ism-writer.js';
8
+ import { CoreArtifactReader } from './core-artifact-reader.js';
9
+ /**
10
+ * Factory function to create a CoreWriter instance.
11
+ * Follows pattern of createHookWriter() and createIsmWriter().
12
+ *
13
+ * @param chainMetadata Chain metadata for target chain
14
+ * @param chainLookup Chain lookup for domain resolution
15
+ * @param signer Signer for transaction signing
16
+ * @returns CoreWriter instance
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const writer = createCoreWriter(chainMetadata, chainLookup, signer);
21
+ * const { mailbox, validatorAnnounce } = await writer.create(coreArtifact);
22
+ * ```
23
+ */
24
+ export function createCoreWriter(chainMetadata, chainLookup, signer) {
25
+ const protocolProvider = getProtocolProvider(chainMetadata.protocol);
26
+ const mailboxArtifactManager = protocolProvider.createMailboxArtifactManager(chainMetadata);
27
+ const validatorAnnounceArtifactManager = protocolProvider.createValidatorAnnounceArtifactManager(chainMetadata);
28
+ return new CoreWriter(mailboxArtifactManager, validatorAnnounceArtifactManager, chainMetadata, chainLookup, signer);
29
+ }
30
+ /**
31
+ * CoreWriter orchestrates full core deployment using the Artifact API.
32
+ * Handles mailbox, ISM, hook, and validator announce deployment.
33
+ *
34
+ * Extends CoreArtifactReader to inherit read() functionality.
35
+ * Follows same pattern as HookWriter, IsmWriter, and WarpTokenWriter.
36
+ *
37
+ * Deployment flow:
38
+ * 1. Deploy ISM if NEW (via IsmWriter)
39
+ * 2. Create Mailbox with ISM + zero hooks (via mailboxWriter)
40
+ * 3. Deploy hooks if NEW with mailbox context (via HookWriter)
41
+ * 4. Update mailbox with hooks + owner (via mailboxWriter.update + signer)
42
+ * 5. Deploy validator announce (via vaWriter)
43
+ */
44
+ export class CoreWriter extends CoreArtifactReader {
45
+ validatorAnnounceArtifactManager;
46
+ signer;
47
+ logger = rootLogger.child({
48
+ module: CoreWriter.name,
49
+ });
50
+ ismWriter;
51
+ constructor(mailboxArtifactManager, validatorAnnounceArtifactManager, chainMetadata, chainLookup, signer) {
52
+ super(mailboxArtifactManager, chainMetadata, chainLookup);
53
+ this.validatorAnnounceArtifactManager = validatorAnnounceArtifactManager;
54
+ this.signer = signer;
55
+ this.ismWriter = createIsmWriter(this.chainMetadata, this.chainLookup, this.signer);
56
+ }
57
+ /**
58
+ * Deploys full core contracts: ISM, hooks, mailbox, validator announce.
59
+ *
60
+ * @param artifact Mailbox artifact with nested ISM and hook artifacts
61
+ * @returns Object containing deployed mailbox, validator announce artifacts, and receipts
62
+ */
63
+ async create(artifact) {
64
+ const { config } = artifact;
65
+ const allReceipts = [];
66
+ const chainName = this.chainMetadata.name;
67
+ this.logger.info(`Starting core deployment on ${chainName}`);
68
+ // Step 1: Deploy ISM if NEW
69
+ let onChainIsmArtifact;
70
+ if (isArtifactNew(config.defaultIsm)) {
71
+ this.logger.info(`Deploying default ISM on ${chainName}`);
72
+ const [deployed, ismReceipts] = await this.ismWriter.create(config.defaultIsm);
73
+ allReceipts.push(...ismReceipts);
74
+ onChainIsmArtifact = deployed;
75
+ this.logger.info(`Default ISM deployed at ${deployed.deployed.address} on ${chainName}`);
76
+ }
77
+ else {
78
+ // DEPLOYED or UNDERIVED - use as-is
79
+ onChainIsmArtifact = config.defaultIsm;
80
+ this.logger.info(`Using existing ISM at ${config.defaultIsm.deployed.address} for core deployment on ${chainName}`);
81
+ }
82
+ // Step 2: Create mailbox with ISM + zero hooks initially
83
+ this.logger.info(`Creating mailbox on ${chainName}`);
84
+ const mailboxWriter = this.mailboxArtifactManager.createWriter('mailbox', this.signer);
85
+ // Create mailbox with ISM but zero hooks initially.
86
+ // Hooks require the mailbox address for deployment (circular dependency),
87
+ // so we create mailbox first, deploy hooks in Step 3, then update mailbox in Step 4.
88
+ const initialMailboxArtifact = {
89
+ artifactState: ArtifactState.NEW,
90
+ config: {
91
+ owner: this.signer.getSignerAddress(), // Initial owner (will transfer later)
92
+ defaultIsm: onChainIsmArtifact,
93
+ defaultHook: {
94
+ artifactState: ArtifactState.UNDERIVED,
95
+ deployed: { address: ZERO_ADDRESS_HEX_32 },
96
+ },
97
+ requiredHook: {
98
+ artifactState: ArtifactState.UNDERIVED,
99
+ deployed: { address: ZERO_ADDRESS_HEX_32 },
100
+ },
101
+ },
102
+ };
103
+ const [deployedMailbox, mailboxReceipts] = await mailboxWriter.create(initialMailboxArtifact);
104
+ allReceipts.push(...mailboxReceipts);
105
+ const mailboxAddress = deployedMailbox.deployed.address;
106
+ this.logger.info(`Mailbox created at ${mailboxAddress} on ${chainName}`);
107
+ const hookWriter = createHookWriter(this.chainMetadata, this.chainLookup, this.signer, { mailbox: mailboxAddress });
108
+ // Step 3: Deploy hooks if NEW (hooks need mailbox address)
109
+ let onChainDefaultHookArtifact;
110
+ if (isArtifactNew(config.defaultHook)) {
111
+ this.logger.info(`Deploying default hook on ${chainName}`);
112
+ const [deployed, hookReceipts] = await hookWriter.create(config.defaultHook);
113
+ allReceipts.push(...hookReceipts);
114
+ onChainDefaultHookArtifact = deployed;
115
+ this.logger.info(`Default hook deployed at ${deployed.deployed.address} on ${chainName}`);
116
+ }
117
+ else {
118
+ onChainDefaultHookArtifact = config.defaultHook;
119
+ this.logger.info(`Using existing default hook at ${config.defaultHook.deployed.address} for core deployment on ${chainName}`);
120
+ }
121
+ let onChainRequiredHookArtifact;
122
+ if (isArtifactNew(config.requiredHook)) {
123
+ this.logger.info(`Deploying required hook on ${chainName}`);
124
+ const [deployed, hookReceipts] = await hookWriter.create(config.requiredHook);
125
+ allReceipts.push(...hookReceipts);
126
+ onChainRequiredHookArtifact = deployed;
127
+ this.logger.info(`Required hook deployed at ${deployed.deployed.address} on ${chainName}`);
128
+ }
129
+ else {
130
+ onChainRequiredHookArtifact = config.requiredHook;
131
+ this.logger.info(`Using existing required hook at ${config.requiredHook.deployed.address} for core deployment on ${chainName}`);
132
+ }
133
+ // Step 4: Update mailbox with hooks + transfer owner
134
+ this.logger.info(`Updating mailbox configuration on ${chainName}`);
135
+ const updatedMailboxArtifact = {
136
+ artifactState: ArtifactState.DEPLOYED,
137
+ config: {
138
+ owner: config.owner,
139
+ defaultIsm: onChainIsmArtifact,
140
+ defaultHook: onChainDefaultHookArtifact,
141
+ requiredHook: onChainRequiredHookArtifact,
142
+ },
143
+ deployed: deployedMailbox.deployed,
144
+ };
145
+ const updateTxs = await mailboxWriter.update(updatedMailboxArtifact);
146
+ for (const tx of updateTxs) {
147
+ this.logger.debug(`Executing update transaction on ${chainName}: ${tx.annotation}`);
148
+ const receipt = await this.signer.sendAndConfirmTransaction(tx);
149
+ allReceipts.push(receipt);
150
+ }
151
+ // Step 5: Deploy validator announce (if supported by protocol)
152
+ let validatorAnnounceArtifact = null;
153
+ if (this.validatorAnnounceArtifactManager) {
154
+ this.logger.info(`Deploying validator announce on ${chainName}`);
155
+ const vaWriter = this.validatorAnnounceArtifactManager.createWriter('validatorAnnounce', this.signer);
156
+ const vaArtifact = {
157
+ artifactState: ArtifactState.NEW,
158
+ config: { mailboxAddress },
159
+ };
160
+ const [deployed, vaReceipts] = await vaWriter.create(vaArtifact);
161
+ allReceipts.push(...vaReceipts);
162
+ validatorAnnounceArtifact = deployed;
163
+ this.logger.info(`Validator announce deployed at ${deployed.deployed.address} on ${chainName}`);
164
+ }
165
+ else {
166
+ this.logger.info(`Validator announce not supported by protocol for ${chainName}`);
167
+ }
168
+ this.logger.info(`Core deployment complete on ${chainName}`);
169
+ return {
170
+ mailbox: updatedMailboxArtifact,
171
+ validatorAnnounce: validatorAnnounceArtifact,
172
+ receipts: allReceipts,
173
+ };
174
+ }
175
+ /**
176
+ * Updates existing core deployment.
177
+ *
178
+ * @param mailboxAddress Existing mailbox address
179
+ * @param expectedArtifact Expected mailbox artifact with nested ISM/hook artifacts
180
+ * @returns Array of update transactions
181
+ */
182
+ async update(mailboxAddress, expectedArtifact) {
183
+ const { config: expectedConfig } = expectedArtifact;
184
+ const updateTxs = [];
185
+ const chainName = this.chainMetadata.name;
186
+ this.logger.info(`Starting core update on ${chainName}`);
187
+ // Read actual state (fully expanded)
188
+ const currentArtifact = await this.read(mailboxAddress);
189
+ const currentConfig = currentArtifact.config;
190
+ // Verify that reader expanded all nested artifacts
191
+ assert(isArtifactDeployed(currentConfig.defaultIsm), 'Expected Core Reader to expand the ISM config');
192
+ assert(isArtifactDeployed(currentConfig.defaultHook), 'Expected Core Reader to expand the default hook config');
193
+ assert(isArtifactDeployed(currentConfig.requiredHook), 'Expected Core Reader to expand the required hook config');
194
+ // Update ISM
195
+ const { address: newIsmAddress, transactions: ismTxs } = await this.deployOrUpdateIsm(currentConfig.defaultIsm, expectedConfig.defaultIsm);
196
+ updateTxs.push(...ismTxs);
197
+ // Update default hook
198
+ const { address: newDefaultHookAddress, transactions: defaultHookTxs } = await this.deployOrUpdateHook(currentConfig.defaultHook, expectedConfig.defaultHook, mailboxAddress);
199
+ updateTxs.push(...defaultHookTxs);
200
+ // Update required hook
201
+ const { address: newRequiredHookAddress, transactions: requiredHookTxs } = await this.deployOrUpdateHook(currentConfig.requiredHook, expectedConfig.requiredHook, mailboxAddress);
202
+ updateTxs.push(...requiredHookTxs);
203
+ this.logger.info(`Updating mailbox configuration on ${chainName}`);
204
+ const mailboxWriter = this.mailboxArtifactManager.createWriter('mailbox', this.signer);
205
+ const updatedMailboxArtifact = {
206
+ artifactState: ArtifactState.DEPLOYED,
207
+ config: {
208
+ owner: expectedConfig.owner,
209
+ defaultIsm: {
210
+ artifactState: ArtifactState.UNDERIVED,
211
+ deployed: { address: newIsmAddress },
212
+ },
213
+ defaultHook: {
214
+ artifactState: ArtifactState.UNDERIVED,
215
+ deployed: { address: newDefaultHookAddress },
216
+ },
217
+ requiredHook: {
218
+ artifactState: ArtifactState.UNDERIVED,
219
+ deployed: { address: newRequiredHookAddress },
220
+ },
221
+ },
222
+ deployed: currentArtifact.deployed,
223
+ };
224
+ const mailboxUpdateTxs = await mailboxWriter.update(updatedMailboxArtifact);
225
+ updateTxs.push(...mailboxUpdateTxs);
226
+ return updateTxs;
227
+ }
228
+ /**
229
+ * Helper: Deploy or update ISM based on current vs expected.
230
+ * Uses IsmWriter internally, follows merge pattern from WarpTokenWriter.
231
+ */
232
+ async deployOrUpdateIsm(currentIsmArtifact, expectedIsm) {
233
+ const chainName = this.chainMetadata.name;
234
+ // If expected is UNDERIVED (just an address reference), use as-is
235
+ if (isArtifactUnderived(expectedIsm)) {
236
+ return { address: expectedIsm.deployed.address, transactions: [] };
237
+ }
238
+ const ismWriter = createIsmWriter(this.chainMetadata, this.chainLookup, this.signer);
239
+ // Merge current with expected (preserves DEPLOYED state for unchanged nested ISMs)
240
+ const mergedArtifact = mergeIsmArtifacts(currentIsmArtifact, expectedIsm);
241
+ if (isArtifactNew(mergedArtifact)) {
242
+ // Deploy new ISM
243
+ this.logger.info(`Deploying new ISM on ${chainName}`);
244
+ const [deployed] = await ismWriter.create(mergedArtifact);
245
+ this.logger.info(`New ISM deployed at ${deployed.deployed.address} on ${chainName}`);
246
+ return { address: deployed.deployed.address, transactions: [] };
247
+ }
248
+ // Update in-place
249
+ this.logger.info(`Updating existing ISM on ${chainName}`);
250
+ const updateTxs = await ismWriter.update(mergedArtifact);
251
+ this.logger.info(`ISM update generated ${updateTxs.length} transactions on ${chainName}`);
252
+ return {
253
+ address: mergedArtifact.deployed.address,
254
+ transactions: updateTxs,
255
+ };
256
+ }
257
+ /**
258
+ * Helper: Deploy or update hook based on current vs expected.
259
+ * Uses HookWriter internally, follows merge pattern from WarpTokenWriter.
260
+ */
261
+ async deployOrUpdateHook(currentHookArtifact, expectedHook, mailboxAddress) {
262
+ const chainName = this.chainMetadata.name;
263
+ // If expected is UNDERIVED (just an address reference), use as-is
264
+ if (isArtifactUnderived(expectedHook)) {
265
+ return { address: expectedHook.deployed.address, transactions: [] };
266
+ }
267
+ const hookWriter = createHookWriter(this.chainMetadata, this.chainLookup, this.signer, { mailbox: mailboxAddress });
268
+ // Merge current with expected
269
+ const mergedArtifact = mergeHookArtifacts(currentHookArtifact, expectedHook);
270
+ if (isArtifactNew(mergedArtifact)) {
271
+ // Deploy new hook
272
+ this.logger.info(`Deploying new hook on ${chainName}`);
273
+ const [deployed] = await hookWriter.create(mergedArtifact);
274
+ this.logger.info(`New hook deployed at ${deployed.deployed.address} on ${chainName}`);
275
+ return { address: deployed.deployed.address, transactions: [] };
276
+ }
277
+ // Update in-place
278
+ this.logger.info(`Updating existing hook on ${chainName}`);
279
+ const updateTxs = await hookWriter.update(mergedArtifact);
280
+ this.logger.info(`Hook update generated ${updateTxs.length} transactions on ${chainName}`);
281
+ return {
282
+ address: mergedArtifact.deployed.address,
283
+ transactions: updateTxs,
284
+ };
285
+ }
286
+ }
287
+ //# sourceMappingURL=core-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-writer.js","sourceRoot":"","sources":["../../src/core/core-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAIL,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAIL,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAIL,iBAAiB,GAClB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