Merge branch 'feature/generic-swap-support' into feature/swap-info-eps-field

# Conflicts:
#	package-lock.json
#	package.json
This commit is contained in:
Dmitriy Pavlov
2023-08-24 10:34:31 +03:00
13 changed files with 3202 additions and 1734 deletions

View File

@@ -22,14 +22,15 @@ const swapInfoBase = z.object({
minAmountOut: z.number(),
minAmountIn: z.number(),
marketPrice: z.number().nullable(), // spending asset market price
exchangeContractPath: z.array(z.object({
pool: z.string(),
assetIn: z.string(),
assetOut: z.string(),
factory: z.string(),
})),
alternatives: z.object({ // execution alternatives
exchanges: z.array(z.string()),
path: z.object({
units: z.object({
assetPair: z.string().toUpperCase(),
action: z.string(),
}).array(),
}),
path: z.array(z.string()),
marketAmountOut: z.number().nullable(),
marketAmountIn: z.number().nullable(),
marketPrice: z.number(),

View File

@@ -229,7 +229,7 @@ class AggregatorWS {
this.logger?.(`Sent: ${jsonData}`);
}
private hearbeatIntervalId: NodeJS.Timer | undefined;
private hearbeatIntervalId: ReturnType<typeof setInterval> | undefined;
private setupHeartbeat() {
const heartbeat = () => {
if (this.isAlive) {
@@ -558,7 +558,7 @@ class AggregatorWS {
break;
case MessageType.AGGREGATED_ORDER_BOOK_UPDATE: {
const { ob, S } = json;
const mapOrderbookItems = (rawItems: typeof ob.a | typeof ob.b) => rawItems.reduce<OrderbookItem[]>((acc, item) => {
const mapOrderbookItems = (rawItems: typeof ob.a) => rawItems.reduce<OrderbookItem[]>((acc, item) => {
const [
price,
amount,

View File

@@ -34,7 +34,7 @@ const sourceAtomicHistorySchemaItem = baseAtomicHistoryItem.extend({
expiration: z.object({
lock: z.number().optional(),
}).optional(),
state: z.enum(['BEFORE-LOCK', 'LOCKED', 'REFUNDED', 'CLAIMED']),
state: z.enum(['BEFORE-LOCK', 'LOCKED', 'REFUNDED', 'CLAIMED']).optional(),
targetChainId: z.number(),
transactions: z.object({
lock: z.string().optional(),
@@ -51,7 +51,7 @@ const targetAtomicHistorySchemaItem = baseAtomicHistoryItem.extend({
expiration: z.object({
redeem: z.number().optional(),
}).optional(),
state: z.enum(['BEFORE-REDEEM', 'REDEEMED']),
state: z.enum(['BEFORE-REDEEM', 'REDEEMED']).optional(),
transactions: z.object({
redeem: z.string().optional(),
}).optional(),