File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable n/no-process-env */
22
3+ import { getPythClusterApiUrl } from "@pythnetwork/client" ;
4+
35/**
46 * Indicates this is a production-optimized build. Note this does NOT
57 * necessarily indicate that we're running on a cloud machine or the live build
1113 * with the optimized React build, etc.
1214 */
1315export const IS_PRODUCTION_BUILD = process . env . NODE_ENV === "production" ;
16+
17+ export const PYTHNET_RPC =
18+ process . env . NEXT_PUBLIC_PYTHNET_RPC ?? getPythClusterApiUrl ( "pythnet" ) ;
19+ export const PYTHTEST_CONFORMANCE_RPC =
20+ process . env . NEXT_PUBLIC_PYTHTEST_CONFORMANCE_RPC ??
21+ getPythClusterApiUrl ( "pythtest-conformance" ) ;
Original file line number Diff line number Diff line change 11import {
22 PythHttpClient ,
33 PythConnection ,
4- getPythClusterApiUrl ,
54 getPythProgramKeyForCluster ,
65} from "@pythnetwork/client" ;
76import type { PythPriceCallback } from "@pythnetwork/client/lib/PythConnection" ;
87import { Connection , PublicKey } from "@solana/web3.js" ;
98import { z } from "zod" ;
109
10+ import { PYTHNET_RPC , PYTHTEST_CONFORMANCE_RPC } from "../config/isomorphic" ;
11+
1112export enum Cluster {
1213 Pythnet ,
1314 PythtestConformance ,
@@ -18,6 +19,11 @@ export const ClusterToName = {
1819 [ Cluster . PythtestConformance ] : "pythtest-conformance" ,
1920} as const ;
2021
22+ const ClusterToRPC = {
23+ [ Cluster . Pythnet ] : PYTHNET_RPC ,
24+ [ Cluster . PythtestConformance ] : PYTHTEST_CONFORMANCE_RPC ,
25+ } as const ;
26+
2127export const CLUSTER_NAMES = [ "pythnet" , "pythtest-conformance" ] as const ;
2228
2329export const toCluster = ( name : ( typeof CLUSTER_NAMES ) [ number ] ) : Cluster => {
@@ -37,7 +43,7 @@ export const parseCluster = (name: string): Cluster | undefined =>
3743 : undefined ;
3844
3945const mkConnection = ( cluster : Cluster ) =>
40- new Connection ( getPythClusterApiUrl ( ClusterToName [ cluster ] ) ) ;
46+ new Connection ( ClusterToRPC [ cluster ] ) ;
4147
4248const connections = {
4349 [ Cluster . Pythnet ] : mkConnection ( Cluster . Pythnet ) ,
Original file line number Diff line number Diff line change 1111 " CLICKHOUSE_USERNAME" ,
1212 " CLICKHOUSE_PASSWORD" ,
1313 " SOLANA_RPC" ,
14- " DISABLE_ACCESSIBILITY_REPORTING"
14+ " DISABLE_ACCESSIBILITY_REPORTING" ,
15+ " NEXT_PUBLIC_PYTHNET_RPC" ,
16+ " NEXT_PUBLIC_PYTHTEST_CONFORMANCE_RPC"
1517 ]
1618 },
1719 "fix:lint" : {
You can’t perform that action at this time.
0 commit comments