mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-14 11:15:49 +00:00
fixes
This commit is contained in:
parent
b6ac6a5e80
commit
1e3fa6a42a
15
src/App.tsx
15
src/App.tsx
@ -345,13 +345,16 @@ function App() {
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
setIsLoading(true)
|
||||
chrome.runtime.sendMessage({ action: "getWalletInfo" }, (response) => {
|
||||
if (response && response?.walletInfo) {
|
||||
setRawWallet(response?.walletInfo);
|
||||
setExtstate("authenticated");
|
||||
}
|
||||
});
|
||||
} catch (error) {}
|
||||
} catch (error) {} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@ -737,8 +740,14 @@ function App() {
|
||||
autoComplete="off"
|
||||
/>
|
||||
</Box>
|
||||
<Typography color="errror">{sendPaymentError}</Typography>
|
||||
<Typography>{sendPaymentSuccess}</Typography>
|
||||
<Spacer height="10px" />
|
||||
<Typography sx={{
|
||||
color: "red",
|
||||
fontSize: "12px",
|
||||
fontFamily: "Inter",
|
||||
fontWeight: '600'
|
||||
}}>{sendPaymentError}</Typography>
|
||||
{/* <Typography>{sendPaymentSuccess}</Typography> */}
|
||||
<Spacer height="25px" />
|
||||
<CustomButton
|
||||
onClick={() => {
|
||||
|
@ -213,7 +213,9 @@ async function getNameOrAddress(receiver) {
|
||||
}
|
||||
if (!response?.ok) throw new Error("Cannot fetch name");
|
||||
return { error: "cannot validate address or name" };
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
throw new Error(error?.message || "cannot validate address or name")
|
||||
}
|
||||
}
|
||||
async function sendCoin({ password, amount, receiver }) {
|
||||
try {
|
||||
@ -238,7 +240,6 @@ async function sendCoin({ password, amount, receiver }) {
|
||||
);
|
||||
return {res, validApi};
|
||||
} catch (error) {
|
||||
console.log({ error });
|
||||
throw new Error(error.message);
|
||||
}
|
||||
}
|
||||
@ -301,7 +302,6 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
getBalanceInfo()
|
||||
.then((balance) => {
|
||||
sendResponse(balance);
|
||||
console.log("balance:", balance);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error.message);
|
||||
|
@ -3,10 +3,19 @@
|
||||
import Base58 from "../deps/Base58"
|
||||
|
||||
export const validateAddress = (address) => {
|
||||
const decodePubKey = Base58.decode(address)
|
||||
let isAddress = false
|
||||
try {
|
||||
const decodePubKey = Base58.decode(address)
|
||||
|
||||
if (!(decodePubKey instanceof Uint8Array && decodePubKey.length == 25)) {
|
||||
return false
|
||||
isAddress = false
|
||||
} else {
|
||||
isAddress = true
|
||||
}
|
||||
return true
|
||||
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
return isAddress
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user