load_wallet
Function
def load_wallet(address, secret):
file_path = "./data/wallets/{}/keystore".format(address)
if not os.path.exists(file_path):
raise FileNotFoundError
keystore = "\n".join([line.strip() for line in open(file_path, 'r+')])
private_key = web3.eth.account.decrypt(keystore, secret)
return web3.eth.account.from_key(private_key)
Description
Set the file path for the wallet’s keystore
If the file doesn’t exist then raise FileNotFoundError
Load the keystore as a string
Decrypt the keystore with secret
Return the account