Skip to content

Commit a0cb5ae

Browse files
authored
Merge pull request #50 from pyth-network/guibescos/cluster-localnet
Add localnet to clusters
2 parents b1e4c1e + 8a9fa44 commit a0cb5ae

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/PythHttpClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export class PythHttpClient {
5858
const productAccountKeyToProduct = new Map<string, Product>()
5959
const currentSlot = await this.connection.getSlot(this.commitment)
6060

61-
// Initialize permission field as undefined
62-
let permissionData;
61+
// Initialize permission field as undefined
62+
let permissionData
6363

6464
accountList.forEach((singleAccount) => {
6565
const base = parseBaseData(singleAccount.account.data)

src/cluster.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Cluster, clusterApiUrl, PublicKey } from '@solana/web3.js'
22

3-
export type PythCluster = Cluster | 'pythtest' | 'pythnet'
3+
export type PythCluster = Cluster | 'pythtest' | 'pythnet' | 'localnet'
44

55
/** Mapping from solana clusters to the public key of the pyth program. */
66
const clusterToPythProgramKey: Record<PythCluster, string> = {
@@ -9,6 +9,7 @@ const clusterToPythProgramKey: Record<PythCluster, string> = {
99
testnet: '8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz',
1010
pythtest: '8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz',
1111
pythnet: 'FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH',
12+
localnet: 'gMYYig2utAxVoXnM9UhtTWrt8e7x2SVBZqsWZJeT5Gw',
1213
}
1314

1415
/** Gets the public key of the Pyth program running on the given cluster. */
@@ -31,6 +32,8 @@ export function getPythClusterApiUrl(cluster: PythCluster): string {
3132
return 'https://api.pythtest.pyth.network'
3233
} else if (cluster === 'pythnet') {
3334
return 'https://pythnet.rpcpool.com'
35+
} else if (cluster === 'localnet') {
36+
return 'http://localhost:8899'
3437
} else {
3538
return clusterApiUrl(cluster)
3639
}

0 commit comments

Comments
 (0)