mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 22:52:36 +03:00
Bumo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.17.0-rc.3",
|
||||
"version": "0.17.0-rc.4",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
import { z } from 'zod';
|
||||
import { SupportedChainId } from '../../types';
|
||||
|
||||
export const pureEnvNetworksSchema = z.object({
|
||||
api: z.string(),
|
||||
services: z.object({
|
||||
blockchain: z.object({
|
||||
http: z.string(),
|
||||
}),
|
||||
aggregator: z.object({
|
||||
http: z.string(),
|
||||
ws: z.string(),
|
||||
}),
|
||||
priceFeed: z.object({
|
||||
all: z.string(),
|
||||
}),
|
||||
}),
|
||||
rpc: z.string().optional(),
|
||||
liquidityMigratorAddress: z.string().optional(),
|
||||
});
|
||||
|
||||
export const pureEnvPayloadSchema = z.object({
|
||||
analyticsAPI: z.string().url(),
|
||||
referralAPI: z.string().url(),
|
||||
networks: z.record(
|
||||
z.nativeEnum(SupportedChainId),
|
||||
z.object({
|
||||
api: z.string(),
|
||||
services: z.object({
|
||||
blockchain: z.object({
|
||||
http: z.string(),
|
||||
}),
|
||||
aggregator: z.object({
|
||||
http: z.string(),
|
||||
ws: z.string(),
|
||||
}),
|
||||
priceFeed: z.object({
|
||||
all: z.string(),
|
||||
}),
|
||||
}),
|
||||
rpc: z.string().optional(),
|
||||
liquidityMigratorAddress: z.string().optional(),
|
||||
}),
|
||||
pureEnvNetworksSchema
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
const httpToWS = (url: string) => {
|
||||
const parsedUrl = new URL(url);
|
||||
let parsedUrl: URL;
|
||||
try {
|
||||
parsedUrl = new URL(url);
|
||||
} catch (e) {
|
||||
console.error(`httpToWS: Invalid URL ${url}`);
|
||||
throw e;
|
||||
}
|
||||
if (parsedUrl.protocol === 'https:') {
|
||||
parsedUrl.protocol = 'wss:';
|
||||
} else if (parsedUrl.protocol === 'http:') {
|
||||
|
||||
Reference in New Issue
Block a user