This repository has been archived on 2020-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-24 06:29:30 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys, argparse, os
|
|
|
|
from os.path import join, dirname
|
|
|
|
from shutil import copyfile
|
|
|
|
from dotenv import load_dotenv
|
2020-11-24 07:41:23 +01:00
|
|
|
from lib.balancelib import Balance
|
2020-11-24 06:29:30 +01:00
|
|
|
|
|
|
|
# Get variables environment
|
|
|
|
if not os.path.isfile('.env'):
|
|
|
|
copyfile(".env.template", ".env")
|
|
|
|
dotenv_path = join(dirname(__file__), '.env')
|
|
|
|
load_dotenv(dotenv_path)
|
|
|
|
|
|
|
|
dunikey = os.getenv('DUNIKEY')
|
|
|
|
node = os.getenv('NODE')
|
|
|
|
if not node:
|
|
|
|
sys.stderr.write("Please fill a Duniter node in .env file\n")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
# Parse arguments
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('-p', '--pubkey', help="Clé publique du compte visé")
|
|
|
|
parser.add_argument('--mempool', action='store_true', help="Utilise les sources en Mempool")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
# Create transaction and send it
|
|
|
|
balance = Balance(dunikey, node, args.pubkey, args.mempool)
|
|
|
|
result = balance.balance()
|
2020-11-26 04:45:52 +01:00
|
|
|
print(result)
|