@humanode-hyperlane/deploy-sdk 0.0.0-stage → 4.2.3-humanode.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 (79) hide show
  1. package/LICENSE.md +193 -0
  2. package/dist/AltVMFileSubmitter.d.ts +12 -0
  3. package/dist/AltVMFileSubmitter.d.ts.map +1 -0
  4. package/dist/AltVMFileSubmitter.js +35 -0
  5. package/dist/AltVMFileSubmitter.js.map +1 -0
  6. package/dist/AltVMJsonRpcSubmitter.d.ts +16 -0
  7. package/dist/AltVMJsonRpcSubmitter.d.ts.map +1 -0
  8. package/dist/AltVMJsonRpcSubmitter.js +40 -0
  9. package/dist/AltVMJsonRpcSubmitter.js.map +1 -0
  10. package/dist/core/core-artifact-reader.d.ts +67 -0
  11. package/dist/core/core-artifact-reader.d.ts.map +1 -0
  12. package/dist/core/core-artifact-reader.js +117 -0
  13. package/dist/core/core-artifact-reader.js.map +1 -0
  14. package/dist/core/core-artifact-reader.test.d.ts +2 -0
  15. package/dist/core/core-artifact-reader.test.d.ts.map +1 -0
  16. package/dist/core/core-artifact-reader.test.js +300 -0
  17. package/dist/core/core-artifact-reader.test.js.map +1 -0
  18. package/dist/core/core-writer.d.ts +43 -0
  19. package/dist/core/core-writer.d.ts.map +1 -0
  20. package/dist/core/core-writer.js +235 -0
  21. package/dist/core/core-writer.js.map +1 -0
  22. package/dist/core/core-writer.test.d.ts +2 -0
  23. package/dist/core/core-writer.test.d.ts.map +1 -0
  24. package/dist/core/core-writer.test.js +1097 -0
  25. package/dist/core/core-writer.test.js.map +1 -0
  26. package/dist/hook/hook-reader.d.ts +41 -0
  27. package/dist/hook/hook-reader.d.ts.map +1 -0
  28. package/dist/hook/hook-reader.js +52 -0
  29. package/dist/hook/hook-reader.js.map +1 -0
  30. package/dist/hook/hook-writer.d.ts +101 -0
  31. package/dist/hook/hook-writer.d.ts.map +1 -0
  32. package/dist/hook/hook-writer.js +140 -0
  33. package/dist/hook/hook-writer.js.map +1 -0
  34. package/dist/hook/hook-writer.test.d.ts +2 -0
  35. package/dist/hook/hook-writer.test.d.ts.map +1 -0
  36. package/dist/hook/hook-writer.test.js +69 -0
  37. package/dist/hook/hook-writer.test.js.map +1 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +15 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/ism/generic-ism-writer.d.ts +61 -0
  43. package/dist/ism/generic-ism-writer.d.ts.map +1 -0
  44. package/dist/ism/generic-ism-writer.js +84 -0
  45. package/dist/ism/generic-ism-writer.js.map +1 -0
  46. package/dist/ism/generic-ism.d.ts +43 -0
  47. package/dist/ism/generic-ism.d.ts.map +1 -0
  48. package/dist/ism/generic-ism.js +95 -0
  49. package/dist/ism/generic-ism.js.map +1 -0
  50. package/dist/ism/routing-ism.d.ts +21 -0
  51. package/dist/ism/routing-ism.d.ts.map +1 -0
  52. package/dist/ism/routing-ism.js +145 -0
  53. package/dist/ism/routing-ism.js.map +1 -0
  54. package/dist/protocol.d.ts +3 -0
  55. package/dist/protocol.d.ts.map +1 -0
  56. package/dist/protocol.js +38 -0
  57. package/dist/protocol.js.map +1 -0
  58. package/dist/protocol.test.d.ts +2 -0
  59. package/dist/protocol.test.d.ts.map +1 -0
  60. package/dist/protocol.test.js +14 -0
  61. package/dist/protocol.test.js.map +1 -0
  62. package/dist/utils/validation.d.ts +37 -0
  63. package/dist/utils/validation.d.ts.map +1 -0
  64. package/dist/utils/validation.js +66 -0
  65. package/dist/utils/validation.js.map +1 -0
  66. package/dist/warp/warp-reader.d.ts +49 -0
  67. package/dist/warp/warp-reader.d.ts.map +1 -0
  68. package/dist/warp/warp-reader.js +108 -0
  69. package/dist/warp/warp-reader.js.map +1 -0
  70. package/dist/warp/warp-writer.d.ts +66 -0
  71. package/dist/warp/warp-writer.d.ts.map +1 -0
  72. package/dist/warp/warp-writer.js +231 -0
  73. package/dist/warp/warp-writer.js.map +1 -0
  74. package/dist/warp/warp-writer.test.d.ts +2 -0
  75. package/dist/warp/warp-writer.test.d.ts.map +1 -0
  76. package/dist/warp/warp-writer.test.js +903 -0
  77. package/dist/warp/warp-writer.test.js.map +1 -0
  78. package/package.json +48 -3
  79. package/README.md +0 -3
