Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cctdaniel committed Aug 4, 2022
2 parents 630956c + 307ca11 commit 5a9377d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cluster.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Cluster, clusterApiUrl, PublicKey } from '@solana/web3.js'

export type PythCluster = Cluster | 'pythtest'
export type PythCluster = Cluster | 'pythtest' | 'pythnet'

/** Mapping from solana clusters to the public key of the pyth program. */
const clusterToPythProgramKey: Record<PythCluster, string> = {
'mainnet-beta': 'FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH',
devnet: 'gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s',
testnet: '8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz',
pythtest: '8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz',
pythnet: 'FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH',
}

/** Gets the public key of the Pyth program running on the given cluster. */
Expand All @@ -28,6 +29,8 @@ export function getPythClusterApiUrl(cluster: PythCluster): string {
// TODO: Add pythnet when it's ready
if (cluster === 'pythtest') {
return 'https://api.pythtest.pyth.network'
} else if (cluster === 'pythnet') {
return 'https://pythnet.rpcpool.com'
} else {
return clusterApiUrl(cluster)
}
Expand Down

0 comments on commit 5a9377d

Please sign in to comment.