File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { clusterApiUrl , Connection } from '@solana/web3.js'
2
+ import { getPythProgramKeyForCluster , PythHttpClient } from '..'
3
+
4
+ test ( 'PythHttpClientCall' , ( done ) => {
5
+ jest . setTimeout ( 20000 )
6
+ try {
7
+ const programKey = getPythProgramKeyForCluster ( 'testnet' )
8
+ const currentConnection = new Connection ( clusterApiUrl ( 'testnet' ) )
9
+ const pyth_client = new PythHttpClient ( currentConnection , programKey )
10
+ pyth_client . getData ( ) . then (
11
+ ( result ) => {
12
+ try {
13
+ // Find a product with symbol "SOL/USD"
14
+ const products = result . products . filter ( ( p ) => p . symbol === 'Crypto.SOL/USD' )
15
+ expect ( products . length ) . toBeGreaterThan ( 0 )
16
+
17
+ done ( )
18
+ } catch ( cerr ) {
19
+ done ( cerr )
20
+ }
21
+ } ,
22
+ ( err ) => done ( err ) ,
23
+ )
24
+ } catch ( err_catch ) {
25
+ done ( err_catch )
26
+ }
27
+ } )
You can’t perform that action at this time.
0 commit comments