mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-19 05:35:51 +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(() => {
|
useEffect(() => {
|
||||||
try {
|
try {
|
||||||
|
setIsLoading(true)
|
||||||
chrome.runtime.sendMessage({ action: "getWalletInfo" }, (response) => {
|
chrome.runtime.sendMessage({ action: "getWalletInfo" }, (response) => {
|
||||||
if (response && response?.walletInfo) {
|
if (response && response?.walletInfo) {
|
||||||
setRawWallet(response?.walletInfo);
|
setRawWallet(response?.walletInfo);
|
||||||
setExtstate("authenticated");
|
setExtstate("authenticated");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {}
|
} catch (error) {} finally {
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -737,8 +740,14 @@ function App() {
|
|||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography color="errror">{sendPaymentError}</Typography>
|
<Spacer height="10px" />
|
||||||
<Typography>{sendPaymentSuccess}</Typography>
|
<Typography sx={{
|
||||||
|
color: "red",
|
||||||
|
fontSize: "12px",
|
||||||
|
fontFamily: "Inter",
|
||||||
|
fontWeight: '600'
|
||||||
|
}}>{sendPaymentError}</Typography>
|
||||||
|
{/* <Typography>{sendPaymentSuccess}</Typography> */}
|
||||||
<Spacer height="25px" />
|
<Spacer height="25px" />
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -213,7 +213,9 @@ async function getNameOrAddress(receiver) {
|
|||||||
}
|
}
|
||||||
if (!response?.ok) throw new Error("Cannot fetch name");
|
if (!response?.ok) throw new Error("Cannot fetch name");
|
||||||
return { error: "cannot validate address or 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 }) {
|
async function sendCoin({ password, amount, receiver }) {
|
||||||
try {
|
try {
|
||||||
@ -238,7 +240,6 @@ async function sendCoin({ password, amount, receiver }) {
|
|||||||
);
|
);
|
||||||
return {res, validApi};
|
return {res, validApi};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log({ error });
|
|
||||||
throw new Error(error.message);
|
throw new Error(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +302,6 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||||||
getBalanceInfo()
|
getBalanceInfo()
|
||||||
.then((balance) => {
|
.then((balance) => {
|
||||||
sendResponse(balance);
|
sendResponse(balance);
|
||||||
console.log("balance:", balance);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
|
@ -3,10 +3,19 @@
|
|||||||
import Base58 from "../deps/Base58"
|
import Base58 from "../deps/Base58"
|
||||||
|
|
||||||
export const validateAddress = (address) => {
|
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)) {
|
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