mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
return analyticsAPI and make it optional
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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]: {
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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<
|
||||
|
||||
Reference in New Issue
Block a user