utilisation variable d'env

This commit is contained in:
nyanloutre 2020-04-27 16:39:57 +02:00
parent 7c33bbb408
commit 18c875a2e4
Signed by: nyanloutre
GPG Key ID: 194A92D1103ACB2A
1 changed files with 6 additions and 6 deletions

View File

@ -16,8 +16,8 @@ import argparse
# Parsing arguments
parser = argparse.ArgumentParser(description="Dogetipbot telegram")
parser.add_argument("--telegram-api-key")
parser.add_argument("--private-key")
parser.add_argument("--telegram-api-key", default=os.environ.get("TELEGRAM_API_KEY"))
parser.add_argument("--private-key", default=os.environ.get("DOGE_WALLET_KEY"))
parser.add_argument("--db-path")
args = parser.parse_args()
@ -28,9 +28,7 @@ TELEGRAM_API_KEY = args.telegram_api_key
DERIVATION_PATH = "44/3"
TX_FEE_PER_THOUSAND_BYTES = 100000000
with open(args.private_key, "rb") as f:
seed = f.readline().strip()
DOGE_WALLET = network.keys.bip32_seed(seed)
DOGE_WALLET = network.keys.bip32_seed(args.private_key.encode())
# SQL
@ -149,7 +147,9 @@ def transaction(sender, receiver, amount=None):
fee=TX_FEE_PER_THOUSAND_BYTES * ((999 + tx_byte_count) // 1000),
)
elif balance >= amount:
tx = network.tx_utils.create_signed_tx(unspent, [(receiver, amount), pkey.address()], wifs=[pkey.wif()])
tx = network.tx_utils.create_signed_tx(
unspent, [(receiver, amount), pkey.address()], wifs=[pkey.wif()]
)
tx.stream(s)
tx_byte_count = len(s.getvalue())
tx = network.tx_utils.create_signed_tx(