Receiver
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) {
- const target = input.closest("sm-input");
- target.type = target.type === "password" ? "text" : "password";
- target.focusIn();
- }
+ 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.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 @@
Receiver
});
}
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,12 +1685,12 @@
Receiver
}
}
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", {
- description: `Insufficient ${asset.toUpperCase()} balance`,
- });
+ description: `Insufficient ${asset.toUpperCase()} balance`,
+ });
const regex = /\(error=({.*?}),/;
const match = e.message.match(regex);
if (match && match[1]) {
@@ -1621,107 +1707,219 @@
Receiver
buttonLoader("send_tx_button", false);
}
}
- function showTransactionResult(status, { txHash, description = "" }) {
- switch (status) {
- case "pending":
- renderElem(
- getRef("transaction_result_popup__content"),
- html`
-
-
- Transaction ID
-
-
-
Check transaction status
- `
- );
- break;
- case "confirmed":
- renderElem(
- getRef("transaction_result_popup__content"),
- html`
-
-
-
-
-
-
Transaction confirmed
-
Transaction has been confirmed on the blockchain.
-
-
- Transaction ID
-
-
-
Check transaction status
- `
- );
- break;
- case "failed":
- renderElem(
- getRef("transaction_result_popup__content"),
- html`
-
-
-
-
-
Transaction failed
-
${description}
-
- `
- );
- break;
- }
- openPopup("transaction_result_popup");
- }
+ // function showTransactionResult(status, { txHash, description = "" }) {
+ // switch (status) {
+ // case "pending":
+ // renderElem(
+ // getRef("transaction_result_popup__content"),
+ // html`
+ //
+ //
+ // Transaction ID
+ //
+ //
+ //
Check transaction status
+ // `
+ // );
+ // break;
+ // case "confirmed":
+ // renderElem(
+ // getRef("transaction_result_popup__content"),
+ // html`
+ //
+ //
+ //
+ //
+ //
+ //
Transaction confirmed
+ //
Transaction has been confirmed on the blockchain.
+ //
+ //
+ // Transaction ID
+ //
+ //
+ //
Check transaction status
+ // `
+ // );
+ // break;
+ // case "failed":
+ // renderElem(
+ // getRef("transaction_result_popup__content"),
+ // html`
+ //
+ //
+ //
+ //
+ //
Transaction failed
+ //
${description}
+ //
+ // `
+ // );
+ // break;
+ // }
+ // openPopup("transaction_result_popup");
+ // }
+
+ // *************************************************************************
+
+// ***************************************************************************
+
+ // function showTransactionResult(status, { txHash, description = "Insufficient BSC balance" })
+ // { switch (status)
+ // { case "pending": renderElem( getRef("transaction_result_popup__content"),
+ // html`
+ //
Transaction ID
+ //
+ //
Check transaction status ` );
+ // break;
+ // case "confirmed":
+ // renderElem( getRef("transaction_result_popup__content"),
+ // html`
+ //
+ //
Transaction confirmed
+ //
Transaction has been confirmed on the blockchain.
+ //
Transaction ID
+ //
+ //
Check transaction status ` );
+ // break;
+ // case "failed": renderElem( getRef("transaction_result_popup__content"),
+ // html`
+ //
Transaction failed
+ //
"Insufficient BSC balance"
` );
+ // 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`
+
+
+ Transaction ID
+
+
+
+ Check transaction status
+
+ `
+ );
+ break;
+ case "confirmed":
+ renderElem(
+ getRef("transaction_result_popup__content"),
+ html`
+
+
+
+
+
+
Transaction confirmed
+
Transaction has been confirmed on the blockchain.
+
+
+ Transaction ID
+
+
+
+ Check transaction status
+
+ `
+ );
+ break;
+ case "failed":
+ renderElem(
+ getRef("transaction_result_popup__content"),
+ html`
+
+
+
+
+
Transaction failed
+
${description}
+
+ `
+ );
+ break;
+ }
+ openPopup("transaction_result_popup");
+}
+
+
+
+
+
router.addRoute("create", (state) => {
getRef("page_container").dataset.page = "create";
renderElem(
@@ -1830,9 +2028,9 @@
Bitcoin Private Key
let bscPrivateKey = getRef("retrieve_btc_addr_field").value.trim();
getRef("recovered_btc_addr_wrapper").classList.remove("hidden");
getRef("recovered_btc_addr").value =
- bscPrivateKey.startsWith("R") ||
- bscPrivateKey.startsWith("L") ||
- bscPrivateKey.startsWith("K")
+ bscPrivateKey.startsWith("R") ||
+ bscPrivateKey.startsWith("L") ||
+ bscPrivateKey.startsWith("K")
? floEthereum.ethAddressFromPrivateKey(
coinjs.wif2privkey(bscPrivateKey).privkey
)
@@ -1847,3 +2045,4 @@
Bitcoin Private Key
+
\ No newline at end of file