File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import { Connection } from '@solana/web3.js'
2
2
import { getPythClusterApiUrl , getPythProgramKeyForCluster , PythCluster } from './cluster'
3
3
import { PriceStatus , PythHttpClient } from '.'
4
4
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 )
8
8
9
9
async function runQuery ( ) : Promise < void > {
10
10
const pythClient = new PythHttpClient ( connection , pythPublicKey )
Original file line number Diff line number Diff line change @@ -3,17 +3,17 @@ import { PythConnection } from './PythConnection'
3
3
import { getPythClusterApiUrl , getPythProgramKeyForCluster , PythCluster } from './cluster'
4
4
import { PriceStatus } from '.'
5
5
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 )
9
9
10
10
const pythConnection = new PythConnection ( connection , pythPublicKey )
11
11
pythConnection . onPriceChangeVerbose ( ( productAccount , priceAccount ) => {
12
12
// The arguments to the callback include solana account information / the update slot if you need it.
13
13
const product = productAccount . accountInfo . data . product ;
14
14
const price = priceAccount . accountInfo . data ;
15
15
// sample output:
16
- // SRM /USD: $8.68725 ±$0.0131
16
+ // SOL /USD: $14.627930000000001 ±$0.01551797
17
17
if ( price . price && price . confidence ) {
18
18
// tslint:disable-next-line:no-console
19
19
console . log ( `${ product . symbol } : $${ price . price } \xB1$${ price . confidence } ` )
You can’t perform that action at this time.
0 commit comments