@@ -7,6 +7,7 @@ import type {
77 Chain ,
88 Collection ,
99 CollectionOrderBy ,
10+ CollectionPaginatedResponse ,
1011 CollectionStats ,
1112 GetTraitsResponse ,
1213} from "../types/index.js"
@@ -90,5 +91,81 @@ export function collectionsCommand(
9091 console . log ( formatOutput ( result , getFormat ( ) ) )
9192 } )
9293
94+ cmd
95+ . command ( "trending" )
96+ . description ( "Get trending collections by sales activity" )
97+ . option (
98+ "--timeframe <timeframe>" ,
99+ "Time window (one_minute, five_minutes, fifteen_minutes, one_hour, one_day, seven_days, thirty_days, one_year, all_time)" ,
100+ "one_day" ,
101+ )
102+ . option ( "--chains <chains>" , "Comma-separated list of chains to filter by" )
103+ . option (
104+ "--category <category>" ,
105+ "Category (art, gaming, memberships, music, pfps, photography, domain-names, virtual-worlds, sports-collectibles)" ,
106+ )
107+ . option ( "--limit <limit>" , "Number of results (max 100)" , "20" )
108+ . option ( "--next <cursor>" , "Pagination cursor" )
109+ . action (
110+ async ( options : {
111+ timeframe : string
112+ chains ?: string
113+ category ?: string
114+ limit : string
115+ next ?: string
116+ } ) => {
117+ const client = getClient ( )
118+ const result = await client . get < CollectionPaginatedResponse > (
119+ "/api/v2/collections/trending" ,
120+ {
121+ timeframe : options . timeframe ,
122+ chains : options . chains ,
123+ category : options . category ,
124+ limit : parseIntOption ( options . limit , "--limit" ) ,
125+ cursor : options . next ,
126+ } ,
127+ )
128+ console . log ( formatOutput ( result , getFormat ( ) ) )
129+ } ,
130+ )
131+
132+ cmd
133+ . command ( "top" )
134+ . description ( "Get top collections ranked by volume, sales, or floor price" )
135+ . option (
136+ "--sort-by <field>" ,
137+ "Sort by (one_day_volume, seven_days_volume, thirty_days_volume, floor_price, one_day_sales, seven_days_sales, thirty_days_sales, total_volume, total_sales)" ,
138+ "one_day_volume" ,
139+ )
140+ . option ( "--chains <chains>" , "Comma-separated list of chains to filter by" )
141+ . option (
142+ "--category <category>" ,
143+ "Category (art, gaming, memberships, music, pfps, photography, domain-names, virtual-worlds, sports-collectibles)" ,
144+ )
145+ . option ( "--limit <limit>" , "Number of results (max 100)" , "50" )
146+ . option ( "--next <cursor>" , "Pagination cursor" )
147+ . action (
148+ async ( options : {
149+ sortBy : string
150+ chains ?: string
151+ category ?: string
152+ limit : string
153+ next ?: string
154+ } ) => {
155+ const client = getClient ( )
156+ const result = await client . get < CollectionPaginatedResponse > (
157+ "/api/v2/collections/top" ,
158+ {
159+ sort_by : options . sortBy ,
160+ chains : options . chains ,
161+ category : options . category ,
162+ limit : parseIntOption ( options . limit , "--limit" ) ,
163+ cursor : options . next ,
164+ } ,
165+ )
166+ console . log ( formatOutput ( result , getFormat ( ) ) )
167+ } ,
168+ )
169+
93170 return cmd
94171}
0 commit comments