mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Added isKnownEnv
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.17.14",
|
||||
"version": "0.17.15",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -28,7 +28,9 @@ export const pureEnvPayloadSchema = z.object({
|
||||
),
|
||||
});
|
||||
|
||||
export const knownEnvs = ['production', 'staging', 'testing'] as const;
|
||||
|
||||
export const pureEnvSchema = z.record(
|
||||
z.enum(['production', 'staging', 'testing']).or(z.string()),
|
||||
z.enum(knownEnvs).or(z.string()),
|
||||
pureEnvPayloadSchema,
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ import type BigNumber from 'bignumber.js';
|
||||
import type exchanges from './constants/exchanges';
|
||||
import type subOrderStatuses from './constants/subOrderStatuses';
|
||||
import type positionStatuses from './constants/positionStatuses';
|
||||
import type { knownEnvs } from './config/schemas';
|
||||
|
||||
export type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
@@ -284,4 +285,4 @@ export type VerboseOrionUnitConfig = {
|
||||
}
|
||||
}
|
||||
|
||||
export type KnownEnv = 'testing' | 'staging' | 'production';
|
||||
export type KnownEnv = typeof knownEnvs[number];
|
||||
|
||||
@@ -4,7 +4,6 @@ export { default as calculateNetworkFeeInFeeAsset } from './calculateNetworkFeeI
|
||||
export { default as calculateOrionFeeInFeeAsset } from './calculateOrionFeeInFeeAsset';
|
||||
export { default as checkIsToken } from './checkIsToken';
|
||||
export { default as generateSecret } from './generateSecret';
|
||||
export { default as isValidChainId } from './isValidChainId';
|
||||
export { default as denormalizeNumber } from './denormalizeNumber';
|
||||
export { default as normalizeNumber } from './normalizeNumber';
|
||||
export { default as isNetworkCodeInEnvironment } from './isNetworkCodeInEnvironment';
|
||||
@@ -14,6 +13,8 @@ export { default as toLowerCase } from './toLowerCase';
|
||||
export { default as isUppercasedNetworkCode } from './isUppercasedNetworkCode';
|
||||
export { default as getNativeCryptocurrency } from './getNativeCryptocurrency';
|
||||
|
||||
export { default as isValidChainId } from './isValidChainId';
|
||||
export { default as isKnownEnv } from './isKnownEnv';
|
||||
// export { default as HttpError } from './httpError';
|
||||
|
||||
export * from './typeHelpers';
|
||||
|
||||
8
src/utils/isKnownEnv.ts
Normal file
8
src/utils/isKnownEnv.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { knownEnvs } from '../config/schemas';
|
||||
import type { KnownEnv, } from '../types';
|
||||
|
||||
const isKnownEnv = (env: string): env is KnownEnv => {
|
||||
return knownEnvs.some((knownEnv) => knownEnv === env);
|
||||
}
|
||||
|
||||
export default isKnownEnv;
|
||||
Reference in New Issue
Block a user