feat: tickers schema was updated

This commit is contained in:
Mikhail Gladchenko
2024-04-25 12:31:34 +01:00
parent 704bcbca1b
commit 54e0ab8e76
2 changed files with 9 additions and 2 deletions

View File

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

View File

@@ -1,12 +1,19 @@
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.nativeEnum(SupportedChainId)),
networks: z.array(z.preprocess(preprocessToEnum, z.nativeEnum(SupportedChainId))),
});
export const tickersSchema = z.array(tickerSchema);