mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-11 05:28:06 +03:00
Fix pools schema
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.17.33",
|
"version": "0.17.34",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/esm/index.js",
|
"main": "./lib/esm/index.js",
|
||||||
"module": "./lib/esm/index.js",
|
"module": "./lib/esm/index.js",
|
||||||
|
|||||||
8
src/addressSchema.ts
Normal file
8
src/addressSchema.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { ethers } from 'ethers';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
const addressSchema = z.string().refine(ethers.utils.isAddress, (value) => ({
|
||||||
|
message: `Should be an address, got ${value}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default addressSchema;
|
||||||
@@ -1,30 +1,30 @@
|
|||||||
import { ethers } from 'ethers';
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import addressSchema from '../../../addressSchema';
|
||||||
import { makePartial } from '../../../utils';
|
import { makePartial } from '../../../utils';
|
||||||
|
|
||||||
const poolsConfigSchema = z.object({
|
const poolsConfigSchema = z.object({
|
||||||
WETHAddress: z.string().optional(),
|
WETHAddress: addressSchema.optional(),
|
||||||
factoryAddress: z.string(),
|
factoryAddress: addressSchema,
|
||||||
governanceAddress: z.string(),
|
governanceAddress: addressSchema.optional(),
|
||||||
routerAddress: z.string(),
|
routerAddress: addressSchema,
|
||||||
votingAddress: z.string(),
|
votingAddress: addressSchema.optional(),
|
||||||
factories: z.record(
|
factories: z.record(
|
||||||
z.string(),
|
z.string(),
|
||||||
z.string().refine(ethers.utils.isAddress, 'Factory should be an address'),
|
addressSchema,
|
||||||
)
|
)
|
||||||
.transform(makePartial)
|
.transform(makePartial)
|
||||||
.optional(),
|
.optional(),
|
||||||
pools: z.record(
|
pools: z.record(
|
||||||
z.string(),
|
z.string(),
|
||||||
z.object({
|
z.object({
|
||||||
lpTokenAddress: z.string(),
|
lpTokenAddress: addressSchema,
|
||||||
minQty: z.number().optional(),
|
minQty: z.number().optional(),
|
||||||
reverted: z.boolean().optional(),
|
reverted: z.boolean().optional(),
|
||||||
rewardToken: z.string().nullable().optional(),
|
rewardToken: z.string().nullable().optional(),
|
||||||
state: z.number().int().optional(),
|
state: z.number().int().optional(),
|
||||||
rewardTokenDecimals: z.number().int().optional(),
|
rewardTokenDecimals: z.number().int().optional(),
|
||||||
stakingRewardFinish: z.number().optional(),
|
stakingRewardFinish: z.number().optional(),
|
||||||
stakingRewardAddress: z.string(),
|
stakingRewardAddress: addressSchema,
|
||||||
vote_rewards_disabled: z.boolean().optional(),
|
vote_rewards_disabled: z.boolean().optional(),
|
||||||
}),
|
}),
|
||||||
).transform(makePartial),
|
).transform(makePartial),
|
||||||
|
|||||||
Reference in New Issue
Block a user