2017-04-11 17:13:25 -07:00
|
|
|
import os, re
|
2017-04-18 14:57:33 -07:00
|
|
|
|
|
|
|
# Address and port of local zcashd testnet RPC ports
|
|
|
|
testnet = "http://localhost:18232" #testnet
|
|
|
|
mainnet = "http://localhost:8232"
|
|
|
|
regtest = "http://localhost:18444"
|
2019-09-25 10:17:22 -07:00
|
|
|
if 'ZCASH_NETWORK' in os.environ:
|
|
|
|
ZCASH_NETWORK = os.getenv('ZCASH_NETWORK')
|
|
|
|
NETWORK = ZCASH_NETWORK
|
2017-04-18 14:57:33 -07:00
|
|
|
# Default is testnet
|
2019-09-25 10:17:22 -07:00
|
|
|
else:
|
|
|
|
NETWORK = testnet
|
2017-04-18 14:57:33 -07:00
|
|
|
|
2017-04-11 17:13:25 -07:00
|
|
|
#Timeout needs to be high for any pour operations
|
|
|
|
TIMEOUT = 600
|
|
|
|
#Default fee to use on network for txs.
|
|
|
|
DEFAULT_FEE = 0.01
|
|
|
|
|
2019-09-25 07:27:45 -07:00
|
|
|
# Try to get RPC parameters from environment
|
|
|
|
if 'RPCUSER' in os.environ and 'RPCPASSWORD' in os.environ:
|
2019-09-25 10:17:22 -07:00
|
|
|
RPCUSER = os.getenv('RPCUSER')
|
|
|
|
RPCPASSWORD = os.getenv('RPCPASSWORD')
|
2019-09-25 07:27:45 -07:00
|
|
|
else:
|
|
|
|
zcashconf = os.path.expanduser('~/.zcash/zcash.conf')
|
|
|
|
def read_config(filename):
|
|
|
|
f = open(filename)
|
|
|
|
for line in f:
|
|
|
|
if re.match('rpcuser', line):
|
|
|
|
user = line.strip('\n').split('=')[1]
|
|
|
|
if re.match('rpcpassword', line):
|
|
|
|
password = line.strip('\n').split('=')[1]
|
|
|
|
return (user, password)
|
2017-04-11 17:13:25 -07:00
|
|
|
|
2019-09-25 07:27:45 -07:00
|
|
|
config = read_config(zcashconf)
|
|
|
|
# from zcash conf
|
|
|
|
RPCUSER = config[0]
|
|
|
|
RPCPASSWORD = config[1]
|
2017-04-11 17:13:25 -07:00
|
|
|
|
|
|
|
#TESTS
|
|
|
|
#for tests (sample data here - replace with your own)
|
|
|
|
TEST_TXID = ''
|
|
|
|
TEST_ZADDR = ""
|
|
|
|
TEST_TADDR = ""
|
|
|
|
TEST_ZSECRET = ""
|