mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
feat: tickers schema was updated
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user