diff --git a/locale/cnr/translation.toml b/locale/cnr/translation.toml index 5c3bb73b..561a216e 100644 --- a/locale/cnr/translation.toml +++ b/locale/cnr/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/de/translation.toml b/locale/de/translation.toml index f3b32975..44407ab8 100644 --- a/locale/de/translation.toml +++ b/locale/de/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/en/translation.toml b/locale/en/translation.toml index 39a1d547..33a01e76 100644 --- a/locale/en/translation.toml +++ b/locale/en/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "Save Wallet File" # Save Wallet File proposalOverBudget = "Over Budget" # Over Budget badSaplingRoot = "There was an error while syncing. Resyncing from scratch (Bad sapling root)" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "Creating SHIELD transaction..." # Creating SHIELD transaction... +deleteProposal = "Delete Proposal" # Delete Proposal +deleteProposalBody = "Are you sure you want to delete your proposal? Your collateral will be permanently lost." # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "Part of your staked balance may be locked for 100 blocks as your reward matures." # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/es-mx/translation.toml b/locale/es-mx/translation.toml index d3a90d59..3b0f178f 100644 --- a/locale/es-mx/translation.toml +++ b/locale/es-mx/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/fr/translation.toml b/locale/fr/translation.toml index bfcab012..e39ee469 100644 --- a/locale/fr/translation.toml +++ b/locale/fr/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/hi/translation.toml b/locale/hi/translation.toml index 3fa0cf88..31eb6b82 100644 --- a/locale/hi/translation.toml +++ b/locale/hi/translation.toml @@ -208,6 +208,8 @@ shieldAddress = "शील्ड एड्रेस" # Shield address cantShieldToExc = "यह एड्रेस शील्ड ट्रांसफर का समर्थन नहीं करता" # This address does not support shield transfers badSaplingRoot = "सिंक करते समय एक त्रुटि हुई। रिसिंकिंग कर रहे हैं स्क्रैच से(खराब सैपलिंग रूट)" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "क्रिएटिंग शील्ड ट्रांजेक्शन..." # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/it/translation.toml b/locale/it/translation.toml index 1035bf08..fa2fca9d 100644 --- a/locale/it/translation.toml +++ b/locale/it/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/nl/translation.toml b/locale/nl/translation.toml index df0c1486..48084ec0 100644 --- a/locale/nl/translation.toml +++ b/locale/nl/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/ph/translation.toml b/locale/ph/translation.toml index ec2739ef..b317d4b1 100644 --- a/locale/ph/translation.toml +++ b/locale/ph/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/pl/translation.toml b/locale/pl/translation.toml index 1fa0bee8..cb7aaff4 100644 --- a/locale/pl/translation.toml +++ b/locale/pl/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/pt-br/translation.toml b/locale/pt-br/translation.toml index b26fcc1a..b5a31527 100644 --- a/locale/pt-br/translation.toml +++ b/locale/pt-br/translation.toml @@ -84,6 +84,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/pt-pt/translation.toml b/locale/pt-pt/translation.toml index c6d9f486..aa5fc1df 100644 --- a/locale/pt-pt/translation.toml +++ b/locale/pt-pt/translation.toml @@ -84,6 +84,8 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/locale/template/translation.toml b/locale/template/translation.toml index 5d7269e5..c3fc3ebf 100644 --- a/locale/template/translation.toml +++ b/locale/template/translation.toml @@ -232,6 +232,8 @@ shieldAddress = "Shield address" cantShieldToExc = "This address does not support shield transfers" badSaplingRoot = "There was an error while syncing. Resyncing from scratch (Bad sapling root)" creatingShieldTransaction = "Creating SHIELD transaction..." +deleteProposal = "Delete Proposal" +deleteProposalBody = "Are you sure you want to delete your proposal? Your collateral will be permanently lost." immatureRewards = "Part of your staked balance may be locked for 100 blocks as your reward matures." [ALERTS] diff --git a/locale/uwu/translation.toml b/locale/uwu/translation.toml index 2717070b..d3796632 100644 --- a/locale/uwu/translation.toml +++ b/locale/uwu/translation.toml @@ -208,6 +208,8 @@ saveWalletFile = "Save Wawwet File" # Save Wallet File proposalOverBudget = "Over Budgey" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +deleteProposal = "" # Delete Proposal +deleteProposalBody = "" # Are you sure you want to delete your proposal? Your collateral will be permanently lost. immatureRewards = "" # Part of your staked balance may be locked for 100 blocks as your reward matures. [ALERTS] diff --git a/scripts/composables/use_masternode.js b/scripts/composables/use_masternode.js index 9a59bc02..f057cf42 100644 --- a/scripts/composables/use_masternode.js +++ b/scripts/composables/use_masternode.js @@ -11,12 +11,12 @@ export const useMasternode = defineStore('masternode', () => { const localProposals = ref([]); watch( localProposals, - async () => { + async (localProposals) => { const database = await Database.getInstance(); const account = await database.getAccount(); if (account) { - account.localProposals = toRaw(localProposals.value); - await database.updateAccount(account); + account.localProposals = toRaw(localProposals); + await database.updateAccount(account, true); } }, { diff --git a/scripts/governance/Governance.vue b/scripts/governance/Governance.vue index 2c074c0a..06a72ede 100644 --- a/scripts/governance/Governance.vue +++ b/scripts/governance/Governance.vue @@ -58,7 +58,7 @@ watch( [blockCount, localProposals], async () => { for (const proposal of localProposals.value) { - if (!proposal.blockHeight) { + if (!proposal.blockHeight || proposal.blockHeight === -1) { let tx; try { tx = await getNetwork().getTxInfo(proposal.txid); @@ -74,8 +74,7 @@ watch( cChainParams.current.proposalFeeConfirmRequirement ) { // Proposal fee has the required amounts of confirms, stop watching and try to finalize - // TODO: remove propsal - finalizeProposal(proposal); + await finalizeProposal(proposal); } } }, @@ -188,16 +187,24 @@ async function createProposal(name, url, payments, monthlyPayment, address) { } async function finalizeProposal(proposal) { const { ok, err } = await Masternode.finalizeProposal(proposal); + if (ok) { - createAlert('success', translation.PROPOSAL_FINALISED); + createAlert('success', ALERTS.PROPOSAL_FINALISED); + deleteProposal(proposal); } else { createAlert( 'warning', - translation.PROPOSAL_FINALISE_FAIL + '
' + sanitizeHTML(err) + ALERTS.PROPOSAL_FINALISE_FAIL + '
' + sanitizeHTML(err) ); } } +function deleteProposal(proposal) { + localProposals.value = localProposals.value.filter( + (p) => p.txid !== proposal.txid + ); +} + async function vote(proposal, voteCode) { if (masternode.value) { if ((await masternode.value.getStatus()) !== 'ENABLED') { @@ -296,6 +303,7 @@ async function vote(proposal, voteCode) { :price="price" @vote="vote" @finalizeProposal="(proposal) => finalizeProposal(proposal)" + @deleteProposal="(proposal) => deleteProposal(proposal)" /> diff --git a/scripts/governance/LocalProposalStatus.vue b/scripts/governance/LocalProposalStatus.vue index a43f20a1..13d877a5 100644 --- a/scripts/governance/LocalProposalStatus.vue +++ b/scripts/governance/LocalProposalStatus.vue @@ -1,7 +1,8 @@ diff --git a/scripts/governance/MobileProposalRow.vue b/scripts/governance/MobileProposalRow.vue index f3945b96..81dc492b 100644 --- a/scripts/governance/MobileProposalRow.vue +++ b/scripts/governance/MobileProposalRow.vue @@ -9,7 +9,7 @@ const props = defineProps({ strCurrency: String, }); const { proposal, price, strCurrency } = toRefs(props); -const emit = defineEmits(['vote']); +const emit = defineEmits(['vote', 'deleteProposal']); diff --git a/scripts/governance/ProposalRow.vue b/scripts/governance/ProposalRow.vue index cb4e5d5a..b6658c06 100644 --- a/scripts/governance/ProposalRow.vue +++ b/scripts/governance/ProposalRow.vue @@ -28,7 +28,12 @@ const { proposalValidator, blockCount, } = toRefs(props); -const emit = defineEmits(['click', 'finalizeProposal', 'vote']); +const emit = defineEmits([ + 'click', + 'finalizeProposal', + 'vote', + 'deleteProposal', +]); const showConfirmVoteModal = ref(false); const selectedVoteCode = ref(0); function vote(voteCode) { @@ -51,6 +56,7 @@ function vote(voteCode) { :proposal="proposal" :blockCount="blockCount" @finalizeProposal="emit('finalizeProposal')" + @deleteProposal="emit('deleteProposal')" /> diff --git a/scripts/governance/ProposalsTable.vue b/scripts/governance/ProposalsTable.vue index b88c0db8..6202cb9f 100644 --- a/scripts/governance/ProposalsTable.vue +++ b/scripts/governance/ProposalsTable.vue @@ -1,7 +1,7 @@