Update index.html
This commit is contained in:
parent
86154f268b
commit
8cbd06aadb
565
index.html
565
index.html
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -254,8 +255,8 @@
|
|||||||
<div class="grid gap-0-5">
|
<div class="grid gap-0-5">
|
||||||
<h4>Did you forget your Binance Address?</h4>
|
<h4>Did you forget your Binance Address?</h4>
|
||||||
<p>
|
<p>
|
||||||
If you have your BSC/BTC/FLO Private Key, enter it here and recover your
|
If you have your BSC/BTC/FLO Private Key, enter it here and recover
|
||||||
Binance Address.
|
your Binance Address.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<sm-form>
|
<sm-form>
|
||||||
@ -1120,6 +1121,7 @@
|
|||||||
if (/^[0-9a-fA-F]{64}$/.test(keyToConvert)) {
|
if (/^[0-9a-fA-F]{64}$/.test(keyToConvert)) {
|
||||||
keyToConvert = coinjs.privkey2wif(keyToConvert);
|
keyToConvert = coinjs.privkey2wif(keyToConvert);
|
||||||
}
|
}
|
||||||
|
console.log("lkkkk", keyToConvert);
|
||||||
const ethPrivateKey = coinjs.wif2privkey(keyToConvert).privkey;
|
const ethPrivateKey = coinjs.wif2privkey(keyToConvert).privkey;
|
||||||
BSCAddress = floEthereum.ethAddressFromPrivateKey(ethPrivateKey);
|
BSCAddress = floEthereum.ethAddressFromPrivateKey(ethPrivateKey);
|
||||||
floAddress = keyToConvert.startsWith("R")
|
floAddress = keyToConvert.startsWith("R")
|
||||||
@ -1222,6 +1224,9 @@
|
|||||||
buttonLoader("check_balance_button", false);
|
buttonLoader("check_balance_button", false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function handleInvalidSearch() {
|
function handleInvalidSearch() {
|
||||||
if (document.startViewTransition)
|
if (document.startViewTransition)
|
||||||
document.startViewTransition(() => {
|
document.startViewTransition(() => {
|
||||||
@ -1269,74 +1274,81 @@
|
|||||||
Check balance
|
Check balance
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<sm-input
|
|
||||||
id="private_key_input"
|
|
||||||
placeholder="Sender's FLO/BTC/BSC private key"
|
|
||||||
oninput=${handleSenderInput}
|
|
||||||
data-private-key
|
|
||||||
class="password-field"
|
<sm-input
|
||||||
type="password"
|
id="private_key_input"
|
||||||
animate
|
placeholder="Sender's FLO/BTC/BSC private key"
|
||||||
required
|
oninput=${handleSenderInput}
|
||||||
>
|
data-private-key
|
||||||
<svg
|
class="password-field"
|
||||||
class="icon"
|
type="password"
|
||||||
slot="icon"
|
animate
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
required
|
||||||
enable-background="new 0 0 24 24"
|
>
|
||||||
height="24px"
|
<svg
|
||||||
viewBox="0 0 24 24"
|
class="icon"
|
||||||
width="24px"
|
slot="icon"
|
||||||
fill="#000000"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
enable-background="new 0 0 24 24"
|
||||||
<g><rect fill="none" height="24" width="24"></rect></g>
|
height="24px"
|
||||||
<g>
|
viewBox="0 0 24 24"
|
||||||
<path
|
width="24px"
|
||||||
d="M21,10h-8.35C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6s2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H13l2,2l2-2l2,2l4-4.04L21,10z M7,15c-1.65,0-3-1.35-3-3c0-1.65,1.35-3,3-3s3,1.35,3,3C10,13.65,8.65,15,7,15z"
|
fill="#000000"
|
||||||
></path>
|
>
|
||||||
</g>
|
<g><rect fill="none" height="24" width="24"></rect></g>
|
||||||
</svg>
|
<g>
|
||||||
<label slot="right" class="interact">
|
<path
|
||||||
<input
|
d="M21,10h-8.35C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6s2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H13l2,2l2-2l2,2l4-4.04L21,10z M7,15c-1.65,0-3-1.35-3-3c0-1.65,1.35-3,3-3s3,1.35,3,3C10,13.65,8.65,15,7,15z"
|
||||||
type="checkbox"
|
></path>
|
||||||
class="hidden"
|
</g>
|
||||||
autocomplete="off"
|
</svg>
|
||||||
readonly
|
<label slot="right" class="interact">
|
||||||
onchange="togglePrivateKeyVisibility(this)"
|
<input
|
||||||
/>
|
type="checkbox"
|
||||||
<svg
|
class="hidden"
|
||||||
class="icon invisible"
|
autocomplete="off"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
readonly
|
||||||
height="24px"
|
onchange="togglePrivateKeyVisibility(this)"
|
||||||
viewBox="0 0 24 24"
|
/>
|
||||||
width="24px"
|
<svg
|
||||||
fill="#000000"
|
class="icon invisible"
|
||||||
>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
<title>Hide password</title>
|
height="24px"
|
||||||
<path
|
viewBox="0 0 24 24"
|
||||||
d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z"
|
width="24px"
|
||||||
fill="none"
|
fill="#000000"
|
||||||
></path>
|
>
|
||||||
<path
|
<title>Hide password</title>
|
||||||
d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
|
<path
|
||||||
></path>
|
d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z"
|
||||||
</svg>
|
fill="none"
|
||||||
<svg
|
></path>
|
||||||
class="icon visible"
|
<path
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
|
||||||
height="24px"
|
></path>
|
||||||
viewBox="0 0 24 24"
|
</svg>
|
||||||
width="24px"
|
<svg
|
||||||
fill="#000000"
|
class="icon visible"
|
||||||
>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
<title>Show password</title>
|
height="24px"
|
||||||
<path d="M0 0h24v24H0z" fill="none"></path>
|
viewBox="0 0 24 24"
|
||||||
<path
|
width="24px"
|
||||||
d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
|
fill="#000000"
|
||||||
></path>
|
>
|
||||||
</svg>
|
<title>Show password</title>
|
||||||
</label>
|
<path d="M0 0h24v24H0z" fill="none"></path>
|
||||||
</sm-input>
|
<path
|
||||||
|
d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
</label>
|
||||||
|
</sm-input>
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="sender_balance_container"
|
id="sender_balance_container"
|
||||||
class="flex align-center gap-0-3 hidden"
|
class="flex align-center gap-0-3 hidden"
|
||||||
@ -1468,11 +1480,84 @@
|
|||||||
renderError("Please switch MetaMask to Binance Mainnet");
|
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) {
|
function togglePrivateKeyVisibility(input) {
|
||||||
const target = input.closest("sm-input");
|
console.log(input)
|
||||||
target.type = target.type === "password" ? "text" : "password";
|
const target = input.closest("sm-input");
|
||||||
target.focusIn();
|
// const checkBalanceButton = document.querySelector("#check_balance_button");
|
||||||
}
|
console.log(target)
|
||||||
|
target.type = target.type === "password" ? "text" : "password";
|
||||||
|
// target.focus();
|
||||||
|
|
||||||
|
|
||||||
|
// checkBalanceButton.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// const toggleButton = document.querySelector('#toggleButton');
|
||||||
|
// const privateKeyInput = document.querySelector('#private_key_input');
|
||||||
|
|
||||||
|
// toggleButton.addEventListener('click', () => {
|
||||||
|
// togglePrivateKeyVisibility(privateKeyInput);
|
||||||
|
// });
|
||||||
function checkSenderBalance() {
|
function checkSenderBalance() {
|
||||||
let address;
|
let address;
|
||||||
const privateKey = getRef("private_key_input").value.trim();
|
const privateKey = getRef("private_key_input").value.trim();
|
||||||
@ -1533,9 +1618,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleSenderInput(e) {
|
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) {
|
if (!e.target.isValid) {
|
||||||
getRef("sender_balance_container").classList.add("hidden");
|
// getRef("sender_balance_container").classList.add("hidden");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleAssetChange(e) {
|
function handleAssetChange(e) {
|
||||||
@ -1599,12 +1685,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getRef("send_tx_form").reset();
|
getRef("send_tx_form").reset();
|
||||||
getRef("sender_balance_container").classList.add("hidden");
|
// getRef("sender_balance_container").classList.add("hidden");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
showTransactionResult("failed", {
|
showTransactionResult("failed", {
|
||||||
description: `Insufficient ${asset.toUpperCase()} balance`,
|
description: `Insufficient ${asset.toUpperCase()} balance`,
|
||||||
});
|
});
|
||||||
const regex = /\(error=({.*?}),/;
|
const regex = /\(error=({.*?}),/;
|
||||||
const match = e.message.match(regex);
|
const match = e.message.match(regex);
|
||||||
if (match && match[1]) {
|
if (match && match[1]) {
|
||||||
@ -1621,107 +1707,219 @@
|
|||||||
buttonLoader("send_tx_button", false);
|
buttonLoader("send_tx_button", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showTransactionResult(status, { txHash, description = "" }) {
|
// function showTransactionResult(status, { txHash, description = "" }) {
|
||||||
switch (status) {
|
// switch (status) {
|
||||||
case "pending":
|
// case "pending":
|
||||||
renderElem(
|
// renderElem(
|
||||||
getRef("transaction_result_popup__content"),
|
// getRef("transaction_result_popup__content"),
|
||||||
html`
|
// html`
|
||||||
<ul>
|
// <ul>
|
||||||
<li class="transaction__phase">
|
// <li class="transaction__phase">
|
||||||
<svg
|
// <svg
|
||||||
class="icon confirmed"
|
// class="icon confirmed"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
// xmlns="http://www.w3.org/2000/svg"
|
||||||
height="24px"
|
// height="24px"
|
||||||
viewBox="0 0 24 24"
|
// viewBox="0 0 24 24"
|
||||||
width="24px"
|
// width="24px"
|
||||||
fill="#000000"
|
// fill="#000000"
|
||||||
>
|
// >
|
||||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
// <path d="M0 0h24v24H0V0z" fill="none" />
|
||||||
<path
|
// <path
|
||||||
d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
// d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
||||||
/>
|
// />
|
||||||
</svg>
|
// </svg>
|
||||||
<h4>Transaction sent</h4>
|
// <h4>Transaction sent</h4>
|
||||||
</li>
|
// </li>
|
||||||
<li class="transaction__phase">
|
// <li class="transaction__phase">
|
||||||
<sm-spinner></sm-spinner>
|
// <sm-spinner></sm-spinner>
|
||||||
<p>Waiting for transaction to be confirmed</p>
|
// <p>Waiting for transaction to be confirmed</p>
|
||||||
</li>
|
// </li>
|
||||||
</ul>
|
// </ul>
|
||||||
<div class="grid">
|
// <div class="grid">
|
||||||
<span class="label">Transaction ID</span>
|
// <span class="label">Transaction ID</span>
|
||||||
<sm-copy value=${txHash}></sm-copy>
|
// <sm-copy value=${txHash}></sm-copy>
|
||||||
</div>
|
// </div>
|
||||||
<a
|
// <a
|
||||||
class="button button--primary"
|
// class="button button--primary"
|
||||||
target="_blank"
|
// target="_blank"
|
||||||
href=${`https://bscscan.com/tx/${txHash}`}
|
// href=${`https://bscscan.com/tx/${txHash}`}
|
||||||
>Check transaction status</a
|
// >Check transaction status</a
|
||||||
>
|
// >
|
||||||
`
|
// `
|
||||||
);
|
// );
|
||||||
break;
|
// break;
|
||||||
case "confirmed":
|
// case "confirmed":
|
||||||
renderElem(
|
// renderElem(
|
||||||
getRef("transaction_result_popup__content"),
|
// getRef("transaction_result_popup__content"),
|
||||||
html`
|
// html`
|
||||||
<svg
|
// <svg
|
||||||
class="icon user-action-result__icon confirmed"
|
// class="icon user-action-result__icon confirmed"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
// xmlns="http://www.w3.org/2000/svg"
|
||||||
height="24px"
|
// height="24px"
|
||||||
viewBox="0 0 24 24"
|
// viewBox="0 0 24 24"
|
||||||
width="24px"
|
// width="24px"
|
||||||
fill="#000000"
|
// fill="#000000"
|
||||||
>
|
// >
|
||||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
// <path d="M0 0h24v24H0V0z" fill="none" />
|
||||||
<path
|
// <path
|
||||||
d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
// d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
||||||
/>
|
// />
|
||||||
</svg>
|
// </svg>
|
||||||
<div class="grid gap-0-5 justify-center text-center">
|
// <div class="grid gap-0-5 justify-center text-center">
|
||||||
<h4>Transaction confirmed</h4>
|
// <h4>Transaction confirmed</h4>
|
||||||
<p>Transaction has been confirmed on the blockchain.</p>
|
// <p>Transaction has been confirmed on the blockchain.</p>
|
||||||
</div>
|
// </div>
|
||||||
<div class="grid">
|
// <div class="grid">
|
||||||
<span class="label">Transaction ID</span>
|
// <span class="label">Transaction ID</span>
|
||||||
<sm-copy value=${txHash}></sm-copy>
|
// <sm-copy value=${txHash}></sm-copy>
|
||||||
</div>
|
// </div>
|
||||||
<a
|
// <a
|
||||||
class="button button--primary"
|
// class="button button--primary"
|
||||||
target="_blank"
|
// target="_blank"
|
||||||
href=${`https://bscscan.com/tx/${txHash}`}
|
// href=${`https://bscscan.com/tx/${txHash}`}
|
||||||
>Check transaction status</a
|
// >Check transaction status</a
|
||||||
>
|
// >
|
||||||
`
|
// `
|
||||||
);
|
// );
|
||||||
break;
|
// break;
|
||||||
case "failed":
|
// case "failed":
|
||||||
renderElem(
|
// renderElem(
|
||||||
getRef("transaction_result_popup__content"),
|
// getRef("transaction_result_popup__content"),
|
||||||
html`
|
// html`
|
||||||
<svg
|
// <svg
|
||||||
class="icon user-action-result__icon failed"
|
// class="icon user-action-result__icon failed"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
// xmlns="http://www.w3.org/2000/svg"
|
||||||
height="24px"
|
// height="24px"
|
||||||
viewBox="0 0 24 24"
|
// viewBox="0 0 24 24"
|
||||||
width="24px"
|
// width="24px"
|
||||||
fill="#000000"
|
// fill="#000000"
|
||||||
>
|
// >
|
||||||
<path
|
// <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"
|
// 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>
|
// </svg>
|
||||||
<div class="grid gap-0-5 justify-center text-center">
|
// <div class="grid gap-0-5 justify-center text-center">
|
||||||
<h4>Transaction failed</h4>
|
// <h4>Transaction failed</h4>
|
||||||
<p>${description}</p>
|
// <p>${description}</p>
|
||||||
</div>
|
// </div>
|
||||||
`
|
// `
|
||||||
);
|
// );
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
openPopup("transaction_result_popup");
|
// 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(
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.addRoute("create", (state) => {
|
router.addRoute("create", (state) => {
|
||||||
getRef("page_container").dataset.page = "create";
|
getRef("page_container").dataset.page = "create";
|
||||||
renderElem(
|
renderElem(
|
||||||
@ -1830,9 +2028,9 @@
|
|||||||
let bscPrivateKey = getRef("retrieve_btc_addr_field").value.trim();
|
let bscPrivateKey = getRef("retrieve_btc_addr_field").value.trim();
|
||||||
getRef("recovered_btc_addr_wrapper").classList.remove("hidden");
|
getRef("recovered_btc_addr_wrapper").classList.remove("hidden");
|
||||||
getRef("recovered_btc_addr").value =
|
getRef("recovered_btc_addr").value =
|
||||||
bscPrivateKey.startsWith("R") ||
|
bscPrivateKey.startsWith("R") ||
|
||||||
bscPrivateKey.startsWith("L") ||
|
bscPrivateKey.startsWith("L") ||
|
||||||
bscPrivateKey.startsWith("K")
|
bscPrivateKey.startsWith("K")
|
||||||
? floEthereum.ethAddressFromPrivateKey(
|
? floEthereum.ethAddressFromPrivateKey(
|
||||||
coinjs.wif2privkey(bscPrivateKey).privkey
|
coinjs.wif2privkey(bscPrivateKey).privkey
|
||||||
)
|
)
|
||||||
@ -1847,3 +2045,4 @@
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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" }); -->
|
||||||
Loading…
Reference in New Issue
Block a user