Skip to content

Commit 05b4b3d

Browse files
authored
use pythnet as default cluster for examples (#40)
* use pythnet as default cluster for examples * change SOLANA_CUSTER_NAME to PYTHNET_CLUSTER_NAME
1 parent 6821430 commit 05b4b3d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/example_http_usage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Connection } from '@solana/web3.js'
22
import { getPythClusterApiUrl, getPythProgramKeyForCluster, PythCluster } from './cluster'
33
import { PriceStatus, PythHttpClient } from '.'
44

5-
const SOLANA_CLUSTER_NAME: PythCluster = 'mainnet-beta'
6-
const connection = new Connection(getPythClusterApiUrl(SOLANA_CLUSTER_NAME))
7-
const pythPublicKey = getPythProgramKeyForCluster(SOLANA_CLUSTER_NAME)
5+
const PYTHNET_CLUSTER_NAME: PythCluster = 'pythnet'
6+
const connection = new Connection(getPythClusterApiUrl(PYTHNET_CLUSTER_NAME))
7+
const pythPublicKey = getPythProgramKeyForCluster(PYTHNET_CLUSTER_NAME)
88

99
async function runQuery(): Promise<void> {
1010
const pythClient = new PythHttpClient(connection, pythPublicKey)

src/example_ws_usage.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { PythConnection } from './PythConnection'
33
import { getPythClusterApiUrl, getPythProgramKeyForCluster, PythCluster } from './cluster'
44
import { PriceStatus } from '.'
55

6-
const SOLANA_CLUSTER_NAME: PythCluster = 'devnet'
7-
const connection = new Connection(getPythClusterApiUrl(SOLANA_CLUSTER_NAME))
8-
const pythPublicKey = getPythProgramKeyForCluster(SOLANA_CLUSTER_NAME)
6+
const PYTHNET_CLUSTER_NAME: PythCluster = 'pythnet'
7+
const connection = new Connection(getPythClusterApiUrl(PYTHNET_CLUSTER_NAME))
8+
const pythPublicKey = getPythProgramKeyForCluster(PYTHNET_CLUSTER_NAME)
99

1010
const pythConnection = new PythConnection(connection, pythPublicKey)
1111
pythConnection.onPriceChangeVerbose((productAccount, priceAccount) => {
1212
// The arguments to the callback include solana account information / the update slot if you need it.
1313
const product = productAccount.accountInfo.data.product;
1414
const price = priceAccount.accountInfo.data;
1515
// sample output:
16-
// SRM/USD: $8.68725 ±$0.0131
16+
// SOL/USD: $14.627930000000001 ±$0.01551797
1717
if (price.price && price.confidence) {
1818
// tslint:disable-next-line:no-console
1919
console.log(`${product.symbol}: $${price.price} \xB1$${price.confidence}`)

0 commit comments

Comments
 (0)