set_authorities.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from beem import Steem | |
from beem.account import Account | |
from beem.amount import Amount | |
from argparse import ArgumentParser | |
from beembase import operations | |
from beem.transactionbuilder import TransactionBuilder | |
import json | |
parser = ArgumentParser() | |
parser.add_argument('--account', type=str, required=True) | |
parser.add_argument('--to', type=str, required=True) | |
parser.add_argument('--amount', type=float, required=True) | |
parser.add_argument('--asset', type=str, required=True) | |
parser.add_argument('--memo', type=str, default="") | |
args = parser.parse_args() | |
op = operations.Transfer(**{ | |
'from': args.account, | |
'to': args.to, | |
'amount': Amount(args.amount, args.asset), | |
'memo': args.memo | |
}) | |
stm = Steem(expiration=3600) | |
tb = TransactionBuilder(steem_instance=stm) | |
tb.appendOps([op]) | |
print("'%s'" % (json.dumps(tb.json()))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
from beem import Steem | |
from beem.transactionbuilder import TransactionBuilder | |
from getpass import getpass | |
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument('--trx', type=str, required=True) | |
parser.add_argument('--append-signature', action="store_true", | |
default=False) | |
parser.add_argument('--broadcast', action="store_true", default=False) | |
args = parser.parse_args() | |
op = json.loads(args.trx) | |
tb = TransactionBuilder(tx=op) | |
if args.append_signature: | |
wif = getpass("Enter private key:") | |
tb.appendWif(wif) | |
tb.sign(reconstruct_tx=False) | |
if args.broadcast: | |
tx = tb.broadcast() | |
print("SUCCESS: broadcasted '%s'" % (json.dumps(tx, indent=2))) | |
else: | |
print("'%s'" % (json.dumps(tb.json()))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment