This commit is contained in:
PhilReact 2024-04-16 13:25:36 +03:00
parent b6ac6a5e80
commit 1e3fa6a42a
3 changed files with 27 additions and 9 deletions

View File

@ -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={() => {

View File

@ -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);

View File

@ -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
}