|
16 | 16 | from credmark.cmf.model.errors import ModelInputError |
17 | 17 | from credmark.cmf.types import Address, Contract, JoinType, Token |
18 | 18 | from credmark.dto import DTO, DTOField |
19 | | -from web3.exceptions import (ABIFunctionNotFound, BadFunctionCallOutput, |
20 | | - ContractLogicError) |
| 19 | +from web3.exceptions import ABIFunctionNotFound, BadFunctionCallOutput, ContractLogicError |
21 | 20 |
|
22 | 21 | AZUKI_NFT = "0xED5AF388653567Af2F388E6224dC7C4b3241C544" |
23 | 22 | RTFKT_MNLTH_NFT = "0x86825dFCa7A6224cfBd2DA48e85DF2fc3Aa7C4B1" |
@@ -123,7 +122,7 @@ def run(self, input: NFTContract) -> dict: |
123 | 122 | minted_ids_count = minted_ids.shape[0] |
124 | 123 |
|
125 | 124 | self.logger.info( |
126 | | - f'{minted_ids_count=} {set(range(0, minted_ids_count)) - set(df_mint.evt_tokenid.astype("int"))}' |
| 125 | + f"{minted_ids_count=} {set(range(0, minted_ids_count)) - set(df_mint.evt_tokenid.astype('int'))}" |
127 | 126 | ) |
128 | 127 |
|
129 | 128 | df_mint["value"] = df_mint["value"].astype("float64") / 1e18 |
@@ -258,7 +257,8 @@ class NFTHolderInput(NFTContract): |
258 | 257 | 0, ge=0, description="Omit a specified number of holders from beginning of result set" |
259 | 258 | ) |
260 | 259 | order_by: str = DTOField( |
261 | | - "most_tokens", description="Sort by most_tokens, least_tokens, oldest or newest" |
| 260 | + "most_tokens", |
| 261 | + description="Sort by most_tokens, least_tokens, oldest, newest, most_recent or least_recent", |
262 | 262 | ) |
263 | 263 |
|
264 | 264 |
|
@@ -307,9 +307,10 @@ async def get_attributes_bulk_async(self, urls: Iterable[str]): |
307 | 307 | tcp_connection = aiohttp.TCPConnector( |
308 | 308 | limit=max_workers, force_close=True, enable_cleanup_closed=True |
309 | 309 | ) |
310 | | - async with aiohttp.ClientSession( |
311 | | - connector=tcp_connection |
312 | | - ) as session, asyncio.TaskGroup() as tg: |
| 310 | + async with ( |
| 311 | + aiohttp.ClientSession(connector=tcp_connection) as session, |
| 312 | + asyncio.TaskGroup() as tg, |
| 313 | + ): |
313 | 314 | responses = [tg.create_task(self.get_nft_attributes(session, url)) for url in urls] |
314 | 315 | responses = await asyncio.gather(*responses) |
315 | 316 | # await asyncio.sleep(0.250) |
@@ -379,6 +380,10 @@ def run(self, input: NFTHolderInput) -> NFTHoldersOutput: |
379 | 380 | order_by = q.field("first_block_number").dquote().desc() |
380 | 381 | elif input.order_by == "oldest": |
381 | 382 | order_by = q.field("first_block_number").dquote().asc() |
| 383 | + elif input.order_by == "most_recent": |
| 384 | + order_by = q.field("last_block_number").dquote().desc() |
| 385 | + elif input.order_by == "least_recent": |
| 386 | + order_by = q.field("last_block_number").dquote().asc() |
382 | 387 | elif input.order_by == "most_tokens": |
383 | 388 | order_by = q.field("balance").dquote().desc() |
384 | 389 | elif input.order_by == "least_tokens": |
|
0 commit comments