Skip to content

Commit

Permalink
Merge pull request #129 from skip-mev/staging
Browse files Browse the repository at this point in the history
chore: sync staging -> main
  • Loading branch information
Zygimantass authored Dec 25, 2023
2 parents 454226e + 649618f commit 7b0f3d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/constants/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ export const CHAIN_IDS_L5_NODES = [
"secret-4",
//
];

export const CHAIN_IDS_POLKACHU_BACKUP_NODES = [
"osmosis-1",
//
]
16 changes: 12 additions & 4 deletions src/pages/api/nodes/[$chainID]/[[...$args]].ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageConfig } from "next";
import { NextRequest } from "next/server";

import { CHAIN_IDS_L5_NODES } from "@/constants/rpc";
import { CHAIN_IDS_L5_NODES, CHAIN_IDS_POLKACHU_BACKUP_NODES } from "@/constants/rpc";
import { getCorsDomains } from "@/lib/edge-config";
import { getPolkachuAuthHeader } from "@/utils/api";
import { raise } from "@/utils/assert";
Expand Down Expand Up @@ -51,11 +51,19 @@ export default async function handler(req: NextRequest) {
searchParams.delete("$args");

const shouldUseL5 = CHAIN_IDS_L5_NODES.includes(chainID);
const shouldUsePolkachuBackup = CHAIN_IDS_POLKACHU_BACKUP_NODES.includes(chainID);

const headers = new Headers();
const rpcURL = shouldUseL5
? `https://skip-secretnetwork-rpc.lavenderfive.com`
: `https://${chainID}-skip-rpc.polkachu.com`;

var rpcURL = '';

if (shouldUseL5) {
rpcURL = `https://skip-secretnetwork-rpc.lavenderfive.com`;
} else if (shouldUsePolkachuBackup) {
rpcURL = `https://${chainID}-skip-rpc-1.polkachu.com`;
} else {
rpcURL = `https://${chainID}-skip-rpc.polkachu.com`;
}

if (!shouldUseL5) {
headers.set("authorization", getPolkachuAuthHeader());
Expand Down

1 comment on commit 7b0f3d4

@vercel
Copy link

@vercel vercel bot commented on 7b0f3d4 Dec 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.