diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index d6c9537..92d403a 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -11,7 +11,7 @@ module.exports = {
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
- 'warn',
+ 'off',
{ allowConstantExport: true },
],
},
diff --git a/src/components/Apps/useQortalMessageListener.tsx b/src/components/Apps/useQortalMessageListener.tsx
index e25c1bb..f8bd7a0 100644
--- a/src/components/Apps/useQortalMessageListener.tsx
+++ b/src/components/Apps/useQortalMessageListener.tsx
@@ -320,7 +320,7 @@ const UIQortalRequests = [
// Handle the obj.file if it exists and is a File instance
if (obj.file) {
- const fileId = "objFile_qortalfile";
+ const fileId = Date.now() + "objFile_qortalfile";
// Store the file in IndexedDB
const fileData = {
@@ -334,7 +334,7 @@ const UIQortalRequests = [
delete obj.file;
}
if (obj.blob) {
- const fileId = "objFile_qortalfile";
+ const fileId = Date.now() + "objFile_qortalfile";
// Store the file in IndexedDB
const fileData = {
@@ -355,8 +355,8 @@ const UIQortalRequests = [
// Iterate through resources to find files and save them to IndexedDB
for (let resource of (obj?.resources || [])) {
if (resource.file) {
- const fileId = resource.identifier + "_qortalfile";
-
+ const fileId = resource.identifier + Date.now() + "_qortalfile";
+
// Store the file in IndexedDB
const fileData = {
id: fileId,
@@ -484,17 +484,8 @@ isDOMContentLoaded: false
event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'ENCRYPT_DATA_WITH_SHARING_KEY' || event?.data?.action === 'ENCRYPT_QORTAL_GROUP_DATA'
) {
- let data;
- try {
- data = await storeFilesInIndexedDB(event.data);
- } catch (error) {
- console.error('Error storing files in IndexedDB:', error);
- event.ports[0].postMessage({
- result: null,
- error: 'Failed to store files in IndexedDB',
- });
- return;
- }
+ const data = event.data;
+
if (data) {
sendMessageToRuntime(
{ action: event.data.action, type: 'qortalRequest', payload: data, isExtension: true },
diff --git a/src/components/Chat/TipTap.tsx b/src/components/Chat/TipTap.tsx
index 4493482..929ab41 100644
--- a/src/components/Chat/TipTap.tsx
+++ b/src/components/Chat/TipTap.tsx
@@ -472,7 +472,12 @@ export default ({
return (
-
+
{
if (groups?.length === 0) return false;
return !!groups?.find((item) => item?.groupId?.toString() === "694");
@@ -199,6 +198,7 @@ export const Minting = ({
}
const data = await response.json();
setRewardShares(data);
+ return data
} catch (error) {}
}, []);
@@ -338,6 +338,31 @@ export const Minting = ({
});
}, []);
+ 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) {
+
+ const rewardShares = await getRewardShares(myAddress);
+ const findRewardShare = rewardShares?.find(
+ (item) =>
+ item?.recipient === myAddress && item?.mintingAccount === myAddress
+ );
+
+ if (findRewardShare) {
+ return true; // Exit early if found
+ }
+
+
+ await sleep(pollingInterval); // Wait before the next poll
+ }
+
+ throw new Error("Timeout waiting for reward share confirmation");
+ };
+
const startMinting = async () => {
try {
setIsLoading(true);
@@ -352,12 +377,20 @@ export const Minting = ({
addMintingAccount(privateRewardShare);
} else {
await createRewardShare(accountInfo?.publicKey, myAddress);
+ setShowWaitDialog(true)
+ await waitUntilRewardShareIsConfirmed()
+ await showNext({
+ message: ''
+ })
const privateRewardShare = await getRewardSharePrivateKey(
accountInfo?.publicKey
);
+ setShowWaitDialog(false)
addMintingAccount(privateRewardShare);
+
}
} catch (error) {
+ setShowWaitDialog(false)
setInfo({
type: "error",
message: error?.message || "Unable to start minting",
@@ -436,8 +469,8 @@ export const Minting = ({
const confirmReceiver = await getNameOrAddress(receiver);
if (confirmReceiver.error)
throw new Error("Invalid receiver address or name");
- const isInMinterGroup = await checkIfMinterGroup(confirmReceiver)
- if(!isInMinterGroup) throw new Error('Account not in Minter Group')
+ const isInMinterGroup = await checkIfMinterGroup(confirmReceiver);
+ if (!isInMinterGroup) throw new Error("Account not in Minter Group");
const publicKey = await getPublicKeyFromAddress(confirmReceiver);
const findRewardShare = rewardShares?.find(
(item) =>
@@ -520,18 +553,8 @@ export const Minting = ({
return "" + countBlocksString;
};
- const showAndCopySponsorshipKey = async (rs) => {
- try {
- const sponsorshipKey = await getRewardSharePrivateKey(
- rs?.rewardSharePublicKey
- );
- await showKey({
- message: sponsorshipKey,
- });
- } catch (error) {}
- };
-
+
return (