Update index.html

This commit is contained in:
SaketAnand 2024-08-15 02:55:59 +05:30
parent 86154f268b
commit 8cbd06aadb

View File

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html lang="en">
<head>
@ -254,8 +255,8 @@
<div class="grid gap-0-5">
<h4>Did you forget your Binance Address?</h4>
<p>
If you have your BSC/BTC/FLO Private Key, enter it here and recover your
Binance Address.
If you have your BSC/BTC/FLO Private Key, enter it here and recover
your Binance Address.
</p>
</div>
<sm-form>
@ -1120,6 +1121,7 @@
if (/^[0-9a-fA-F]{64}$/.test(keyToConvert)) {
keyToConvert = coinjs.privkey2wif(keyToConvert);
}
console.log("lkkkk", keyToConvert);
const ethPrivateKey = coinjs.wif2privkey(keyToConvert).privkey;
BSCAddress = floEthereum.ethAddressFromPrivateKey(ethPrivateKey);
floAddress = keyToConvert.startsWith("R")
@ -1222,6 +1224,9 @@
buttonLoader("check_balance_button", false);
});
}
function handleInvalidSearch() {
if (document.startViewTransition)
document.startViewTransition(() => {
@ -1269,6 +1274,11 @@
Check balance
</button>
</div>
<sm-input
id="private_key_input"
placeholder="Sender's FLO/BTC/BSC private key"
@ -1337,6 +1347,8 @@
</svg>
</label>
</sm-input>
<div
id="sender_balance_container"
class="flex align-center gap-0-3 hidden"
@ -1468,11 +1480,84 @@
renderError("Please switch MetaMask to Binance Mainnet");
}
});
// function togglePrivateKeyVisibility(input) {
// const target = input.closest("sm-input") ;
// target.type = target.type === "password" ? "text" : "password";
// target.focusIn();
// }
function togglePrivateKeyVisibility(input) {
console.log(input)
const target = input.closest("sm-input");
// const checkBalanceButton = document.querySelector("#check_balance_button");
console.log(target)
target.type = target.type === "password" ? "text" : "password";
target.focusIn();
}
// target.focus();
// checkBalanceButton.disabled = false;
}
// const toggleButton = document.querySelector('#toggleButton');
// const privateKeyInput = document.querySelector('#private_key_input');
// toggleButton.addEventListener('click', () => {
// togglePrivateKeyVisibility(privateKeyInput);
// });
function checkSenderBalance() {
let address;
const privateKey = getRef("private_key_input").value.trim();
@ -1533,9 +1618,10 @@
});
}
function handleSenderInput(e) {
getRef("check_balance_button").disabled = !e.target.isValid;
console.log(e.target.isValid)
getRef("check_balance_button").disabled = false;
if (!e.target.isValid) {
getRef("sender_balance_container").classList.add("hidden");
// getRef("sender_balance_container").classList.add("hidden");
}
}
function handleAssetChange(e) {
@ -1599,7 +1685,7 @@
}
}
getRef("send_tx_form").reset();
getRef("sender_balance_container").classList.add("hidden");
// getRef("sender_balance_container").classList.add("hidden");
} catch (e) {
console.error(e.message);
showTransactionResult("failed", {
@ -1621,7 +1707,147 @@
buttonLoader("send_tx_button", false);
}
}
function showTransactionResult(status, { txHash, description = "" }) {
// function showTransactionResult(status, { txHash, description = "" }) {
// switch (status) {
// case "pending":
// renderElem(
// getRef("transaction_result_popup__content"),
// html`
// <ul>
// <li class="transaction__phase">
// <svg
// class="icon confirmed"
// 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>
// <h4>Transaction sent</h4>
// </li>
// <li class="transaction__phase">
// <sm-spinner></sm-spinner>
// <p>Waiting for transaction to be confirmed</p>
// </li>
// </ul>
// <div class="grid">
// <span class="label">Transaction ID</span>
// <sm-copy value=${txHash}></sm-copy>
// </div>
// <a
// class="button button--primary"
// target="_blank"
// href=${`https://bscscan.com/tx/${txHash}`}
// >Check transaction status</a
// >
// `
// );
// break;
// case "confirmed":
// renderElem(
// getRef("transaction_result_popup__content"),
// html`
// <svg
// class="icon user-action-result__icon confirmed"
// 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 confirmed</h4>
// <p>Transaction has been confirmed on the blockchain.</p>
// </div>
// <div class="grid">
// <span class="label">Transaction ID</span>
// <sm-copy value=${txHash}></sm-copy>
// </div>
// <a
// class="button button--primary"
// target="_blank"
// href=${`https://bscscan.com/tx/${txHash}`}
// >Check transaction status</a
// >
// `
// );
// break;
// case "failed":
// renderElem(
// getRef("transaction_result_popup__content"),
// html`
// <svg
// class="icon user-action-result__icon failed"
// xmlns="http://www.w3.org/2000/svg"
// height="24px"
// viewBox="0 0 24 24"
// width="24px"
// fill="#000000"
// >
// <path
// d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
// />
// </svg>
// <div class="grid gap-0-5 justify-center text-center">
// <h4>Transaction failed</h4>
// <p>${description}</p>
// </div>
// `
// );
// break;
// }
// openPopup("transaction_result_popup");
// }
// *************************************************************************
// ***************************************************************************
// function showTransactionResult(status, { txHash, description = "Insufficient BSC balance" })
// { switch (status)
// { case "pending": renderElem( getRef("transaction_result_popup__content"),
// html` <ul> <li class="transaction__phase"> <svg class="icon confirmed" 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> <h4>Transaction sent</h4> </li> <li class="transaction__phase"> <sm-spinner></sm-spinner> <p>Waiting for transaction to be confirmed</p> </li> </ul>
// <div class="grid"> <span class="label">Transaction ID</span>
// <sm-copy value=${txHash}></sm-copy> </div>
// <a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`} >Check transaction status</a > ` );
// break;
// case "confirmed":
// renderElem( getRef("transaction_result_popup__content"),
// html` <svg class="icon user-action-result__icon confirmed" 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 confirmed</h4>
// <p>Transaction has been confirmed on the blockchain.</p> </div>
// <div class="grid"> <span class="label">Transaction ID</span>
// <sm-copy value=${txHash}></sm-copy> </div>
// <a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`} >Check transaction status</a > ` );
// break;
// case "failed": renderElem( getRef("transaction_result_popup__content"),
// html` <svg class="icon user-action-result__icon failed" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000" > <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" /> </svg> <div class="grid gap-0-5 justify-center text-center">
// <h4>Transaction failed</h4>
// <p>"Insufficient BSC balance"</p> </div> ` );
// break;
// } openPopup("transaction_result_popup"); }
// showTransactionResult("failed", { txHash: "your-tx-hash-here", description: "Insufficient BSC balance" });
function showTransactionResult(status, { txHash, usdtBalance, bscBalance }) {
let description = "Insufficient BSC balance";
if (usdtBalance <= 0) {
description = "Insufficient USDT balance";
} else if (bscBalance <= 0) {
description = "Insufficient BSC balance";
}
switch (status) {
case "pending":
renderElem(
@ -1629,18 +1855,9 @@
html`
<ul>
<li class="transaction__phase">
<svg
class="icon confirmed"
xmlns="http://www.w3.org/2000/svg"
height="24px"
viewBox="0 0 24 24"
width="24px"
fill="#000000"
>
<svg class="icon confirmed" 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"
/>
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
</svg>
<h4>Transaction sent</h4>
</li>
@ -1653,12 +1870,9 @@
<span class="label">Transaction ID</span>
<sm-copy value=${txHash}></sm-copy>
</div>
<a
class="button button--primary"
target="_blank"
href=${`https://bscscan.com/tx/${txHash}`}
>Check transaction status</a
>
<a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`}>
Check transaction status
</a>
`
);
break;
@ -1666,18 +1880,9 @@
renderElem(
getRef("transaction_result_popup__content"),
html`
<svg
class="icon user-action-result__icon confirmed"
xmlns="http://www.w3.org/2000/svg"
height="24px"
viewBox="0 0 24 24"
width="24px"
fill="#000000"
>
<svg class="icon user-action-result__icon confirmed" 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"
/>
<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 confirmed</h4>
@ -1687,12 +1892,9 @@
<span class="label">Transaction ID</span>
<sm-copy value=${txHash}></sm-copy>
</div>
<a
class="button button--primary"
target="_blank"
href=${`https://bscscan.com/tx/${txHash}`}
>Check transaction status</a
>
<a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`}>
Check transaction status
</a>
`
);
break;
@ -1700,17 +1902,8 @@
renderElem(
getRef("transaction_result_popup__content"),
html`
<svg
class="icon user-action-result__icon failed"
xmlns="http://www.w3.org/2000/svg"
height="24px"
viewBox="0 0 24 24"
width="24px"
fill="#000000"
>
<path
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
/>
<svg class="icon user-action-result__icon failed" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
</svg>
<div class="grid gap-0-5 justify-center text-center">
<h4>Transaction failed</h4>
@ -1721,7 +1914,12 @@
break;
}
openPopup("transaction_result_popup");
}
}
router.addRoute("create", (state) => {
getRef("page_container").dataset.page = "create";
renderElem(
@ -1847,3 +2045,4 @@
</script>
</body>
</html>
<!-- function showTransactionResult(status, { txHash, description = "Insufficient BSC balance" }) { switch (status) { case "pending": renderElem( getRef("transaction_result_popup__content"), html` <ul> <li class="transaction__phase"> <svg class="icon confirmed" 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> <h4>Transaction sent</h4> </li> <li class="transaction__phase"> <sm-spinner></sm-spinner> <p>Waiting for transaction to be confirmed</p> </li> </ul> <div class="grid"> <span class="label">Transaction ID</span> <sm-copy value=${txHash}></sm-copy> </div> <a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`} >Check transaction status</a > ` ); break; case "confirmed": renderElem( getRef("transaction_result_popup__content"), html` <svg class="icon user-action-result__icon confirmed" 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 confirmed</h4> <p>Transaction has been confirmed on the blockchain.</p> </div> <div class="grid"> <span class="label">Transaction ID</span> <sm-copy value=${txHash}></sm-copy> </div> <a class="button button--primary" target="_blank" href=${`https://bscscan.com/tx/${txHash}`} >Check transaction status</a > ` ); break; case "failed": renderElem( getRef("transaction_result_popup__content"), html` <svg class="icon user-action-result__icon failed" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000" > <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" /> </svg> <div class="grid gap-0-5 justify-center text-center"> <h4>Transaction failed</h4> <p>"Insufficient BSC balance"</p> </div> ` ); break; } openPopup("transaction_result_popup"); } showTransactionResult("failed", { txHash: "your-tx-hash-here", description: "Insufficient BSC balance" }); -->