Browse Source

Merge pull request #70 from PhillipLangMartinez/bugfix/start-minting-remove-sponsorshipkey

Bugfix/start minting remove sponsorshipkey
pull/71/head
AlphaX-Projects 2 years ago committed by GitHub
parent
commit
c8703cca51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      qortal-ui-core/language/us.json
  2. 19
      qortal-ui-core/src/components/start-minting.js

3
qortal-ui-core/language/us.json

@ -152,7 +152,8 @@
"smchange6":"Awaiting confirmation on blockchain", "smchange6":"Awaiting confirmation on blockchain",
"smchange7":"Finishing up relationship", "smchange7":"Finishing up relationship",
"smchange8":"Adding minting key to node", "smchange8":"Adding minting key to node",
"smchange9":"Complete" "smchange9":"Complete",
"smchange10": "Only 2 minting keys are allowed per node, you are attempting to assign 3 keys, please go to management - node management, and remove the key you do not want to assign to this node, thank you!"
}, },
"mintingpage":{ "mintingpage":{
"mchange1":"General Minting Details", "mchange1":"General Minting Details",

19
qortal-ui-core/src/components/start-minting.js

@ -36,6 +36,9 @@ class StartMinting extends connect(store)(LitElement) {
static get styles() { static get styles() {
return [ return [
css` css`
p, h1 {
color: var(--black)
}
.dialogCustom { .dialogCustom {
position: fixed; position: fixed;
z-index: 10000; z-index: 10000;
@ -152,6 +155,7 @@ class StartMinting extends connect(store)(LitElement) {
.between p { .between p {
margin: 0; margin: 0;
padding: 0; padding: 0;
color: var(--black);
} }
.marginLoader { .marginLoader {
margin-left: 10px; margin-left: 10px;
@ -224,11 +228,14 @@ class StartMinting extends connect(store)(LitElement) {
const myNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]; const myNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node];
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port; const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
this.status = value this.status = value
const publicAddress = window.parent.reduxStore.getState().app?.selectedAddress ?.base58PublicKey; const address = window.parent.reduxStore.getState().app?.selectedAddress?.address;
// Check to see if a sponsorship key on a newly-level 1 minter exists. If it does, remove it. // Check to see if a sponsorship key on a newly-level 1 minter exists. If it does, remove it.
const findMintingAccountFromOtherUser = this.mintingAccountData.find((ma) => !ma.publicKey.includes(publicAddress)); const findMintingAccountFromOtherUser = this.mintingAccountData.find((ma) => ma.recipientAccount === address && ma.mintingAccount !== address);
const removeMintingAccount = async (publicKey) => { const removeMintingAccount = async (publicKey) => {
const url = `${nodeUrl}/admin/mintingaccounts?apiKey=${myNode.apiKey}`; const url = `${nodeUrl}/admin/mintingaccounts?apiKey=${myNode.apiKey}`;
return await fetch(url, { return await fetch(url, {
@ -394,6 +401,14 @@ async confirmRelationship(){
const startMinting = async () => { const startMinting = async () => {
this.openDialogRewardShare = true this.openDialogRewardShare = true
this.errorMsg = ''; this.errorMsg = '';
const address = window.parent.reduxStore.getState().app?.selectedAddress?.address;
const findMintingAccountsFromUser = this.mintingAccountData.filter((ma) => ma.recipientAccount === address && ma.mintingAccount === address);
if(findMintingAccountsFromUser.length > 2){
this.errorMsg = translate("startminting.smchange10")
return;
}
try { try {
this.privateRewardShareKey = await createSponsorshipKey(); this.privateRewardShareKey = await createSponsorshipKey();

Loading…
Cancel
Save