utilisation variable d'env
This commit is contained in:
parent
7c33bbb408
commit
18c875a2e4
@ -16,8 +16,8 @@ import argparse
|
|||||||
# Parsing arguments
|
# Parsing arguments
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Dogetipbot telegram")
|
parser = argparse.ArgumentParser(description="Dogetipbot telegram")
|
||||||
parser.add_argument("--telegram-api-key")
|
parser.add_argument("--telegram-api-key", default=os.environ.get("TELEGRAM_API_KEY"))
|
||||||
parser.add_argument("--private-key")
|
parser.add_argument("--private-key", default=os.environ.get("DOGE_WALLET_KEY"))
|
||||||
parser.add_argument("--db-path")
|
parser.add_argument("--db-path")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -28,9 +28,7 @@ TELEGRAM_API_KEY = args.telegram_api_key
|
|||||||
|
|
||||||
DERIVATION_PATH = "44/3"
|
DERIVATION_PATH = "44/3"
|
||||||
TX_FEE_PER_THOUSAND_BYTES = 100000000
|
TX_FEE_PER_THOUSAND_BYTES = 100000000
|
||||||
with open(args.private_key, "rb") as f:
|
DOGE_WALLET = network.keys.bip32_seed(args.private_key.encode())
|
||||||
seed = f.readline().strip()
|
|
||||||
DOGE_WALLET = network.keys.bip32_seed(seed)
|
|
||||||
|
|
||||||
# SQL
|
# SQL
|
||||||
|
|
||||||
@ -149,7 +147,9 @@ def transaction(sender, receiver, amount=None):
|
|||||||
fee=TX_FEE_PER_THOUSAND_BYTES * ((999 + tx_byte_count) // 1000),
|
fee=TX_FEE_PER_THOUSAND_BYTES * ((999 + tx_byte_count) // 1000),
|
||||||
)
|
)
|
||||||
elif balance >= amount:
|
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.stream(s)
|
||||||
tx_byte_count = len(s.getvalue())
|
tx_byte_count = len(s.getvalue())
|
||||||
tx = network.tx_utils.create_signed_tx(
|
tx = network.tx_utils.create_signed_tx(
|
||||||
|
Loading…
Reference in New Issue
Block a user