Few improvements to "nft ethereum"

pull/226/head
Neeraj Kashyap 2021-09-02 22:42:32 -07:00
rodzic a564737dbc
commit 5a997ad772
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -36,11 +36,16 @@ def ethereum_handler(args: argparse.Namespace) -> None:
web3_client = web3_client_from_cli_or_env(args)
result = ethereum_summary(web3_client, args.start, args.end, args.address)
start_time = result.get("date_range", {}).get("start_time", "UNKNOWN")
start_block = result.get("blocks", {}).get("start", -1)
end_time = result.get("date_range", {}).get("end_time", "UNKNOWN")
end_block = result.get("blocks", {}).get("end", -1)
humbug_token = args.humbug
if humbug_token is None:
humbug_token = os.environ.get("MOONSTREAM_HUMBUG_TOKEN")
if humbug_token:
title = f"NFT activity on the Ethereum blockchain: Blocks {args.start} to {args.end}"
title = f"NFT activity on the Ethereum blockchain: {start_time} (block {start_block}) to {end_time} (block {end_block})"
publish_json(
"nft_ethereum",
humbug_token,

Wyświetl plik

@ -197,7 +197,7 @@ def summary(
# By default, let us summarize 100 blocks worth of NFT transfers
if from_block is None:
from_block = to_block - 100
from_block = to_block - 99
start_block = w3.eth.get_block(from_block)
start_time = datetime.utcfromtimestamp(start_block.timestamp).isoformat()