@hyperlane-xyz/registry 1.0.3 → 1.0.5
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/chainAddresses.d.ts +18 -0
- package/dist/chainAddresses.js +18 -0
- package/dist/chainMetadata.js +43 -6
- package/dist/chains/alfajores/metadata.yaml +1 -1
- package/dist/chains/ancient8/addresses.d.ts +18 -0
- package/dist/chains/ancient8/addresses.js +18 -0
- package/dist/chains/ancient8/addresses.json +18 -0
- package/dist/chains/ancient8/addresses.yaml +16 -0
- package/dist/chains/ancient8/index.d.ts +2 -0
- package/dist/chains/ancient8/index.js +2 -0
- package/dist/chains/ancient8/logo.svg +1 -0
- package/dist/chains/ancient8/metadata.d.ts +2 -0
- package/dist/chains/ancient8/metadata.js +33 -0
- package/dist/chains/ancient8/metadata.json +33 -0
- package/dist/chains/ancient8/metadata.yaml +24 -0
- package/dist/chains/arbitrum/metadata.js +3 -0
- package/dist/chains/arbitrum/metadata.json +3 -0
- package/dist/chains/arbitrum/metadata.yaml +7 -1
- package/dist/chains/avalanche/metadata.yaml +1 -1
- package/dist/chains/base/metadata.yaml +1 -1
- package/dist/chains/bsc/metadata.yaml +1 -1
- package/dist/chains/bsctestnet/metadata.yaml +1 -1
- package/dist/chains/celo/metadata.yaml +1 -1
- package/dist/chains/chiado/metadata.yaml +1 -1
- package/dist/chains/eclipsetestnet/metadata.yaml +1 -1
- package/dist/chains/ethereum/metadata.yaml +1 -1
- package/dist/chains/fuji/metadata.yaml +1 -1
- package/dist/chains/gnosis/metadata.yaml +1 -1
- package/dist/chains/inevm/metadata.yaml +1 -1
- package/dist/chains/injective/metadata.yaml +1 -1
- package/dist/chains/mantapacific/metadata.yaml +1 -1
- package/dist/chains/moonbeam/metadata.yaml +1 -1
- package/dist/chains/nautilus/metadata.yaml +1 -1
- package/dist/chains/neutron/metadata.yaml +1 -1
- package/dist/chains/optimism/metadata.yaml +1 -1
- package/dist/chains/plumetestnet/metadata.yaml +1 -1
- package/dist/chains/polygon/metadata.yaml +1 -1
- package/dist/chains/polygonzkevm/metadata.yaml +1 -1
- package/dist/chains/proteustestnet/metadata.js +1 -0
- package/dist/chains/proteustestnet/metadata.json +1 -0
- package/dist/chains/proteustestnet/metadata.yaml +2 -1
- package/dist/chains/scroll/metadata.yaml +1 -1
- package/dist/chains/scrollsepolia/metadata.yaml +1 -1
- package/dist/chains/sepolia/metadata.yaml +1 -1
- package/dist/chains/solana/metadata.js +2 -2
- package/dist/chains/solana/metadata.json +2 -2
- package/dist/chains/solana/metadata.yaml +3 -3
- package/dist/chains/solanadevnet/metadata.js +2 -2
- package/dist/chains/solanadevnet/metadata.json +2 -2
- package/dist/chains/solanadevnet/metadata.yaml +3 -3
- package/dist/chains/solanatestnet/metadata.js +2 -2
- package/dist/chains/solanatestnet/metadata.json +2 -2
- package/dist/chains/solanatestnet/metadata.yaml +3 -3
- package/dist/chains/viction/metadata.yaml +1 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/coreChainAddresses.d.ts +18 -0
- package/dist/coreChainAddresses.js +18 -0
- package/dist/coreChainMetadata.js +40 -4
- package/dist/index-local.d.ts +1 -0
- package/dist/index-local.js +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -0
- package/dist/registry/BaseRegistry.d.ts +21 -7
- package/dist/registry/BaseRegistry.js +1 -0
- package/dist/registry/GithubRegistry.d.ts +16 -3
- package/dist/registry/GithubRegistry.js +25 -10
- package/dist/registry/IRegistry.d.ts +23 -8
- package/dist/registry/IRegistry.js +5 -1
- package/dist/registry/LocalRegistry.d.ts +43 -0
- package/dist/registry/LocalRegistry.js +146 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +5 -0
- package/package.json +12 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"blockExplorers": [
|
|
3
3
|
{
|
|
4
|
-
"apiUrl": "https://explorer.solana.com",
|
|
4
|
+
"apiUrl": "https://explorer.solana.com?cluster=devnet",
|
|
5
5
|
"family": "other",
|
|
6
6
|
"name": "Solana Explorer",
|
|
7
|
-
"url": "https://explorer.solana.com"
|
|
7
|
+
"url": "https://explorer.solana.com?cluster=devnet"
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
10
|
"blocks": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# yaml-language-server: $schema=../schema
|
|
1
|
+
# yaml-language-server: $schema=../schema.json
|
|
2
2
|
blockExplorers:
|
|
3
|
-
- apiUrl: https://explorer.solana.com
|
|
3
|
+
- apiUrl: https://explorer.solana.com?cluster=devnet
|
|
4
4
|
family: other
|
|
5
5
|
name: Solana Explorer
|
|
6
|
-
url: https://explorer.solana.com
|
|
6
|
+
url: https://explorer.solana.com?cluster=devnet
|
|
7
7
|
blocks:
|
|
8
8
|
confirmations: 1
|
|
9
9
|
estimateBlockTime: 0.4
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const metadata = {
|
|
2
2
|
"blockExplorers": [
|
|
3
3
|
{
|
|
4
|
-
"apiUrl": "https://explorer.solana.com",
|
|
4
|
+
"apiUrl": "https://explorer.solana.com?cluster=testnet",
|
|
5
5
|
"family": "other",
|
|
6
6
|
"name": "Solana Explorer",
|
|
7
|
-
"url": "https://explorer.solana.com"
|
|
7
|
+
"url": "https://explorer.solana.com?cluster=testnet"
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
10
|
"blocks": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"blockExplorers": [
|
|
3
3
|
{
|
|
4
|
-
"apiUrl": "https://explorer.solana.com",
|
|
4
|
+
"apiUrl": "https://explorer.solana.com?cluster=testnet",
|
|
5
5
|
"family": "other",
|
|
6
6
|
"name": "Solana Explorer",
|
|
7
|
-
"url": "https://explorer.solana.com"
|
|
7
|
+
"url": "https://explorer.solana.com?cluster=testnet"
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
10
|
"blocks": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# yaml-language-server: $schema=../schema
|
|
1
|
+
# yaml-language-server: $schema=../schema.json
|
|
2
2
|
blockExplorers:
|
|
3
|
-
- apiUrl: https://explorer.solana.com
|
|
3
|
+
- apiUrl: https://explorer.solana.com?cluster=testnet
|
|
4
4
|
family: other
|
|
5
5
|
name: Solana Explorer
|
|
6
|
-
url: https://explorer.solana.com
|
|
6
|
+
url: https://explorer.solana.com?cluster=testnet
|
|
7
7
|
blocks:
|
|
8
8
|
confirmations: 1
|
|
9
9
|
estimateBlockTime: 0.4
|
package/dist/consts.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CHAIN_SCHEMA_REF = "# yaml-language-server: $schema=../schema.json";
|
package/dist/consts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHAIN_SCHEMA_REF = '# yaml-language-server: $schema=../schema.json';
|
|
@@ -22,6 +22,24 @@ export declare const coreChainAddresses: {
|
|
|
22
22
|
timelockController: string;
|
|
23
23
|
validatorAnnounce: string;
|
|
24
24
|
};
|
|
25
|
+
ancient8: {
|
|
26
|
+
staticAggregationHookFactory: string;
|
|
27
|
+
staticAggregationIsmFactory: string;
|
|
28
|
+
fallbackRoutingHook: string;
|
|
29
|
+
interchainGasPaymaster: string;
|
|
30
|
+
interchainSecurityModule: string;
|
|
31
|
+
mailbox: string;
|
|
32
|
+
staticMerkleRootMultisigIsmFactory: string;
|
|
33
|
+
merkleTreeHook: string;
|
|
34
|
+
staticMessageIdMultisigIsmFactory: string;
|
|
35
|
+
pausableHook: string;
|
|
36
|
+
protocolFee: string;
|
|
37
|
+
proxyAdmin: string;
|
|
38
|
+
domainRoutingIsmFactory: string;
|
|
39
|
+
storageGasOracle: string;
|
|
40
|
+
testRecipient: string;
|
|
41
|
+
validatorAnnounce: string;
|
|
42
|
+
};
|
|
25
43
|
avalanche: {
|
|
26
44
|
aggregationHook: string;
|
|
27
45
|
domainRoutingIsmFactory: string;
|
|
@@ -22,6 +22,24 @@ export const coreChainAddresses = {
|
|
|
22
22
|
"timelockController": "0x0000000000000000000000000000000000000000",
|
|
23
23
|
"validatorAnnounce": "0x1df063280C4166AF9a725e3828b4dAC6c7113B08"
|
|
24
24
|
},
|
|
25
|
+
"ancient8": {
|
|
26
|
+
"staticAggregationHookFactory": "0xEb9FcFDC9EfDC17c1EC5E1dc085B98485da213D6",
|
|
27
|
+
"staticAggregationIsmFactory": "0x8F7454AC98228f3504Bb91eA3D8Adafe6406110A",
|
|
28
|
+
"fallbackRoutingHook": "0x5E01d8F34b629E3f92d69546bbc4142A7Adee7e9",
|
|
29
|
+
"interchainGasPaymaster": "0x8F1E22d309baa69D398a03cc88E9b46037e988AA",
|
|
30
|
+
"interchainSecurityModule": "0x6E3387e12C6e181BF8e712eCa9c60ccEEaBD1c67",
|
|
31
|
+
"mailbox": "0x2f2aFaE1139Ce54feFC03593FeE8AB2aDF4a85A7",
|
|
32
|
+
"staticMerkleRootMultisigIsmFactory": "0x2C1FAbEcd7bFBdEBF27CcdB67baADB38b6Df90fC",
|
|
33
|
+
"merkleTreeHook": "0x811808Dd29ba8B0FC6C0ec0b5537035E59745162",
|
|
34
|
+
"staticMessageIdMultisigIsmFactory": "0x8b83fefd896fAa52057798f6426E9f0B080FCCcE",
|
|
35
|
+
"pausableHook": "0x66DC49405Ae2956f7E87FEAa9fE8f506C8987462",
|
|
36
|
+
"protocolFee": "0xE0C452DDA7506f0F4dE5C8C1d383F7aD866eA4F0",
|
|
37
|
+
"proxyAdmin": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004",
|
|
38
|
+
"domainRoutingIsmFactory": "0x1052eF3419f26Bec74Ed7CEf4a4FA6812Bc09908",
|
|
39
|
+
"storageGasOracle": "0x59Bf7c7b458375b1A7c453aE70EaCb376E65CDAF",
|
|
40
|
+
"testRecipient": "0x2Fa570E83009eaEef3a1cbd496a9a30F05266634",
|
|
41
|
+
"validatorAnnounce": "0x931dFCc8c1141D6F532FD023bd87DAe0080c835d"
|
|
42
|
+
},
|
|
25
43
|
"avalanche": {
|
|
26
44
|
"aggregationHook": "0x0165a22BA489F7DA37DAf6397781777D9FCB5708",
|
|
27
45
|
"domainRoutingIsmFactory": "0x28F7907911C7E321c596686AE6D1F20516450037",
|
|
@@ -18,6 +18,9 @@ export const coreChainMetadata = {
|
|
|
18
18
|
"domainId": 42161,
|
|
19
19
|
"gasCurrencyCoinGeckoId": "ethereum",
|
|
20
20
|
"gnosisSafeTransactionServiceUrl": "https://safe-transaction-arbitrum.safe.global/",
|
|
21
|
+
"index": {
|
|
22
|
+
"from": 143649797
|
|
23
|
+
},
|
|
21
24
|
"name": "arbitrum",
|
|
22
25
|
"nativeToken": {
|
|
23
26
|
"decimals": 18,
|
|
@@ -32,6 +35,39 @@ export const coreChainMetadata = {
|
|
|
32
35
|
],
|
|
33
36
|
"technicalStack": "arbitrumnitro"
|
|
34
37
|
},
|
|
38
|
+
"ancient8": {
|
|
39
|
+
"blockExplorers": [
|
|
40
|
+
{
|
|
41
|
+
"apiUrl": "https://scan.ancient8.gg/api",
|
|
42
|
+
"family": "blockscout",
|
|
43
|
+
"name": "Ancient8 Explorer",
|
|
44
|
+
"url": "https://scan.ancient8.gg"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"blocks": {
|
|
48
|
+
"confirmations": 1,
|
|
49
|
+
"estimateBlockTime": 2,
|
|
50
|
+
"reorgPeriod": 0
|
|
51
|
+
},
|
|
52
|
+
"chainId": 888888888,
|
|
53
|
+
"displayName": "Ancient8",
|
|
54
|
+
"domainId": 888888888,
|
|
55
|
+
"gasCurrencyCoinGeckoId": "ethereum",
|
|
56
|
+
"isTestnet": false,
|
|
57
|
+
"name": "ancient8",
|
|
58
|
+
"nativeToken": {
|
|
59
|
+
"decimals": 18,
|
|
60
|
+
"name": "Ether",
|
|
61
|
+
"symbol": "ETH"
|
|
62
|
+
},
|
|
63
|
+
"protocol": "ethereum",
|
|
64
|
+
"rpcUrls": [
|
|
65
|
+
{
|
|
66
|
+
"http": "https://rpc.ancient8.gg"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"technicalStack": "other"
|
|
70
|
+
},
|
|
35
71
|
"avalanche": {
|
|
36
72
|
"blockExplorers": [
|
|
37
73
|
{
|
|
@@ -847,10 +883,10 @@ export const coreChainMetadata = {
|
|
|
847
883
|
"solanadevnet": {
|
|
848
884
|
"blockExplorers": [
|
|
849
885
|
{
|
|
850
|
-
"apiUrl": "https://explorer.solana.com",
|
|
886
|
+
"apiUrl": "https://explorer.solana.com?cluster=devnet",
|
|
851
887
|
"family": "other",
|
|
852
888
|
"name": "Solana Explorer",
|
|
853
|
-
"url": "https://explorer.solana.com"
|
|
889
|
+
"url": "https://explorer.solana.com?cluster=devnet"
|
|
854
890
|
}
|
|
855
891
|
],
|
|
856
892
|
"blocks": {
|
|
@@ -879,10 +915,10 @@ export const coreChainMetadata = {
|
|
|
879
915
|
"solanatestnet": {
|
|
880
916
|
"blockExplorers": [
|
|
881
917
|
{
|
|
882
|
-
"apiUrl": "https://explorer.solana.com",
|
|
918
|
+
"apiUrl": "https://explorer.solana.com?cluster=testnet",
|
|
883
919
|
"family": "other",
|
|
884
920
|
"name": "Solana Explorer",
|
|
885
|
-
"url": "https://explorer.solana.com"
|
|
921
|
+
"url": "https://explorer.solana.com?cluster=testnet"
|
|
886
922
|
}
|
|
887
923
|
],
|
|
888
924
|
"blocks": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LocalRegistry } from './registry/LocalRegistry.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export { CoreChain, CoreChainName, CoreChains, CoreMainnets, CoreTestnets } from './core/chains.js';
|
|
2
2
|
export { BaseRegistry } from './registry/BaseRegistry.js';
|
|
3
3
|
export { GithubRegistry, GithubRegistryOptions } from './registry/GithubRegistry.js';
|
|
4
|
-
export {
|
|
4
|
+
export { ChainFiles, IRegistry, RegistryContent, RegistryType } from './registry/IRegistry.js';
|
|
5
|
+
export { ChainAddresses, ChainAddressesSchema } from './types.js';
|
|
5
6
|
export { chainMetadata } from './chainMetadata.js';
|
|
6
7
|
export { coreChainMetadata } from './coreChainMetadata.js';
|
|
7
8
|
export { chainAddresses } from './chainAddresses.js';
|
|
8
9
|
export { coreChainAddresses } from './coreChainAddresses.js';
|
|
9
10
|
export { metadata as alfajores } from './chains/alfajores/metadata.js';
|
|
10
11
|
export { addresses as alfajoresAddresses } from './chains/alfajores/addresses.js';
|
|
12
|
+
export { metadata as ancient8 } from './chains/ancient8/metadata.js';
|
|
13
|
+
export { addresses as ancient8Addresses } from './chains/ancient8/addresses.js';
|
|
11
14
|
export { metadata as arbitrum } from './chains/arbitrum/metadata.js';
|
|
12
15
|
export { addresses as arbitrumAddresses } from './chains/arbitrum/addresses.js';
|
|
13
16
|
export { metadata as avalanche } from './chains/avalanche/metadata.js';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export { CoreChain, CoreChains, CoreMainnets, CoreTestnets } from './core/chains.js';
|
|
2
2
|
export { BaseRegistry } from './registry/BaseRegistry.js';
|
|
3
3
|
export { GithubRegistry } from './registry/GithubRegistry.js';
|
|
4
|
+
export { RegistryType } from './registry/IRegistry.js';
|
|
5
|
+
export { ChainAddressesSchema } from './types.js';
|
|
4
6
|
export { chainMetadata } from './chainMetadata.js';
|
|
5
7
|
export { coreChainMetadata } from './coreChainMetadata.js';
|
|
6
8
|
export { chainAddresses } from './chainAddresses.js';
|
|
7
9
|
export { coreChainAddresses } from './coreChainAddresses.js';
|
|
8
10
|
export { metadata as alfajores } from './chains/alfajores/metadata.js';
|
|
9
11
|
export { addresses as alfajoresAddresses } from './chains/alfajores/addresses.js';
|
|
12
|
+
export { metadata as ancient8 } from './chains/ancient8/metadata.js';
|
|
13
|
+
export { addresses as ancient8Addresses } from './chains/ancient8/addresses.js';
|
|
10
14
|
export { metadata as arbitrum } from './chains/arbitrum/metadata.js';
|
|
11
15
|
export { addresses as arbitrumAddresses } from './chains/arbitrum/addresses.js';
|
|
12
16
|
export { metadata as avalanche } from './chains/avalanche/metadata.js';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import type { ChainMap, ChainMetadata, ChainName } from '@hyperlane-xyz/sdk';
|
|
3
|
-
import type { ChainAddresses,
|
|
3
|
+
import type { ChainAddresses, MaybePromise } from '../types.js';
|
|
4
|
+
import type { IRegistry, RegistryContent, RegistryType } from './IRegistry.js';
|
|
5
|
+
export declare const CHAIN_FILE_REGEX: RegExp;
|
|
4
6
|
export declare abstract class BaseRegistry implements IRegistry {
|
|
7
|
+
abstract type: RegistryType;
|
|
5
8
|
protected readonly logger: Logger;
|
|
6
9
|
protected listContentCache?: RegistryContent;
|
|
7
10
|
protected metadataCache?: ChainMap<ChainMetadata>;
|
|
@@ -11,10 +14,21 @@ export declare abstract class BaseRegistry implements IRegistry {
|
|
|
11
14
|
});
|
|
12
15
|
protected getChainsPath(): string;
|
|
13
16
|
protected getWarpArtifactsPath(): string;
|
|
14
|
-
abstract listRegistryContent():
|
|
15
|
-
abstract getChains():
|
|
16
|
-
abstract getMetadata():
|
|
17
|
-
abstract getChainMetadata(chainName: ChainName):
|
|
18
|
-
abstract getAddresses():
|
|
19
|
-
abstract getChainAddresses(chainName: ChainName):
|
|
17
|
+
abstract listRegistryContent(): MaybePromise<RegistryContent>;
|
|
18
|
+
abstract getChains(): MaybePromise<Array<ChainName>>;
|
|
19
|
+
abstract getMetadata(): MaybePromise<ChainMap<ChainMetadata>>;
|
|
20
|
+
abstract getChainMetadata(chainName: ChainName): MaybePromise<ChainMetadata | null>;
|
|
21
|
+
abstract getAddresses(): MaybePromise<ChainMap<ChainAddresses>>;
|
|
22
|
+
abstract getChainAddresses(chainName: ChainName): MaybePromise<ChainAddresses | null>;
|
|
23
|
+
abstract addChain(chains: {
|
|
24
|
+
chainName: ChainName;
|
|
25
|
+
metadata?: ChainMetadata;
|
|
26
|
+
addresses?: ChainAddresses;
|
|
27
|
+
}): MaybePromise<void>;
|
|
28
|
+
abstract updateChain(chains: {
|
|
29
|
+
chainName: ChainName;
|
|
30
|
+
metadata?: ChainMetadata;
|
|
31
|
+
addresses?: ChainAddresses;
|
|
32
|
+
}): MaybePromise<void>;
|
|
33
|
+
abstract removeChain(chains: ChainName): MaybePromise<void>;
|
|
20
34
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
|
-
import type
|
|
2
|
+
import { type ChainMap, type ChainMetadata, type ChainName } from '@hyperlane-xyz/sdk';
|
|
3
|
+
import { ChainAddresses } from '../types.js';
|
|
3
4
|
import { BaseRegistry } from './BaseRegistry.js';
|
|
4
|
-
import
|
|
5
|
+
import { RegistryType, type IRegistry, type RegistryContent } from './IRegistry.js';
|
|
5
6
|
export interface GithubRegistryOptions {
|
|
6
|
-
|
|
7
|
+
uri?: string;
|
|
7
8
|
branch?: string;
|
|
8
9
|
authToken?: string;
|
|
9
10
|
logger?: Logger;
|
|
10
11
|
}
|
|
11
12
|
export declare class GithubRegistry extends BaseRegistry implements IRegistry {
|
|
13
|
+
readonly type = RegistryType.Github;
|
|
12
14
|
readonly url: URL;
|
|
13
15
|
readonly branch: string;
|
|
14
16
|
readonly repoOwner: string;
|
|
@@ -20,6 +22,17 @@ export declare class GithubRegistry extends BaseRegistry implements IRegistry {
|
|
|
20
22
|
getChainMetadata(chainName: ChainName): Promise<ChainMetadata>;
|
|
21
23
|
getAddresses(): Promise<ChainMap<ChainAddresses>>;
|
|
22
24
|
getChainAddresses(chainName: ChainName): Promise<ChainAddresses>;
|
|
25
|
+
addChain(_chains: {
|
|
26
|
+
chainName: ChainName;
|
|
27
|
+
metadata?: ChainMetadata;
|
|
28
|
+
addresses?: ChainAddresses;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
updateChain(_chains: {
|
|
31
|
+
chainName: ChainName;
|
|
32
|
+
metadata?: ChainMetadata;
|
|
33
|
+
addresses?: ChainAddresses;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
removeChain(_chains: ChainName): Promise<void>;
|
|
23
36
|
protected getRawContentUrl(path: string): string;
|
|
24
37
|
protected fetch(url: string): Promise<Response>;
|
|
25
38
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { parse } from 'yaml';
|
|
2
|
-
import {
|
|
1
|
+
import { parse as yamlParse } from 'yaml';
|
|
2
|
+
import { ChainAddressesSchema } from '../types.js';
|
|
3
|
+
import { BaseRegistry, CHAIN_FILE_REGEX } from './BaseRegistry.js';
|
|
4
|
+
import { RegistryType, } from './IRegistry.js';
|
|
3
5
|
const DEFAULT_REGISTRY = 'https://github.com/hyperlane-xyz/hyperlane-registry';
|
|
4
|
-
const CHAIN_FILE_REGEX = /chains\/([a-z]+)\/([a-z]+)\.yaml/;
|
|
5
6
|
export class GithubRegistry extends BaseRegistry {
|
|
7
|
+
type = RegistryType.Github;
|
|
6
8
|
url;
|
|
7
9
|
branch;
|
|
8
10
|
repoOwner;
|
|
9
11
|
repoName;
|
|
10
12
|
constructor(options = {}) {
|
|
11
13
|
super({ logger: options.logger });
|
|
12
|
-
this.url = new URL(options.
|
|
14
|
+
this.url = new URL(options.uri ?? DEFAULT_REGISTRY);
|
|
13
15
|
this.branch = options.branch ?? 'main';
|
|
14
16
|
const pathSegments = this.url.pathname.split('/');
|
|
15
17
|
if (pathSegments.length < 2)
|
|
@@ -48,12 +50,13 @@ export class GithubRegistry extends BaseRegistry {
|
|
|
48
50
|
return this.metadataCache;
|
|
49
51
|
const chainMetadata = {};
|
|
50
52
|
const repoContents = await this.listRegistryContent();
|
|
53
|
+
// TODO use concurrentMap here when utils package is updated
|
|
51
54
|
for (const [chainName, chainFiles] of Object.entries(repoContents.chains)) {
|
|
52
55
|
if (!chainFiles.metadata)
|
|
53
56
|
continue;
|
|
54
57
|
const response = await this.fetch(chainFiles.metadata);
|
|
55
|
-
const
|
|
56
|
-
chainMetadata[chainName] =
|
|
58
|
+
const data = await response.text();
|
|
59
|
+
chainMetadata[chainName] = yamlParse(data);
|
|
57
60
|
}
|
|
58
61
|
return (this.metadataCache = chainMetadata);
|
|
59
62
|
}
|
|
@@ -62,19 +65,21 @@ export class GithubRegistry extends BaseRegistry {
|
|
|
62
65
|
return this.metadataCache[chainName];
|
|
63
66
|
const url = this.getRawContentUrl(`${this.getChainsPath()}/${chainName}/metadata.yaml`);
|
|
64
67
|
const response = await this.fetch(url);
|
|
65
|
-
|
|
68
|
+
const data = await response.text();
|
|
69
|
+
return yamlParse(data);
|
|
66
70
|
}
|
|
67
71
|
async getAddresses() {
|
|
68
72
|
if (this.addressCache)
|
|
69
73
|
return this.addressCache;
|
|
70
74
|
const chainAddresses = {};
|
|
71
75
|
const repoContents = await this.listRegistryContent();
|
|
76
|
+
// TODO use concurrentMap here when utils package is updated
|
|
72
77
|
for (const [chainName, chainFiles] of Object.entries(repoContents.chains)) {
|
|
73
78
|
if (!chainFiles.addresses)
|
|
74
79
|
continue;
|
|
75
80
|
const response = await this.fetch(chainFiles.addresses);
|
|
76
|
-
const
|
|
77
|
-
chainAddresses[chainName] =
|
|
81
|
+
const data = await response.text();
|
|
82
|
+
chainAddresses[chainName] = ChainAddressesSchema.parse(yamlParse(data));
|
|
78
83
|
}
|
|
79
84
|
return (this.addressCache = chainAddresses);
|
|
80
85
|
}
|
|
@@ -83,7 +88,17 @@ export class GithubRegistry extends BaseRegistry {
|
|
|
83
88
|
return this.addressCache[chainName];
|
|
84
89
|
const url = this.getRawContentUrl(`${this.getChainsPath()}/${chainName}/addresses.yaml`);
|
|
85
90
|
const response = await this.fetch(url);
|
|
86
|
-
|
|
91
|
+
const data = await response.text();
|
|
92
|
+
return ChainAddressesSchema.parse(yamlParse(data));
|
|
93
|
+
}
|
|
94
|
+
async addChain(_chains) {
|
|
95
|
+
throw new Error('TODO: Implement');
|
|
96
|
+
}
|
|
97
|
+
async updateChain(_chains) {
|
|
98
|
+
throw new Error('TODO: Implement');
|
|
99
|
+
}
|
|
100
|
+
async removeChain(_chains) {
|
|
101
|
+
throw new Error('TODO: Implement');
|
|
87
102
|
}
|
|
88
103
|
getRawContentUrl(path) {
|
|
89
104
|
return `https://raw.githubusercontent.com/${this.repoOwner}/${this.repoName}/${this.branch}/${path}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Address } from '@hyperlane-xyz/utils';
|
|
2
1
|
import type { ChainMap, ChainMetadata, ChainName } from '@hyperlane-xyz/sdk';
|
|
2
|
+
import type { ChainAddresses, MaybePromise } from '../types.js';
|
|
3
3
|
export interface ChainFiles {
|
|
4
4
|
metadata?: string;
|
|
5
5
|
addresses?: string;
|
|
@@ -8,12 +8,27 @@ export interface RegistryContent {
|
|
|
8
8
|
chains: ChainMap<ChainFiles>;
|
|
9
9
|
deployments: {};
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export declare enum RegistryType {
|
|
12
|
+
Github = "github",
|
|
13
|
+
Local = "local"
|
|
14
|
+
}
|
|
12
15
|
export interface IRegistry {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
type: RegistryType;
|
|
17
|
+
listRegistryContent(): MaybePromise<RegistryContent>;
|
|
18
|
+
getChains(): MaybePromise<Array<ChainName>>;
|
|
19
|
+
getMetadata(): MaybePromise<ChainMap<ChainMetadata>>;
|
|
20
|
+
getChainMetadata(chainName: ChainName): MaybePromise<ChainMetadata | null>;
|
|
21
|
+
getAddresses(): MaybePromise<ChainMap<ChainAddresses>>;
|
|
22
|
+
getChainAddresses(chainName: ChainName): MaybePromise<ChainAddresses | null>;
|
|
23
|
+
addChain(chains: {
|
|
24
|
+
chainName: ChainName;
|
|
25
|
+
metadata?: ChainMetadata;
|
|
26
|
+
addresses?: ChainAddresses;
|
|
27
|
+
}): MaybePromise<void>;
|
|
28
|
+
updateChain(chains: {
|
|
29
|
+
chainName: ChainName;
|
|
30
|
+
metadata?: ChainMetadata;
|
|
31
|
+
addresses?: ChainAddresses;
|
|
32
|
+
}): MaybePromise<void>;
|
|
33
|
+
removeChain(chains: ChainName): MaybePromise<void>;
|
|
19
34
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Logger } from 'pino';
|
|
2
|
+
import type { ChainMap, ChainMetadata, ChainName } from '@hyperlane-xyz/sdk';
|
|
3
|
+
import { ChainAddresses } from '../types.js';
|
|
4
|
+
import { BaseRegistry } from './BaseRegistry.js';
|
|
5
|
+
import { RegistryType, type ChainFiles, type IRegistry, type RegistryContent } from './IRegistry.js';
|
|
6
|
+
export interface LocalRegistryOptions {
|
|
7
|
+
uri: string;
|
|
8
|
+
logger?: Logger;
|
|
9
|
+
}
|
|
10
|
+
export declare class LocalRegistry extends BaseRegistry implements IRegistry {
|
|
11
|
+
readonly type = RegistryType.Local;
|
|
12
|
+
readonly uri: string;
|
|
13
|
+
constructor(options: LocalRegistryOptions);
|
|
14
|
+
listRegistryContent(): RegistryContent;
|
|
15
|
+
getChains(): Array<ChainName>;
|
|
16
|
+
getMetadata(): ChainMap<ChainMetadata>;
|
|
17
|
+
getChainMetadata(chainName: ChainName): ChainMetadata;
|
|
18
|
+
getAddresses(): ChainMap<ChainAddresses>;
|
|
19
|
+
getChainAddresses(chainName: ChainName): ChainAddresses;
|
|
20
|
+
addChain(chain: {
|
|
21
|
+
chainName: ChainName;
|
|
22
|
+
metadata?: ChainMetadata;
|
|
23
|
+
addresses?: ChainAddresses;
|
|
24
|
+
}): void;
|
|
25
|
+
updateChain(chain: {
|
|
26
|
+
chainName: ChainName;
|
|
27
|
+
metadata?: ChainMetadata;
|
|
28
|
+
addresses?: ChainAddresses;
|
|
29
|
+
}): void;
|
|
30
|
+
removeChain(chainName: ChainName): void;
|
|
31
|
+
protected listFiles(dirPath: string): string[];
|
|
32
|
+
protected createOrUpdateChain(chain: {
|
|
33
|
+
chainName: ChainName;
|
|
34
|
+
metadata?: ChainMetadata;
|
|
35
|
+
addresses?: ChainAddresses;
|
|
36
|
+
}): void;
|
|
37
|
+
protected createChainFile(chainName: ChainName, fileName: keyof ChainFiles, data: any, cache: ChainMap<any>, prefix?: string): void;
|
|
38
|
+
protected createFile(file: {
|
|
39
|
+
filePath: string;
|
|
40
|
+
data: string;
|
|
41
|
+
}): void;
|
|
42
|
+
protected removeFiles(filePaths: string[]): void;
|
|
43
|
+
}
|