mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-05-22 08:39:25 +00:00
chore: allow reown project ID through config
This commit is contained in:
parent
05938b5127
commit
3197dcaa6f
@ -14,7 +14,8 @@ createRoot(document.getElementById('root')!).render(
|
|||||||
wakuConfig: {
|
wakuConfig: {
|
||||||
contentTopic: '/opchan/1/messages/proto',
|
contentTopic: '/opchan/1/messages/proto',
|
||||||
reliableChannelId: 'opchan-messages'
|
reliableChannelId: 'opchan-messages'
|
||||||
}
|
},
|
||||||
|
reownProjectId: import.meta.env.VITE_REOWN_SECRET || '2ead96ea166a03e5ab50e5c190532e72'
|
||||||
}}>
|
}}>
|
||||||
<App />
|
<App />
|
||||||
</OpChanProvider>
|
</OpChanProvider>
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { WakuConfig } from '../types';
|
|||||||
export interface OpChanClientConfig {
|
export interface OpChanClientConfig {
|
||||||
ordiscanApiKey: string;
|
ordiscanApiKey: string;
|
||||||
wakuConfig: WakuConfig;
|
wakuConfig: WakuConfig;
|
||||||
|
reownProjectId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OpChanClient {
|
export class OpChanClient {
|
||||||
@ -33,6 +34,7 @@ export class OpChanClient {
|
|||||||
apiKeys: {
|
apiKeys: {
|
||||||
ordiscan: config.ordiscanApiKey,
|
ordiscan: config.ordiscanApiKey,
|
||||||
},
|
},
|
||||||
|
reownProjectId: config.reownProjectId,
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.configure(env);
|
environment.configure(env);
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export interface EnvironmentConfig {
|
|||||||
apiKeys?: {
|
apiKeys?: {
|
||||||
ordiscan?: string;
|
ordiscan?: string;
|
||||||
};
|
};
|
||||||
|
reownProjectId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Environment {
|
class Environment {
|
||||||
@ -20,6 +21,10 @@ class Environment {
|
|||||||
public get ordiscanApiKey(): string | undefined {
|
public get ordiscanApiKey(): string | undefined {
|
||||||
return this.config.apiKeys?.ordiscan;
|
return this.config.apiKeys?.ordiscan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get reownProjectId(): string | undefined {
|
||||||
|
return this.config.reownProjectId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const environment = new Environment();
|
export const environment = new Environment();
|
||||||
|
|||||||
@ -3,15 +3,18 @@ import { BitcoinAdapter } from '@reown/appkit-adapter-bitcoin';
|
|||||||
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
||||||
import { createStorage } from 'wagmi';
|
import { createStorage } from 'wagmi';
|
||||||
import { mainnet, bitcoin, AppKitNetwork } from '@reown/appkit/networks';
|
import { mainnet, bitcoin, AppKitNetwork } from '@reown/appkit/networks';
|
||||||
|
import { environment } from '../utils/environment';
|
||||||
|
|
||||||
const networks: [AppKitNetwork, ...AppKitNetwork[]] = [mainnet, bitcoin];
|
const networks: [AppKitNetwork, ...AppKitNetwork[]] = [mainnet, bitcoin];
|
||||||
|
|
||||||
const projectId =
|
const projectId =
|
||||||
process.env.VITE_REOWN_SECRET || '2ead96ea166a03e5ab50e5c190532e72';
|
environment.reownProjectId ||
|
||||||
|
process.env.VITE_REOWN_SECRET ||
|
||||||
|
'2ead96ea166a03e5ab50e5c190532e72';
|
||||||
|
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'VITE_REOWN_SECRET is not defined. Please set it in your .env file'
|
'Reown project ID is not defined. Please set it via config.reownProjectId, VITE_REOWN_SECRET environment variable, or use the default.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user