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'
22import { getPythClusterApiUrl , getPythProgramKeyForCluster , PythCluster } from './cluster'
33import { 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
99async function runQuery ( ) : Promise < void > {
1010 const pythClient = new PythHttpClient ( connection , pythPublicKey )
Original file line number Diff line number Diff line change @@ -3,17 +3,17 @@ import { PythConnection } from './PythConnection'
33import { getPythClusterApiUrl , getPythProgramKeyForCluster , PythCluster } from './cluster'
44import { 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
1010const pythConnection = new PythConnection ( connection , pythPublicKey )
1111pythConnection . 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 } ` )
You can’t perform that action at this time.
0 commit comments