@@ -0,0 +1,84 @@
1
+ import { AltVM, getProtocolProvider, } from '@humanode-hyperlane/provider-sdk';
2
+ import { IsmReader } from './generic-ism.js';
3
+ import { RoutingIsmWriter } from './routing-ism.js';
4
+ /**
5
+ * Factory function to create an IsmWriter instance.
6
+ * This helper centralizes the creation of artifact managers and ISM writers,
7
+ * making it easier to instantiate writers across the codebase.
8
+ *
9
+ * @param chainMetadata Chain metadata for the target chain (protocol type is extracted from metadata.protocol)
10
+ * @param chainLookup Chain lookup interface for resolving chain names and domain IDs
11
+ * @param signer Signer interface for signing transactions
12
+ * @returns An IsmWriter instance
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const writer = createIsmWriter(chainMetadata, chainLookup, signer);
17
+ * const [deployed, receipts] = await writer.create({ config: ismConfig });
18
+ * ```
19
+ */
20
+ export function createIsmWriter(chainMetadata, chainLookup, signer) {
21
+ const protocolProvider = getProtocolProvider(chainMetadata.protocol);
22
+ const artifactManager = protocolProvider.createIsmArtifactManager(chainMetadata);
23
+ return new IsmWriter(artifactManager, chainLookup, signer);
24
+ }
25
+ /**
26
+ * IsmWriter handles creation and updates of ISMs using the Artifact API.
27
+ * It delegates to protocol-specific artifact writers for individual ISM types.
28
+ *
29
+ * Key features:
30
+ * - Extends IsmReader to inherit read() functionality
31
+ * - Works with pure Artifact API (IsmArtifactConfig)
32
+ * - Delegates to typed writers from artifact manager for specific ISM types
33
+ * - Uses RoutingIsmWriter for composite routing ISM operations
34
+ * - Protocol-agnostic through artifact manager abstraction
35
+ */
36
+ export class IsmWriter extends IsmReader {
37
+ artifactManager;
38
+ chainLookup;
39
+ signer;
40
+ routingWriter;
41
+ constructor(artifactManager, chainLookup, signer) {
42
+ super(artifactManager, chainLookup);
43
+ this.artifactManager = artifactManager;
44
+ this.chainLookup = chainLookup;
45
+ this.signer = signer;
46
+ this.routingWriter = new RoutingIsmWriter(artifactManager, chainLookup, signer);
47
+ }
48
+ /**
49
+ * Creates a new ISM by deploying it on-chain.
50
+ * For routing ISMs, delegates to RoutingIsmWriter to handle nested ISM deployments.
51
+ * For other ISM types, requests a typed writer from the artifact manager.
52
+ *
53
+ * @param artifact The ISM configuration to deploy (can be new or reference existing)
54
+ * @returns A tuple of [deployed artifact, transaction receipts]
55
+ */
56
+ async create(artifact) {
57
+ const { artifactState, config } = artifact;
58
+ // Routing ISMs are composite - use RoutingIsmWriter for nested deployments
59
+ if (config.type === AltVM.IsmType.ROUTING) {
60
+ return this.routingWriter.create({ artifactState, config });
61
+ }
62
+ // For other ISM types, request typed writer from artifact manager
63
+ const writer = this.artifactManager.createWriter(config.type, this.signer);
64
+ return writer.create({ artifactState, config });
65
+ }
66
+ /**
67
+ * Updates an existing ISM to match the desired configuration.
68
+ * Only routing ISMs support updates (domain enrollment/unenrollment, owner changes).
69
+ * Multisig and test ISMs are immutable - returns empty array.
70
+ *
71
+ * @param artifact The desired ISM state (must include deployed address)
72
+ * @returns Array of transactions needed to perform the update
73
+ */
74
+ async update(artifact) {
75
+ const { artifactState, config, deployed } = artifact;
76
+ // Only routing ISMs are mutable - support domain updates and owner changes
77
+ if (config.type === AltVM.IsmType.ROUTING) {
78
+ return this.routingWriter.update({ artifactState, config, deployed });
79
+ }
80
+ // Multisig and test ISMs are immutable - no updates possible
81
+ return [];
82
+ }
83
+ }
84
+ //# sourceMappingURL=generic-ism-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-ism-writer.js","sourceRoot":"","sources":["../../src/ism/generic-ism-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAkB1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C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CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,QAA6B;QACxC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;QAErD,2EAA2E;QAC3E,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,6DAA6D;QAC7D,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { ChainMetadataForAltVM } from '@humanode-hyperlane/provider-sdk';
2
+ import { ArtifactReader } from '@humanode-hyperlane/provider-sdk/artifact';
3
+ import { ChainLookup } from '@humanode-hyperlane/provider-sdk/chain';
4
+ import { DeployedIsmAddress, DeployedIsmArtifact, DerivedIsmConfig, IRawIsmArtifactManager, IsmArtifactConfig } from '@humanode-hyperlane/provider-sdk/ism';
5
+ import { Logger } from '@humanode-hyperlane/utils';
6
+ /**
7
+ * Factory function to create an IsmReader instance.
8
+ * This helper centralizes the creation of artifact managers and ISM readers,
9
+ * making it easier to instantiate readers across the codebase.
10
+ *
11
+ * @param chainMetadata Chain metadata for the target chain (protocol type is extracted from metadata.protocol)
12
+ * @param chainLookup Chain lookup interface for resolving chain names and domain IDs
13
+ * @returns An IsmReader instance
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const reader = createIsmReader(chainMetadata, chainLookup);
18
+ * const ismConfig = await reader.read(ismAddress);
19
+ * ```
20
+ */
21
+ export declare function createIsmReader(chainMetadata: ChainMetadataForAltVM, chainLookup: ChainLookup): IsmReader;
22
+ /**
23
+ * Generic ISM Reader that can read any ISM type by detecting its type
24
+ * and recursively expanding nested ISMs (e.g., for routing ISMs).
25
+ */
26
+ export declare class IsmReader implements ArtifactReader<IsmArtifactConfig, DeployedIsmAddress> {
27
+ protected readonly artifactManager: IRawIsmArtifactManager;
28
+ protected readonly chainLookup: ChainLookup;
29
+ protected readonly logger: Logger;
30
+ constructor(artifactManager: IRawIsmArtifactManager, chainLookup: ChainLookup);
31
+ read(address: string): Promise<DeployedIsmArtifact>;
32
+ /**
33
+ * Expands a raw routing ISM config by recursively reading the domain ISMs.
34
+ * Takes a pre-read raw artifact to avoid double reading.
35
+ */
36
+ private expandRoutingIsm;
37
+ /**
38
+ * Backward compatibility method that converts DeployedIsmArtifact to DerivedIsmConfig.
39
+ * This allows IsmReader to be used as a drop-in replacement for the old AltVMIsmReader.
40
+ */
41
+ deriveIsmConfig(address: string): Promise<DerivedIsmConfig>;
42
+ }
43
+ //# sourceMappingURL=generic-ism.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-ism.d.ts","sourceRoot":"","sources":["../../src/ism/generic-ism.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,cAAc,EAEf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EAIlB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAc,MAAM,2BAA2B,CAAC;AAE/D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,qBAAqB,EACpC,WAAW,EAAE,WAAW,GACvB,SAAS,CAMX;AAED;;;GAGG;AACH,qBAAa,SAAU,YAAW,cAAc,CAC9C,iBAAiB,EACjB,kBAAkB,CACnB;IAMG,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,sBAAsB;IAC1D,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAN7C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;gBAGkB,eAAe,EAAE,sBAAsB,EACvC,WAAW,EAAE,WAAW;IAGvC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkBzD;;;OAGG;YACW,gBAAgB;IAwC9B;;;OAGG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAIlE"}
@@ -0,0 +1,95 @@
1
+ import { AltVM, getProtocolProvider, } from '@humanode-hyperlane/provider-sdk';
2
+ import { isArtifactDeployed, } from '@humanode-hyperlane/provider-sdk/artifact';
3
+ import { ismArtifactToDerivedConfig, } from '@humanode-hyperlane/provider-sdk/ism';
4
+ import { rootLogger } from '@humanode-hyperlane/utils';
5
+ /**
6
+ * Factory function to create an IsmReader instance.
7
+ * This helper centralizes the creation of artifact managers and ISM readers,
8
+ * making it easier to instantiate readers across the codebase.
9
+ *
10
+ * @param chainMetadata Chain metadata for the target chain (protocol type is extracted from metadata.protocol)
11
+ * @param chainLookup Chain lookup interface for resolving chain names and domain IDs
12
+ * @returns An IsmReader instance
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const reader = createIsmReader(chainMetadata, chainLookup);
17
+ * const ismConfig = await reader.read(ismAddress);
18
+ * ```
19
+ */
20
+ export function createIsmReader(chainMetadata, chainLookup) {
21
+ const protocolProvider = getProtocolProvider(chainMetadata.protocol);
22
+ const artifactManager = protocolProvider.createIsmArtifactManager(chainMetadata);
23
+ return new IsmReader(artifactManager, chainLookup);
24
+ }
25
+ /**
26
+ * Generic ISM Reader that can read any ISM type by detecting its type
27
+ * and recursively expanding nested ISMs (e.g., for routing ISMs).
28
+ */
29
+ export class IsmReader {
30
+ artifactManager;
31
+ chainLookup;
32
+ logger = rootLogger.child({
33
+ module: IsmReader.name,
34
+ });
35
+ constructor(artifactManager, chainLookup) {
36
+ this.artifactManager = artifactManager;
37
+ this.chainLookup = chainLookup;
38
+ }
39
+ async read(address) {
40
+ // Read once via readIsm() - detects type
41
+ const { artifactState, config, deployed } = await this.artifactManager.readIsm(address);
42
+ // For routing ISMs, expand nested domain ISMs recursively
43
+ if (config.type === AltVM.IsmType.ROUTING) {
44
+ return this.expandRoutingIsm({ artifactState, config, deployed });
45
+ }
46
+ // For non-routing ISMs, the raw and expanded configs are identical
47
+ return {
48
+ artifactState,
49
+ config,
50
+ deployed,
51
+ };
52
+ }
53
+ /**
54
+ * Expands a raw routing ISM config by recursively reading the domain ISMs.
55
+ * Takes a pre-read raw artifact to avoid double reading.
56
+ */
57
+ async expandRoutingIsm(rawArtifact) {
58
+ const { artifactState, config, deployed } = rawArtifact;
59
+ const domains = {};
60
+ for (const [domainId, domainIsmConfig] of Object.entries(config.domains)) {
61
+ if (!this.chainLookup.getChainName(parseInt(domainId))) {
62
+ this.logger.warn(`Skipping derivation of unknown ${AltVM.IsmType.ROUTING} domain ${domainId}`);
63
+ continue;
64
+ }
65
+ let nestedIsm;
66
+ if (isArtifactDeployed(domainIsmConfig)) {
67
+ // Already a full deployed artifact, use as-is
68
+ nestedIsm = domainIsmConfig;
69
+ }
70
+ else {
71
+ // ArtifactUnderived - recursively read using self to get full config
72
+ nestedIsm = await this.read(domainIsmConfig.deployed.address);
73
+ }
74
+ domains[parseInt(domainId)] = nestedIsm;
75
+ }
76
+ return {
77
+ artifactState,
78
+ config: {
79
+ type: AltVM.IsmType.ROUTING,
80
+ owner: config.owner,
81
+ domains,
82
+ },
83
+ deployed,
84
+ };
85
+ }
86
+ /**
87
+ * Backward compatibility method that converts DeployedIsmArtifact to DerivedIsmConfig.
88
+ * This allows IsmReader to be used as a drop-in replacement for the old AltVMIsmReader.
89
+ */
90
+ async deriveIsmConfig(address) {
91
+ const artifact = await this.read(address);
92
+ return ismArtifactToDerivedConfig(artifact, this.chainLookup);
93
+ }
94
+ }
95
+ //# sourceMappingURL=generic-ism.js.map
@@ -0,0 +1 @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;QAC1C,OAAO,0BAA0B,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import { ISigner } from '@humanode-hyperlane/provider-sdk/altvm';
2
+ import { ArtifactDeployed, ArtifactNew, ArtifactWriter } from '@humanode-hyperlane/provider-sdk/artifact';
3
+ import { ChainLookup } from '@humanode-hyperlane/provider-sdk/chain';
4
+ import { DeployedIsmAddress, IRawIsmArtifactManager, RoutingIsmArtifactConfig } from '@humanode-hyperlane/provider-sdk/ism';
5
+ import { AnnotatedTx, TxReceipt } from '@humanode-hyperlane/provider-sdk/module';
6
+ import { Logger } from '@humanode-hyperlane/utils';
7
+ type DeployedRoutingIsmArtifact = ArtifactDeployed<RoutingIsmArtifactConfig, DeployedIsmAddress>;
8
+ export declare class RoutingIsmWriter implements ArtifactWriter<RoutingIsmArtifactConfig, DeployedIsmAddress> {
9
+ protected readonly artifactManager: IRawIsmArtifactManager;
10
+ protected readonly chainLookup: ChainLookup;
11
+ private readonly signer;
12
+ protected readonly logger: Logger;
13
+ private readonly ismReader;
14
+ constructor(artifactManager: IRawIsmArtifactManager, chainLookup: ChainLookup, signer: ISigner<AnnotatedTx, TxReceipt>);
15
+ read(address: string): Promise<DeployedRoutingIsmArtifact>;
16
+ create(artifact: ArtifactNew<RoutingIsmArtifactConfig>): Promise<[DeployedRoutingIsmArtifact, TxReceipt[]]>;
17
+ update(artifact: DeployedRoutingIsmArtifact): Promise<AnnotatedTx[]>;
18
+ private deployDomainIsm;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=routing-ism.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing-ism.d.ts","sourceRoot":"","sources":["../../src/ism/routing-ism.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAEL,gBAAgB,EAChB,WAAW,EAGX,cAAc,EAIf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EACL,kBAAkB,EAElB,sBAAsB,EAGtB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,SAAS,EACV,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,MAAM,EAAc,MAAM,2BAA2B,CAAC;AAI/D,KAAK,0BAA0B,GAAG,gBAAgB,CAChD,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;AAEF,qBAAa,gBAAiB,YAAW,cAAc,CACrD,wBAAwB,EACxB,kBAAkB,CACnB;IAQG,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,sBAAsB;IAC1D,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;IAEH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAGjB,eAAe,EAAE,sBAAsB,EACvC,WAAW,EAAE,WAAW,EAC1B,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC;IAKpD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAU1D,MAAM,CACV,QAAQ,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAC9C,OAAO,CAAC,CAAC,0BAA0B,EAAE,SAAS,EAAE,CAAC,CAAC;IA+D/C,MAAM,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;YAoF5D,eAAe;CAkB9B"}
@@ -0,0 +1,145 @@
1
+ import { AltVM } from '@humanode-hyperlane/provider-sdk';
2
+ import { ArtifactState, isArtifactDeployed, isArtifactNew, isArtifactUnderived, } from '@humanode-hyperlane/provider-sdk/artifact';
3
+ import { rootLogger } from '@humanode-hyperlane/utils';
4
+ import { IsmReader } from './generic-ism.js';
5
+ export class RoutingIsmWriter {
6
+ artifactManager;
7
+ chainLookup;
8
+ signer;
9
+ logger = rootLogger.child({
10
+ module: RoutingIsmWriter.name,
11
+ });
12
+ ismReader;
13
+ constructor(artifactManager, chainLookup, signer) {
14
+ this.artifactManager = artifactManager;
15
+ this.chainLookup = chainLookup;
16
+ this.signer = signer;
17
+ this.ismReader = new IsmReader(artifactManager, chainLookup);
18
+ }
19
+ async read(address) {
20
+ const artifact = await this.ismReader.read(address);
21
+ if (artifact.config.type !== AltVM.IsmType.ROUTING) {
22
+ throw new Error(`Expected ROUTING ISM at ${address}, got ${artifact.config.type}`);
23
+ }
24
+ return artifact;
25
+ }
26
+ async create(artifact) {
27
+ const { config } = artifact;
28
+ const allReceipts = [];
29
+ const deployedDomainIsms = {};
30
+ for (const [domainId, nestedArtifact] of Object.entries(config.domains)) {
31
+ const domain = parseInt(domainId);
32
+ if (isArtifactDeployed(nestedArtifact)) {
33
+ deployedDomainIsms[domain] = nestedArtifact;
34
+ }
35
+ else if (isArtifactUnderived(nestedArtifact)) {
36
+ // UNDERIVED means predeployed ISM - just pass through without reading
37
+ deployedDomainIsms[domain] = nestedArtifact;
38
+ }
39
+ else if (isArtifactNew(nestedArtifact)) {
40
+ const [deployedNested, receipts] = await this.deployDomainIsm(nestedArtifact);
41
+ deployedDomainIsms[domain] = deployedNested;
42
+ allReceipts.push(...receipts);
43
+ }
44
+ else {
45
+ // This should never happen - all artifact states are handled above
46
+ const _exhaustiveCheck = nestedArtifact;
47
+ this.logger.error(`Unexpected artifact state ${_exhaustiveCheck.artifactState} for domain ${domainId}`);
48
+ }
49
+ }
50
+ const rawRoutingIsmWriter = this.artifactManager.createWriter(AltVM.IsmType.ROUTING, this.signer);
51
+ const rawRoutingConfig = {
52
+ config: {
53
+ type: config.type,
54
+ owner: config.owner,
55
+ domains: deployedDomainIsms,
56
+ },
57
+ };
58
+ const [deployedRoutingIsm, routingIsmReceipts] = await rawRoutingIsmWriter.create(rawRoutingConfig);
59
+ allReceipts.push(...routingIsmReceipts);
60
+ const deployedRoutingIsmConfig = {
61
+ artifactState: deployedRoutingIsm.artifactState,
62
+ config: {
63
+ type: deployedRoutingIsm.config.type,
64
+ owner: deployedRoutingIsm.config.owner,
65
+ domains: deployedDomainIsms,
66
+ },
67
+ deployed: deployedRoutingIsm.deployed,
68
+ };
69
+ return [deployedRoutingIsmConfig, allReceipts];
70
+ }
71
+ async update(artifact) {
72
+ const { config, deployed } = artifact;
73
+ const updateTxs = [];
74
+ const deployedDomains = {};
75
+ for (const [domainId, domainIsmConfig] of Object.entries(config.domains)) {
76
+ if (!this.chainLookup.getChainName(parseInt(domainId))) {
77
+ this.logger.warn(`Skipping update of unknown ${AltVM.IsmType.ROUTING} domain ${domainId}`);
78
+ continue;
79
+ }
80
+ const domain = parseInt(domainId);
81
+ if (isArtifactDeployed(domainIsmConfig)) {
82
+ const { artifactState, config, deployed } = domainIsmConfig;
83
+ const domainIsmWriter = this.artifactManager.createWriter(domainIsmConfig.config.type, this.signer);
84
+ let domainIsmUpdateTxs;
85
+ if (config.type === AltVM.IsmType.ROUTING) {
86
+ domainIsmUpdateTxs = await this.update({
87
+ artifactState,
88
+ config,
89
+ deployed,
90
+ });
91
+ }
92
+ else {
93
+ domainIsmUpdateTxs = await domainIsmWriter.update({
94
+ artifactState,
95
+ config,
96
+ deployed,
97
+ });
98
+ }
99
+ updateTxs.push(...domainIsmUpdateTxs);
100
+ deployedDomains[domain] = domainIsmConfig;
101
+ }
102
+ else if (isArtifactUnderived(domainIsmConfig)) {
103
+ // UNDERIVED means predeployed ISM - just pass through without reading
104
+ deployedDomains[domain] = domainIsmConfig;
105
+ // Note: We don't generate update transactions for UNDERIVED artifacts
106
+ // since they represent existing ISMs that we're just referencing
107
+ }
108
+ else if (isArtifactNew(domainIsmConfig)) {
109
+ [deployedDomains[domain]] = await this.deployDomainIsm(domainIsmConfig);
110
+ }
111
+ else {
112
+ // This should never happen - all artifact states are handled above
113
+ const _exhaustiveCheck = domainIsmConfig;
114
+ this.logger.error(`Unexpected artifact state ${_exhaustiveCheck.artifactState} for domain ${domainId}`);
115
+ }
116
+ }
117
+ const rawRoutingWriter = this.artifactManager.createWriter(AltVM.IsmType.ROUTING, this.signer);
118
+ const rawRoutingArtifact = {
119
+ artifactState: ArtifactState.DEPLOYED,
120
+ config: {
121
+ type: config.type,
122
+ owner: config.owner,
123
+ domains: deployedDomains,
124
+ },
125
+ deployed: deployed,
126
+ };
127
+ const routingUpdateTxs = await rawRoutingWriter.update(rawRoutingArtifact);
128
+ return [...updateTxs, ...routingUpdateTxs];
129
+ }
130
+ async deployDomainIsm(artifact) {
131
+ const { config, artifactState } = artifact;
132
+ if (config.type === AltVM.IsmType.ROUTING) {
133
+ return this.create({
134
+ config,
135
+ artifactState,
136
+ });
137
+ }
138
+ const writer = this.artifactManager.createWriter(config.type, this.signer);
139
+ return writer.create({
140
+ config,
141
+ artifactState,
142
+ });
143
+ }
144
+ }
145
+ //# sourceMappingURL=routing-ism.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing-ism.js","sourceRoot":"","sources":["../../src/ism/routing-ism.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEzD,OAAO,EAKL,aAAa,EAEb,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,2CAA2C,CAAC;AAcnD,OAAO,EAAU,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7C,MAAM,OAAO,gBAAgB;IAWN;IACA;IACF;IATA,MAAM,GAAW,UAAU,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,gBAAgB,CAAC,IAAI;KAC9B,CAAC,CAAC;IAEc,SAAS,CAAY;IAEtC,YACqB,eAAuC,EACvC,WAAwB,EAC1B,MAAuC;QAFrC,oBAAe,GAAf,eAAe,CAAwB;QACvC,gBAAW,GAAX,WAAW,CAAa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C;QACL,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3E,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,MAAM;YACN,aAAa;SACd,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { ProtocolType } from '@humanode-hyperlane/provider-sdk';
2
+ export declare function loadProtocolProviders(neededProtocols: Set<ProtocolType>): Promise<void>;
3
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAG1C,wBAAsB,qBAAqB,CACzC,eAAe,EAAE,GAAG,CAAC,YAAY,CAAC,iBAwCnC"}
@@ -0,0 +1,38 @@
1
+ import { ProtocolType, hasProtocol, registerProtocol, } from '@humanode-hyperlane/provider-sdk';
2
+ import { rootLogger } from '@humanode-hyperlane/utils';
3
+ export async function loadProtocolProviders(neededProtocols) {
4
+ for (const protocol of neededProtocols) {
5
+ if (hasProtocol(protocol)) {
6
+ rootLogger.debug(`${protocol} already loaded`);
7
+ continue;
8
+ }
9
+ switch (protocol) {
10
+ case ProtocolType.CosmosNative: {
11
+ const { CosmosNativeProtocolProvider } = await import('@humanode-hyperlane/cosmos-sdk');
12
+ registerProtocol(protocol, () => new CosmosNativeProtocolProvider());
13
+ break;
14
+ }
15
+ case ProtocolType.Radix: {
16
+ const { RadixProtocolProvider } = await import('@humanode-hyperlane/radix-sdk');
17
+ registerProtocol(protocol, () => new RadixProtocolProvider());
18
+ break;
19
+ }
20
+ case ProtocolType.Aleo: {
21
+ const { AleoProtocolProvider } = await import('@humanode-hyperlane/aleo-sdk');
22
+ registerProtocol(protocol, () => new AleoProtocolProvider());
23
+ break;
24
+ }
25
+ case ProtocolType.Sealevel: {
26
+ const { SealevelProtocolProvider } = await import('@humanode-hyperlane/sealevel-sdk');
27
+ registerProtocol(protocol, () => new SealevelProtocolProvider());
28
+ break;
29
+ }
30
+ case ProtocolType.Starknet: {
31
+ const { StarknetProtocolProvider } = await import('@humanode-hyperlane/starknet-sdk');
32
+ registerProtocol(protocol, () => new StarknetProtocolProvider());
33
+ break;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,eAAkC;IAElC,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,UAAU,CAAC,KAAK,CAAC,GAAG,QAAQ,iBAAiB,CAAC,CAAC;YAC/C,SAAS;QACX,CAAC;QACD,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC/B,MAAM,EAAE,4BAA4B,EAAE,GACpC,MAAM,MAAM,CAAC,gCAAgC,CAAC,CAAC;gBACjD,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,4BAA4B,EAAE,CAAC,CAAC;gBACrE,MAAM;YACR,CAAC;YACD,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;gBACxB,MAAM,EAAE,qBAAqB,EAAE,GAC7B,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;gBAChD,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;gBAC9D,MAAM;YACR,CAAC;YACD,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvB,MAAM,EAAE,oBAAoB,EAAE,GAC5B,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;gBAC/C,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;gBAC7D,MAAM;YACR,CAAC;YACD,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC3B,MAAM,EAAE,wBAAwB,EAAE,GAChC,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;gBACnD,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;gBACjE,MAAM;YACR,CAAC;YACD,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC3B,MAAM,EAAE,wBAAwB,EAAE,GAChC,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;gBACnD,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;gBACjE,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=protocol.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../src/protocol.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { expect } from 'chai';
2
+ import { ProtocolType, getProtocolProvider, hasProtocol, } from '@humanode-hyperlane/provider-sdk';
3
+ import { loadProtocolProviders } from './protocol.js';
4
+ describe('loadProtocolProviders', () => {
5
+ it('registers Starknet provider implementation', async () => {
6
+ await loadProtocolProviders(new Set([ProtocolType.Starknet]));
7
+ expect(hasProtocol(ProtocolType.Starknet)).to.equal(true);
8
+ const provider = getProtocolProvider(ProtocolType.Starknet);
9
+ expect(provider).to.have.property('createProvider');
10
+ expect(provider).to.have.property('createSigner');
11
+ expect(provider).to.have.property('createIsmArtifactManager');
12
+ });
13
+ });
14
+ //# sourceMappingURL=protocol.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.test.js","sourceRoot":"","sources":["../src/protocol.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,qBAAqB,CAAC,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE9D,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,mBAAmB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAClD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Validation utilities for Alt-VM ISM configurations.
3
+ *
4
+ * The provider-sdk has a limited subset of ISM types compared to the full SDK.
5
+ * These utilities validate ISM configs and provide clear error messages for unsupported types.
6
+ */
7
+ import { IsmConfig } from '@humanode-hyperlane/provider-sdk/ism';
8
+ /**
9
+ * Validates that an ISM type is supported by provider-sdk.
10
+ *
11
+ * @param ismType - The ISM type string to validate
12
+ * @param chain - Chain name for error messages
13
+ * @param context - Context string for error messages (e.g., "warp route", "core")
14
+ * @throws UnsupportedIsmTypeError if ISM type is not supported
15
+ */
16
+ export declare function validateIsmType(ismType: string, chain: string, context?: string): void;
17
+ /**
18
+ * Validates that an ISM configuration is supported by provider-sdk.
19
+ *
20
+ * @param config - ISM configuration (can be string address or config object)
21
+ * @param chain - Chain name for error messages
22
+ * @param context - Context string for error messages (e.g., "warp route", "core")
23
+ * @throws UnsupportedIsmTypeError if ISM type is not supported
24
+ */
25
+ export declare function validateIsmConfig(config: IsmConfig | string, chain: string, context?: string): void;
26
+ /**
27
+ * Custom error class for unsupported ISM types.
28
+ * Provides concise error messages.
29
+ */
30
+ export declare class UnsupportedIsmTypeError extends Error {
31
+ readonly ismType: string;
32
+ readonly chain: string;
33
+ readonly context: string;
34
+ readonly supportedTypes: string;
35
+ constructor(ismType: string, chain: string, context: string, supportedTypes: string);
36
+ }
37
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAW,MAAM,sCAAsC,CAAC;AAa1E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAwB,GAChC,IAAI,CAKN;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,GAAG,MAAM,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAwB,GAChC,IAAI,CAmBN;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAE9B,OAAO,EAAE,MAAM;aACf,KAAK,EAAE,MAAM;aACb,OAAO,EAAE,MAAM;aACf,cAAc,EAAE,MAAM;gBAHtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM;CAQzC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * ISM types supported by provider-sdk for Alt-VM chains.
3
+ * These correspond to the types defined in provider-sdk/src/ism.ts
4
+ */
5
+ const SUPPORTED_ISM_TYPES = new Set([
6
+ 'domainRoutingIsm',
7
+ 'merkleRootMultisigIsm',
8
+ 'messageIdMultisigIsm',
9
+ 'testIsm',
10
+ ]);
11
+ /**
12
+ * Validates that an ISM type is supported by provider-sdk.
13
+ *
14
+ * @param ismType - The ISM type string to validate
15
+ * @param chain - Chain name for error messages
16
+ * @param context - Context string for error messages (e.g., "warp route", "core")
17
+ * @throws UnsupportedIsmTypeError if ISM type is not supported
18
+ */
19
+ export function validateIsmType(ismType, chain, context = 'configuration') {
20
+ if (!SUPPORTED_ISM_TYPES.has(ismType)) {
21
+ const supportedTypes = Array.from(SUPPORTED_ISM_TYPES).join(', ');
22
+ throw new UnsupportedIsmTypeError(ismType, chain, context, supportedTypes);
23
+ }
24
+ }
25
+ /**
26
+ * Validates that an ISM configuration is supported by provider-sdk.
27
+ *
28
+ * @param config - ISM configuration (can be string address or config object)
29
+ * @param chain - Chain name for error messages
30
+ * @param context - Context string for error messages (e.g., "warp route", "core")
31
+ * @throws UnsupportedIsmTypeError if ISM type is not supported
32
+ */
33
+ export function validateIsmConfig(config, chain, context = 'configuration') {
34
+ // If it's a string address, it's valid (pre-deployed ISM)
35
+ if (typeof config === 'string') {
36
+ return;
37
+ }
38
+ // Validate the ISM type
39
+ validateIsmType(config.type, chain, context);
40
+ // Recursively validate nested ISMs in routing configs
41
+ if (config.type === 'domainRoutingIsm') {
42
+ for (const [domain, domainConfig] of Object.entries(config.domains)) {
43
+ validateIsmConfig(domainConfig, chain, `${context} (domain routing for ${domain})`);
44
+ }
45
+ }
46
+ }
47
+ /**
48
+ * Custom error class for unsupported ISM types.
49
+ * Provides concise error messages.
50
+ */
51
+ export class UnsupportedIsmTypeError extends Error {
52
+ ismType;
53
+ chain;
54
+ context;
55
+ supportedTypes;
56
+ constructor(ismType, chain, context, supportedTypes) {
57
+ super(`Unsupported ISM type '${ismType}' for Alt-VM chain '${chain}' in ${context}. ` +
58
+ `Supported types: ${supportedTypes}`);
59
+ this.ismType = ismType;
60
+ this.chain = chain;
61
+ this.context = context;
62
+ this.supportedTypes = supportedTypes;
63
+ this.name = 'UnsupportedIsmTypeError';
64
+ }
65
+ }
66
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,mBAAmB,GAAiB,IAAI,GAAG,CAAC;IAChD,kBAAkB;IAClB,uBAAuB;IACvB,sBAAsB;IACtB,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,KAAa,EACb,UAAkB,eAAe;IAEjC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAkB,CAAC,EAAE,CAAC;QACjD,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClE,MAAM,IAAI,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAA0B,EAC1B,KAAa,EACb,UAAkB,eAAe;IAEjC,0DAA0D;IAC1D,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,wBAAwB;IACxB,eAAe,CAAC,MAAM,CAAC,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