@hyperlane-xyz/registry 19.1.1 → 19.2.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.
- package/dist/chainMetadata.js +1 -1
- package/dist/chains/paradex/metadata.js +1 -1
- package/dist/chains/paradex/metadata.json +1 -1
- package/dist/chains/paradex/metadata.yaml +1 -1
- package/dist/deployments/warp_routes/SEDA/base-ethereum-config.d.ts +2 -0
- package/dist/deployments/warp_routes/SEDA/base-ethereum-config.js +34 -0
- package/dist/deployments/warp_routes/SEDA/base-ethereum-config.json +34 -0
- package/dist/deployments/warp_routes/SEDA/base-ethereum-config.yaml +22 -0
- package/dist/deployments/warp_routes/USDC/subtensor-config.d.ts +2 -0
- package/dist/deployments/warp_routes/USDC/subtensor-config.js +214 -0
- package/dist/deployments/warp_routes/USDC/subtensor-config.json +214 -0
- package/dist/deployments/warp_routes/USDC/subtensor-config.yaml +107 -0
- package/dist/fs/FileSystemRegistry.d.ts +2 -2
- package/dist/fs/registry-utils.js +7 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/registry/BaseRegistry.d.ts +2 -2
- package/dist/registry/GithubRegistry.d.ts +3 -2
- package/dist/registry/GithubRegistry.js +7 -0
- package/dist/registry/HttpClientRegistry.d.ts +34 -0
- package/dist/registry/HttpClientRegistry.js +149 -0
- package/dist/registry/IRegistry.d.ts +19 -11
- package/dist/registry/IRegistry.js +1 -0
- package/dist/registry/MergedRegistry.d.ts +3 -3
- package/dist/registry/MergedRegistry.js +8 -9
- package/dist/registry/SynchronousRegistry.d.ts +2 -2
- package/dist/registry/warp-utils.d.ts +1 -2
- package/dist/types.d.ts +4826 -1
- package/dist/types.js +15 -0
- package/dist/warpRouteConfigs.js +248 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
3
|
-
import { ChainAddresses, WarpRouteId } from '../types.js';
|
|
4
|
-
import { AddWarpRouteConfigOptions, RegistryType,
|
|
3
|
+
import { ChainAddresses, UpdateChainParams, WarpRouteId } from '../types.js';
|
|
4
|
+
import { AddWarpRouteConfigOptions, RegistryType, type ChainFiles, type IRegistry, type RegistryContent } from '../registry/IRegistry.js';
|
|
5
5
|
import { SynchronousRegistry } from '../registry/SynchronousRegistry.js';
|
|
6
6
|
export interface FileSystemRegistryOptions {
|
|
7
7
|
uri: string;
|
|
@@ -2,12 +2,13 @@ import { GithubRegistry } from '../registry/GithubRegistry.js';
|
|
|
2
2
|
import { FileSystemRegistry } from './FileSystemRegistry.js';
|
|
3
3
|
import { PROXY_DEPLOYED_URL } from '../consts.js';
|
|
4
4
|
import { MergedRegistry } from '../registry/MergedRegistry.js';
|
|
5
|
-
|
|
5
|
+
import { HttpClientRegistry } from '../registry/HttpClientRegistry.js';
|
|
6
|
+
const isProtocolUrl = (value, protocols) => {
|
|
6
7
|
try {
|
|
7
8
|
if (!value)
|
|
8
9
|
return false;
|
|
9
10
|
const url = new URL(value);
|
|
10
|
-
return url.protocol
|
|
11
|
+
return protocols.includes(url.protocol);
|
|
11
12
|
}
|
|
12
13
|
catch {
|
|
13
14
|
return false;
|
|
@@ -57,7 +58,7 @@ export function getRegistry({ registryUris, enableProxy, branch, logger, authTok
|
|
|
57
58
|
.filter((uri) => !!uri)
|
|
58
59
|
.map((uri, index) => {
|
|
59
60
|
const childLogger = registryLogger?.child({ uri, index });
|
|
60
|
-
if (
|
|
61
|
+
if (isProtocolUrl(uri, ['https:']) && uri.includes('github')) {
|
|
61
62
|
return new GithubRegistry({
|
|
62
63
|
uri,
|
|
63
64
|
branch,
|
|
@@ -66,6 +67,9 @@ export function getRegistry({ registryUris, enableProxy, branch, logger, authTok
|
|
|
66
67
|
authToken,
|
|
67
68
|
});
|
|
68
69
|
}
|
|
70
|
+
else if (isProtocolUrl(uri, ['http:', 'https:'])) {
|
|
71
|
+
return new HttpClientRegistry(uri);
|
|
72
|
+
}
|
|
69
73
|
else {
|
|
70
74
|
if (!isValidFilePath(uri)) {
|
|
71
75
|
throw new Error(`Invalid file system path: ${uri}`);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ export { GithubRegistry, GithubRegistryOptions } from './registry/GithubRegistry
|
|
|
4
4
|
export { AddWarpRouteConfigOptions, ChainFiles, IRegistry, RegistryContent, RegistryType, } from './registry/IRegistry.js';
|
|
5
5
|
export { MergedRegistry, MergedRegistryOptions } from './registry/MergedRegistry.js';
|
|
6
6
|
export { PartialRegistry, PartialRegistryOptions } from './registry/PartialRegistry.js';
|
|
7
|
+
export { HttpClientRegistry } from './registry/HttpClientRegistry.js';
|
|
7
8
|
export { filterWarpRoutesIds, warpConfigToWarpAddresses, warpRouteConfigPathToId, createWarpRouteConfigId, } from './registry/warp-utils.js';
|
|
8
|
-
export { ChainAddresses, ChainAddressesSchema } from './types.js';
|
|
9
|
+
export { ChainAddresses, ChainAddressesSchema, WarpRouteId, WarpRouteConfigMap, WarpRouteFilterParams, WarpRouteFilterSchema, UpdateChainParams, UpdateChainSchema, } from './types.js';
|
|
9
10
|
export { isAbacusWorksChain } from './utils.js';
|
|
10
11
|
export { chainMetadata } from './chainMetadata.js';
|
|
11
12
|
export { chainAddresses } from './chainAddresses.js';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,9 @@ export { GithubRegistry } from './registry/GithubRegistry.js';
|
|
|
4
4
|
export { RegistryType, } from './registry/IRegistry.js';
|
|
5
5
|
export { MergedRegistry } from './registry/MergedRegistry.js';
|
|
6
6
|
export { PartialRegistry } from './registry/PartialRegistry.js';
|
|
7
|
+
export { HttpClientRegistry } from './registry/HttpClientRegistry.js';
|
|
7
8
|
export { filterWarpRoutesIds, warpConfigToWarpAddresses, warpRouteConfigPathToId, createWarpRouteConfigId, } from './registry/warp-utils.js';
|
|
8
|
-
export { ChainAddressesSchema } from './types.js';
|
|
9
|
+
export { ChainAddressesSchema, WarpRouteFilterSchema, UpdateChainSchema, } from './types.js';
|
|
9
10
|
export { isAbacusWorksChain } from './utils.js';
|
|
10
11
|
export { chainMetadata } from './chainMetadata.js';
|
|
11
12
|
export { chainAddresses } from './chainAddresses.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
3
|
-
import type { ChainAddresses, MaybePromise, WarpDeployConfigMap, WarpRouteId } from '../types.js';
|
|
3
|
+
import type { ChainAddresses, MaybePromise, WarpDeployConfigMap, WarpRouteFilterParams, WarpRouteId, UpdateChainParams } from '../types.js';
|
|
4
4
|
import { WarpRouteConfigMap } from '../types.js';
|
|
5
|
-
import type { AddWarpRouteConfigOptions, IRegistry, RegistryContent, RegistryType
|
|
5
|
+
import type { AddWarpRouteConfigOptions, IRegistry, RegistryContent, RegistryType } from './IRegistry.js';
|
|
6
6
|
export declare abstract class BaseRegistry implements IRegistry {
|
|
7
7
|
abstract type: RegistryType;
|
|
8
8
|
readonly uri: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
3
|
-
import { ChainAddresses, WarpDeployConfigMap, WarpRouteConfigMap } from '../types.js';
|
|
3
|
+
import { ChainAddresses, UpdateChainParams, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteFilterParams } from '../types.js';
|
|
4
4
|
import { BaseRegistry } from './BaseRegistry.js';
|
|
5
|
-
import { AddWarpRouteConfigOptions, ChainFiles, IRegistry, RegistryContent, RegistryType
|
|
5
|
+
import { AddWarpRouteConfigOptions, ChainFiles, IRegistry, IRegistryMethods, RegistryContent, RegistryType } from './IRegistry.js';
|
|
6
6
|
export interface GithubRegistryOptions {
|
|
7
7
|
uri?: string;
|
|
8
8
|
proxyUrl?: string;
|
|
@@ -48,6 +48,7 @@ export declare class GithubRegistry extends BaseRegistry implements IRegistry {
|
|
|
48
48
|
private readonly isBrowser;
|
|
49
49
|
private archiveEntries?;
|
|
50
50
|
private archiveEntriesPromise?;
|
|
51
|
+
readonly unimplementedMethods: Set<IRegistryMethods>;
|
|
51
52
|
private readonly baseApiHeaders;
|
|
52
53
|
constructor(options?: GithubRegistryOptions);
|
|
53
54
|
getUri(itemPath?: string): string;
|
|
@@ -37,6 +37,13 @@ export class GithubRegistry extends BaseRegistry {
|
|
|
37
37
|
archiveEntries;
|
|
38
38
|
// Promise tracking an in-flight archive download/unpack to dedupe parallel calls
|
|
39
39
|
archiveEntriesPromise;
|
|
40
|
+
unimplementedMethods = new Set([
|
|
41
|
+
'addChain',
|
|
42
|
+
'updateChain',
|
|
43
|
+
'removeChain',
|
|
44
|
+
'addWarpRoute',
|
|
45
|
+
'addWarpRouteConfig',
|
|
46
|
+
]);
|
|
40
47
|
baseApiHeaders = {
|
|
41
48
|
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
42
49
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
2
|
+
import { ChainAddresses, MaybePromise, UpdateChainParams, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteFilterParams } from '../types.js';
|
|
3
|
+
import { IRegistry, RegistryContent, RegistryType, AddWarpRouteConfigOptions, IRegistryMethods } from './IRegistry.js';
|
|
4
|
+
export declare class HttpError extends Error {
|
|
5
|
+
status: number;
|
|
6
|
+
body: any;
|
|
7
|
+
constructor(message: string, status: number, body?: any);
|
|
8
|
+
}
|
|
9
|
+
export declare class HttpClientRegistry implements IRegistry {
|
|
10
|
+
private baseUrl;
|
|
11
|
+
readonly type = RegistryType.Http;
|
|
12
|
+
readonly uri: string;
|
|
13
|
+
readonly unimplementedMethods: Set<IRegistryMethods>;
|
|
14
|
+
constructor(baseUrl?: string);
|
|
15
|
+
getMetadata(): MaybePromise<ChainMap<ChainMetadata>>;
|
|
16
|
+
getAddresses(): MaybePromise<ChainMap<ChainAddresses>>;
|
|
17
|
+
getUri(_itemPath?: string): string;
|
|
18
|
+
listRegistryContent(): MaybePromise<RegistryContent>;
|
|
19
|
+
getChains(): MaybePromise<Array<ChainName>>;
|
|
20
|
+
getChainMetadata(chainName: ChainName): Promise<ChainMetadata | null>;
|
|
21
|
+
getChainAddresses(chainName: ChainName): Promise<ChainAddresses | null>;
|
|
22
|
+
updateChain(update: UpdateChainParams): Promise<void>;
|
|
23
|
+
getChainLogoUri(_chainName: ChainName): Promise<string | null>;
|
|
24
|
+
addChain(_chain: UpdateChainParams): MaybePromise<void>;
|
|
25
|
+
removeChain(_chain: ChainName): MaybePromise<void>;
|
|
26
|
+
getWarpRoute(routeId: string): MaybePromise<WarpCoreConfig | null>;
|
|
27
|
+
getWarpRoutes(filter?: WarpRouteFilterParams): MaybePromise<WarpRouteConfigMap>;
|
|
28
|
+
addWarpRoute(_config: WarpCoreConfig): MaybePromise<void>;
|
|
29
|
+
getWarpDeployConfig(_routeId: string): MaybePromise<WarpRouteDeployConfig | null>;
|
|
30
|
+
getWarpDeployConfigs(): MaybePromise<WarpDeployConfigMap>;
|
|
31
|
+
addWarpRouteConfig(_config: WarpRouteDeployConfig, _options: AddWarpRouteConfigOptions): MaybePromise<void>;
|
|
32
|
+
merge(_otherRegistry: IRegistry): IRegistry;
|
|
33
|
+
private fetchJson;
|
|
34
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { RegistryType, } from './IRegistry.js';
|
|
2
|
+
export class HttpError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, body = null) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'HttpError';
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class HttpClientRegistry {
|
|
13
|
+
baseUrl;
|
|
14
|
+
type = RegistryType.Http;
|
|
15
|
+
uri;
|
|
16
|
+
unimplementedMethods = new Set([
|
|
17
|
+
'getUri',
|
|
18
|
+
'getChainLogoUri',
|
|
19
|
+
'addChain',
|
|
20
|
+
'removeChain',
|
|
21
|
+
'addWarpRoute',
|
|
22
|
+
'getWarpDeployConfig',
|
|
23
|
+
'getWarpDeployConfigs',
|
|
24
|
+
'addWarpRouteConfig',
|
|
25
|
+
'merge',
|
|
26
|
+
]);
|
|
27
|
+
constructor(baseUrl = 'http://localhost:3001') {
|
|
28
|
+
this.baseUrl = baseUrl;
|
|
29
|
+
this.uri = baseUrl;
|
|
30
|
+
}
|
|
31
|
+
getMetadata() {
|
|
32
|
+
return this.fetchJson('/metadata');
|
|
33
|
+
}
|
|
34
|
+
getAddresses() {
|
|
35
|
+
return this.fetchJson('/addresses');
|
|
36
|
+
}
|
|
37
|
+
getUri(_itemPath) {
|
|
38
|
+
throw new Error('Method not implemented.');
|
|
39
|
+
}
|
|
40
|
+
listRegistryContent() {
|
|
41
|
+
return this.fetchJson('/list-registry-content');
|
|
42
|
+
}
|
|
43
|
+
getChains() {
|
|
44
|
+
return this.fetchJson('/chains');
|
|
45
|
+
}
|
|
46
|
+
async getChainMetadata(chainName) {
|
|
47
|
+
try {
|
|
48
|
+
return await this.fetchJson(`/chain/${chainName}/metadata`);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
if (e instanceof HttpError && e.status === 404) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async getChainAddresses(chainName) {
|
|
58
|
+
try {
|
|
59
|
+
return await this.fetchJson(`/chain/${chainName}/addresses`);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (e instanceof HttpError && e.status === 404) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async updateChain(update) {
|
|
69
|
+
await this.fetchJson(`/chain/${update.chainName}`, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
metadata: update.metadata,
|
|
73
|
+
addresses: update.addresses,
|
|
74
|
+
}),
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/json',
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
getChainLogoUri(_chainName) {
|
|
81
|
+
throw new Error('Method not implemented.');
|
|
82
|
+
}
|
|
83
|
+
addChain(_chain) {
|
|
84
|
+
throw new Error('Method not implemented.');
|
|
85
|
+
}
|
|
86
|
+
removeChain(_chain) {
|
|
87
|
+
throw new Error('Method not implemented.');
|
|
88
|
+
}
|
|
89
|
+
getWarpRoute(routeId) {
|
|
90
|
+
return this.fetchJson(`/warp-route/${routeId}`);
|
|
91
|
+
}
|
|
92
|
+
getWarpRoutes(filter) {
|
|
93
|
+
const queryParams = new URLSearchParams();
|
|
94
|
+
if (filter?.symbol) {
|
|
95
|
+
queryParams.set('symbol', filter.symbol);
|
|
96
|
+
}
|
|
97
|
+
if (filter?.label) {
|
|
98
|
+
queryParams.set('label', filter.label);
|
|
99
|
+
}
|
|
100
|
+
return this.fetchJson(`/warp-routes?${queryParams.toString()}`);
|
|
101
|
+
}
|
|
102
|
+
addWarpRoute(_config) {
|
|
103
|
+
throw new Error('Method not implemented.');
|
|
104
|
+
}
|
|
105
|
+
getWarpDeployConfig(_routeId) {
|
|
106
|
+
throw new Error('Method not implemented.');
|
|
107
|
+
}
|
|
108
|
+
getWarpDeployConfigs() {
|
|
109
|
+
throw new Error('Method not implemented.');
|
|
110
|
+
}
|
|
111
|
+
addWarpRouteConfig(_config, _options) {
|
|
112
|
+
throw new Error('Method not implemented.');
|
|
113
|
+
}
|
|
114
|
+
merge(_otherRegistry) {
|
|
115
|
+
throw new Error('Method not implemented.');
|
|
116
|
+
}
|
|
117
|
+
async fetchJson(endpoint, options = {}) {
|
|
118
|
+
const requestOptions = { ...options };
|
|
119
|
+
// Only add JSON content-type header if there's a body
|
|
120
|
+
if (options.body) {
|
|
121
|
+
requestOptions.headers = {
|
|
122
|
+
'Content-Type': 'application/json',
|
|
123
|
+
...options.headers,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const response = await fetch(`${this.baseUrl}${endpoint}`, requestOptions);
|
|
127
|
+
// Handle successful requests that have no content to parse.
|
|
128
|
+
if (response.status === 204) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
let errorBody = null;
|
|
133
|
+
let errorMessage = `HTTP Error: ${response.status} ${response.statusText}`;
|
|
134
|
+
try {
|
|
135
|
+
errorBody = await response.json();
|
|
136
|
+
// Use the server's detailed error message if available
|
|
137
|
+
if (errorBody?.message) {
|
|
138
|
+
errorMessage = errorBody.message;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
// Ignore if error body isn't valid JSON, use statusText instead.
|
|
143
|
+
}
|
|
144
|
+
// Throw the structured error
|
|
145
|
+
throw new HttpError(errorMessage, response.status, errorBody);
|
|
146
|
+
}
|
|
147
|
+
return response.json();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
2
|
-
import { ChainAddresses, MaybePromise, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteId } from '../types.js';
|
|
2
|
+
import { ChainAddresses, MaybePromise, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteId, WarpRouteFilterParams, UpdateChainParams } from '../types.js';
|
|
3
|
+
type MethodsOf<T> = {
|
|
4
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
/**
|
|
7
|
+
* A type listing all method names on IRegistry.
|
|
8
|
+
* It is derived from IRegistry to ensure it's always in sync.
|
|
9
|
+
* Omit is used to avoid a circular reference with the `unimplementedMethods` property.
|
|
10
|
+
*/
|
|
11
|
+
export type IRegistryMethods = MethodsOf<Omit<IRegistry, 'unimplementedMethods'>>;
|
|
3
12
|
export interface ChainFiles {
|
|
4
13
|
metadata?: string;
|
|
5
14
|
addresses?: string;
|
|
@@ -12,20 +21,12 @@ export interface RegistryContent {
|
|
|
12
21
|
warpDeployConfig: Record<WarpRouteId, string>;
|
|
13
22
|
};
|
|
14
23
|
}
|
|
15
|
-
export interface UpdateChainParams {
|
|
16
|
-
chainName: ChainName;
|
|
17
|
-
metadata?: ChainMetadata;
|
|
18
|
-
addresses?: ChainAddresses;
|
|
19
|
-
}
|
|
20
|
-
export interface WarpRouteFilterParams {
|
|
21
|
-
symbol?: string;
|
|
22
|
-
label?: string;
|
|
23
|
-
}
|
|
24
24
|
export declare enum RegistryType {
|
|
25
25
|
Github = "github",
|
|
26
26
|
FileSystem = "filesystem",
|
|
27
27
|
Merged = "merged",
|
|
28
|
-
Partial = "partial"
|
|
28
|
+
Partial = "partial",
|
|
29
|
+
Http = "http"
|
|
29
30
|
}
|
|
30
31
|
export type AddWarpRouteConfigOptions = {
|
|
31
32
|
symbol: string;
|
|
@@ -35,6 +36,12 @@ export type AddWarpRouteConfigOptions = {
|
|
|
35
36
|
export interface IRegistry {
|
|
36
37
|
type: RegistryType;
|
|
37
38
|
uri: string;
|
|
39
|
+
/**
|
|
40
|
+
* An optional set of method names that are not implemented by the registry.
|
|
41
|
+
* If a method is in this set, it should not be called.
|
|
42
|
+
* If this property is undefined, all methods are assumed to be implemented.
|
|
43
|
+
*/
|
|
44
|
+
readonly unimplementedMethods?: Set<IRegistryMethods>;
|
|
38
45
|
getUri(itemPath?: string): string;
|
|
39
46
|
listRegistryContent(): MaybePromise<RegistryContent>;
|
|
40
47
|
getChains(): MaybePromise<Array<ChainName>>;
|
|
@@ -54,3 +61,4 @@ export interface IRegistry {
|
|
|
54
61
|
getWarpDeployConfigs(filter?: WarpRouteFilterParams): MaybePromise<WarpDeployConfigMap>;
|
|
55
62
|
merge(otherRegistry: IRegistry): IRegistry;
|
|
56
63
|
}
|
|
64
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
3
|
-
import { ChainAddresses, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteId } from '../types.js';
|
|
4
|
-
import { AddWarpRouteConfigOptions, IRegistry, RegistryContent, RegistryType
|
|
3
|
+
import { ChainAddresses, UpdateChainParams, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteFilterParams, WarpRouteId } from '../types.js';
|
|
4
|
+
import { AddWarpRouteConfigOptions, IRegistry, IRegistryMethods, RegistryContent, RegistryType } from './IRegistry.js';
|
|
5
5
|
export interface MergedRegistryOptions {
|
|
6
6
|
registries: Array<IRegistry>;
|
|
7
7
|
logger?: Logger;
|
|
@@ -36,6 +36,6 @@ export declare class MergedRegistry implements IRegistry {
|
|
|
36
36
|
addWarpRoute(config: WarpCoreConfig, options?: AddWarpRouteConfigOptions): Promise<void>;
|
|
37
37
|
addWarpRouteConfig(config: WarpRouteDeployConfig, options: AddWarpRouteConfigOptions): Promise<void>;
|
|
38
38
|
protected multiRegistryRead<R>(readFn: (registry: IRegistry) => Promise<R> | R): Promise<(Awaited<R> | Awaited<R>)[]>;
|
|
39
|
-
protected multiRegistryWrite(writeFn: (registry: IRegistry) => Promise<void>, logMsg: string): Promise<void>;
|
|
39
|
+
protected multiRegistryWrite(writeFn: (registry: IRegistry) => Promise<void>, methodName: IRegistryMethods, logMsg: string): Promise<void>;
|
|
40
40
|
merge(otherRegistry: IRegistry): IRegistry;
|
|
41
41
|
}
|
|
@@ -53,13 +53,13 @@ export class MergedRegistry {
|
|
|
53
53
|
return results.find((uri) => !!uri) || null;
|
|
54
54
|
}
|
|
55
55
|
async addChain(chain) {
|
|
56
|
-
return this.multiRegistryWrite(async (registry) => await registry.addChain(chain), `adding chain ${chain.chainName}`);
|
|
56
|
+
return this.multiRegistryWrite(async (registry) => await registry.addChain(chain), 'addChain', `adding chain ${chain.chainName}`);
|
|
57
57
|
}
|
|
58
58
|
async updateChain(chain) {
|
|
59
|
-
return this.multiRegistryWrite(async (registry) => await registry.updateChain(chain), `updating chain ${chain.chainName}`);
|
|
59
|
+
return this.multiRegistryWrite(async (registry) => await registry.updateChain(chain), 'updateChain', `updating chain ${chain.chainName}`);
|
|
60
60
|
}
|
|
61
61
|
async removeChain(chain) {
|
|
62
|
-
return this.multiRegistryWrite(async (registry) => await registry.removeChain(chain), `removing chain ${chain}`);
|
|
62
|
+
return this.multiRegistryWrite(async (registry) => await registry.removeChain(chain), 'removeChain', `removing chain ${chain}`);
|
|
63
63
|
}
|
|
64
64
|
async getWarpRoute(id) {
|
|
65
65
|
const results = await this.multiRegistryRead((r) => r.getWarpRoute(id));
|
|
@@ -78,19 +78,18 @@ export class MergedRegistry {
|
|
|
78
78
|
return results.reduce((acc, content) => objMerge(acc, content), {});
|
|
79
79
|
}
|
|
80
80
|
async addWarpRoute(config, options) {
|
|
81
|
-
return this.multiRegistryWrite(async (registry) => await registry.addWarpRoute(config, options), 'adding warp route');
|
|
81
|
+
return this.multiRegistryWrite(async (registry) => await registry.addWarpRoute(config, options), 'addWarpRoute', 'adding warp route');
|
|
82
82
|
}
|
|
83
83
|
async addWarpRouteConfig(config, options) {
|
|
84
|
-
return this.multiRegistryWrite(async (registry) => await registry.addWarpRouteConfig(config, options), 'adding warp route deploy config');
|
|
84
|
+
return this.multiRegistryWrite(async (registry) => await registry.addWarpRouteConfig(config, options), 'addWarpRouteConfig', 'adding warp route deploy config');
|
|
85
85
|
}
|
|
86
86
|
multiRegistryRead(readFn) {
|
|
87
87
|
return Promise.all(this.registries.map(readFn));
|
|
88
88
|
}
|
|
89
|
-
async multiRegistryWrite(writeFn, logMsg) {
|
|
89
|
+
async multiRegistryWrite(writeFn, methodName, logMsg) {
|
|
90
90
|
for (const registry of this.registries) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.logger.warn(`Skipping ${logMsg} at ${registry.type} registry`);
|
|
91
|
+
if (registry.unimplementedMethods?.has(methodName)) {
|
|
92
|
+
this.logger.warn(`Skipping ${logMsg} at ${registry.type} registry (not supported)`);
|
|
94
93
|
continue;
|
|
95
94
|
}
|
|
96
95
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
|
|
2
|
-
import { ChainAddresses, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteId } from '../types.js';
|
|
2
|
+
import { ChainAddresses, UpdateChainParams, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteFilterParams, WarpRouteId } from '../types.js';
|
|
3
3
|
import { BaseRegistry } from './BaseRegistry.js';
|
|
4
|
-
import { AddWarpRouteConfigOptions, IRegistry, RegistryContent
|
|
4
|
+
import { AddWarpRouteConfigOptions, IRegistry, RegistryContent } from './IRegistry.js';
|
|
5
5
|
/**
|
|
6
6
|
* Shared code for sync registries like the FileSystem and Partial registries.
|
|
7
7
|
* This is required because of the inconsistent sync/async methods across registries.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TokenStandard, type ChainMap, type WarpCoreConfig } from '@hyperlane-xyz/sdk';
|
|
2
|
-
import { ChainAddresses, WarpRouteId } from '../types.js';
|
|
3
|
-
import { WarpRouteFilterParams } from './IRegistry.js';
|
|
2
|
+
import { ChainAddresses, WarpRouteFilterParams, WarpRouteId } from '../types.js';
|
|
4
3
|
/**
|
|
5
4
|
* Converts from a full warp config to a map of chain addresses.
|
|
6
5
|
*/
|