File tree 2 files changed +17
-4
lines changed
pages/api/nodes/[$chainID]
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,8 @@ export const CHAIN_IDS_L5_NODES = [
2
2
"secret-4" ,
3
3
//
4
4
] ;
5
+
6
+ export const CHAIN_IDS_POLKACHU_BACKUP_NODES = [
7
+ "osmosis-1" ,
8
+ //
9
+ ]
Original file line number Diff line number Diff line change 1
1
import { PageConfig } from "next" ;
2
2
import { NextRequest } from "next/server" ;
3
3
4
- import { CHAIN_IDS_L5_NODES } from "@/constants/rpc" ;
4
+ import { CHAIN_IDS_L5_NODES , CHAIN_IDS_POLKACHU_BACKUP_NODES } from "@/constants/rpc" ;
5
5
import { getCorsDomains } from "@/lib/edge-config" ;
6
6
import { getPolkachuAuthHeader } from "@/utils/api" ;
7
7
import { raise } from "@/utils/assert" ;
@@ -51,11 +51,19 @@ export default async function handler(req: NextRequest) {
51
51
searchParams . delete ( "$args" ) ;
52
52
53
53
const shouldUseL5 = CHAIN_IDS_L5_NODES . includes ( chainID ) ;
54
+ const shouldUsePolkachuBackup = CHAIN_IDS_POLKACHU_BACKUP_NODES . includes ( chainID ) ;
54
55
55
56
const headers = new Headers ( ) ;
56
- const rpcURL = shouldUseL5
57
- ? `https://skip-secretnetwork-rpc.lavenderfive.com`
58
- : `https://${ chainID } -skip-rpc.polkachu.com` ;
57
+
58
+ var rpcURL = '' ;
59
+
60
+ if ( shouldUseL5 ) {
61
+ rpcURL = `https://skip-secretnetwork-rpc.lavenderfive.com` ;
62
+ } else if ( shouldUsePolkachuBackup ) {
63
+ rpcURL = `https://${ chainID } -skip-rpc-1.polkachu.com` ;
64
+ } else {
65
+ rpcURL = `https://${ chainID } -skip-rpc.polkachu.com` ;
66
+ }
59
67
60
68
if ( ! shouldUseL5 ) {
61
69
headers . set ( "authorization" , getPolkachuAuthHeader ( ) ) ;
You can’t perform that action at this time.
0 commit comments