forked from SecorD0/evm-signer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
51 lines (41 loc) · 1.48 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import logging
from data import config
from data.models import ProgramActions
from functions.check_internet_connection import check_internet_connection
from functions.create_files import create_files
from functions.generate import generate
from functions.retrieve import retrieve
from functions.send import send
from functions.sign import sign
if __name__ == '__main__':
create_files()
while True:
check_internet_connection()
action = None
print('''Select the action:
1) Generate a mnemonic;
2) Retrieve a private key and an address from a mnemonic or a private key;
3) Sign a sending transaction;
4) Send a signed transaction;
5) Exit.''')
try:
action = int(input('> '))
print()
if action == ProgramActions.Generate:
generate()
elif action == ProgramActions.Retrieve:
retrieve()
elif action == ProgramActions.SignSendingTransaction:
sign()
elif action == ProgramActions.SendSignedTransaction:
send()
else:
break
except ValueError:
print(f"{config.RED}You didn't enter a number!{config.RESET_ALL}")
except BaseException as e:
logging.exception('main')
print(f'\n{config.RED}Something went wrong: {e}{config.RESET_ALL}\n')
if action:
input(f'\nPress {config.LIGHTGREEN_EX}Enter{config.RESET_ALL} to exit.\n')
break