@@ -26,12 +26,12 @@ export const PriceFeedIdsProTable = () => {
2626 } , [ ] ) ;
2727
2828 const columns : ColumnConfig < Col > [ ] = [
29- { id : "Asset Type " , name : "Asset Type" , isRowHeader : true } ,
30- { id : "Description " , name : "Description" } ,
31- { id : "Name " , name : "Name" } ,
32- { id : "Symbol " , name : "Symbol" } ,
33- { id : "Pyth Pro ID " , name : "Pyth Pro ID" } ,
34- { id : "Exponent " , name : "Exponent" } ,
29+ { id : "asset_type " , name : "Asset Type" } ,
30+ { id : "description " , name : "Description" } ,
31+ { id : "name " , name : "Name" } ,
32+ { id : "symbol " , name : "Symbol" } ,
33+ { id : "pyth_lazer_id " , name : "Pyth Pro ID" , isRowHeader : true } ,
34+ { id : "exponent " , name : "Exponent" } ,
3535 ] ;
3636
3737 const {
@@ -52,17 +52,14 @@ export const PriceFeedIdsProTable = () => {
5252 ( ) => 1 ,
5353 ( items , searchString ) => {
5454 return matchSorter ( items , searchString , {
55- keys : [
56- "Asset Type" ,
57- "Description" ,
58- "Name" ,
59- "Symbol" ,
60- "Pyth Pro ID" ,
61- "Exponent" ,
62- ] ,
55+ keys : [ "pyth_lazer_id" ] ,
6356 } ) ;
6457 } ,
65- { defaultSort : "Pyth Pro ID" , defaultPageSize : 20 } ,
58+ {
59+ defaultSort : "pyth_lazer_id" ,
60+ defaultPageSize : 10 ,
61+ defaultDescending : false ,
62+ } ,
6663 ) ;
6764
6865 if ( state . type === StateType . Error ) {
@@ -75,28 +72,28 @@ export const PriceFeedIdsProTable = () => {
7572 const rows = paginatedItems . map ( ( feed ) => ( {
7673 id : feed . pyth_lazer_id ,
7774 data : {
78- "Asset Type" : feed . asset_type ,
79- Description : feed . description ,
80- Name : feed . name ,
81- Symbol : feed . symbol ,
82- "Pyth Pro ID" : feed . pyth_lazer_id ,
83- Exponent : feed . exponent ,
75+ asset_type : feed . asset_type ,
76+ description : feed . description ,
77+ name : feed . name ,
78+ symbol : feed . symbol ,
79+ pyth_lazer_id : feed . pyth_lazer_id ,
80+ exponent : feed . exponent ,
8481 } ,
8582 } ) ) ;
8683
8784 return (
8885 < >
8986 < SearchInput
9087 label = "Search price feeds"
91- placeholder = "Search by symbol or feed id "
88+ placeholder = "Search by symbol, name, or Pyth Pro ID "
9289 value = { search }
9390 onChange = { updateSearch }
9491 className = { styles . searchInput ?? "" }
9592 />
9693
9794 < Table < Col >
9895 { ...( isLoading ? { isLoading : true } : { isLoading : false , rows } ) }
99- label = "Price feed ids"
96+ label = "Pyth Pro price feed ids"
10097 columns = { columns }
10198 onSortChange = { updateSortDescriptor }
10299 sortDescriptor = { sortDescriptor }
@@ -117,16 +114,6 @@ export const PriceFeedIdsProTable = () => {
117114 ) ;
118115} ;
119116
120- const errorToString = ( error : unknown ) => {
121- if ( error instanceof Error ) {
122- return error . message ;
123- } else if ( typeof error === "string" ) {
124- return error ;
125- } else {
126- return "An error occurred, please try again" ;
127- }
128- } ;
129-
130117enum StateType {
131118 NotLoaded ,
132119 Loading ,
@@ -150,7 +137,10 @@ const getPythProFeeds = async () => {
150137 "https://history.pyth-lazer.dourolabs.app/history/v1/symbols" ,
151138 ) ;
152139 const data = pythProSchema . parse ( await result . json ( ) ) ;
153- return data ;
140+ return data . toSorted (
141+ ( firstFeed , secondFeed ) =>
142+ firstFeed . pyth_lazer_id - secondFeed . pyth_lazer_id ,
143+ ) ;
154144} ;
155145
156146const pythProSchema = z . array (
@@ -159,16 +149,25 @@ const pythProSchema = z.array(
159149 description : z . string ( ) ,
160150 name : z . string ( ) ,
161151 symbol : z . string ( ) ,
162- pyth_lazer_id : z . number ( ) ,
163- priceFeedId : z . number ( ) ,
152+ pyth_lazer_id : z . number ( ) . int ( ) . positive ( ) ,
164153 exponent : z . number ( ) ,
165154 } ) ,
166155) ;
167156
168157type Col =
169- | "Asset Type"
170- | "Description"
171- | "Name"
172- | "Symbol"
173- | "Pyth Pro ID"
174- | "Exponent" ;
158+ | "asset_type"
159+ | "description"
160+ | "name"
161+ | "symbol"
162+ | "pyth_lazer_id"
163+ | "exponent" ;
164+
165+ const errorToString = ( error : unknown ) => {
166+ if ( error instanceof Error ) {
167+ return error . message ;
168+ } else if ( typeof error === "string" ) {
169+ return error ;
170+ } else {
171+ return "An error occurred, please try again" ;
172+ }
173+ } ;
0 commit comments