feat: tickers schema was updated

This commit is contained in:
Mikhail Gladchenko
2024-05-06 17:35:09 +01:00
parent e258cb1d9a
commit f9f849a84e
2 changed files with 2 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.79-rc13",
"version": "0.20.79-rc14",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -1,19 +1,12 @@
import { z } from 'zod';
import { SupportedChainId } from '../../../types';
const preprocessToEnum = (value: unknown) => {
if (typeof value === 'number') {
return String(value);
}
return value;
};
export const tickerSchema = z.object({
pair: z.string(),
volume24: z.number(),
change24: z.number(),
lastPrice: z.number(),
networks: z.array(z.preprocess(preprocessToEnum, z.nativeEnum(SupportedChainId))),
networks: z.array(z.nativeEnum(SupportedChainId)),
});
export const tickersSchema = z.array(tickerSchema);