getting balance is modified to use utils-api
This commit is contained in:
parent
1ec2750699
commit
ac77f4675c
|
@ -1 +1,4 @@
|
|||
**/address_book.json
|
||||
**/dapps_history.json
|
||||
**/*.swp
|
||||
**/__pycache__
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/opt/anaconda3/bin/python
|
||||
|
||||
from utils.getenv import BridgeEnv
|
||||
from utils.web3 import toChecksumAddress
|
||||
from sys import argv, exit
|
||||
|
||||
b = BridgeEnv()
|
||||
b.initEnv()
|
||||
|
||||
signer = b.validator
|
||||
sender = b.actor_address
|
||||
|
||||
# Home direction will be used by default
|
||||
direction = "h"
|
||||
if len(argv[1:]) == 1:
|
||||
if argv[1] in ["h", "f"]:
|
||||
direction = argv[1]
|
||||
else:
|
||||
exit("Incorrect direction")
|
||||
else:
|
||||
print("Home is used by default")
|
||||
|
||||
if direction == "h":
|
||||
web3 = b.connectionToHome()
|
||||
else:
|
||||
web3 = b.connectionToForeign()
|
||||
|
||||
for i in [signer, sender]:
|
||||
balance=web3.eth.getBalance(i)
|
||||
print(i, ":", web3.fromWei(balance, 'ether'))
|
|
@ -1,13 +0,0 @@
|
|||
#!/opt/anaconda3/bin/python
|
||||
|
||||
from web3 import Web3
|
||||
#from web3.utils.transactions import wait_for_transaction_receipt
|
||||
|
||||
signer = "0xf3ee321df87781864f46f6464e764c2827fca73b"
|
||||
sender = "0x08c7e1b446520914ba7126325d69fe2863f62413"
|
||||
|
||||
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:48545'))
|
||||
|
||||
for i in [signer, sender]:
|
||||
balance=web3.eth.getBalance(i)
|
||||
print(web3.fromWei(balance, 'ether'))
|
|
@ -1,31 +0,0 @@
|
|||
#!/opt/anaconda3/bin/python
|
||||
|
||||
from web3 import Web3
|
||||
from toml import load
|
||||
import sys
|
||||
|
||||
test_env_db = '/home/koal/parity/bridge/test_env_db.toml'
|
||||
try:
|
||||
test_env = load(test_env_db)
|
||||
except:
|
||||
sys.exit(1)
|
||||
|
||||
bridge_config = load(test_env['bridge_config'])
|
||||
|
||||
IPC_file = bridge_config['foreign']['ipc']
|
||||
web3 = Web3(Web3.IPCProvider(IPC_file))
|
||||
|
||||
signer = web3.toChecksumAddress("0xf3ee321df87781864f46f6464e764c2827fca73b")
|
||||
sender = web3.toChecksumAddress("0x37a30534da3d53aa1867adde26e114a3161b2b12")
|
||||
#sender = "0x08c7e1b446520914ba7126325d69fe2863f62413"
|
||||
accounts_list = [signer, sender]
|
||||
|
||||
if (len(sys.argv) == 2):
|
||||
if (sys.argv[1] == "--all"):
|
||||
accounts_list = web3.eth.accounts
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
for i in accounts_list:
|
||||
balance=web3.eth.getBalance(i)
|
||||
print(i, ":", web3.fromWei(balance, 'ether'))
|
|
@ -1,13 +0,0 @@
|
|||
#!/opt/anaconda3/bin/python
|
||||
|
||||
from web3 import Web3
|
||||
#from web3.utils.transactions import wait_for_transaction_receipt
|
||||
|
||||
signer = "0x842eb2142c5aa1260954f07aae39ddee1640c3a7"
|
||||
sender = "0x37a30534da3d53aa1867adde26e114a3161b2b12"
|
||||
|
||||
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:38545'))
|
||||
|
||||
for i in [signer, sender]:
|
||||
balance=web3.eth.getBalance(i)
|
||||
print(i, ":", web3.fromWei(balance, 'ether'))
|
|
@ -1,30 +0,0 @@
|
|||
#!/opt/anaconda3/bin/python
|
||||
|
||||
from web3 import Web3
|
||||
from toml import load
|
||||
import sys
|
||||
|
||||
test_env_db = '/home/koal/parity/bridge/test_env_db.toml'
|
||||
try:
|
||||
test_env = load(test_env_db)
|
||||
except:
|
||||
sys.exit(1)
|
||||
|
||||
bridge_config = load(test_env['bridge_config'])
|
||||
|
||||
IPC_file = bridge_config['home']['ipc']
|
||||
web3 = Web3(Web3.IPCProvider(IPC_file))
|
||||
|
||||
signer = web3.toChecksumAddress("0x842eb2142c5aa1260954f07aae39ddee1640c3a7")
|
||||
sender = web3.toChecksumAddress("0x37a30534da3d53aa1867adde26e114a3161b2b12")
|
||||
accounts_list = [signer, sender]
|
||||
|
||||
if (len(sys.argv) == 2):
|
||||
if (sys.argv[1] == "--all"):
|
||||
accounts_list = web3.eth.accounts
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
for i in accounts_list:
|
||||
balance=web3.eth.getBalance(i)
|
||||
print(i, ":", web3.fromWei(balance, 'ether'))
|
Loading…
Reference in New Issue