mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-24 03:47:53 +00:00
added minting page
This commit is contained in:
parent
91d33c5761
commit
d917412988
101
package-lock.json
generated
101
package-lock.json
generated
@ -72,6 +72,7 @@
|
||||
"react-infinite-scroller": "^1.2.6",
|
||||
"react-intersection-observer": "^9.13.0",
|
||||
"react-json-view-lite": "^2.0.1",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-qr-code": "^2.0.15",
|
||||
"react-quill": "^2.0.0",
|
||||
"react-redux": "^9.1.2",
|
||||
@ -4450,6 +4451,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/slice-ansi/-/slice-ansi-4.0.0.tgz",
|
||||
"integrity": "sha512-+OpjSaq85gvlZAYINyzKpLeiFkSC4EsC6IIiT6v6TLSU5k5U83fHGj9Lel8oKEXM0HqgrMVCjXPDPVICtxF7EQ=="
|
||||
},
|
||||
"node_modules/@types/stylis": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz",
|
||||
"integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw=="
|
||||
},
|
||||
"node_modules/@types/trusted-types": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||
@ -5899,6 +5905,14 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/camelize": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz",
|
||||
"integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001674",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001674.tgz",
|
||||
@ -6678,6 +6692,24 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/css-color-keywords": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
|
||||
"integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/css-to-react-native": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz",
|
||||
"integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==",
|
||||
"dependencies": {
|
||||
"camelize": "^1.0.0",
|
||||
"css-color-keywords": "^1.0.0",
|
||||
"postcss-value-parser": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/css.escape": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
|
||||
@ -13882,9 +13914,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.37",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.37.tgz",
|
||||
"integrity": "sha512-7iB/v/r7Woof0glKLH8b1SPHrsX7uhdO+Geb41QpF/+mWZHU3uxxSlN+UXGVit1PawOYDToO+AbZzhBzWRDwbQ==",
|
||||
"version": "8.4.38",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
|
||||
"integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@ -13908,6 +13940,11 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-value-parser": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
|
||||
},
|
||||
"node_modules/postject": {
|
||||
"version": "1.0.0-alpha.6",
|
||||
"resolved": "https://registry.npmjs.org/postject/-/postject-1.0.0-alpha.6.tgz",
|
||||
@ -14484,6 +14521,27 @@
|
||||
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
|
||||
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
|
||||
},
|
||||
"node_modules/react-loader-spinner": {
|
||||
"version": "6.1.6",
|
||||
"resolved": "https://registry.npmjs.org/react-loader-spinner/-/react-loader-spinner-6.1.6.tgz",
|
||||
"integrity": "sha512-x5h1Jcit7Qn03MuKlrWcMG9o12cp9SNDVHVJTNRi9TgtGPKcjKiXkou4NRfLAtXaFB3+Z8yZsVzONmPzhv2ErA==",
|
||||
"dependencies": {
|
||||
"react-is": "^18.2.0",
|
||||
"styled-components": "^6.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
||||
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-loader-spinner/node_modules/react-is": {
|
||||
"version": "18.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
||||
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="
|
||||
},
|
||||
"node_modules/react-qr-code": {
|
||||
"version": "2.0.15",
|
||||
"resolved": "https://registry.npmjs.org/react-qr-code/-/react-qr-code-2.0.15.tgz",
|
||||
@ -15374,6 +15432,11 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/shallowequal": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
|
||||
"integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ=="
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
@ -15855,6 +15918,38 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-components": {
|
||||
"version": "6.1.13",
|
||||
"resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.13.tgz",
|
||||
"integrity": "sha512-M0+N2xSnAtwcVAQeFEsGWFFxXDftHUD7XrKla06QbpUMmbmtFBMMTcKWvFXtWxuD5qQkB8iU5gk6QASlx2ZRMw==",
|
||||
"dependencies": {
|
||||
"@emotion/is-prop-valid": "1.2.2",
|
||||
"@emotion/unitless": "0.8.1",
|
||||
"@types/stylis": "4.2.5",
|
||||
"css-to-react-native": "3.2.0",
|
||||
"csstype": "3.1.3",
|
||||
"postcss": "8.4.38",
|
||||
"shallowequal": "1.1.0",
|
||||
"stylis": "4.3.2",
|
||||
"tslib": "2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/styled-components"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">= 16.8.0",
|
||||
"react-dom": ">= 16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-components/node_modules/stylis": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz",
|
||||
"integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg=="
|
||||
},
|
||||
"node_modules/stylis": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz",
|
||||
|
@ -76,6 +76,7 @@
|
||||
"react-infinite-scroller": "^1.2.6",
|
||||
"react-intersection-observer": "^9.13.0",
|
||||
"react-json-view-lite": "^2.0.1",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-qr-code": "^2.0.15",
|
||||
"react-quill": "^2.0.0",
|
||||
"react-redux": "^9.1.2",
|
||||
@ -87,9 +88,9 @@
|
||||
"slate-react": "^0.109.0",
|
||||
"tippy.js": "^6.3.7",
|
||||
"tiptap-extension-resize-image": "^1.1.8",
|
||||
"ts-key-enum": "^2.0.12",
|
||||
"vite-plugin-top-level-await": "^1.4.4",
|
||||
"vite-plugin-wasm": "^3.3.0",
|
||||
"ts-key-enum": "^2.0.12"
|
||||
"vite-plugin-wasm": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/dom": "^10.3.0",
|
||||
|
70
src/App.tsx
70
src/App.tsx
@ -44,7 +44,7 @@ import Success from "./assets/svgs/Success.svg";
|
||||
import Info from "./assets/svgs/Info.svg";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import './utils/seedPhrase/RandomSentenceGenerator';
|
||||
|
||||
import EngineeringIcon from '@mui/icons-material/Engineering';
|
||||
import {
|
||||
createAccount,
|
||||
generateRandomSentence,
|
||||
@ -136,6 +136,8 @@ import { Tutorials } from "./components/Tutorials/Tutorials";
|
||||
import { useHandleTutorials } from "./components/Tutorials/useHandleTutorials";
|
||||
import BoundedNumericTextField from "./common/BoundedNumericTextField";
|
||||
import { useHandleUserInfo } from "./components/Group/useHandleUserInfo";
|
||||
import { Minting } from "./components/Minting/Minting";
|
||||
import { isRunningGateway } from "./qortalRequests";
|
||||
|
||||
type extStates =
|
||||
| "not-authenticated"
|
||||
@ -406,7 +408,7 @@ function App() {
|
||||
const [isEnabledDevMode, setIsEnabledDevMode] =
|
||||
useRecoilState(enabledDevModeAtom);
|
||||
const setIsDisabledEditorEnter = useSetRecoilState(isDisabledEditorEnterAtom)
|
||||
|
||||
const [isOpenMinting, setIsOpenMinting] = useState(false)
|
||||
const { toggleFullScreen } = useAppFullScreen(setFullScreen);
|
||||
const generatorRef = useRef(null)
|
||||
const exportSeedphrase = ()=> {
|
||||
@ -1592,6 +1594,54 @@ function App() {
|
||||
alignItems: 'center'
|
||||
}}
|
||||
>
|
||||
{extState === "authenticated" && isMainWindow && (
|
||||
<MyContext.Provider
|
||||
value={{
|
||||
txList,
|
||||
setTxList,
|
||||
memberGroups,
|
||||
setMemberGroups,
|
||||
isShow,
|
||||
onCancel,
|
||||
onOk,
|
||||
show,
|
||||
userInfo,
|
||||
message,
|
||||
rootHeight,
|
||||
showInfo,
|
||||
openSnackGlobal: openSnack,
|
||||
setOpenSnackGlobal: setOpenSnack,
|
||||
infoSnackCustom: infoSnack,
|
||||
setInfoSnackCustom: setInfoSnack,
|
||||
downloadResource,
|
||||
getIndividualUserInfo
|
||||
}}
|
||||
>
|
||||
<TaskManager getUserInfo={getUserInfo} />
|
||||
</MyContext.Provider>
|
||||
)}
|
||||
<Spacer height="20px" />
|
||||
<ButtonBase onClick={async ()=> {
|
||||
try {
|
||||
const res = await isRunningGateway()
|
||||
if(res) throw new Error('Cannot view minting details on the gateway')
|
||||
setIsOpenMinting(true)
|
||||
|
||||
} catch (error) {
|
||||
setOpenSnack(true)
|
||||
setInfoSnack({
|
||||
type: 'error',
|
||||
message: error?.message
|
||||
})
|
||||
}
|
||||
}}>
|
||||
<EngineeringIcon sx={{
|
||||
color: 'var(--unread)'
|
||||
}} />
|
||||
</ButtonBase>
|
||||
|
||||
|
||||
<Spacer height="20px" />
|
||||
{(desktopViewMode === "apps" || desktopViewMode === "home") && (
|
||||
<ButtonBase onClick={()=> {
|
||||
if(desktopViewMode === "apps"){
|
||||
@ -1705,17 +1755,7 @@ function App() {
|
||||
{!isMobile && renderProfile()}
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
position: "fixed",
|
||||
right: "25px",
|
||||
bottom: "25px",
|
||||
width: "350px",
|
||||
zIndex: 100000,
|
||||
}}
|
||||
>
|
||||
<TaskManager getUserInfo={getUserInfo} />
|
||||
</Box>
|
||||
|
||||
</MyContext.Provider>
|
||||
)}
|
||||
{isOpenSendQort && isMainWindow && (
|
||||
@ -3273,7 +3313,9 @@ function App() {
|
||||
}} />
|
||||
</ButtonBase>
|
||||
)}
|
||||
|
||||
{isOpenMinting && (
|
||||
<Minting setIsOpenMinting={setIsOpenMinting} groups={memberGroups} myAddress={address} show={show} setTxList={setTxList} txList={txList}/>
|
||||
)}
|
||||
</AppContainer>
|
||||
);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import {
|
||||
getGroupDataSingle,
|
||||
getKeyPair,
|
||||
getLTCBalance,
|
||||
getLastRef,
|
||||
getNameInfo,
|
||||
getTempPublish,
|
||||
getTimestampEnterChat,
|
||||
@ -41,6 +42,7 @@ import {
|
||||
makeAdmin,
|
||||
notifyAdminRegenerateSecretKey,
|
||||
pauseAllQueues,
|
||||
processTransactionVersion2,
|
||||
registerName,
|
||||
removeAdmin,
|
||||
resumeAllQueues,
|
||||
@ -56,8 +58,10 @@ import {
|
||||
} from "./background";
|
||||
import { decryptGroupEncryption, encryptAndPublishSymmetricKeyGroupChat, encryptAndPublishSymmetricKeyGroupChatForAdmins, publishGroupEncryptedResource, publishOnQDN } from "./backgroundFunctions/encryption";
|
||||
import { PUBLIC_NOTIFICATION_CODE_FIRST_SECRET_KEY } from "./constants/codes";
|
||||
import Base58 from "./deps/Base58";
|
||||
import { encryptSingle } from "./qdn/encryption/group-encryption";
|
||||
import { _createPoll, _voteOnPoll } from "./qortalRequests/get";
|
||||
import { createTransaction } from "./transactions/transactions";
|
||||
import { getData, storeData } from "./utils/chromeStorage";
|
||||
|
||||
export function versionCase(request, event) {
|
||||
@ -1895,4 +1899,140 @@ export async function publishGroupEncryptedResourceCase(request, event) {
|
||||
event.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function createRewardShareCase(request, event) {
|
||||
try {
|
||||
const {recipientPublicKey} = request.payload;
|
||||
const resKeyPair = await getKeyPair();
|
||||
const parsedData = resKeyPair;
|
||||
const uint8PrivateKey = Base58.decode(parsedData.privateKey);
|
||||
const uint8PublicKey = Base58.decode(parsedData.publicKey);
|
||||
const keyPair = {
|
||||
privateKey: uint8PrivateKey,
|
||||
publicKey: uint8PublicKey,
|
||||
};
|
||||
let lastRef = await getLastRef();
|
||||
|
||||
const tx = await createTransaction(38, keyPair, {
|
||||
recipientPublicKey,
|
||||
percentageShare: 0,
|
||||
lastReference: lastRef,
|
||||
});
|
||||
|
||||
const signedBytes = Base58.encode(tx.signedBytes);
|
||||
|
||||
const res = await processTransactionVersion2(signedBytes);
|
||||
if (!res?.signature)
|
||||
throw new Error("Transaction was not able to be processed");
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "createRewardShare",
|
||||
payload: res,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
} catch (error) {
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "createRewardShare",
|
||||
error: error?.message,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeRewardShareCase(request, event) {
|
||||
try {
|
||||
const {rewardShareKeyPairPublicKey, recipient, percentageShare} = request.payload;
|
||||
const resKeyPair = await getKeyPair();
|
||||
const parsedData = resKeyPair;
|
||||
const uint8PrivateKey = Base58.decode(parsedData.privateKey);
|
||||
const uint8PublicKey = Base58.decode(parsedData.publicKey);
|
||||
const keyPair = {
|
||||
privateKey: uint8PrivateKey,
|
||||
publicKey: uint8PublicKey,
|
||||
};
|
||||
let lastRef = await getLastRef();
|
||||
|
||||
const tx = await createTransaction(381, keyPair, {
|
||||
rewardShareKeyPairPublicKey,
|
||||
recipient,
|
||||
percentageShare,
|
||||
lastReference: lastRef,
|
||||
});
|
||||
|
||||
const signedBytes = Base58.encode(tx.signedBytes);
|
||||
|
||||
const res = await processTransactionVersion2(signedBytes);
|
||||
if (!res?.signature)
|
||||
throw new Error("Transaction was not able to be processed");
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "removeRewardShare",
|
||||
payload: res,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
} catch (error) {
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "removeRewardShare",
|
||||
error: error?.message,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getRewardSharePrivateKeyCase(request, event) {
|
||||
try {
|
||||
const {recipientPublicKey} = request.payload;
|
||||
const resKeyPair = await getKeyPair();
|
||||
const parsedData = resKeyPair;
|
||||
const uint8PrivateKey = Base58.decode(parsedData.privateKey);
|
||||
const uint8PublicKey = Base58.decode(parsedData.publicKey);
|
||||
const keyPair = {
|
||||
privateKey: uint8PrivateKey,
|
||||
publicKey: uint8PublicKey,
|
||||
};
|
||||
let lastRef = await getLastRef();
|
||||
|
||||
const tx = await createTransaction(38, keyPair, {
|
||||
recipientPublicKey,
|
||||
percentageShare: 0,
|
||||
lastReference: lastRef,
|
||||
});
|
||||
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "getRewardSharePrivateKey",
|
||||
payload: tx?._base58RewardShareSeed,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
} catch (error) {
|
||||
event.source.postMessage(
|
||||
{
|
||||
requestId: request.requestId,
|
||||
action: "getRewardSharePrivateKey",
|
||||
error: error?.message,
|
||||
type: "backgroundMessageResponse",
|
||||
},
|
||||
event.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ import {
|
||||
clearAllNotificationsCase,
|
||||
createGroupCase,
|
||||
createPollCase,
|
||||
createRewardShareCase,
|
||||
decryptDirectCase,
|
||||
decryptGroupEncryptionCase,
|
||||
decryptSingleCase,
|
||||
@ -61,6 +62,7 @@ import {
|
||||
getEnteredQmailTimestampCase,
|
||||
getGroupDataSingleCase,
|
||||
getGroupNotificationTimestampCase,
|
||||
getRewardSharePrivateKeyCase,
|
||||
getTempPublishCase,
|
||||
getThreadActivityCase,
|
||||
getTimestampEnterChatCase,
|
||||
@ -82,6 +84,7 @@ import {
|
||||
publishOnQDNCase,
|
||||
registerNameCase,
|
||||
removeAdminCase,
|
||||
removeRewardShareCase,
|
||||
resumeAllQueuesCase,
|
||||
saveTempPublishCase,
|
||||
sendChatDirectCase,
|
||||
@ -1105,7 +1108,7 @@ export const sendQortFee = async (): Promise<number> => {
|
||||
return qortFee;
|
||||
};
|
||||
|
||||
async function getNameOrAddress(receiver) {
|
||||
export async function getNameOrAddress(receiver) {
|
||||
try {
|
||||
const isAddress = validateAddress(receiver);
|
||||
if (isAddress) {
|
||||
@ -3046,6 +3049,15 @@ function setupMessageListener() {
|
||||
case "setupGroupWebsocket":
|
||||
setupGroupWebsocketCase(request, event);
|
||||
break;
|
||||
case "createRewardShare":
|
||||
createRewardShareCase(request, event);
|
||||
break;
|
||||
case "getRewardSharePrivateKey":
|
||||
getRewardSharePrivateKeyCase(request, event);
|
||||
break;
|
||||
case "removeRewardShare" :
|
||||
removeRewardShareCase(request, event);
|
||||
break;
|
||||
case "addEnteredQmailTimestamp":
|
||||
addEnteredQmailTimestampCase(request, event);
|
||||
break;
|
||||
|
1191
src/components/Minting/Minting.tsx
Normal file
1191
src/components/Minting/Minting.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@ import TaskAltIcon from "@mui/icons-material/TaskAlt";
|
||||
import ExpandLess from "@mui/icons-material/ExpandLess";
|
||||
import ExpandMore from "@mui/icons-material/ExpandMore";
|
||||
import { MyContext, getBaseApiReact, isMobile } from "../../App";
|
||||
import { executeEvent } from "../../utils/events";
|
||||
|
||||
export const TaskManager = ({ getUserInfo }) => {
|
||||
const { txList, setTxList, memberGroups } = useContext(MyContext);
|
||||
@ -39,7 +40,7 @@ export const TaskManager = ({ getUserInfo }) => {
|
||||
await new Promise((res) =>
|
||||
setTimeout(() => {
|
||||
res(null);
|
||||
}, 300000)
|
||||
}, 60000)
|
||||
);
|
||||
setTxList((prev) => {
|
||||
let previousData = [...prev];
|
||||
@ -62,7 +63,7 @@ export const TaskManager = ({ getUserInfo }) => {
|
||||
}
|
||||
};
|
||||
|
||||
intervals.current[signature] = setInterval(getAnswer, 120000);
|
||||
intervals.current[signature] = setInterval(getAnswer, 60000);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@ -96,7 +97,15 @@ export const TaskManager = ({ getUserInfo }) => {
|
||||
}
|
||||
});
|
||||
|
||||
prev.forEach((tx) => {
|
||||
|
||||
|
||||
return previousData;
|
||||
});
|
||||
}, [memberGroups, getUserInfo]);
|
||||
|
||||
useEffect(()=> {
|
||||
|
||||
txList.forEach((tx) => {
|
||||
if (
|
||||
["created-common-secret", "joined-group-request", "join-request-accept"].includes(
|
||||
tx?.type
|
||||
@ -113,11 +122,17 @@ export const TaskManager = ({ getUserInfo }) => {
|
||||
getStatus({ signature: tx.signature }, getUserInfo);
|
||||
}
|
||||
}
|
||||
if((tx?.type === "remove-rewardShare" || tx?.type === "add-rewardShare") && tx?.signature && !tx.done){
|
||||
if (!intervals.current[tx.signature]) {
|
||||
const sendEventForRewardShare = ()=> {
|
||||
executeEvent('refresh-rewardshare-list', {})
|
||||
}
|
||||
getStatus({ signature: tx.signature }, sendEventForRewardShare);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return previousData;
|
||||
});
|
||||
}, [memberGroups, getUserInfo]);
|
||||
}, [txList])
|
||||
|
||||
if (isMobile || txList?.length === 0 || txList.every((item) => item?.done))
|
||||
return null;
|
||||
@ -128,9 +143,9 @@ export const TaskManager = ({ getUserInfo }) => {
|
||||
<IconButton
|
||||
onClick={handleClick}
|
||||
sx={{
|
||||
position: "fixed",
|
||||
bottom: 16,
|
||||
right: 16,
|
||||
// position: "fixed",
|
||||
// bottom: 16,
|
||||
// right: 16,
|
||||
bgcolor: "primary.main",
|
||||
color: "white",
|
||||
":hover": { bgcolor: "primary.dark" },
|
||||
|
46
src/transactions/RemoveRewardShareTransaction.ts
Normal file
46
src/transactions/RemoveRewardShareTransaction.ts
Normal file
@ -0,0 +1,46 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { DYNAMIC_FEE_TIMESTAMP } from "../constants/constants"
|
||||
import Base58 from "../deps/Base58"
|
||||
import publicKeyToAddress from "../utils/generateWallet/publicKeyToAddress"
|
||||
import TransactionBase from "./TransactionBase"
|
||||
|
||||
|
||||
export default class RemoveRewardShareTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
super()
|
||||
this.type = 38
|
||||
}
|
||||
|
||||
|
||||
set rewardShareKeyPairPublicKey(rewardShareKeyPairPublicKey) {
|
||||
this._rewardShareKeyPairPublicKey = Base58.decode(rewardShareKeyPairPublicKey)
|
||||
}
|
||||
|
||||
set recipient(recipient) {
|
||||
const _address = publicKeyToAddress(this._keyPair.publicKey)
|
||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||
|
||||
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
||||
this.fee = _address === recipient ? 0 : 0.01
|
||||
} else {
|
||||
this.fee = _address === recipient ? 0 : 0.001
|
||||
}
|
||||
}
|
||||
|
||||
set percentageShare(share) {
|
||||
this._percentageShare = share * 100
|
||||
this._percentageShareBytes = this.constructor.utils.int64ToBytes(this._percentageShare)
|
||||
}
|
||||
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._recipient,
|
||||
this._rewardShareKeyPairPublicKey,
|
||||
this._percentageShareBytes,
|
||||
this._feeBytes
|
||||
)
|
||||
return params
|
||||
}
|
||||
}
|
60
src/transactions/RewardShareTransaction.ts
Normal file
60
src/transactions/RewardShareTransaction.ts
Normal file
@ -0,0 +1,60 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import TransactionBase from './TransactionBase'
|
||||
|
||||
import { Sha256 } from 'asmcrypto.js'
|
||||
import nacl from '../deps/nacl-fast'
|
||||
import ed2curve from '../deps/ed2curve'
|
||||
import { DYNAMIC_FEE_TIMESTAMP } from '../constants/constants'
|
||||
import publicKeyToAddress from '../utils/generateWallet/publicKeyToAddress'
|
||||
|
||||
export default class RewardShareTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
super()
|
||||
this.type = 38
|
||||
}
|
||||
|
||||
|
||||
|
||||
set recipientPublicKey(recipientPublicKey) {
|
||||
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
||||
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
||||
this.recipient = publicKeyToAddress(this._recipientPublicKey)
|
||||
|
||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
||||
const sharedSecret = new Uint8Array(32)
|
||||
|
||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||
|
||||
this._rewardShareSeed = new Sha256().process(sharedSecret).finish().result
|
||||
this._base58RewardShareSeed = this.constructor.Base58.encode(this._rewardShareSeed)
|
||||
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(this._rewardShareSeed)
|
||||
|
||||
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.01)
|
||||
} else {
|
||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001)
|
||||
}
|
||||
}
|
||||
|
||||
set recipient(recipient) {
|
||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||
}
|
||||
|
||||
set percentageShare(share) {
|
||||
this._percentageShare = share * 100
|
||||
this._percentageShareBytes = this.constructor.utils.int64ToBytes(this._percentageShare)
|
||||
}
|
||||
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._recipient,
|
||||
this._rewardShareKeyPair.publicKey,
|
||||
this._percentageShareBytes,
|
||||
this._feeBytes
|
||||
)
|
||||
return params
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ import RegisterNameTransaction from './RegisterNameTransaction.js'
|
||||
import VoteOnPollTransaction from './VoteOnPollTransaction.js'
|
||||
import CreatePollTransaction from './CreatePollTransaction.js'
|
||||
import DeployAtTransaction from './DeployAtTransaction.js'
|
||||
import RewardShareTransaction from './RewardShareTransaction.js'
|
||||
import RemoveRewardShareTransaction from './RemoveRewardShareTransaction.js'
|
||||
|
||||
|
||||
export const transactionTypes = {
|
||||
@ -36,14 +38,14 @@ export const transactionTypes = {
|
||||
29: GroupInviteTransaction,
|
||||
30: CancelGroupInviteTransaction,
|
||||
31: JoinGroupTransaction,
|
||||
32: LeaveGroupTransaction
|
||||
32: LeaveGroupTransaction,
|
||||
38: RewardShareTransaction,
|
||||
381: RemoveRewardShareTransaction
|
||||
}
|
||||
|
||||
|
||||
export const createTransaction = (type, keyPair, params) => {
|
||||
|
||||
const tx = new transactionTypes[type]()
|
||||
|
||||
tx.keyPair = keyPair
|
||||
Object.keys(params).forEach(param => {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user