Skip to content

Commit 42c4fe4

Browse files
committed
TheLootBoxWallet Linux Beta 0.2.3 release
1 parent 1960128 commit 42c4fe4

File tree

7 files changed

+52
-22
lines changed

7 files changed

+52
-22
lines changed

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
* Removed loot bundles feature
1616
* Improved GUI
1717
* Added icons
18+
19+
## 0.2.3
20+
21+
* Refactored for Python 3.10
22+
* Fixed a few bugs
23+
* Added custom logging based on config value
24+
* Windows build

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Example `config.ini` file:
7676
network = https://goerli-rollup.arbitrum.io/rpc
7777
default_address = your_public_ethereum_address
7878
ens_mainnet_node = your_mainnet_node_url
79+
logs = False
7980
```
8081

8182
### Preview screenshot

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[tool.briefcase]
33
project_name = "TheLootBoxWallet"
44
bundle = "com.thelootboxwallet"
5-
version = "0.2.2"
5+
version = "0.2.3"
66
url = "https://thelootbox.xyz/"
77
license = "MIT"
88
author = "Kyle Benac"

src/TheLootBoxWallet/code/blueprints.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
from datetime import datetime
44
from web3.exceptions import TransactionNotFound
5+
from requests.exceptions import MissingSchema
56

67
import eth_utils
78
from cryptography.fernet import Fernet, InvalidToken
@@ -21,9 +22,12 @@
2122
config_file,
2223
address,
2324
network,
24-
ens_resolver
25+
ens_mainnet_address,
26+
ens_resolver,
27+
logs
2528
)
2629
from eth_account import Account
30+
from TheLootBoxWallet.code.custom_logs import logger
2731

2832
index_blueprint = Blueprint('index_blueprint', __name__)
2933
create_account_blueprint = Blueprint('create_account_blueprint', __name__)
@@ -165,8 +169,8 @@ def save_account_info(pub_address, mnemonic_phrase, private_key, account_id):
165169
'private_key': str(private_key.decode("utf-8")),
166170
'mnemonic_phrase': str(mnemonic_phrase.decode("utf-8"))}
167171
accounts_list.append(account_info)
168-
json.dump(accounts_list, open(__location__ + accounts_file, 'w'))
169-
172+
with open(__location__ + accounts_file, 'w'):
173+
json.dump(accounts_list, open(__location__ + accounts_file, 'w'))
170174

171175
def populate_public_address_list():
172176
public_address_list = []
@@ -180,10 +184,16 @@ def populate_public_address_list():
180184
return public_address_list
181185

182186
def get_ens_name(default_address):
183-
domain = ens_resolver.name(default_address)
184-
if domain == None:
185-
domain = "No ENS name associated with this address."
186-
return domain
187+
try:
188+
if ens_mainnet_address != "":
189+
domain = ens_resolver.name(default_address)
190+
if domain == None:
191+
domain = "No ENS name associated with this address."
192+
else:
193+
domain = None
194+
except MissingSchema:
195+
flash(f"No ENS name associated with this address.", 'warning')
196+
187197

188198
@account_blueprint.route('/account', methods=['GET', 'POST'])
189199
def account():
@@ -211,7 +221,8 @@ def account():
211221
default_address: str = get_pub_address_from_config()
212222
ens_name: str = get_ens_name(default_address)
213223
wei_balance = network.eth.get_balance(default_address)
214-
except (InvalidSignature, InvalidToken, ValueError):
224+
except (InvalidSignature, InvalidToken, ValueError) as e:
225+
print(e)
215226
flash("Invalid account key.", 'warning')
216227
return render_template('unlock.html', account="current", unlock_account_form=unlock_account_form, year=year)
217228
else:
@@ -297,27 +308,30 @@ def send():
297308
@send_transaction_blueprint.route('/send_transaction', methods=['POST'])
298309
def send_transaction():
299310
if request.method == 'POST' and unlocked:
311+
lookup_account_form = LookupAccountForm()
312+
replay_transaction_form = ReplayTransactionForm()
313+
default_address: str = get_pub_address_from_config()
314+
wei_balance = network.eth.get_balance(default_address)
300315
to_account = request.form['to_public_address']
301316
amount = request.form['amount_of_ether']
302317
try:
303318
tx = {
304-
'nonce': network.eth.get_transaction_count(pub_address, 'pending'),
319+
'nonce': network.eth.get_transaction_count(default_address, 'pending'),
305320
'to': to_account,
306321
'value': network.to_wei(amount, 'ether'),
307322
'gas': network.to_wei('0.03', 'gwei'),
308323
'gasPrice': gas_price,
309-
'from': pub_address
324+
'from': default_address
310325
}
311326
sign = network.eth.account.sign_transaction(tx, unlocked_account[1])
312-
network.eth.send_raw_transaction(sign.rawTransaction)
313-
327+
sent_transaction = network.eth.send_raw_transaction(sign.rawTransaction)
328+
if logs:
329+
logger.info(bytes(sent_transaction.hex(), encoding='utf8'))
314330
flash('Transaction sent successfully!', 'success')
315331
except Exception as e:
332+
if logs:
333+
logger.debug(e)
316334
flash(e, 'warning')
317-
lookup_account_form = LookupAccountForm()
318-
replay_transaction_form = ReplayTransactionForm()
319-
default_address: str = get_pub_address_from_config()
320-
wei_balance = network.eth.get_balance(default_address)
321335
return render_template('account.html', account="unlocked", pub_address=default_address,
322336
private_key=unlocked_account[1], mnemonic_phrase=unlocked_account[2],
323337
account_list=populate_public_address_list(), lookup_account_form=lookup_account_form, replay_transaction_form=replay_transaction_form,

src/TheLootBoxWallet/code/config.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import logging
2+
3+
logging.basicConfig(filename='TheLootBoxWallet.log', encoding='utf-8', level=logging.INFO)
4+
5+
logging.getLogger("web3.RequestManager").setLevel(logging.WARNING)
6+
logging.getLogger("web3.providers.HTTPProvider").setLevel(logging.WARNING)
7+
logging.getLogger("requests").setLevel(logging.WARNING)
8+
logging.getLogger("urllib3").setLevel(logging.WARNING)
9+
10+
logger = logging.getLogger(__name__)

src/TheLootBoxWallet/code/networks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
config.read(__location__ + config_file)
1313
network = Web3(Web3.HTTPProvider(config['DEFAULT']['network']))
1414
address = config['DEFAULT']['default_address']
15+
ens_mainnet_address = config['DEFAULT']['ens_mainnet_node']
1516
ens_mainnet_node = Web3(Web3.HTTPProvider(config['DEFAULT']['ens_mainnet_node']))
17+
logs = config['DEFAULT']['logs']
1618
else:
1719
network = Web3(Web3.HTTPProvider('https://goerli-rollup.arbitrum.io/rpc'))
1820
ens_mainnet_node = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/c027bbda707e4d6d83124ca432d42e6f'))
19-
21+
logs = False
2022
ens_resolver = ENS.from_web3(ens_mainnet_node)
2123

2224
from web3.middleware import geth_poa_middleware

0 commit comments

Comments
 (0)