mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-31 01:58:06 +03:00
33 lines
851 B
TypeScript
33 lines
851 B
TypeScript
import { z } from 'zod';
|
|
import { exchanges } from '../../../constants/index.js';
|
|
|
|
const orderbookElementSchema = z.object({
|
|
price: z.number(),
|
|
amount: z.number(),
|
|
path: z.array(z.object({
|
|
assetPair: z.string().toUpperCase(),
|
|
action: z.enum(['BUY', 'SELL']),
|
|
})),
|
|
});
|
|
|
|
const aggregatedOrderbookElementSchema = orderbookElementSchema
|
|
.extend({
|
|
exchanges: z.enum(exchanges).array(),
|
|
});
|
|
|
|
export const aggregatedOrderbookSchema = z.object({
|
|
asks: z.array(aggregatedOrderbookElementSchema),
|
|
bids: z.array(aggregatedOrderbookElementSchema),
|
|
});
|
|
|
|
export const exchangeOrderbookSchema = z.object({
|
|
asks: z.array(orderbookElementSchema),
|
|
bids: z.array(orderbookElementSchema),
|
|
});
|
|
|
|
export const poolReservesSchema = z.object({
|
|
a: z.number(), // amount asset
|
|
p: z.number(), // price asset
|
|
indicativePrice: z.number(),
|
|
});
|