|
@@ -57,6 +57,9 @@ class RollcoinWallet:
|
|
|
s += f"NFTs: {num_nfts}\n"
|
|
|
return s.strip()
|
|
|
|
|
|
+ def get_valuation(self):
|
|
|
+ return self.balance + self.holdings - self.cost_basis, len(self.nfts)
|
|
|
+
|
|
|
def get_nft_ratios(self):
|
|
|
if (num_nfts := len(self.nfts)) == 0:
|
|
|
return ""
|
|
@@ -135,7 +138,8 @@ async def blockchain(wallets: Data(RollcoinWallet), wallet_lookup: WalletLookup,
|
|
|
"""
|
|
|
response = f"Blockchain:\n\tTreasury: {state.treasury}\n\n"
|
|
|
names = {v: k.title() for k, v in wallet_lookup.items()}
|
|
|
- async for (sender_id, wallet) in wallets.all():
|
|
|
+ wallets = [(sender_id, wallet) async for (sender_id, wallet) in wallets.all()]
|
|
|
+ for (sender_id, wallet) in sorted(wallets, key=lambda p: p[1].get_valuation(), reverse=True):
|
|
|
response += names.get(sender_id, f"Unnamed wallet {sender_id}") + ":\n"
|
|
|
response += "\n".join("\t" + s for s in str(wallet).split("\n")) + "\n\n"
|
|
|
return response.strip()
|