mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 08:41:38 +03:00
🗿
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { merge } from 'merge-anything';
|
||||
import { chains, envs } from '../config/index.js';
|
||||
import { chains, envs } from '../config';
|
||||
import type { networkCodes } from '../constants/index.js';
|
||||
import Unit from '../Unit/index.js';
|
||||
import { ReferralSystem } from '../services/ReferralSystem/index.js';
|
||||
import { ReferralSystem } from '../services/ReferralSystem';
|
||||
import type {
|
||||
SupportedChainId,
|
||||
DeepPartial,
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
import { isValidChainId } from '../utils/index.js';
|
||||
import { simpleFetch } from 'simple-typed-fetch';
|
||||
import Bridge from './bridge/index.js';
|
||||
import { FrontageService } from '../services/Frontage';
|
||||
|
||||
export default class Orion {
|
||||
public readonly env?: string;
|
||||
@@ -22,6 +23,8 @@ export default class Orion {
|
||||
|
||||
public readonly referralSystem: ReferralSystem;
|
||||
|
||||
public readonly frontage: FrontageService;
|
||||
|
||||
public readonly bridge: Bridge;
|
||||
|
||||
// TODO: get tradable assets (aggregated)
|
||||
@@ -42,6 +45,7 @@ export default class Orion {
|
||||
config = {
|
||||
analyticsAPI: envConfig?.analyticsAPI,
|
||||
referralAPI: envConfig.referralAPI,
|
||||
frontageAPI: envConfig.frontageAPI,
|
||||
networks: Object.entries(envConfig.networks).map(([chainId, networkConfig]) => {
|
||||
if (!isValidChainId(chainId)) throw new Error(`Invalid chainId: ${chainId}`);
|
||||
const chainConfig = chains[chainId];
|
||||
@@ -67,9 +71,6 @@ export default class Orion {
|
||||
},
|
||||
indexer: {
|
||||
api: networkConfig.api + networkConfig.services.indexer?.http,
|
||||
},
|
||||
frontage: {
|
||||
api: networkConfig.api + networkConfig.services.frontage.http,
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -89,6 +90,7 @@ export default class Orion {
|
||||
}
|
||||
|
||||
this.referralSystem = new ReferralSystem(config.referralAPI);
|
||||
this.frontage = new FrontageService(config.frontageAPI);
|
||||
|
||||
this.units = Object.entries(config.networks)
|
||||
.reduce<Partial<Record<SupportedChainId, Unit>>>((acc, [chainId, networkConfig]) => {
|
||||
|
||||
Reference in New Issue
Block a user