diff --git a/src/App.tsx b/src/App.tsx
index 6ffbf21..979a561 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -3978,13 +3978,11 @@ function App() {
)}
{isOpenMinting && (
- //
-
-
+
)}
{!isAuthenticated && (
diff --git a/src/components/Minting/Minting.tsx b/src/components/Minting/Minting.tsx
index 198b5e1..69a65b9 100644
--- a/src/components/Minting/Minting.tsx
+++ b/src/components/Minting/Minting.tsx
@@ -4,17 +4,20 @@ import {
Box,
Button,
Card,
+ Container,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Divider,
IconButton,
+ Paper,
Snackbar,
Toolbar,
Typography,
useTheme,
} from '@mui/material';
+import Grid from '@mui/material/Grid';
import { useCallback, useEffect, useMemo, useState } from 'react';
import CloseIcon from '@mui/icons-material/Close';
import { getBaseApiReact } from '../../App';
@@ -37,14 +40,11 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const [mintingAccounts, setMintingAccounts] = useState([]);
const [accountInfo, setAccountInfo] = useState(null);
- const [rewardSharePublicKey, setRewardSharePublicKey] = useState('');
const [mintingKey, setMintingKey] = useState('');
- const [rewardsharekey, setRewardsharekey] = useState('');
const [rewardShares, setRewardShares] = useState([]);
const [nodeInfos, setNodeInfos] = useState({});
const [openSnack, setOpenSnack] = useState(false);
const [isLoading, setIsLoading] = useState(false);
- const { show: showKey, message } = useModal();
const { isShow: isShowNext, onOk, show: showNext } = useModal();
const theme = useTheme();
const { t } = useTranslation([
@@ -161,13 +161,13 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
return address;
};
- const handleAccountInfos = (address, field) => {
- if (!address) return undefined;
- if (accountInfos[address]) return accountInfos[address]?.[field];
- if (accountInfos[address] === null) return undefined;
- getAccountInfo(address, true);
- return undefined;
- };
+ // const handleAccountInfos = (address, field) => {
+ // if (!address) return undefined;
+ // if (accountInfos[address]) return accountInfos[address]?.[field];
+ // if (accountInfos[address] === null) return undefined;
+ // getAccountInfo(address, true);
+ // return undefined;
+ // };
const calculateBlocksRemainingToLevel1 = (address) => {
if (!address) return undefined;
@@ -308,6 +308,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const createRewardShare = useCallback(async (publicKey, recipient) => {
const fee = await getFee('REWARD_SHARE');
+
await show({
message: t('core:message.question.perform_transaction', {
action: 'REWARD_SHARE',
@@ -315,6 +316,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
}),
publishFee: fee.fee + ' QORT',
});
+
return await new Promise((res, rej) => {
window
.sendMessage('createRewardShare', {
@@ -382,7 +384,6 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const waitUntilRewardShareIsConfirmed = async (timeoutMs = 600000) => {
const pollingInterval = 30000;
const startTime = Date.now();
-
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
while (Date.now() - startTime < timeoutMs) {
@@ -424,9 +425,11 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
await showNext({
message: '',
});
+
const privateRewardShare = await getRewardSharePrivateKey(
accountInfo?.publicKey
);
+
setShowWaitDialog(false);
addMintingAccount(privateRewardShare);
}
@@ -446,61 +449,61 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
}
};
- const getPublicKeyFromAddress = async (address) => {
- const url = `${getBaseApiReact()}/addresses/publickey/${address}`;
- const response = await fetch(url);
- const data = await response.text();
- return data;
- };
+ // const getPublicKeyFromAddress = async (address) => {
+ // const url = `${getBaseApiReact()}/addresses/publickey/${address}`;
+ // const response = await fetch(url);
+ // const data = await response.text();
+ // return data;
+ // };
- const checkIfMinterGroup = async (address) => {
- const url = `${getBaseApiReact()}/groups/member/${address}`;
- const response = await fetch(url);
- const data = await response.json();
- return !!data?.find((grp) => grp?.groupId?.toString() === '694');
- };
+ // const checkIfMinterGroup = async (address) => {
+ // const url = `${getBaseApiReact()}/groups/member/${address}`;
+ // const response = await fetch(url);
+ // const data = await response.json();
+ // return !!data?.find((grp) => grp?.groupId?.toString() === '694');
+ // };
- const removeRewardShare = useCallback(async (rewardShare) => {
- return await new Promise((res, rej) => {
- window
- .sendMessage('removeRewardShare', {
- rewardShareKeyPairPublicKey: rewardShare.rewardSharePublicKey,
- recipient: rewardShare.recipient,
- percentageShare: -1,
- })
- .then((response) => {
- if (!response?.error) {
- res(response);
- setTxList((prev) => [
- {
- ...rewardShare,
- ...response,
- type: 'remove-rewardShare',
- label: t('group:message.success.rewardshare_remove', {
- postProcess: 'capitalizeFirstChar',
- }),
- labelDone: t('group:message.success.rewardshare_remove_label', {
- postProcess: 'capitalizeFirstChar',
- }),
- done: false,
- },
- ...prev,
- ]);
- return;
- }
- rej({ message: response.error });
- })
- .catch((error) => {
- rej({
- message:
- error.message ||
- t('core:message.error.generic', {
- postProcess: 'capitalizeFirstChar',
- }),
- });
- });
- });
- }, []);
+ // const removeRewardShare = useCallback(async (rewardShare) => {
+ // return await new Promise((res, rej) => {
+ // window
+ // .sendMessage('removeRewardShare', {
+ // rewardShareKeyPairPublicKey: rewardShare.rewardSharePublicKey,
+ // recipient: rewardShare.recipient,
+ // percentageShare: -1,
+ // })
+ // .then((response) => {
+ // if (!response?.error) {
+ // res(response);
+ // setTxList((prev) => [
+ // {
+ // ...rewardShare,
+ // ...response,
+ // type: 'remove-rewardShare',
+ // label: t('group:message.success.rewardshare_remove', {
+ // postProcess: 'capitalizeFirstChar',
+ // }),
+ // labelDone: t('group:message.success.rewardshare_remove_label', {
+ // postProcess: 'capitalizeFirstChar',
+ // }),
+ // done: false,
+ // },
+ // ...prev,
+ // ]);
+ // return;
+ // }
+ // rej({ message: response.error });
+ // })
+ // .catch((error) => {
+ // rej({
+ // message:
+ // error.message ||
+ // t('core:message.error.generic', {
+ // postProcess: 'capitalizeFirstChar',
+ // }),
+ // });
+ // });
+ // });
+ // }, []);
useEffect(() => {
getNodeInfos();
@@ -559,6 +562,17 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
return '' + countBlocksString;
};
+ const StatCard = ({ label, value }: { label: string; value: string }) => (
+
+
+
+ {label}
+
+ {value}
+
+
+ );
+
return (