changed isSponsored logic

This commit is contained in:
Phillip Lang Martinez 2022-08-30 18:01:24 +03:00
parent 565bed7b16
commit cafcb83a24

View File

@ -98,8 +98,7 @@ class BecomeMinter extends LitElement {
async atMount() { async atMount() {
this.changeLanguage(); this.changeLanguage();
this.addressInfo =
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
this.isPageLoading = true; this.isPageLoading = true;
try { try {
const [nodeInfo, myRewardShareArray, mintingaccounts] = const [nodeInfo, myRewardShareArray, mintingaccounts] =
@ -117,6 +116,8 @@ class BecomeMinter extends LitElement {
myRewardShareArray[0]?.rewardSharePublicKey; myRewardShareArray[0]?.rewardSharePublicKey;
this.isPageLoading = false; this.isPageLoading = false;
this.mintingAccountData = mintingaccounts; this.mintingAccountData = mintingaccounts;
this.addressInfo =
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
@ -147,15 +148,18 @@ class BecomeMinter extends LitElement {
} }
render() { render() {
const findMintingAccount = this.mintingAccountData?.find( const findMintingAccount = this.mintingAccountData?.find(
(ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress (ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress
?.address ?.address
); );
const isAlreadySponsored = const isAlreadySponsored =
this.addressInfo?.error !== 124 && this.addressInfo?.error !== 124 &&
this.addressInfo?.level === 0 && this.addressInfo?.level === 0 &&
findMintingAccount; this.addressInfo?.blocksMinted > 0 && this.addressInfo?.blocksMinted < 7200
return html` return html`
${this.isPageLoading ${this.isPageLoading
@ -189,6 +193,7 @@ class BecomeMinter extends LitElement {
.rewardSharePublicKey=${this .rewardSharePublicKey=${this
.rewardSharePublicKey} .rewardSharePublicKey}
.addressInfo=${this.addressInfo} .addressInfo=${this.addressInfo}
.isMinting=${!!findMintingAccount}
></yes-sponsored> ></yes-sponsored>
`} `}
</div> </div>