return analyticsAPI and make it optional

This commit is contained in:
TheJuze
2024-03-13 14:07:36 +03:00
parent 8dedc46cb5
commit cf2fd889a0
6 changed files with 8 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ export default class Orion {
}
this.env = envOrConfig;
config = {
analyticsAPI: envConfig?.analyticsAPI,
referralAPI: envConfig.referralAPI,
networks: Object.entries(envConfig.networks).map(([chainId, networkConfig]) => {
if (!isValidChainId(chainId)) throw new Error(`Invalid chainId: ${chainId}`);

View File

@@ -159,6 +159,7 @@ describe('Orion', () => {
const orionPriceFeedAPI = `http://localhost:${server2.port}`;
const orion = new Orion({
analyticsAPI: 'https://analytics-api.orionprotocol.io',
referralAPI: 'https://referral-api.orionprotocol.io',
networks: {
1: {
@@ -238,6 +239,7 @@ describe('Orion', () => {
test('Init Orion testing with overrides', () => {
const orion = new Orion('testing', {
analyticsAPI: 'https://asdasd.orionprotocol.io',
referralAPI: 'https://zxczxc.orionprotocol.io',
networks: {
[SupportedChainId.BSC_TESTNET]: {

View File

@@ -23,6 +23,7 @@ export const pureEnvNetworksSchema = z.object({
});
export const pureEnvPayloadSchema = z.object({
analyticsAPI: z.string().url().optional(),
referralAPI: z.string().url(),
networks: z.record(
z.nativeEnum(SupportedChainId),

View File

@@ -279,6 +279,7 @@ export type KnownEnv = typeof knownEnvs[number];
export type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
export type EnvConfig = {
analyticsAPI: string | undefined
referralAPI: string
networks: Partial<
Record<