mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-28 08:37:51 +03:00
Merge branch 'refs/heads/main' into OP-5247-frontend-optimization
# Conflicts: # package.json
This commit is contained in:
@@ -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));
|
||||
// }
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -541,6 +541,7 @@ class AggregatorWS {
|
||||
marketAmountIn: json.usd.mi,
|
||||
difference: json.usd.d,
|
||||
},
|
||||
autoSlippage: json.sl,
|
||||
};
|
||||
|
||||
switch (json.k) { // kind
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user