Skip to content

Commit d30f585

Browse files
committed
* code cleanup
* displaying block explorer links on the FE * displaying a "please change your network to X" prompt * reformatting control dashboard payment info
1 parent 0afc1f1 commit d30f585

File tree

14 files changed

+12634
-388
lines changed

14 files changed

+12634
-388
lines changed

pretix_eth/payment.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,27 @@ def payment_control_render(self, request: HttpRequest, payment: OrderPayment):
302302
hex_wallet_address = self.get_receiving_address()
303303

304304
# display all submitted transaction hashes along with their respective sendr and recipient addresses
305-
signed_messages = list(payment.signed_messages.all().values(
306-
'sender_address',
307-
'recipient_address',
308-
'transaction_hash'
309-
))
310-
311-
ctx = {"payment_info": payment.info_data, "wallet_address": hex_wallet_address, "signed_messages": signed_messages}
305+
last_signed_message: SignedMessage = payment.signed_messages.last()
306+
307+
if last_signed_message is not None:
308+
transaction_sender_address = last_signed_message.sender_address
309+
transaction_recipient_address = last_signed_message.recipient_address
310+
block_explorer_link = None
311+
transaction_hash = last_signed_message.transaction_hash
312+
else:
313+
transaction_sender_address = None
314+
transaction_recipient_address = None
315+
block_explorer_link = None
316+
transaction_hash = None
317+
318+
ctx = {
319+
"payment_info": payment.info_data,
320+
"wallet_address": hex_wallet_address,
321+
"transaction_sender_address": transaction_sender_address,
322+
"transaction_recipient_address": transaction_recipient_address,
323+
"block_explorer_link": block_explorer_link,
324+
"transaction_hash": transaction_hash
325+
}
312326

313327
return template.render(ctx)
314328

pretix_eth/signals.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ def signal_process_response(sender, request, response, **kwargs):
5757
return response
5858

5959

60-
@receiver(html_head, dispatch_uid="payment_eth_add_question_type_javascript")
61-
def add_question_type_javascript(sender, request, **kwargs):
60+
@receiver(html_head,
61+
dispatch_uid="payment_eth_add_web3modal_css_and_javascript")
62+
def add_web3modal_css_and_javascript(sender, request, **kwargs):
6263
# TODO: enable js only when question is asked
6364
# url = resolve(request.path_info)
64-
template = get_template('pretix_eth/question_type_javascript.html')
65+
template = get_template('pretix_eth/web3modal_css_and_javascript.html')
6566
context = {
6667
'event': sender,
6768
}

0 commit comments

Comments
 (0)