@@ -110,21 +110,29 @@ async def get_onchain_data(
110
110
tags = ["onchain" ],
111
111
)
112
112
async def get_publishers (
113
- network : str = Query ("sepolia" , description = "Network name" , regex = "^(sepolia|mainnet)$" ),
113
+ network : str = Query ("sepolia" , description = "Network name" ),
114
114
data_type : str = Query (
115
115
"spot_entry" ,
116
116
description = "Data type" ,
117
- regex = "^(spot_entry|perp_entry|future_entry)$" ,
118
117
),
119
118
client : PragmaApiClient = Depends (get_api_client ),
120
119
):
121
- """Retrieve publishers for a specific network and data type.
120
+ """Retrieve publishers for a specific network and data type."""
121
+ publishers = await client .get_publishers (network , data_type )
122
122
123
- Args:
124
- network: The network to fetch data from (sepolia or mainnet)
125
- data_type: The data type to filter by (spot_entry, perp_entry, or future_entry)
126
- client: The API client dependency
127
- Returns:
128
- List of publishers
129
- """
130
- return await client .get_publishers (network , data_type )
123
+ formatted_publishers = []
124
+ for publisher in publishers :
125
+ formatted_publisher = {
126
+ "image" : f"/assets/publishers/{ publisher ['publisher' ].lower ()} .svg" ,
127
+ "type" : publisher .get ("type" , "" ),
128
+ "link" : publisher .get ("website_url" , "" ),
129
+ "name" : publisher ["publisher" ],
130
+ "lastUpdated" : publisher .get ("last_updated_timestamp" , 0 ), # Just the raw timestamp
131
+ "reputationScore" : "soon" ,
132
+ "nbFeeds" : publisher .get ("nb_feeds" , 0 ),
133
+ "dailyUpdates" : publisher .get ("daily_updates" , 0 ),
134
+ "totalUpdates" : publisher .get ("total_updates" , 0 ),
135
+ }
136
+ formatted_publishers .append (formatted_publisher )
137
+
138
+ return formatted_publishers
0 commit comments