Skip to content

Commit

Permalink
Fixed chia plotnft show command
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaMineJP committed Aug 2, 2023
1 parent 51d3a5a commit 01a93dc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
44 changes: 28 additions & 16 deletions chia/cmds/plotnft_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,29 @@ async def pprint_pool_wallet_state(
print(f"Expected to leave after block height: {expected_leave_height}")


async def pprint_all_pool_wallet_state(
wallet_client: WalletRpcClient,
get_wallets_response: List[Dict[str, Any]],
address_prefix: str,
pool_state_dict: Dict[bytes32, Dict[str, Any]],
) -> None:
print(f"Wallet height: {await wallet_client.get_height_info()}")
print(f"Sync status: {'Synced' if (await wallet_client.get_synced()) else 'Not synced'}")
for wallet_info in get_wallets_response:
pool_wallet_id = wallet_info["id"]
typ = WalletType(int(wallet_info["type"]))
if typ == WalletType.POOLING_WALLET:
pool_wallet_info, _ = await wallet_client.pw_status(pool_wallet_id)
await pprint_pool_wallet_state(
wallet_client,
pool_wallet_id,
pool_wallet_info,
address_prefix,
pool_state_dict.get(pool_wallet_info.launcher_id),
)
print("")


async def show(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id_passed_in: Optional[int]) -> None:
async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, _):
try:
Expand Down Expand Up @@ -209,23 +232,12 @@ async def show(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id_pass
address_prefix,
pool_state_dict.get(pool_wallet_info.launcher_id),
)
except CliRpcConnectionError: # we want to output this if we can't connect to the farmer
print(f"Wallet height: {await wallet_client.get_height_info()}")
print(f"Sync status: {'Synced' if (await wallet_client.get_synced()) else 'Not synced'}")
for summary in summaries_response:
wallet_id = summary["id"]
typ = WalletType(int(summary["type"]))
if typ == WalletType.POOLING_WALLET:
print(f"Wallet id {wallet_id}: ")
pool_wallet_info, _ = await wallet_client.pw_status(wallet_id)
await pprint_pool_wallet_state(
wallet_client,
wallet_id,
pool_wallet_info,
address_prefix,
pool_state_dict.get(pool_wallet_info.launcher_id),
else:
await pprint_all_pool_wallet_state(
wallet_client, summaries_response, address_prefix, pool_state_dict
)
print("")
except CliRpcConnectionError: # we want to output this if we can't connect to the farmer
await pprint_all_pool_wallet_state(wallet_client, summaries_response, address_prefix, pool_state_dict)


async def get_login_link(launcher_id_str: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion chia/rpc/wallet_rpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def get_timestamp_for_height(self, height: uint32) -> uint64:
return uint64((await self.fetch("get_timestamp_for_height", {"height": height}))["timestamp"])

# Wallet Management APIs
async def get_wallets(self, wallet_type: Optional[WalletType] = None) -> Dict:
async def get_wallets(self, wallet_type: Optional[WalletType] = None) -> List[Dict[str, Any]]:
request: Dict[str, Any] = {}
if wallet_type is not None:
request["type"] = wallet_type
Expand Down

0 comments on commit 01a93dc

Please sign in to comment.