Skip to content

Commit

Permalink
chore: override core SVM deployments to include the mailbox addr
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Sep 13, 2024
1 parent 97f7784 commit e3001d3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@headlessui/react": "^1.7.14",
"@hyperlane-xyz/registry": "https://github.com/hyperlane-xyz/hyperlane-registry.git",
"@hyperlane-xyz/registry": "4.1.0",
"@hyperlane-xyz/sdk": "5.1.0",
"@hyperlane-xyz/utils": "5.1.0",
"@hyperlane-xyz/widgets": "5.1.0",
Expand Down
14 changes: 14 additions & 0 deletions src/consts/chains.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import {
eclipsemainnet,
eclipsemainnetAddresses,
solanamainnet,
solanamainnetAddresses,
} from '@hyperlane-xyz/registry';
import { ChainMap, ChainMetadata } from '@hyperlane-xyz/sdk';

// A map of chain names to ChainMetadata
// Chains can be defined here, in chains.json, or in chains.yaml
// Chains already in the SDK need not be included here unless you want to override some fields
// Schema here: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/sdk/src/metadata/chainMetadataTypes.ts
export const chains: ChainMap<ChainMetadata & { mailbox?: Address }> = {
solanamainnet: {
...solanamainnet,
mailbox: solanamainnetAddresses.mailbox,
},
eclipsemainnet: {
...eclipsemainnet,
mailbox: eclipsemainnetAddresses.mailbox,
},
// mycustomchain: {
// protocol: ProtocolType.Ethereum,
// chainId: 123123,
Expand Down
4 changes: 2 additions & 2 deletions src/context/chains.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from 'zod';

import { GithubRegistry, chainMetadata } from '@hyperlane-xyz/registry';
import { ChainMap, ChainMetadata, ChainMetadataSchema } from '@hyperlane-xyz/sdk';
import { ChainMap, ChainMetadata, ChainMetadataSchemaObject } from '@hyperlane-xyz/sdk';

import { chains as ChainsTS } from '../consts/chains.ts';
import ChainsYaml from '../consts/chains.yaml';
Expand All @@ -11,7 +11,7 @@ import { logger } from '../utils/logger';

export async function assembleChainMetadata() {
// Chains must include a cosmos chain or CosmosKit throws errors
const result = z.record(ChainMetadataSchema).safeParse({
const result = z.record(ChainMetadataSchemaObject.passthrough()).safeParse({
cosmoshub: cosmosDefaultChain,
...ChainsYaml,
...ChainsTS,
Expand Down
6 changes: 1 addition & 5 deletions src/features/chains/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CoreChain, CoreChains } from '@hyperlane-xyz/registry';
import { ChainNameOrId } from '@hyperlane-xyz/sdk';
import { ProtocolType, toTitleCase } from '@hyperlane-xyz/utils';

Expand All @@ -14,10 +13,7 @@ export function getChainDisplayName(chain: ChainName, shortName = false) {

export function isPermissionlessChain(chain: ChainName) {
if (!chain) return true;
return (
getChainMetadata(chain).protocol !== ProtocolType.Ethereum ||
!CoreChains.includes(chain as CoreChain)
);
return getChainMetadata(chain).protocol !== ProtocolType.Ethereum;
}

export function hasPermissionlessChain(ids: ChainName[]) {
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3938,16 +3938,6 @@ __metadata:
languageName: node
linkType: hard

"@hyperlane-xyz/registry@https://github.com/hyperlane-xyz/hyperlane-registry.git":
version: 4.0.0
resolution: "@hyperlane-xyz/registry@https://github.com/hyperlane-xyz/hyperlane-registry.git#commit=9b1bb59da273ce9912178f15cb759297f6a9d1cb"
dependencies:
yaml: "npm:2.4.5"
zod: "npm:^3.21.2"
checksum: caf3cf191fe5066a2ca8733b52b281fce89512caabbc244a0ee36b0ab60d46efd245ff83331257f3b9c7df1ccac1ce691a368c4308d9e4f09af8ec13e765b445
languageName: node
linkType: hard

"@hyperlane-xyz/registry@npm:2.5.0":
version: 2.5.0
resolution: "@hyperlane-xyz/registry@npm:2.5.0"
Expand All @@ -3958,6 +3948,16 @@ __metadata:
languageName: node
linkType: hard

"@hyperlane-xyz/registry@npm:4.1.0":
version: 4.1.0
resolution: "@hyperlane-xyz/registry@npm:4.1.0"
dependencies:
yaml: "npm:2.4.5"
zod: "npm:^3.21.2"
checksum: 5de3ef5539abfaadbfefb82e6e69fdb2413f404d8321456c91810fb50a5a70e9f93b38789495efce6ab5963682536e95a2abe636c7d0ad91ee158cc0ce6b063a
languageName: node
linkType: hard

"@hyperlane-xyz/sdk@npm:5.1.0":
version: 5.1.0
resolution: "@hyperlane-xyz/sdk@npm:5.1.0"
Expand Down Expand Up @@ -4020,7 +4020,7 @@ __metadata:
"@emotion/react": "npm:^11.13.0"
"@emotion/styled": "npm:^11.13.0"
"@headlessui/react": "npm:^1.7.14"
"@hyperlane-xyz/registry": "https://github.com/hyperlane-xyz/hyperlane-registry.git"
"@hyperlane-xyz/registry": "npm:4.1.0"
"@hyperlane-xyz/sdk": "npm:5.1.0"
"@hyperlane-xyz/utils": "npm:5.1.0"
"@hyperlane-xyz/widgets": "npm:5.1.0"
Expand Down

0 comments on commit e3001d3

Please sign in to comment.