diff --git a/beem/cli.py b/beem/cli.py index e8a0603d6c8b9b61029c6f897d4ab5786af193bf..30e2ee73aaff006d18418bec55c47c32734eb2fc 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -2909,6 +2909,26 @@ def broadcast(file): tx = json.dumps(tx, indent=4) print(tx) +@cli.command() +@click.option('--lines', '-n', help='Defines how many ops should be shown', default=10) +@click.option('--mode', '-m', help='Stream mode: Can be irreversible (default) or head', default="irreversible") +@click.option('--json', '-j', help='Output as JSON', is_flag=True, default=False) +@click.option('--follow', '-f', help='Constantly stream output', is_flag=True, default=False) +def stream(lines, mode, json, follow): + """ Stream operations + """ + stm = shared_blockchain_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + b = Blockchain(mode=mode, blockchain_instance=stm) + op_count = 0 + import pprint + for ops in b.stream(raw_ops=True): + op_count += 1 + pprint.pprint(ops) + if op_count >= lines and not follow: + return + @cli.command() @click.option('--sbd-to-steem', '-i', help='Show ticker in SBD/STEEM', is_flag=True, default=False) diff --git a/beembase/objects.py b/beembase/objects.py index 335eda9cf3f7f95d84e93cd9d2fed4f364fd38e7..9c3489d440e9ad4c8eaab60d0fbe925fb613f37d 100644 --- a/beembase/objects.py +++ b/beembase/objects.py @@ -102,9 +102,9 @@ class Amount(object): def __bytes__(self): # padding # Workaround to allow transfers in HIVE - if self.symbol == "HBD" and self.replace_hive_by_steem: + if self.symbol == "HBD": self.symbol = "SBD" - elif self.symbol == "HIVE" and self.replace_hive_by_steem: + elif self.symbol == "HIVE": self.symbol = "STEEM" symbol = self.symbol + "\x00" * (7 - len(self.symbol)) return (struct.pack("<q", int(self.amount)) + struct.pack("<b", self.precision) +