Merge branch 'refs/heads/main' into OP-5247-frontend-optimization

# Conflicts:
#	package.json
This commit is contained in:
Mikhail Gladchenko
2024-05-06 14:42:51 +01:00
12 changed files with 129 additions and 56 deletions

View File

@@ -232,5 +232,18 @@
"WETH": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
"curveRegistry": ""
}
},
"8453": {
"chainId": "8453",
"label": "Base",
"shortName": "BASE",
"code": "base",
"baseCurrencyName": "ETH",
"rpc": "https://mainnet.base.org/",
"explorer": "https://basescan.org/",
"contracts": {
"WETH": "0x4200000000000000000000000000000000000006",
"curveRegistry": ""
}
}
}

View File

@@ -183,6 +183,24 @@
"http": "/orion-indexer/"
}
}
},
"8453": {
"api": "https://trade.orion.xyz/base-mainnet",
"services": {
"aggregator": {
"http": "/backend",
"ws": "/v1"
},
"blockchain": {
"http": ""
},
"priceFeed": {
"all": "/price-feed"
},
"indexer": {
"http": "/orion-indexer/"
}
}
}
}
},
@@ -432,7 +450,7 @@
}
},
"2525": {
"api": "https://trade.orion.xyz/inevm-mainnet",
"api": "https://staging.orion.xyz/inevm-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -450,7 +468,7 @@
}
},
"59144": {
"api": "https://trade.orion.xyz/linea-mainnet",
"api": "https://staging.orion.xyz/linea-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -468,7 +486,25 @@
}
},
"43114": {
"api": "https://trade.orion.xyz/avalanche-c-chain",
"api": "https://staging.orion.xyz/avalanche-c-chain",
"services": {
"aggregator": {
"http": "/backend",
"ws": "/v1"
},
"blockchain": {
"http": ""
},
"priceFeed": {
"all": "/price-feed"
},
"indexer": {
"http": "/orion-indexer/"
}
}
},
"8453": {
"api": "https://staging.orion.xyz/base-mainnet",
"services": {
"aggregator": {
"http": "/backend",

View File

@@ -20,4 +20,5 @@ export const productionChains = [
SupportedChainId.INEVM,
SupportedChainId.LINEA,
SupportedChainId.AVAX,
SupportedChainId.BASE,
];

View File

@@ -1 +1 @@
export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax'] as const;
export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax', 'base'] as const;

View File

@@ -1 +1 @@
export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX'] as const;
export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX', 'BASE'] as const;

View File

@@ -72,6 +72,7 @@ class Aggregator {
this.getPoolReserves = this.getPoolReserves.bind(this);
this.getVersion = this.getVersion.bind(this);
this.getPrices = this.getPrices.bind(this);
this.getIsCexLiquidityAvailable = this.getIsCexLiquidityAvailable.bind(this);
}
get basicAuthHeaders() {
@@ -390,6 +391,20 @@ class Aggregator {
return fetchWithValidation(url.toString(), atomicSwapHistorySchema, { headers: this.basicAuthHeaders });
};
getIsCexLiquidityAvailable = (
assetIn: string,
assetOut: string,
) => {
const url = new URL(`${this.apiUrl}/api/v1/pairs/cex/liquidity/${assetIn}/${assetOut}`);
return fetchWithValidation(
url.toString(),
z.boolean(),
{ headers: this.basicAuthHeaders },
errorSchema,
);
};
// private encode_utf8(s: string) {
// return unescape(encodeURIComponent(s));
// }

View File

@@ -49,6 +49,7 @@ const swapInfoBase = z.object({
mi: z.number().optional(), // market amount in, USD
d: z.string().optional(), // difference in available amount in/out (USD) and market amount out/in (USD) in percentage
}).optional(),
autoSlippage: z.number().optional(),
});
const swapInfoByAmountIn = swapInfoBase.extend({

View File

@@ -541,6 +541,7 @@ class AggregatorWS {
marketAmountIn: json.usd.mi,
difference: json.usd.d,
},
autoSlippage: json.sl,
};
switch (json.k) { // kind

View File

@@ -48,6 +48,7 @@ const swapInfoSchemaBase = baseMessageSchema.extend({
mi: z.number().optional(), // market amount in, USD
d: z.string().optional(), // difference in available amount in/out (USD) and market amount out/in (USD) in percentage
}).optional(),
sl: z.number().optional(),
});
const swapInfoSchemaByAmountIn = swapInfoSchemaBase.extend({

View File

@@ -92,6 +92,7 @@ export enum SupportedChainId {
INEVM = '2525',
LINEA = '59144',
AVAX = '43114',
BASE = '8453',
POLYGON_TESTNET = '80001',
FANTOM_TESTNET = '4002',
@@ -210,6 +211,7 @@ export type SwapInfoBase = {
marketAmountIn: number | undefined
difference: string | undefined
} | undefined
autoSlippage: number | undefined
}
export type SwapInfoByAmountIn = SwapInfoBase & {