We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d14e733 commit 2b7e158Copy full SHA for 2b7e158
src/cluster.ts
@@ -9,5 +9,9 @@ const clusterToPythProgramKey: Record<Cluster, string> = {
9
10
/** Gets the public key of the Pyth program running on the given cluster. */
11
export function getPythProgramKeyForCluster(cluster: Cluster): PublicKey {
12
- return new PublicKey(clusterToPythProgramKey[cluster]);
+ if (clusterToPythProgramKey[cluster] !== undefined) {
13
+ return new PublicKey(clusterToPythProgramKey[cluster]);
14
+ } else {
15
+ throw new Error(`Invalid Solana cluster name: ${cluster}. Valid options are: ${JSON.stringify(Object.keys(clusterToPythProgramKey))}`)
16
+ }
17
}
0 commit comments