Bug fixes

This commit is contained in:
sairaj mote 2023-10-19 13:42:19 +05:30
parent 75696ff968
commit dcdada2464
3 changed files with 28 additions and 24 deletions

View File

@ -537,7 +537,7 @@
</header>
<div id="increase_fee_popup_content"></div>
</sm-popup>
<sm-popup id="txid_popup">
<sm-popup id="transaction_result_popup">
<header slot="header" class="popup__header">
<div class="flex align-center">
<button class="popup__header__close" onclick="closePopup()">
@ -550,21 +550,7 @@
</button>
</div>
</header>
<div class="grid gap-2">
<svg class="icon user-action-result__icon success" xmlns="http://www.w3.org/2000/svg" height="24px"
viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
</svg>
<div class="grid gap-0-5 justify-center text-center">
<h4>Transaction sent</h4>
<p>Confirmation of transaction might take few hours. </p>
</div>
<div class="grid">
<span class="label">Transaction ID</span>
<sm-copy id="txid_popup__resolved_txid"></sm-copy>
</div>
</div>
<div id="transaction_result_popup__content" class="grid gap-2"></div>
</sm-popup>
<template id="sender_template">
<fieldset class="sender-card card">
@ -2031,12 +2017,32 @@
})
function showTransactionResult(status, txid) {
switch (status) {
case 'success':
renderElem(getRef('transaction_result_popup__content'), html`
<svg class="icon user-action-result__icon success" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"> <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" /> </svg>
<div class="grid gap-0-5 justify-center text-center">
<h4>Transaction sent</h4>
<p>Confirmation of transaction might take few hours. </p>
</div>
<div class="grid">
<span class="label">Transaction ID</span>
<sm-copy value=${txid}></sm-copy>
</div>
<a class="button button--primary" href=${`https://ranchimall.github.io/btcwallet/#/check_details?query=${txid}`}>Check transaction status</a>
`)
break;
}
openPopup('transaction_result_popup')
}
getRef('send_transaction').onclick = async evt => {
buttonLoader('send_transaction', true)
const [senders, privKeys, receivers, amounts] = getTransactionInputs();
let fee = parseFloat(getRef('recommended_fee').dataset.btcAmount);
let fee = parseFloat(getRef('recommended_fee')?.dataset.btcAmount);
if (getRef('fees_selector').value === 'custom') {
const feeInput = document.getElementById('send_fee').value.trim();
const feeInput = getRef('send_fee').value.trim();
if (!feeInput || isNaN(feeInput) || feeInput <= 0) {
notify('Please enter a valid fee', 'error');
buttonLoader('send_transaction', false)
@ -2078,8 +2084,7 @@
}
btcOperator.sendTx(senders, privKeys, receivers, amounts, fee).then(txid => {
console.log(txid);
getRef('txid_popup__resolved_txid').value = txid;
openPopup('txid_popup', true);
showTransactionResult('success', txid);
getRef('send_tx').reset();
}).catch(error => {
console.error(error)
@ -2254,8 +2259,7 @@
btcOperator.broadcastTx(signedTxHex).then(txId => {
console.log(txId)
closePopup()
getRef('txid_popup__resolved_txid').value = txId;
openPopup('txid_popup', true);
showTransactionResult('success', txId)
}).catch(e => {
notify(e, 'error')
}).finally(_ => {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long