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 1
1
/* eslint-disable n/no-process-env */
2
2
3
+ import { getPythClusterApiUrl } from "@pythnetwork/client" ;
4
+
3
5
/**
4
6
* Indicates this is a production-optimized build. Note this does NOT
5
7
* necessarily indicate that we're running on a cloud machine or the live build
11
13
* with the optimized React build, etc.
12
14
*/
13
15
export 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 1
1
import {
2
2
PythHttpClient ,
3
3
PythConnection ,
4
- getPythClusterApiUrl ,
5
4
getPythProgramKeyForCluster ,
6
5
} from "@pythnetwork/client" ;
7
6
import type { PythPriceCallback } from "@pythnetwork/client/lib/PythConnection" ;
8
7
import { Connection , PublicKey } from "@solana/web3.js" ;
9
8
import { z } from "zod" ;
10
9
10
+ import { PYTHNET_RPC , PYTHTEST_CONFORMANCE_RPC } from "../config/isomorphic" ;
11
+
11
12
export enum Cluster {
12
13
Pythnet ,
13
14
PythtestConformance ,
@@ -18,6 +19,11 @@ export const ClusterToName = {
18
19
[ Cluster . PythtestConformance ] : "pythtest-conformance" ,
19
20
} as const ;
20
21
22
+ const ClusterToRPC = {
23
+ [ Cluster . Pythnet ] : PYTHNET_RPC ,
24
+ [ Cluster . PythtestConformance ] : PYTHTEST_CONFORMANCE_RPC ,
25
+ } as const ;
26
+
21
27
export const CLUSTER_NAMES = [ "pythnet" , "pythtest-conformance" ] as const ;
22
28
23
29
export const toCluster = ( name : ( typeof CLUSTER_NAMES ) [ number ] ) : Cluster => {
@@ -37,7 +43,7 @@ export const parseCluster = (name: string): Cluster | undefined =>
37
43
: undefined ;
38
44
39
45
const mkConnection = ( cluster : Cluster ) =>
40
- new Connection ( getPythClusterApiUrl ( ClusterToName [ cluster ] ) ) ;
46
+ new Connection ( ClusterToRPC [ cluster ] ) ;
41
47
42
48
const connections = {
43
49
[ Cluster . Pythnet ] : mkConnection ( Cluster . Pythnet ) ,
Original file line number Diff line number Diff line change 11
11
" CLICKHOUSE_USERNAME" ,
12
12
" CLICKHOUSE_PASSWORD" ,
13
13
" SOLANA_RPC" ,
14
- " DISABLE_ACCESSIBILITY_REPORTING"
14
+ " DISABLE_ACCESSIBILITY_REPORTING" ,
15
+ " NEXT_PUBLIC_PYTHNET_RPC" ,
16
+ " NEXT_PUBLIC_PYTHTEST_CONFORMANCE_RPC"
15
17
]
16
18
},
17
19
"fix:lint" : {
You can’t perform that action at this time.
0 commit comments