|
|
@ -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" |
|
|
|
> |
|
|
|
> |
|
|
|