@hyperlane-xyz/provider-sdk 3.0.1 → 3.1.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.
@@ -0,0 +1,90 @@
1
+ import { Artifact, ArtifactDeployed, ConfigOnChain, IArtifactManager } from './artifact.js';
2
+ import type { ChainLookup } from './chain.js';
3
+ import type { DerivedCoreConfig } from './core.js';
4
+ import type { DeployedHookAddress, DeployedHookArtifact, DerivedHookConfig, HookArtifactConfig } from './hook.js';
5
+ import type { DeployedIsmAddress, DeployedIsmArtifact, DerivedIsmConfig, IsmArtifactConfig } from './ism.js';
6
+ /**
7
+ * Mailbox configuration for the Artifact API.
8
+ * Defines the parameters needed to deploy or configure a mailbox.
9
+ */
10
+ export interface MailboxArtifactConfig {
11
+ owner: string;
12
+ defaultIsm: Artifact<IsmArtifactConfig, DeployedIsmAddress>;
13
+ defaultHook: Artifact<HookArtifactConfig, DeployedHookAddress>;
14
+ requiredHook: Artifact<HookArtifactConfig, DeployedHookAddress>;
15
+ }
16
+ /**
17
+ * Deployment data returned after deploying a mailbox.
18
+ * Contains the on-chain address and optionally the domain ID.
19
+ */
20
+ export interface DeployedMailboxAddress {
21
+ address: string;
22
+ domainId?: number;
23
+ }
24
+ /**
25
+ * Describes the configuration of a deployed mailbox
26
+ */
27
+ export type DeployedMailboxArtifact = ArtifactDeployed<ConfigOnChain<MailboxArtifactConfig>, DeployedMailboxAddress>;
28
+ /**
29
+ * Mailbox artifact configs map
30
+ */
31
+ export interface MailboxArtifactConfigs {
32
+ mailbox: MailboxArtifactConfig;
33
+ }
34
+ export type MailboxType = keyof MailboxArtifactConfigs;
35
+ /**
36
+ * Should be used to implement an object/closure or class that is in charge of coordinating
37
+ * deployment of a Mailbox config, including nested ISM and Hook deployments.
38
+ */
39
+ export type IMailboxArtifactManager = IArtifactManager<MailboxType, MailboxArtifactConfigs, DeployedMailboxAddress>;
40
+ /**
41
+ * Raw mailbox config - uses ArtifactOnChain for nested artifacts instead of Artifact.
42
+ * This is the format used by protocol implementations that work directly with on-chain state.
43
+ */
44
+ export type MailboxOnChain = ConfigOnChain<MailboxArtifactConfig>;
45
+ /**
46
+ * Raw mailbox artifact configs map
47
+ */
48
+ export interface RawMailboxArtifactConfigs {
49
+ mailbox: MailboxOnChain;
50
+ }
51
+ /**
52
+ * Should be used for the specific artifact code that
53
+ * deploys or reads a single mailbox artifact on chain
54
+ */
55
+ export type RawMailboxArtifactConfig = RawMailboxArtifactConfigs[MailboxType];
56
+ /**
57
+ * Describes the configuration of deployed mailbox without nested config expansion
58
+ */
59
+ export type DeployedRawMailboxArtifact = ArtifactDeployed<RawMailboxArtifactConfig, DeployedMailboxAddress>;
60
+ /**
61
+ * Should be used to implement an object/closure or class that individually deploys
62
+ * Mailboxes on chain
63
+ */
64
+ export interface IRawMailboxArtifactManager extends IArtifactManager<MailboxType, RawMailboxArtifactConfigs, DeployedMailboxAddress> {
65
+ /**
66
+ * Read a mailbox by its address.
67
+ * This is the entry point for reading mailbox configuration from the chain.
68
+ * @param address The on-chain address of the mailbox
69
+ * @returns The artifact configuration and deployment data
70
+ */
71
+ readMailbox(address: string): Promise<DeployedRawMailboxArtifact>;
72
+ }
73
+ /**
74
+ * Converts a DeployedMailboxArtifact (with fully expanded nested ISM/hook artifacts)
75
+ * to the DerivedCoreConfig format for backward compatibility.
76
+ *
77
+ * This function is used by CoreArtifactReader to provide the deriveCoreConfig() method
78
+ * that existing code expects. The conversion functions for ISM and Hook artifacts
79
+ * must be passed in to avoid circular dependencies.
80
+ *
81
+ * @param artifact The deployed mailbox artifact with expanded nested configs
82
+ * @param chainLookup Chain lookup for converting domain IDs to chain names
83
+ * @param converters Object containing ismArtifactToDerivedConfig and hookArtifactToDerivedConfig functions
84
+ * @returns DerivedCoreConfig in the legacy format (from core.ts)
85
+ */
86
+ export declare function mailboxArtifactToDerivedCoreConfig(artifact: DeployedMailboxArtifact, chainLookup: ChainLookup, converters: {
87
+ ismArtifactToDerivedConfig: (artifact: DeployedIsmArtifact, chainLookup: ChainLookup) => DerivedIsmConfig;
88
+ hookArtifactToDerivedConfig: (artifact: DeployedHookArtifact, chainLookup: ChainLookup) => DerivedHookConfig;
89
+ }): DerivedCoreConfig;
90
+ //# sourceMappingURL=mailbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../src/mailbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAEhB,aAAa,EACb,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAKlB;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,QAAQ,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;IAC5D,WAAW,EAAE,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;IAC/D,YAAY,EAAE,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;CACjE;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,CACpD,aAAa,CAAC,qBAAqB,CAAC,EACpC,sBAAsB,CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,CACpD,WAAW,EACX,sBAAsB,EACtB,sBAAsB,CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,CACvD,wBAAwB,EACxB,sBAAsB,CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB,CAClE,WAAW,EACX,yBAAyB,EACzB,sBAAsB,CACvB;IACC;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE;IACV,0BAA0B,EAAE,CAC1B,QAAQ,EAAE,mBAAmB,EAC7B,WAAW,EAAE,WAAW,KACrB,gBAAgB,CAAC;IACtB,2BAA2B,EAAE,CAC3B,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,WAAW,KACrB,iBAAiB,CAAC;CACxB,GACA,iBAAiB,CA6BnB"}
@@ -0,0 +1,29 @@
1
+ import { ArtifactState, isArtifactDeployed, } from './artifact.js';
2
+ import { assert } from '@hyperlane-xyz/utils';
3
+ /**
4
+ * Converts a DeployedMailboxArtifact (with fully expanded nested ISM/hook artifacts)
5
+ * to the DerivedCoreConfig format for backward compatibility.
6
+ *
7
+ * This function is used by CoreArtifactReader to provide the deriveCoreConfig() method
8
+ * that existing code expects. The conversion functions for ISM and Hook artifacts
9
+ * must be passed in to avoid circular dependencies.
10
+ *
11
+ * @param artifact The deployed mailbox artifact with expanded nested configs
12
+ * @param chainLookup Chain lookup for converting domain IDs to chain names
13
+ * @param converters Object containing ismArtifactToDerivedConfig and hookArtifactToDerivedConfig functions
14
+ * @returns DerivedCoreConfig in the legacy format (from core.ts)
15
+ */
16
+ export function mailboxArtifactToDerivedCoreConfig(artifact, chainLookup, converters) {
17
+ const { defaultIsm, defaultHook, requiredHook, owner } = artifact.config;
18
+ // All nested artifacts should be in DEPLOYED state after CoreArtifactReader.read()
19
+ assert(isArtifactDeployed(defaultIsm), `Expected defaultIsm to be ${ArtifactState.DEPLOYED}, got ${defaultIsm.artifactState}`);
20
+ assert(isArtifactDeployed(defaultHook), `Expected defaultHook to be ${ArtifactState.DEPLOYED}, got ${defaultHook.artifactState}`);
21
+ assert(isArtifactDeployed(requiredHook), `Expected requiredHook to be ${ArtifactState.DEPLOYED}, got ${requiredHook.artifactState}`);
22
+ return {
23
+ owner,
24
+ defaultIsm: converters.ismArtifactToDerivedConfig(defaultIsm, chainLookup),
25
+ defaultHook: converters.hookArtifactToDerivedConfig(defaultHook, chainLookup),
26
+ requiredHook: converters.hookArtifactToDerivedConfig(requiredHook, chainLookup),
27
+ };
28
+ }
29
+ //# sourceMappingURL=mailbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailbox.js","sourceRoot":"","sources":["../src/mailbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAGb,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAevB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAgG9C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAiC,EACjC,WAAwB,EACxB,UASC;IAED,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;IAEzE,mFAAmF;IACnF,MAAM,CACJ,kBAAkB,CAAC,UAAU,CAAC,EAC9B,6BAA6B,aAAa,CAAC,QAAQ,SAAS,UAAU,CAAC,aAAa,EAAE,CACvF,CAAC;IACF,MAAM,CACJ,kBAAkB,CAAC,WAAW,CAAC,EAC/B,8BAA8B,aAAa,CAAC,QAAQ,SAAS,WAAW,CAAC,aAAa,EAAE,CACzF,CAAC;IACF,MAAM,CACJ,kBAAkB,CAAC,YAAY,CAAC,EAChC,+BAA+B,aAAa,CAAC,QAAQ,SAAS,YAAY,CAAC,aAAa,EAAE,CAC3F,CAAC;IAEF,OAAO;QACL,KAAK;QACL,UAAU,EAAE,UAAU,CAAC,0BAA0B,CAAC,UAAU,EAAE,WAAW,CAAC;QAC1E,WAAW,EAAE,UAAU,CAAC,2BAA2B,CACjD,WAAW,EACX,WAAW,CACZ;QACD,YAAY,EAAE,UAAU,CAAC,2BAA2B,CAClD,YAAY,EACZ,WAAW,CACZ;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { ArtifactDeployed, IArtifactManager } from './artifact.js';
2
+ /**
3
+ * Validator Announce configuration for the Artifact API.
4
+ * Defines the parameters needed to deploy or configure a validator announce contract.
5
+ */
6
+ export interface ValidatorAnnounceArtifactConfig {
7
+ mailboxAddress: string;
8
+ }
9
+ /**
10
+ * Deployment data returned after deploying a validator announce contract.
11
+ * Contains the on-chain address.
12
+ */
13
+ export interface DeployedValidatorAnnounceAddress {
14
+ address: string;
15
+ }
16
+ /**
17
+ * Describes the configuration of a deployed validator announce contract
18
+ */
19
+ export type DeployedValidatorAnnounceArtifact = ArtifactDeployed<ValidatorAnnounceArtifactConfig, DeployedValidatorAnnounceAddress>;
20
+ /**
21
+ * Validator announce artifact configs map
22
+ */
23
+ export interface ValidatorAnnounceArtifactConfigs {
24
+ validatorAnnounce: ValidatorAnnounceArtifactConfig;
25
+ }
26
+ export type ValidatorAnnounceType = keyof ValidatorAnnounceArtifactConfigs;
27
+ /**
28
+ * Should be used to implement an object/closure or class that is in charge of coordinating
29
+ * deployment of a ValidatorAnnounce config.
30
+ */
31
+ export type IValidatorAnnounceArtifactManager = IArtifactManager<ValidatorAnnounceType, ValidatorAnnounceArtifactConfigs, DeployedValidatorAnnounceAddress>;
32
+ /**
33
+ * Raw validator announce config - identical to the compound config since there are no nested artifacts.
34
+ * Kept for consistency with the artifact API pattern.
35
+ */
36
+ export interface RawValidatorAnnounceConfig {
37
+ mailboxAddress: string;
38
+ }
39
+ /**
40
+ * Raw validator announce artifact configs map
41
+ */
42
+ export interface RawValidatorAnnounceArtifactConfigs {
43
+ validatorAnnounce: RawValidatorAnnounceConfig;
44
+ }
45
+ /**
46
+ * Should be used for the specific artifact code that
47
+ * deploys or reads a single validator announce artifact on chain
48
+ */
49
+ export type RawValidatorAnnounceArtifactConfig = RawValidatorAnnounceArtifactConfigs[ValidatorAnnounceType];
50
+ /**
51
+ * Describes the configuration of deployed validator announce without nested config expansion
52
+ */
53
+ export type DeployedRawValidatorAnnounceArtifact = ArtifactDeployed<RawValidatorAnnounceArtifactConfig, DeployedValidatorAnnounceAddress>;
54
+ /**
55
+ * Should be used to implement an object/closure or class that individually deploys
56
+ * ValidatorAnnounce contracts on chain
57
+ */
58
+ export interface IRawValidatorAnnounceArtifactManager extends IArtifactManager<ValidatorAnnounceType, RawValidatorAnnounceArtifactConfigs, DeployedValidatorAnnounceAddress> {
59
+ /**
60
+ * Read a validator announce contract by its address.
61
+ * This is the entry point for reading validator announce configuration from the chain.
62
+ * @param address The on-chain address of the validator announce contract
63
+ * @returns The artifact configuration and deployment data
64
+ */
65
+ readValidatorAnnounce(address: string): Promise<DeployedRawValidatorAnnounceArtifact>;
66
+ }
67
+ //# sourceMappingURL=validator-announce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator-announce.d.ts","sourceRoot":"","sources":["../src/validator-announce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAInE;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,gBAAgB,CAC9D,+BAA+B,EAC/B,gCAAgC,CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,iBAAiB,EAAE,+BAA+B,CAAC;CACpD;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,gCAAgC,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,gBAAgB,CAC9D,qBAAqB,EACrB,gCAAgC,EAChC,gCAAgC,CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,iBAAiB,EAAE,0BAA0B,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,MAAM,kCAAkC,GAC5C,mCAAmC,CAAC,qBAAqB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,gBAAgB,CACjE,kCAAkC,EAClC,gCAAgC,CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,oCAAqC,SAAQ,gBAAgB,CAC5E,qBAAqB,EACrB,mCAAmC,EACnC,gCAAgC,CACjC;IACC;;;;;OAKG;IACH,qBAAqB,CACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oCAAoC,CAAC,CAAC;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validator-announce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator-announce.js","sourceRoot":"","sources":["../src/validator-announce.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperlane-xyz/provider-sdk",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Protocol Provider SDK for the Hyperlane Protocol",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo",
@@ -17,6 +17,8 @@
17
17
  "./hook": "./dist/hook.js",
