From 4868292d1f62f9be648cd33e1e542964d7c63af0 Mon Sep 17 00:00:00 2001 From: Frank <963688200@qq.com> Date: Fri, 29 Nov 2024 09:59:41 +0800 Subject: [PATCH] feat: Add NEXT_PUBLIC_REGISTRY_BRANCH (#341) --- src/consts/config.ts | 3 +++ src/features/store.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/consts/config.ts b/src/consts/config.ts index d46f8ac6..a6bdaac1 100644 --- a/src/consts/config.ts +++ b/src/consts/config.ts @@ -4,6 +4,7 @@ import { ADDRESS_BLACKLIST } from './blacklist'; const isDevMode = process?.env?.NODE_ENV === 'development'; const version = process?.env?.NEXT_PUBLIC_VERSION || '0.0.0'; const registryUrl = process?.env?.NEXT_PUBLIC_REGISTRY_URL || undefined; +const registryBranch = process?.env?.NEXT_PUBLIC_REGISTRY_BRANCH || undefined; const registryProxyUrl = process?.env?.NEXT_PUBLIC_GITHUB_PROXY || 'https://proxy.hyperlane.xyz'; const explorerApiKeys = JSON.parse(process?.env?.EXPLORER_API_KEYS || '{}'); const walletConnectProjectId = process?.env?.NEXT_PUBLIC_WALLET_CONNECT_ID || ''; @@ -18,6 +19,7 @@ interface Config { explorerApiKeys: Record; // Optional map of API keys for block explorer isDevMode: boolean; // Enables some debug features in the app registryUrl: string | undefined; // Optional URL to use a custom registry instead of the published canonical version + registryBranch?: string | undefined; // Optional customization of the registry branch instead of main registryProxyUrl?: string; // Optional URL to use a custom proxy for the GithubRegistry showDisabledTokens: boolean; // Show/Hide invalid token options in the selection modal showTipBox: boolean; // Show/Hide the blue tip box above the transfer form @@ -34,6 +36,7 @@ export const config: Config = Object.freeze({ explorerApiKeys, isDevMode, registryUrl, + registryBranch, registryProxyUrl, showDisabledTokens: false, showTipBox: true, diff --git a/src/features/store.ts b/src/features/store.ts index e634529b..dc90b9a4 100644 --- a/src/features/store.ts +++ b/src/features/store.ts @@ -66,7 +66,11 @@ export const useStore = create()( set({ chainMetadataOverrides: filtered, multiProvider }); }, multiProvider: new MultiProtocolProvider({}), - registry: new GithubRegistry({ uri: config.registryUrl, proxyUrl: config.registryProxyUrl }), + registry: new GithubRegistry({ + uri: config.registryUrl, + branch: config.registryBranch, + proxyUrl: config.registryProxyUrl, + }), warpCore: new WarpCore(new MultiProtocolProvider({}), []), setWarpContext: ({ registry, chainMetadata, multiProvider, warpCore }) => { logger.debug('Setting warp context in store');