added qortalRequest sign tx

This commit is contained in:
PhilReact 2024-11-19 05:19:31 +02:00
parent 14214ba6f0
commit e8b2196b01
7 changed files with 1741 additions and 1479 deletions

12
package-lock.json generated
View File

@ -69,6 +69,7 @@
"react-frame-component": "^5.2.7", "react-frame-component": "^5.2.7",
"react-infinite-scroller": "^1.2.6", "react-infinite-scroller": "^1.2.6",
"react-intersection-observer": "^9.13.0", "react-intersection-observer": "^9.13.0",
"react-json-view-lite": "^2.0.1",
"react-qr-code": "^2.0.15", "react-qr-code": "^2.0.15",
"react-quill": "^2.0.0", "react-quill": "^2.0.0",
"react-redux": "^9.1.2", "react-redux": "^9.1.2",
@ -14416,6 +14417,17 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
}, },
"node_modules/react-json-view-lite": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/react-json-view-lite/-/react-json-view-lite-2.0.1.tgz",
"integrity": "sha512-yElNMSzL7UJ9rMDQIbTiBemXbvfAoqpxM/0IQd3nr52CLLBC0HxOSKcta/bayct2QCq7ZVzLzI8CGfuf387hHw==",
"engines": {
"node": ">=18"
},
"peerDependencies": {
"react": "^18.0.0"
}
},
"node_modules/react-lifecycles-compat": { "node_modules/react-lifecycles-compat": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",

View File

@ -73,6 +73,7 @@
"react-frame-component": "^5.2.7", "react-frame-component": "^5.2.7",
"react-infinite-scroller": "^1.2.6", "react-infinite-scroller": "^1.2.6",
"react-intersection-observer": "^9.13.0", "react-intersection-observer": "^9.13.0",
"react-json-view-lite": "^2.0.1",
"react-qr-code": "^2.0.15", "react-qr-code": "^2.0.15",
"react-quill": "^2.0.0", "react-quill": "^2.0.0",
"react-redux": "^9.1.2", "react-redux": "^9.1.2",

View File

@ -25,6 +25,8 @@ import {
Tooltip, Tooltip,
Typography, Typography,
} from "@mui/material"; } from "@mui/material";
import { JsonView, allExpanded, darkStyles } from 'react-json-view-lite';
import 'react-json-view-lite/dist/index.css';
import { decryptStoredWallet } from "./utils/decryptWallet"; import { decryptStoredWallet } from "./utils/decryptWallet";
import { CountdownCircleTimer } from "react-countdown-circle-timer"; import { CountdownCircleTimer } from "react-countdown-circle-timer";
import Logo1 from "./assets/svgs/Logo1.svg"; import Logo1 from "./assets/svgs/Logo1.svg";
@ -113,12 +115,14 @@ import {
} from "./atoms/global"; } from "./atoms/global";
import { useAppFullScreen } from "./useAppFullscreen"; import { useAppFullScreen } from "./useAppFullscreen";
import { NotAuthenticated } from "./ExtStates/NotAuthenticated"; import { NotAuthenticated } from "./ExtStates/NotAuthenticated";
import { openIndexedDB, showSaveFilePicker } from "./components/Apps/useQortalMessageListener"; import {
openIndexedDB,
showSaveFilePicker,
} from "./components/Apps/useQortalMessageListener";
import { fileToBase64 } from "./utils/fileReading"; import { fileToBase64 } from "./utils/fileReading";
import { handleGetFileFromIndexedDB } from "./utils/indexedDB"; import { handleGetFileFromIndexedDB } from "./utils/indexedDB";
import { CoreSyncStatus } from "./components/CoreSyncStatus"; import { CoreSyncStatus } from "./components/CoreSyncStatus";
type extStates = type extStates =
| "not-authenticated" | "not-authenticated"
| "authenticated" | "authenticated"
@ -372,16 +376,17 @@ function App() {
useRetrieveDataLocalStorage(); useRetrieveDataLocalStorage();
useQortalGetSaveSettings(userInfo?.name); useQortalGetSaveSettings(userInfo?.name);
const [fullScreen, setFullScreen] = useRecoilState(fullScreenAtom); const [fullScreen, setFullScreen] = useRecoilState(fullScreenAtom);
const [isEnabledDevMode, setIsEnabledDevMode] = useRecoilState(enabledDevModeAtom) const [isEnabledDevMode, setIsEnabledDevMode] =
useRecoilState(enabledDevModeAtom);
const { toggleFullScreen } = useAppFullScreen(setFullScreen); const { toggleFullScreen } = useAppFullScreen(setFullScreen);
useEffect(()=> { useEffect(() => {
const isDevModeFromStorage = localStorage.getItem('isEnabledDevMode'); const isDevModeFromStorage = localStorage.getItem("isEnabledDevMode");
if(isDevModeFromStorage){ if (isDevModeFromStorage) {
setIsEnabledDevMode(JSON.parse(isDevModeFromStorage)) setIsEnabledDevMode(JSON.parse(isDevModeFromStorage));
} }
}, []) }, []);
useEffect(() => { useEffect(() => {
// Attach a global event listener for double-click // Attach a global event listener for double-click
@ -575,7 +580,6 @@ function App() {
}; };
}; };
const getBalanceFunc = () => { const getBalanceFunc = () => {
setQortBalanceLoading(true); setQortBalanceLoading(true);
window window
@ -651,11 +655,12 @@ function App() {
const qortalRequestPermissonFromExtension = async (message, event) => { const qortalRequestPermissonFromExtension = async (message, event) => {
if (message.action === "QORTAL_REQUEST_PERMISSION") { if (message.action === "QORTAL_REQUEST_PERMISSION") {
try { try {
if(message?.payload?.checkbox1){ if (message?.payload?.checkbox1) {
qortalRequestCheckbox1Ref.current = message?.payload?.checkbox1?.value || false qortalRequestCheckbox1Ref.current =
message?.payload?.checkbox1?.value || false;
} }
await showQortalRequestExtension(message?.payload); await showQortalRequestExtension(message?.payload);
if (qortalRequestCheckbox1Ref.current) { if (qortalRequestCheckbox1Ref.current) {
event.source.postMessage( event.source.postMessage(
{ {
@ -694,13 +699,12 @@ function App() {
} }
} }
}; };
useEffect(() => { useEffect(() => {
// Handler function for incoming messages // Handler function for incoming messages
const messageHandler = (event) => { const messageHandler = (event) => {
if (event.origin !== window.location.origin) { if (event.origin !== window.location.origin) {
return; return;
} }
const message = event.data; const message = event.data;
@ -717,15 +721,11 @@ function App() {
executeEvent("openGroupMessage", { executeEvent("openGroupMessage", {
from: message.payload.from, from: message.payload.from,
}); });
} else if ( } else if (message.action === "NOTIFICATION_OPEN_ANNOUNCEMENT_GROUP") {
message.action === "NOTIFICATION_OPEN_ANNOUNCEMENT_GROUP"
) {
executeEvent("openGroupAnnouncement", { executeEvent("openGroupAnnouncement", {
from: message.payload.from, from: message.payload.from,
}); });
} else if ( } else if (message.action === "NOTIFICATION_OPEN_THREAD_NEW_POST") {
message.action === "NOTIFICATION_OPEN_THREAD_NEW_POST"
) {
executeEvent("openThreadNewPost", { executeEvent("openThreadNewPost", {
data: message.payload.data, data: message.payload.data,
}); });
@ -734,8 +734,7 @@ function App() {
message?.isFromExtension message?.isFromExtension
) { ) {
qortalRequestPermissonFromExtension(message, event); qortalRequestPermissonFromExtension(message, event);
} } else if (message?.action === "getFileFromIndexedDB") {
else if(message?.action === 'getFileFromIndexedDB'){
handleGetFileFromIndexedDB(event); handleGetFileFromIndexedDB(event);
} }
}; };
@ -780,9 +779,8 @@ function App() {
holdRefExtState.current === "web-app-request-buy-order" holdRefExtState.current === "web-app-request-buy-order"
) )
return; return;
if(response?.hasKeyPair){ if (response?.hasKeyPair) {
setExtstate("authenticated"); setExtstate("authenticated");
} else { } else {
setExtstate("wallet-dropped"); setExtstate("wallet-dropped");
} }
@ -869,7 +867,6 @@ function App() {
walletToBeDownloaded.wallet, walletToBeDownloaded.wallet,
walletToBeDownloaded.qortAddress walletToBeDownloaded.qortAddress
); );
} catch (error: any) { } catch (error: any) {
setWalletToBeDownloadedError(error?.message); setWalletToBeDownloadedError(error?.message);
} finally { } finally {
@ -1014,7 +1011,7 @@ function App() {
resetAllRecoil(); resetAllRecoil();
}; };
function roundUpToDecimals(number, decimals = 8) { function roundUpToDecimals(number, decimals = 8) {
const factor = Math.pow(10, decimals); // Create a factor based on the number of decimals const factor = Math.pow(10, decimals); // Create a factor based on the number of decimals
return Math.ceil(+number * factor) / factor; return Math.ceil(+number * factor) / factor;
} }
@ -1029,10 +1026,14 @@ function App() {
}, 250); }, 250);
}); });
window window
.sendMessage("decryptWallet", { .sendMessage(
password: authenticatePassword, "decryptWallet",
wallet: rawWallet, {
}, 120000) password: authenticatePassword,
wallet: rawWallet,
},
120000
)
.then((response) => { .then((response) => {
if (response && !response.error) { if (response && !response.error) {
setAuthenticatePassword(""); setAuthenticatePassword("");
@ -1078,9 +1079,6 @@ function App() {
} }
}; };
useEffect(() => { useEffect(() => {
if (!isMainWindow) return; if (!isMainWindow) return;
// Handler for when the window gains focus // Handler for when the window gains focus
@ -1220,7 +1218,7 @@ function App() {
width: isMobile ? "100vw" : "auto", width: isMobile ? "100vw" : "auto",
display: "flex", display: "flex",
backgroundColor: "var(--bg-2)", backgroundColor: "var(--bg-2)",
justifyContent: 'flex-end' justifyContent: "flex-end",
}} }}
> >
{isMobile && ( {isMobile && (
@ -1242,237 +1240,268 @@ function App() {
/> />
</Box> </Box>
)} )}
{desktopViewMode !== "apps" && desktopViewMode !== "dev" && desktopViewMode !== "chat" && ( {desktopViewMode !== "apps" &&
<AuthenticatedContainerInnerLeft desktopViewMode !== "dev" &&
sx={{ desktopViewMode !== "chat" && (
overflowY: isMobile && "auto", <AuthenticatedContainerInnerLeft
padding: '0px 20px',
minWidth: '225px'
}}
>
<Spacer height="48px" />
{authenticatedMode === "ltc" ? (
<>
<img src={ltcLogo} />
<Spacer height="32px" />
<CopyToClipboard text={rawWallet?.ltcAddress}>
<AddressBox>
{rawWallet?.ltcAddress?.slice(0, 6)}...
{rawWallet?.ltcAddress?.slice(-4)} <img src={Copy} />
</AddressBox>
</CopyToClipboard>
<Spacer height="10px" />
{ltcBalanceLoading && (
<CircularProgress color="success" size={16} />
)}
{!isNaN(+ltcBalance) && !ltcBalanceLoading && (
<Box
sx={{ sx={{
gap: "10px", overflowY: isMobile && "auto",
display: "flex", padding: "0px 20px",
alignItems: "center", minWidth: "225px",
}} }}
> >
<Spacer height="48px" />
{authenticatedMode === "ltc" ? (
<>
<img src={ltcLogo} />
<Spacer height="32px" />
<CopyToClipboard text={rawWallet?.ltcAddress}>
<AddressBox>
{rawWallet?.ltcAddress?.slice(0, 6)}...
{rawWallet?.ltcAddress?.slice(-4)} <img src={Copy} />
</AddressBox>
</CopyToClipboard>
<Spacer height="10px" />
{ltcBalanceLoading && (
<CircularProgress color="success" size={16} />
)}
{!isNaN(+ltcBalance) && !ltcBalanceLoading && (
<Box
sx={{
gap: "10px",
display: "flex",
alignItems: "center",
}}
>
<TextP
sx={{
textAlign: "center",
lineHeight: "24px",
fontSize: "20px",
fontWeight: 700,
}}
>
{ltcBalance} LTC
</TextP>
<RefreshIcon
onClick={getLtcBalanceFunc}
sx={{
fontSize: "16px",
color: "white",
cursor: "pointer",
}}
/>
</Box>
)}
<AddressQRCode targetAddress={rawWallet?.ltcAddress} />
</>
) : (
<>
<MainAvatar myName={userInfo?.name} />
<Spacer height="32px" />
<TextP
sx={{
textAlign: "center",
lineHeight: "24px",
fontSize: "20px",
}}
>
{userInfo?.name}
</TextP>
<Spacer height="10px" />
<CopyToClipboard text={rawWallet?.address0}>
<AddressBox>
{rawWallet?.address0?.slice(0, 6)}...
{rawWallet?.address0?.slice(-4)} <img src={Copy} />
</AddressBox>
</CopyToClipboard>
<Spacer height="10px" />
{qortBalanceLoading && (
<CircularProgress color="success" size={16} />
)}
{!qortBalanceLoading && balance >= 0 && (
<Box
sx={{
gap: "10px",
display: "flex",
alignItems: "center",
}}
>
<TextP
sx={{
textAlign: "center",
lineHeight: "24px",
fontSize: "20px",
fontWeight: 700,
}}
>
{balance?.toFixed(2)} QORT
</TextP>
<RefreshIcon
onClick={getBalanceFunc}
sx={{
fontSize: "16px",
color: "white",
cursor: "pointer",
}}
/>
</Box>
)}
<Spacer height="35px" />
{userInfo && !userInfo?.name && (
<TextP
ref={registerNamePopoverRef}
sx={{
textAlign: "center",
lineHeight: 1.2,
fontSize: "16px",
fontWeight: 500,
cursor: "pointer",
marginTop: "10px",
color: "red",
textDecoration: "underline",
}}
onClick={() => {
setOpenRegisterName(true);
}}
>
REGISTER NAME
</TextP>
)}
<Spacer height="20px" />
<CustomButton
onClick={() => {
setIsOpenSendQort(true);
// setExtstate("send-qort");
setIsOpenDrawerProfile(false);
}}
>
Transfer QORT
</CustomButton>
<AddressQRCode targetAddress={rawWallet?.address0} />
</>
)}
<TextP <TextP
sx={{ sx={{
textAlign: "center", textAlign: "center",
lineHeight: "24px", lineHeight: "24px",
fontSize: "20px", fontSize: "12px",
fontWeight: 700, fontWeight: 500,
cursor: "pointer",
marginTop: "10px",
textDecoration: "underline",
}}
onClick={async () => {
executeEvent("addTab", {
data: { service: "APP", name: "q-trade" },
});
executeEvent("open-apps-mode", {});
}} }}
> >
{ltcBalance} LTC Get QORT at Q-Trade
</TextP> </TextP>
<RefreshIcon </AuthenticatedContainerInnerLeft>
onClick={getLtcBalanceFunc}
sx={{
fontSize: "16px",
color: "white",
cursor: "pointer",
}}
/>
</Box>
)} )}
<AddressQRCode targetAddress={rawWallet?.ltcAddress} />
</> <AuthenticatedContainerInnerRight
) : ( sx={{
<> height: "100%",
<MainAvatar myName={userInfo?.name} /> justifyContent: "space-between",
<Spacer height="32px" /> }}
<TextP >
<Box
sx={{ sx={{
textAlign: "center", width: "100%",
lineHeight: "24px", display: "flex",
fontSize: "20px", flexDirection: "column",
alignItems: 'center'
}} }}
> >
{userInfo?.name} <Spacer height="20px" />
</TextP>
<Spacer height="10px" /> {!isMobile && (
<CopyToClipboard text={rawWallet?.address0}> <>
<AddressBox> <Spacer height="20px" />
{rawWallet?.address0?.slice(0, 6)}... <img
{rawWallet?.address0?.slice(-4)} <img src={Copy} /> src={Logout}
</AddressBox> onClick={() => {
</CopyToClipboard> logoutFunc();
<Spacer height="10px" /> setIsOpenDrawerProfile(false);
{qortBalanceLoading && ( }}
<CircularProgress color="success" size={16} /> style={{
)} cursor: "pointer",
{!qortBalanceLoading && balance >= 0 && ( width: '20px',
<Box height: 'auto'
sx={{ }}
gap: "10px", />
display: "flex", </>
alignItems: "center", )}
<Spacer height="20px" />
<ButtonBase
onClick={() => {
setIsSettingsOpen(true);
}} }}
> >
<TextP <SettingsIcon
sx={{ sx={{
textAlign: "center", color: "rgba(255, 255, 255, 0.5)",
lineHeight: "24px",
fontSize: "20px",
fontWeight: 700,
}}
>
{balance?.toFixed(2)} QORT
</TextP>
<RefreshIcon
onClick={getBalanceFunc}
sx={{
fontSize: "16px",
color: "white",
cursor: "pointer",
}} }}
/> />
</Box> </ButtonBase>
)} <Spacer height="20px" />
{authenticatedMode === "qort" && (
<Spacer height="35px" />
{userInfo && !userInfo?.name && (
<TextP
ref={registerNamePopoverRef}
sx={{
textAlign: "center",
lineHeight: 1.2,
fontSize: "16px",
fontWeight: 500,
cursor: "pointer",
marginTop: "10px",
color: "red",
textDecoration: "underline",
}}
onClick={() => {
setOpenRegisterName(true);
}}
>
REGISTER NAME
</TextP>
)}
<Spacer height="20px" />
<CustomButton
onClick={() => {
setIsOpenSendQort(true);
// setExtstate("send-qort");
setIsOpenDrawerProfile(false);
}}
>
Transfer QORT
</CustomButton>
<AddressQRCode targetAddress={rawWallet?.address0} />
</>
)}
<TextP
sx={{
textAlign: "center",
lineHeight: "24px",
fontSize: "12px",
fontWeight: 500,
cursor: "pointer",
marginTop: "10px",
textDecoration: "underline",
}}
onClick={async () => {
executeEvent("addTab", { data: { service: 'APP', name: 'q-trade' } });
executeEvent("open-apps-mode", { });
}}
>
Get QORT at Q-Trade
</TextP>
</AuthenticatedContainerInnerLeft>
)}
<AuthenticatedContainerInnerRight>
<Spacer height="20px" />
<img
onClick={() => {
setExtstate("download-wallet");
setIsOpenDrawerProfile(false);
}}
src={Download}
style={{
cursor: "pointer",
}}
/>
{!isMobile && (
<>
<Spacer height="20px" />
<img <img
src={Logout}
onClick={() => { onClick={() => {
logoutFunc(); setAuthenticatedMode("ltc");
setIsOpenDrawerProfile(false);
}} }}
src={ltcLogo}
style={{ style={{
cursor: "pointer", cursor: "pointer",
width: "20px",
height: "auto",
}} }}
/> />
</> )}
)} {authenticatedMode === "ltc" && (
<Spacer height="20px" /> <img
onClick={() => {
<ButtonBase setAuthenticatedMode("qort");
onClick={() => { }}
setIsSettingsOpen(true); src={qortLogo}
style={{
cursor: "pointer",
width: "20px",
height: "auto",
}}
/>
)}
<Spacer height="20px" />
<CoreSyncStatus />
</Box>
<Box
sx={{
width: "100%",
display: "flex",
flexDirection: "column",
alignItems: 'center'
}} }}
> >
<SettingsIcon <img
sx={{
color: "rgba(255, 255, 255, 0.5)",
}}
/>
</ButtonBase>
<Spacer height="20px" />
{authenticatedMode === "qort" && (
<img
onClick={() => { onClick={() => {
setAuthenticatedMode("ltc"); setExtstate("download-wallet");
setIsOpenDrawerProfile(false);
}} }}
src={ltcLogo} src={Download}
style={{ style={{
cursor: "pointer", cursor: "pointer",
width: "20px", width: '20px'
height: "auto",
}} }}
/> />
)} <Spacer height="40px" />
{authenticatedMode === "ltc" && ( </Box>
<img
onClick={() => {
setAuthenticatedMode("qort");
}}
src={qortLogo}
style={{
cursor: "pointer",
width: "20px",
height: "auto",
}}
/>
)}
<Spacer height="20px" />
<CoreSyncStatus />
</AuthenticatedContainerInnerRight> </AuthenticatedContainerInnerRight>
</AuthenticatedContainer> </AuthenticatedContainer>
); );
@ -1516,10 +1545,10 @@ function App() {
message, message,
rootHeight, rootHeight,
showInfo, showInfo,
openSnackGlobal: openSnack, openSnackGlobal: openSnack,
setOpenSnackGlobal: setOpenSnack, setOpenSnackGlobal: setOpenSnack,
infoSnackCustom: infoSnack, infoSnackCustom: infoSnack,
setInfoSnackCustom: setInfoSnack setInfoSnackCustom: setInfoSnack,
}} }}
> >
<Box <Box
@ -1543,7 +1572,7 @@ function App() {
desktopViewMode={desktopViewMode} desktopViewMode={desktopViewMode}
setDesktopViewMode={setDesktopViewMode} setDesktopViewMode={setDesktopViewMode}
/> />
{!isMobile && renderProfile()} {!isMobile && renderProfile()}
</Box> </Box>
<Box <Box
@ -2174,7 +2203,7 @@ function App() {
onClick={() => { onClick={() => {
setRawWallet(null); setRawWallet(null);
setExtstate("not-authenticated"); setExtstate("not-authenticated");
logoutFunc() logoutFunc();
}} }}
src={Return} src={Return}
/> />
@ -2308,12 +2337,14 @@ function App() {
{walletToBeDownloaded && ( {walletToBeDownloaded && (
<> <>
<CustomButton onClick={async ()=> { <CustomButton
await saveFileToDiskFunc() onClick={async () => {
await showInfo({ await saveFileToDiskFunc();
message: `Keep your wallet file secure.`, await showInfo({
}) message: `Keep your wallet file secure.`,
}}> });
}}
>
Download wallet Download wallet
</CustomButton> </CustomButton>
</> </>
@ -2417,7 +2448,7 @@ await showInfo({
returnToMain(); returnToMain();
await showInfo({ await showInfo({
message: `Keep your wallet file secure.`, message: `Keep your wallet file secure.`,
}) });
}} }}
> >
Backup Account Backup Account
@ -2567,10 +2598,8 @@ await showInfo({
<DialogContentText id="alert-dialog-description"> <DialogContentText id="alert-dialog-description">
{messageInfo.message} {messageInfo.message}
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button variant="contained" onClick={onOkInfo} autoFocus> <Button variant="contained" onClick={onOkInfo} autoFocus>
Close Close
</Button> </Button>
@ -2734,6 +2763,16 @@ await showInfo({
{messageQortalRequestExtension?.highlightedText} {messageQortalRequestExtension?.highlightedText}
</TextP> </TextP>
{messageQortalRequestExtension?.json && (
<>
<Spacer height="15px" />
<JsonView data={messageQortalRequestExtension?.json} shouldExpandNode={allExpanded} style={darkStyles} />
<Spacer height="15px" />
</>
)}
{messageQortalRequestExtension?.fee && ( {messageQortalRequestExtension?.fee && (
<> <>
<Spacer height="15px" /> <Spacer height="15px" />

View File

@ -182,7 +182,7 @@ const UIQortalRequests = [
'GET_WALLET_BALANCE', 'GET_USER_WALLET_INFO', 'GET_CROSSCHAIN_SERVER_INFO', 'GET_WALLET_BALANCE', 'GET_USER_WALLET_INFO', 'GET_CROSSCHAIN_SERVER_INFO',
'GET_TX_ACTIVITY_SUMMARY', 'GET_FOREIGN_FEE', 'UPDATE_FOREIGN_FEE', 'GET_TX_ACTIVITY_SUMMARY', 'GET_FOREIGN_FEE', 'UPDATE_FOREIGN_FEE',
'GET_SERVER_CONNECTION_HISTORY', 'SET_CURRENT_FOREIGN_SERVER', 'GET_SERVER_CONNECTION_HISTORY', 'SET_CURRENT_FOREIGN_SERVER',
'ADD_FOREIGN_SERVER', 'REMOVE_FOREIGN_SERVER', 'GET_DAY_SUMMARY', 'CREATE_TRADE_BUY_ORDER', 'CREATE_TRADE_SELL_ORDER', 'CANCEL_TRADE_SELL_ORDER', 'IS_USING_GATEWAY', 'ADMIN_ACTION' 'ADD_FOREIGN_SERVER', 'REMOVE_FOREIGN_SERVER', 'GET_DAY_SUMMARY', 'CREATE_TRADE_BUY_ORDER', 'CREATE_TRADE_SELL_ORDER', 'CANCEL_TRADE_SELL_ORDER', 'IS_USING_GATEWAY', 'ADMIN_ACTION', 'SIGN_TRANSACTION'
]; ];

View File

@ -113,6 +113,7 @@ export const publishData = async ({
transactionBytesBase58 transactionBytesBase58
) )
if (convertedBytesBase58.error) { if (convertedBytesBase58.error) {
throw new Error('Error when signing') throw new Error('Error when signing')
} }

View File

@ -1,5 +1,5 @@
import { gateways, getApiKeyFromStorage } from "./background"; import { gateways, getApiKeyFromStorage } from "./background";
import { addForeignServer, addListItems, adminAction, cancelSellOrder, createBuyOrder, createPoll, createSellOrder, decryptData, deleteListItems, deployAt, encryptData, getCrossChainServerInfo, getDaySummary, getForeignFee, getListItems, getServerConnectionHistory, getTxActivitySummary, getUserAccount, getUserWallet, getUserWalletInfo, getWalletBalance, joinGroup, publishMultipleQDNResources, publishQDNResource, removeForeignServer, saveFile, sendChatMessage, sendCoin, setCurrentForeignServer, updateForeignFee, voteOnPoll } from "./qortalRequests/get"; import { addForeignServer, addListItems, adminAction, cancelSellOrder, createBuyOrder, createPoll, createSellOrder, decryptData, deleteListItems, deployAt, encryptData, getCrossChainServerInfo, getDaySummary, getForeignFee, getListItems, getServerConnectionHistory, getTxActivitySummary, getUserAccount, getUserWallet, getUserWalletInfo, getWalletBalance, joinGroup, publishMultipleQDNResources, publishQDNResource, removeForeignServer, saveFile, sendChatMessage, sendCoin, setCurrentForeignServer, signTransaction, updateForeignFee, voteOnPoll } from "./qortalRequests/get";
import { getData, storeData } from "./utils/chromeStorage"; import { getData, storeData } from "./utils/chromeStorage";
@ -691,6 +691,26 @@ export const isRunningGateway = async ()=> {
} }
break; break;
} }
case "SIGN_TRANSACTION": {
try {
const res = await signTransaction(request.payload, isFromExtension)
event.source.postMessage({
requestId: request.requestId,
action: request.action,
payload: res,
type: "backgroundMessageResponse",
}, event.origin);
} catch (error) {
event.source.postMessage({
requestId: request.requestId,
action: request.action,
error: error?.message,
type: "backgroundMessageResponse",
}, event.origin);
}
break;
}
default: default:
break; break;
} }

File diff suppressed because it is too large Load Diff