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