feat: Use proxied GithubRegistry (#110)

pull/116/head
J M Rossy 2 months ago committed by GitHub
parent ffe2c39f18
commit febdddf8ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      package.json
  2. 2
      src/consts/config.ts
  3. 3
      src/features/api/searchPiMessages.ts
  4. 3
      src/features/api/utils.ts
  5. 3
      src/features/messages/pi-queries/fetchPiChainMessages.test.ts
  6. 3
      src/store.ts
  7. 116
      yarn.lock

@ -5,10 +5,10 @@
"author": "J M Rossy",
"dependencies": {
"@headlessui/react": "^1.7.17",
"@hyperlane-xyz/registry": "2.5.0",
"@hyperlane-xyz/sdk": "5.1.0",
"@hyperlane-xyz/utils": "5.1.0",
"@hyperlane-xyz/widgets": "5.1.0",
"@hyperlane-xyz/registry": "4.3.6",
"@hyperlane-xyz/sdk": "5.2.1",
"@hyperlane-xyz/utils": "5.2.1",
"@hyperlane-xyz/widgets": "5.2.1",
"@metamask/jazzicon": "https://github.com/jmrossy/jazzicon#7a8df28974b4e81129bfbe3cab76308b889032a6",
"@tanstack/react-query": "^5.35.5",
"bignumber.js": "^9.1.2",

@ -7,6 +7,7 @@ interface Config {
version: string | null;
apiUrl: string;
explorerApiKeys: Record<string, string>;
githubProxy?: string;
}
export const config: Config = Object.freeze({
@ -14,6 +15,7 @@ export const config: Config = Object.freeze({
version,
apiUrl: 'https://explorer4.hasura.app/v1/graphql',
explorerApiKeys,
githubProxy: 'https://proxy.hyperlane.xyz',
});
// Based on https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/infra/config/environments/mainnet3/agent.ts

@ -4,6 +4,7 @@ import { z } from 'zod';
import { GithubRegistry } from '@hyperlane-xyz/registry';
import { MultiProvider } from '@hyperlane-xyz/sdk';
import { config } from '../../consts/config';
import { logger } from '../../utils/logger';
import { tryParseChainConfig } from '../chains/chainConfig';
import {
@ -31,7 +32,7 @@ export async function handler(req: NextApiRequest): Promise<ApiHandlerResult<Api
try {
logger.debug('Attempting to search for PI messages:', query);
const multiProvider = new MultiProvider({ [chainConfig.name]: chainConfig });
const registry = new GithubRegistry();
const registry = new GithubRegistry({ proxyUrl: config.githubProxy });
// TODO consider supporting block/time/chain filters here
const messages = await fetchMessagesFromPiChain(chainConfig, query, multiProvider, registry);
logger.debug(`Found ${messages.length} PI messages`);

@ -3,6 +3,7 @@ import { Client } from '@urql/core';
import { GithubRegistry } from '@hyperlane-xyz/registry';
import { MultiProvider } from '@hyperlane-xyz/sdk';
import { config } from '../../consts/config';
import { logger } from '../../utils/logger';
import { DOMAINS_QUERY, DomainsEntry } from '../chains/queries/fragments';
@ -16,7 +17,7 @@ export function failureResult(error: string): { success: false; error: string }
// TODO de-dupe this with store.ts and handle registry/multiProvider concerns in a single place
export async function getMultiProvider(): Promise<MultiProvider> {
const registry = new GithubRegistry();
const registry = new GithubRegistry({ proxyUrl: config.githubProxy });
const chainMetadata = await registry.getMetadata();
return new MultiProvider(chainMetadata);
}

@ -1,6 +1,7 @@
import { GithubRegistry, chainAddresses, chainMetadata } from '@hyperlane-xyz/registry';
import { MultiProvider } from '@hyperlane-xyz/sdk';
import { config } from '../../../consts/config';
import { Message, MessageStatus } from '../../../types';
import { ChainConfig } from '../../chains/chainConfig';
@ -64,7 +65,7 @@ const sepoliaMessage: Message = {
};
describe('fetchMessagesFromPiChain', () => {
const registry = new GithubRegistry();
const registry = new GithubRegistry({ proxyUrl: config.githubProxy });
it('Fetches messages using explorer for tx hash', async () => {
const messages = await fetchMessagesFromPiChain(
sepoliaConfigWithExplorer,

@ -4,6 +4,7 @@ import { persist } from 'zustand/middleware';
import { GithubRegistry, IRegistry } from '@hyperlane-xyz/registry';
import { ChainMap, MultiProvider } from '@hyperlane-xyz/sdk';
import { config } from './consts/config';
import { ChainConfig } from './features/chains/chainConfig';
import { DomainsEntry } from './features/chains/queries/fragments';
import { logger } from './utils/logger';
@ -40,7 +41,7 @@ export const useStore = create<AppState>()(
setMultiProvider: (multiProvider: MultiProvider) => {
set({ multiProvider });
},
registry: new GithubRegistry(),
registry: new GithubRegistry({ proxyUrl: config.githubProxy }),
setRegistry: (registry: IRegistry) => {
set({ registry });
},

@ -2095,13 +2095,13 @@ __metadata:
languageName: node
linkType: hard
"@hyperlane-xyz/core@npm:5.1.0":
version: 5.1.0
resolution: "@hyperlane-xyz/core@npm:5.1.0"
"@hyperlane-xyz/core@npm:5.2.1":
version: 5.2.1
resolution: "@hyperlane-xyz/core@npm:5.2.1"
dependencies:
"@arbitrum/nitro-contracts": "npm:^1.2.1"
"@eth-optimism/contracts": "npm:^0.6.0"
"@hyperlane-xyz/utils": "npm:5.1.0"
"@hyperlane-xyz/utils": "npm:5.2.1"
"@layerzerolabs/lz-evm-oapp-v2": "npm:2.0.2"
"@openzeppelin/contracts": "npm:^4.9.3"
"@openzeppelin/contracts-upgradeable": "npm:^v4.9.3"
@ -2110,7 +2110,7 @@ __metadata:
"@ethersproject/abi": "*"
"@ethersproject/providers": "*"
"@types/sinon-chai": "*"
checksum: 81fd921a06b0d289070afac8e352d8dd38bf9219dea62e6fa3dcc2082b0ae39c23810fb4fe669b1933566fa1dfb7930f25307cbca2361b7e848152e9dc4e6014
checksum: df515d545c3a174dbadef13132a63874f0fc1e2c9cf891bf9c874ab2d4b31cc1d2cb33d660f9e99d547cc6d508f527d4dd5e1e758fc8d141de56401f4616010d
languageName: node
linkType: hard
@ -2119,10 +2119,10 @@ __metadata:
resolution: "@hyperlane-xyz/explorer@workspace:."
dependencies:
"@headlessui/react": "npm:^1.7.17"
"@hyperlane-xyz/registry": "npm:2.5.0"
"@hyperlane-xyz/sdk": "npm:5.1.0"
"@hyperlane-xyz/utils": "npm:5.1.0"
"@hyperlane-xyz/widgets": "npm:5.1.0"
"@hyperlane-xyz/registry": "npm:4.3.6"
"@hyperlane-xyz/sdk": "npm:5.2.1"
"@hyperlane-xyz/utils": "npm:5.2.1"
"@hyperlane-xyz/widgets": "npm:5.2.1"
"@metamask/jazzicon": "https://github.com/jmrossy/jazzicon#7a8df28974b4e81129bfbe3cab76308b889032a6"
"@tanstack/react-query": "npm:^5.35.5"
"@trivago/prettier-plugin-sort-imports": "npm:^4.1.1"
@ -2160,28 +2160,39 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/registry@npm:2.5.0":
version: 2.5.0
resolution: "@hyperlane-xyz/registry@npm:2.5.0"
"@hyperlane-xyz/registry@npm:4.3.2":
version: 4.3.2
resolution: "@hyperlane-xyz/registry@npm:4.3.2"
dependencies:
yaml: "npm:^2"
yaml: "npm:2.4.5"
zod: "npm:^3.21.2"
checksum: 24f433c0938dc31913b0f7a93b880a9aa15eabebf664eb11f319c51f6b38163929429405dd996b8964f8a2f43dfa4ba5424b157ad6fd39432653e46e128e0ffc
checksum: 7b1ff07074e4499f74a4c75dbbf0b7e641b3610bfc2a67785db724748d887d7b03c9dc9738b790cb56e008d6453789432c863f3b251498f77c931f196b9dab86
languageName: node
linkType: hard
"@hyperlane-xyz/sdk@npm:5.1.0":
version: 5.1.0
resolution: "@hyperlane-xyz/sdk@npm:5.1.0"
"@hyperlane-xyz/registry@npm:4.3.6":
version: 4.3.6
resolution: "@hyperlane-xyz/registry@npm:4.3.6"
dependencies:
yaml: "npm:2.4.5"
zod: "npm:^3.21.2"
checksum: 7cc42813f4f8b8ef09266be249f3dcec0584832166419df2f48eec3cc43ba766e58845ecc16673bf6465a711f08ff6c4fc5216da2f704bc31ef8ade52af4b6e5
languageName: node
linkType: hard
"@hyperlane-xyz/sdk@npm:5.2.1":
version: 5.2.1
resolution: "@hyperlane-xyz/sdk@npm:5.2.1"
dependencies:
"@arbitrum/sdk": "npm:^4.0.0"
"@aws-sdk/client-s3": "npm:^3.74.0"
"@cosmjs/cosmwasm-stargate": "npm:^0.32.4"
"@cosmjs/stargate": "npm:^0.32.4"
"@hyperlane-xyz/core": "npm:5.1.0"
"@hyperlane-xyz/utils": "npm:5.1.0"
"@hyperlane-xyz/core": "npm:5.2.1"
"@hyperlane-xyz/utils": "npm:5.2.1"
"@safe-global/api-kit": "npm:1.3.0"
"@safe-global/protocol-kit": "npm:1.3.0"
"@safe-global/safe-deployments": "npm:1.37.8"
"@solana/spl-token": "npm:^0.3.8"
"@solana/web3.js": "npm:^1.78.0"
"@types/coingecko-api": "npm:^1.0.10"
@ -2197,13 +2208,13 @@ __metadata:
peerDependencies:
"@ethersproject/abi": "*"
"@ethersproject/providers": "*"
checksum: 80aaa6836fc1aaa1c10c69b7d80d960daeef9074c763fb2f1161f8d921ca344207117c4a21312ed6bdd80cba6e85ca30c75abab7992273c6da2ff4a953619400
checksum: 94912ab970d911d77590709f78f43139717abf2d1d1ffd4f97137d2b739a0de785517a38108e2c47e4a6090c8c7e2c63f5665aa77333ca243e5ab610b0ce2585
languageName: node
linkType: hard
"@hyperlane-xyz/utils@npm:5.1.0":
version: 5.1.0
resolution: "@hyperlane-xyz/utils@npm:5.1.0"
"@hyperlane-xyz/utils@npm:5.2.1":
version: 5.2.1
resolution: "@hyperlane-xyz/utils@npm:5.2.1"
dependencies:
"@cosmjs/encoding": "npm:^0.32.4"
"@solana/web3.js": "npm:^1.78.0"
@ -2211,21 +2222,21 @@ __metadata:
ethers: "npm:^5.7.2"
lodash-es: "npm:^4.17.21"
pino: "npm:^8.19.0"
yaml: "npm:^2.4.1"
checksum: 3a29c91b0fd8be48833743150299425e26fcf19f6bdbfddddf39e8480cc6587d9c525298d6aaa522a9c854954fb197ef7a11b237b4d48f88c20a75a319453914
yaml: "npm:2.4.5"
checksum: 67c725cbb0581f6a8b42723974986b9c7beee69a51dcc3261efc9c4961f27493eb10108407b1d54329eb95c19c5595ca6cc581137f925773ec600eb72c761fe1
languageName: node
linkType: hard
"@hyperlane-xyz/widgets@npm:5.1.0":
version: 5.1.0
resolution: "@hyperlane-xyz/widgets@npm:5.1.0"
"@hyperlane-xyz/widgets@npm:5.2.1":
version: 5.2.1
resolution: "@hyperlane-xyz/widgets@npm:5.2.1"
dependencies:
"@hyperlane-xyz/registry": "npm:2.5.0"
"@hyperlane-xyz/sdk": "npm:5.1.0"
"@hyperlane-xyz/registry": "npm:4.3.2"
"@hyperlane-xyz/sdk": "npm:5.2.1"
peerDependencies:
react: ^18
react-dom: ^18
checksum: 7a7a28129fa55ea1852f33dc16a527873252e10cf9d6bcc791864c2c9b9cd1c4ea1ef1ecc1a4d3d8a580613ad99548ed33d462eb49da7caf2719f9272e54ec43
checksum: 9ee820be26d51cf59285ca370c88867c02b828473a6ffb136590d9d7987a109b9b956620833945ca32df2345fda3d5b1a4352d2a3e94a519b633fb2fd6f1342f
languageName: node
linkType: hard
@ -3047,6 +3058,15 @@ __metadata:
languageName: node
linkType: hard
"@safe-global/safe-deployments@npm:1.37.8":
version: 1.37.8
resolution: "@safe-global/safe-deployments@npm:1.37.8"
dependencies:
semver: "npm:^7.6.2"
checksum: bc8fce2c4d557e547a6cceebb611f9584d998dfb459cd50cf338409de986bed247ebca9425b0984a6e1a6accab42c7c4d1c68811e09cc981756183ba50a5e5a9
languageName: node
linkType: hard
"@safe-global/safe-deployments@npm:^1.26.0":
version: 1.35.0
resolution: "@safe-global/safe-deployments@npm:1.35.0"
@ -11426,6 +11446,15 @@ __metadata:
languageName: node
linkType: hard
"semver@npm:^7.6.2":
version: 7.6.3
resolution: "semver@npm:7.6.3"
bin:
semver: bin/semver.js
checksum: 36b1fbe1a2b6f873559cd57b238f1094a053dbfd997ceeb8757d79d1d2089c56d1321b9f1069ce263dc64cfa922fa1d2ad566b39426fe1ac6c723c1487589e10
languageName: node
linkType: hard
"send@npm:0.18.0":
version: 0.18.0
resolution: "send@npm:0.18.0"
@ -13195,6 +13224,15 @@ __metadata:
languageName: node
linkType: hard
"yaml@npm:2.4.5":
version: 2.4.5
resolution: "yaml@npm:2.4.5"
bin:
yaml: bin.mjs
checksum: b09bf5a615a65276d433d76b8e34ad6b4c0320b85eb3f1a39da132c61ae6e2ff34eff4624e6458d96d49566c93cf43408ba5e568218293a8c6541a2006883f64
languageName: node
linkType: hard
"yaml@npm:^1.10.2":
version: 1.10.2
resolution: "yaml@npm:1.10.2"
@ -13202,7 +13240,14 @@ __metadata:
languageName: node
linkType: hard
"yaml@npm:^2, yaml@npm:^2.4.1, yaml@npm:^2.4.2":
"yaml@npm:^2.1.1":
version: 2.3.2
resolution: "yaml@npm:2.3.2"
checksum: dba78b314c4b713a7dfa4412c88c1168ffe41fe26cdd4363cb3389194765895415b800f5a2d1a5bdfb0b2e31f1ad689f8e8f9cf78153f24142b68172e72afc95
languageName: node
linkType: hard
"yaml@npm:^2.4.2":
version: 2.4.2
resolution: "yaml@npm:2.4.2"
bin:
@ -13211,13 +13256,6 @@ __metadata:
languageName: node
linkType: hard
"yaml@npm:^2.1.1":
version: 2.3.2
resolution: "yaml@npm:2.3.2"
checksum: dba78b314c4b713a7dfa4412c88c1168ffe41fe26cdd4363cb3389194765895415b800f5a2d1a5bdfb0b2e31f1ad689f8e8f9cf78153f24142b68172e72afc95
languageName: node
linkType: hard
"yargs-parser@npm:^21.1.1":
version: 21.1.1
resolution: "yargs-parser@npm:21.1.1"

Loading…
Cancel
Save