fix bugs: key already existing publickey missing
This commit is contained in:
parent
f6e4de1bf3
commit
536ccbcad2
@ -234,15 +234,23 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
}
|
||||
|
||||
async changeStatus(value){
|
||||
const myNode =
|
||||
store.getState().app.nodeConfig.knownNodes[
|
||||
store.getState().app.nodeConfig.node
|
||||
];
|
||||
|
||||
const nodeUrl =
|
||||
myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
this.status = value
|
||||
const publicAddress =
|
||||
window.parent.reduxStore.getState().app?.selectedAddress
|
||||
?.base58PublicKey;
|
||||
// Check to see if a sponsorship key on a newly-level 1 minter exists. If it does, remove it.
|
||||
const findMintingAccountFromOtherUser = mintingAccountData.find(
|
||||
const findMintingAccountFromOtherUser = this.mintingAccountData.find(
|
||||
(ma) => !ma.publicKey.includes(publicAddress)
|
||||
);
|
||||
const removeMintingAccount = async (publicKey) => {
|
||||
|
||||
const url = `${nodeUrl}/admin/mintingaccounts?apiKey=${myNode.apiKey}`;
|
||||
|
||||
return await fetch(url, {
|
||||
@ -275,7 +283,7 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
}
|
||||
|
||||
try {
|
||||
await addMintingAccount(sponsorshipKeyValue);
|
||||
await addMintingAccount(this.privateRewardShareKey);
|
||||
routes.showSnackBar({
|
||||
data: translate('becomeMinterPage.bchange19'),
|
||||
});
|
||||
@ -291,6 +299,13 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
|
||||
|
||||
async confirmRelationship(){
|
||||
const myNode =
|
||||
store.getState().app.nodeConfig.knownNodes[
|
||||
store.getState().app.nodeConfig.node
|
||||
];
|
||||
const nodeUrl =
|
||||
myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
|
||||
let interval = null
|
||||
let stop = false
|
||||
this.status = 2
|
||||
@ -386,8 +401,8 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
};
|
||||
|
||||
const getTxnRequestResponse = (txnResponse) => {
|
||||
|
||||
if(txnResponse?.message?.includes('multiple')){
|
||||
let err6string = get('rewardsharepage.rchange21');
|
||||
if(txnResponse?.extraData?.rewardSharePrivateKey && txnResponse.success === true){
|
||||
return err6string
|
||||
}
|
||||
if (txnResponse.success === false && txnResponse.message) {
|
||||
@ -396,7 +411,7 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
txnResponse.success === true &&
|
||||
!txnResponse.data.error
|
||||
) {
|
||||
let err6string = get('rewardsharepage.rchange21');
|
||||
|
||||
return err6string;
|
||||
} else {
|
||||
throw(txnResponse);
|
||||
@ -410,7 +425,7 @@ class StartMinting extends connect(store)(LitElement) {
|
||||
let myTransaction = await makeTransactionRequest(lastRef);
|
||||
|
||||
getTxnRequestResponse(myTransaction);
|
||||
return myTransaction.data;
|
||||
return myTransaction?.extraData?.rewardSharePrivateKey
|
||||
};
|
||||
|
||||
|
||||
|
@ -140,15 +140,21 @@ export const routes = {
|
||||
req.data.params
|
||||
);
|
||||
|
||||
if (!req.disableModal) {
|
||||
if (!req.disableModal && !req.data.disableModal) {
|
||||
await requestTransactionDialog.requestTransaction(tx);
|
||||
}
|
||||
|
||||
const res = await processTransaction(tx.signedBytes);
|
||||
let extraData = {}
|
||||
if(req.data.type === 38 && tx?._rewardShareKeyPair?.secretKey){
|
||||
extraData.rewardSharePrivateKey = Base58.encode(tx._rewardShareKeyPair.secretKey)
|
||||
}
|
||||
|
||||
|
||||
response = {
|
||||
success: true,
|
||||
data: res,
|
||||
extraData
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
@ -159,7 +159,6 @@ class SponsorshipList extends LitElement {
|
||||
|
||||
|
||||
|
||||
|
||||
let rewardShares = await this.getRewardShareRelationship(
|
||||
address
|
||||
)
|
||||
@ -171,7 +170,6 @@ class SponsorshipList extends LitElement {
|
||||
type: "api",
|
||||
url: `/addresses/${rs.recipient}`,
|
||||
})
|
||||
|
||||
let blocksRemaining = this._levelUpBlocks(addressInfo)
|
||||
blocksRemaining = +blocksRemaining > 0 ? +blocksRemaining : 0
|
||||
return {
|
||||
@ -294,7 +292,10 @@ class SponsorshipList extends LitElement {
|
||||
|
||||
async createRewardShare(publicKeyValue) {
|
||||
this.openDialogRewardShare = true
|
||||
|
||||
if(!publicKeyValue){
|
||||
this.errorMessage = "unable to pull public key from the chain, account has no outgoing transactions"
|
||||
return
|
||||
}
|
||||
this.privateRewardShareKey = ""
|
||||
|
||||
this.errorMessage = ""
|
||||
@ -348,7 +349,7 @@ class SponsorshipList extends LitElement {
|
||||
|
||||
getTxnRequestResponse(myTransaction)
|
||||
} catch (error) {
|
||||
this.errorMessage = error?.message || 'Error creating relationship'
|
||||
this.errorMessage = error
|
||||
}
|
||||
|
||||
|
||||
@ -379,37 +380,35 @@ class SponsorshipList extends LitElement {
|
||||
rewarddialog3: rewarddialog3,
|
||||
rewarddialog4: rewarddialog4,
|
||||
},
|
||||
disableModal: true
|
||||
})
|
||||
return myTxnrequest
|
||||
}
|
||||
|
||||
const getTxnRequestResponse = (txnResponse) => {
|
||||
|
||||
if(txnResponse.message.includes('multiple')){
|
||||
this.isLoadingCreateSponsorship = false
|
||||
if(txnResponse?.extraData?.rewardSharePrivateKey && txnResponse.success === true){
|
||||
|
||||
this.privateRewardShareKey = txnResponse.data
|
||||
this.confirmRelationship(recipientPublicKey)
|
||||
}
|
||||
if (txnResponse.success === false && txnResponse.message) {
|
||||
this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey
|
||||
this.confirmRelationship()
|
||||
} else if (txnResponse.success === false && txnResponse?.message) {
|
||||
|
||||
this.errorMessage = txnResponse.message
|
||||
this.errorMessage = txnResponse?.message
|
||||
this.isLoadingCreateSponsorship = false
|
||||
throw(txnResponse)
|
||||
throw(txnResponse?.message)
|
||||
} else if (
|
||||
txnResponse.success === true &&
|
||||
!txnResponse.data.error
|
||||
) {
|
||||
|
||||
this.isLoadingCreateSponsorship = false
|
||||
|
||||
this.privateRewardShareKey = txnResponse.data
|
||||
this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey
|
||||
this.confirmRelationship()
|
||||
} else {
|
||||
|
||||
this.errorMessage = txnResponse.data.message
|
||||
this.errorMessage = txnResponse?.data?.message || txnResponse?.message
|
||||
this.isLoadingCreateSponsorship = false
|
||||
throw(txnResponse)
|
||||
throw(txnResponse?.data?.message || txnResponse?.message)
|
||||
}
|
||||
}
|
||||
validateReceiver()
|
||||
@ -419,10 +418,12 @@ class SponsorshipList extends LitElement {
|
||||
|
||||
|
||||
async confirmRelationship(recipientPublicKey){
|
||||
this.status = 2
|
||||
let interval = null
|
||||
let stop = false
|
||||
|
||||
const getAnswer = async () => {
|
||||
|
||||
if (!stop) {
|
||||
stop= true;
|
||||
|
||||
@ -458,7 +459,6 @@ class SponsorshipList extends LitElement {
|
||||
|
||||
|
||||
render() {
|
||||
console.log({sponsors: this.sponsorships})
|
||||
return html`
|
||||
${
|
||||
this.isPageLoading
|
||||
@ -528,7 +528,11 @@ class SponsorshipList extends LitElement {
|
||||
Copy Sponsorship Key
|
||||
</p>
|
||||
|
||||
<mwc-button @click=${()=> this.createRewardShare(sponsorship.publicKey)}>copy</mwc-button>
|
||||
<mwc-button @click=${()=> {
|
||||
|
||||
|
||||
this.createRewardShare(sponsorship?.publicKey)
|
||||
} }>copy</mwc-button>
|
||||
</li>
|
||||
<li class="grid-item grid-item-button">
|
||||
<mwc-button
|
||||
@ -693,6 +697,7 @@ class SponsorshipList extends LitElement {
|
||||
this.errorMessage = ''
|
||||
this.isLoadingCreateSponsorship = false
|
||||
this.privateRewardShareKey = ""
|
||||
this.atMount()
|
||||
}}
|
||||
class="red"
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user