Fix OrionAggregator ws url

This commit is contained in:
Aleksandr Kraiz
2022-05-17 23:17:39 +04:00
parent dd9a3051a3
commit 4e2b980a8c
3 changed files with 22 additions and 29 deletions

View File

@@ -108,11 +108,14 @@ export default class OrionUnit {
?? options?.api
?? apiUrl,
);
const oaUrl = new URL(options?.services?.orionAggregator?.api ?? options?.api ?? apiUrl);
const oaWsProtocol = oaUrl.protocol === 'https:' ? 'wss' : 'ws';
const orionAggregatorWsUrl = `${oaWsProtocol}://${oaUrl.host + (oaUrl.pathname === '/' ? '' : oaUrl.pathname)}/v1`;
this.orionAggregator = new OrionAggregator(
options?.services?.orionAggregator?.api
?? options?.api
?? apiUrl,
chainId,
options?.services?.orionAggregator?.api ?? `${options?.api ?? apiUrl}/backend`,
orionAggregatorWsUrl,
);
this.priceFeed = new PriceFeed(
options?.services?.priceFeed?.api