18
18
  "./ism": "./dist/ism.js",
19
19
  "./core": "./dist/core.js",
20
+ "./mailbox": "./dist/mailbox.js",
21
+ "./validator-announce": "./dist/validator-announce.js",
20
22
  "./warp": "./dist/warp.js",
21
23
  "./factory": "./dist/factory.js",
22
24
  "./submitter": "./dist/submitter.js",
@@ -26,7 +28,7 @@
26
28
  "dependencies": {
27
29
  "pino": "^8.19.0",
28
30
  "zod": "^3.21.2",
29
- "@hyperlane-xyz/utils": "27.0.0"
31
+ "@hyperlane-xyz/utils": "27.1.0"
30
32
  },
31
33
  "devDependencies": {
32
34
  "@types/chai": "^4.3.11",
@@ -37,8 +39,8 @@
37
39
  "mocha": "^11.5.0",
38
40
  "tsx": "^4.19.1",
39
41
  "typescript": "5.8.3",
40
- "@hyperlane-xyz/eslint-config": "^27.0.0",
41
- "@hyperlane-xyz/tsconfig": "^27.0.0"
42
+ "@hyperlane-xyz/eslint-config": "^27.1.0",
43
+ "@hyperlane-xyz/tsconfig": "^27.1.0"
42
44
  },
43
45
  "scripts": {
44
46
  "build": "tsc",