-
Notifications
You must be signed in to change notification settings - Fork 5
/
generateAddr.py
80 lines (70 loc) · 2.44 KB
/
generateAddr.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import cardano_cli_helper as cli
import argparse
from os.path import exists
import sendTokens
def generateAndFund(fundingAddrFile, fundingSkeyFile, network):
if not exists(fundingAddrFile):
print('ERROR: Funding address file does not exist.')
return 0
if not exists(fundingSkeyFile):
print('ERROR: Funding skey file does not exist.')
return 0
generateAccount(network)
sendTokens.main(
fundingAddrFile,
fundingSkeyFile,
'payment.addr',
100*pow(10, 6),
[],
[],
network=network)
def generateAccount(network):
cli.generatePaymentKeyPair()
cli.generatePaymentAddress(network)
def main(withFunding, lovelace_amount, fundingAddrFile,
fundingSkeyFile, network='mainnet'):
if withFunding:
generateAndFund(fundingAddrFile, fundingSkeyFile, network)
else:
generateAccount(network)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-F', '--with-funding',
default=False,
dest='with_funding',
help='Do you want to provide a funding key to fund your new account?',
type=bool
)
parser.add_argument('-L', '--lovelace-amount',
default=1000000,
dest='lovelace_amount',
help='Please provide the amount in lovelace to fund your new account',
type=str
)
parser.add_argument(
'-A', '--funding-addr-file',
default='/home/christos/IOHK/repos/cardano-node/running_block_producer/mambaQAPool/payment.addr',
dest='funding_addr_file',
help='Provide location of funding address file.',
type=str,
)
parser.add_argument(
'-K', '--funding-skey-file',
default='/home/christos/IOHK/repos/cardano-node/running_block_producer/mambaQAPool/payment.skey',
dest='funding_skey_file',
help='Provide location of funding skey file.',
type=str,
)
parser.add_argument(
'-N', '--network',
default='mainnet',
dest='network',
help='Provide cardano network.',
type=str
)
args = parser.parse_args()
main(args.with_funding,
args.lovelace_amount,
args.funding_addr_file,
args.funding_skey_file,
args.network)