mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +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: {
|
||||
contentTopic: '/opchan/1/messages/proto',
|
||||
reliableChannelId: 'opchan-messages'
|
||||
}
|
||||
},
|
||||
reownProjectId: import.meta.env.VITE_REOWN_SECRET || '2ead96ea166a03e5ab50e5c190532e72'
|
||||
}}>
|
||||
<App />
|
||||
</OpChanProvider>
|
||||
|
||||
@ -12,6 +12,7 @@ import { WakuConfig } from '../types';
|
||||
export interface OpChanClientConfig {
|
||||
ordiscanApiKey: string;
|
||||
wakuConfig: WakuConfig;
|
||||
reownProjectId?: string;
|
||||
}
|
||||
|
||||
export class OpChanClient {
|
||||
@ -33,6 +34,7 @@ export class OpChanClient {
|
||||
apiKeys: {
|
||||
ordiscan: config.ordiscanApiKey,
|
||||
},
|
||||
reownProjectId: config.reownProjectId,
|
||||
};
|
||||
|
||||
environment.configure(env);
|
||||
|
||||
@ -7,6 +7,7 @@ export interface EnvironmentConfig {
|
||||
apiKeys?: {
|
||||
ordiscan?: string;
|
||||
};
|
||||
reownProjectId?: string;
|
||||
}
|
||||
|
||||
class Environment {
|
||||
@ -20,6 +21,10 @@ class Environment {
|
||||
public get ordiscanApiKey(): string | undefined {
|
||||
return this.config.apiKeys?.ordiscan;
|
||||
}
|
||||
|
||||
public get reownProjectId(): string | undefined {
|
||||
return this.config.reownProjectId;
|
||||
}
|
||||
}
|
||||
|
||||
export const environment = new Environment();
|
||||
|
||||
@ -3,15 +3,18 @@ import { BitcoinAdapter } from '@reown/appkit-adapter-bitcoin';
|
||||
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
||||
import { createStorage } from 'wagmi';
|
||||
import { mainnet, bitcoin, AppKitNetwork } from '@reown/appkit/networks';
|
||||
import { environment } from '../utils/environment';
|
||||
|
||||
const networks: [AppKitNetwork, ...AppKitNetwork[]] = [mainnet, bitcoin];
|
||||
|
||||
const projectId =
|
||||
process.env.VITE_REOWN_SECRET || '2ead96ea166a03e5ab50e5c190532e72';
|
||||
environment.reownProjectId ||
|
||||
process.env.VITE_REOWN_SECRET ||
|
||||
'2ead96ea166a03e5ab50e5c190532e72';
|
||||
|
||||
if (!projectId) {
|
||||
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