From ce0cccdfc17d93bece42eb06239d5ce606ab153b Mon Sep 17 00:00:00 2001 From: Duddino Date: Fri, 3 Jan 2025 13:46:01 +0100 Subject: [PATCH 01/16] Actually lock mn collateral --- scripts/composables/use_masternode.js | 6 ++++-- scripts/composables/use_wallet.js | 4 ++++ scripts/masternode/Masternode.vue | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/composables/use_masternode.js b/scripts/composables/use_masternode.js index 403c0f00d..9a59bc02b 100644 --- a/scripts/composables/use_masternode.js +++ b/scripts/composables/use_masternode.js @@ -40,8 +40,10 @@ export const useMasternode = defineStore('masternode', () => { await database.addMasternode(toRaw(masternode.value)); }); - fetchProposalsFromDatabase().then(() => {}); - fetchMasternodeFromDatabase().then(() => {}); + getEventEmitter().on('wallet-import', () => { + fetchProposalsFromDatabase().then(() => {}); + fetchMasternodeFromDatabase().then(() => {}); + }); getEventEmitter().on('toggle-network', () => { fetchProposalsFromDatabase().then(() => {}); fetchMasternodeFromDatabase().then(() => {}); diff --git a/scripts/composables/use_wallet.js b/scripts/composables/use_wallet.js index db15abe0f..c1bc7b59e 100644 --- a/scripts/composables/use_wallet.js +++ b/scripts/composables/use_wallet.js @@ -137,6 +137,8 @@ export const useWallet = defineStore('wallet', () => { const isCreatingTransaction = () => createAndSendTransaction.isLocked(); const getMasternodeUTXOs = () => wallet.getMasternodeUTXOs(); const getPath = (script) => wallet.getPath(script); + const lockCoin = (out) => wallet.lockCoin(out); + const unlockCoin = (out) => wallet.unlockCoin(out); getEventEmitter().on('toggle-network', async () => { isEncrypted.value = await hasEncryptedWallet(); @@ -198,5 +200,7 @@ export const useWallet = defineStore('wallet', () => { getMasternodeUTXOs, getPath, blockCount, + lockCoin, + unlockCoin, }; }); diff --git a/scripts/masternode/Masternode.vue b/scripts/masternode/Masternode.vue index 879d20d87..8a9949d2d 100644 --- a/scripts/masternode/Masternode.vue +++ b/scripts/masternode/Masternode.vue @@ -13,6 +13,7 @@ import { getNetwork } from '../network/network_manager.js'; import { translation, ALERTS } from '../i18n.js'; import { generateMasternodePrivkey, parseIpAddress } from '../misc'; import { useAlerts } from '../composables/use_alerts.js'; +import { COutpoint } from '../transaction.js'; const { createAlert } = useAlerts(); @@ -28,6 +29,22 @@ const masternodePrivKey = ref(''); // Array of possible masternode UTXOs const possibleUTXOs = ref(wallet.getMasternodeUTXOs()); +watch(masternode, (masternode, oldValue) => { + if (oldValue?.collateralTxId) { + wallet.unlockCoin( + new COutpoint({ txid: oldValue.collateralTxId, n: oldValue.outidx }) + ); + } + + if (masternode?.collateralTxId) { + wallet.lockCoin( + new COutpoint({ + txid: masternode.collateralTxId, + n: masternode.outidx, + }) + ); + } +}); function updatePossibleUTXOs() { possibleUTXOs.value = wallet.getMasternodeUTXOs(); } From 47feea3d3610e1eb68ad8cb63217f542c2b2eeed Mon Sep 17 00:00:00 2001 From: Duddino Date: Tue, 7 Jan 2025 15:30:44 +0100 Subject: [PATCH 02/16] View only implementation of multi masternodes --- .eslintrc.json | 6 +- locale/cnr/translation.toml | 9 +- locale/de/translation.toml | 9 +- locale/en/translation.toml | 10 +- locale/es-mx/translation.toml | 9 +- locale/fr/translation.toml | 9 +- locale/hi/translation.toml | 9 +- locale/it/translation.toml | 9 +- locale/nl/translation.toml | 9 +- locale/ph/translation.toml | 9 +- locale/pl/translation.toml | 9 +- locale/pt-br/translation.toml | 7 +- locale/pt-pt/translation.toml | 7 +- locale/pt/translation.toml | 2 +- locale/template/translation.toml | 4 + locale/uwu/translation.toml | 9 +- scripts/composables/use_masternode.js | 28 ++- scripts/database.js | 38 ++-- scripts/masternode/Masternode.vue | 79 ++++--- scripts/masternode/NewMasternodeList.vue | 264 +++++++---------------- 20 files changed, 271 insertions(+), 264 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e3af76528..c80eb1f6d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,6 +21,10 @@ "no-constant-condition": "off", "@typescript-eslint/no-empty-function": "off", "no-console": "error", - "eqeqeq": ["error", "smart"] + "eqeqeq": ["error", "smart"], + "no-warning-comments": [ + "error", + { "terms": ["fail"], "location": "anywhere" } + ] } } diff --git a/locale/cnr/translation.toml b/locale/cnr/translation.toml index 217d2be6d..316f234d3 100644 --- a/locale/cnr/translation.toml +++ b/locale/cnr/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Interna greška, molimo pokušajte ponovo kasnije" # Internal error, please try again later @@ -225,7 +229,7 @@ QR_SCANNER_BAD_RECEIVER = "nije validan primalac plaćanja" # is not a valid pay UNSUPPORTED_CHARACTER = "Karakter '{char}' nije podržan u adresama! (Nije kompatibilan sa Base58)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "Ovaj pretraživač ne podržava Web Workers (višenitni JS), nažalost ne možete generisati Personalizovane novčanike!" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "Neispravna PIVX adresa!
{address}" # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "Minimalni iznos je {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Minimalni iznos je {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} decimalno prekoračenje" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Staking adresa je postavljena!
Sada možete unstake-ovati!" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "Potvrdite vaše unstake-ovanje
Potvrdite TX na svom {strHardwareName}" # Confirm your Unstake
Confirm the TX on your {strHardwareName} @@ -313,7 +317,8 @@ WALLET_LOCKED = "Novčanik je uspešno zaključan!" # Wallet successfully Locked WALLET_UNLOCKED = "Novčanik je uspešno otključan!" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/de/translation.toml b/locale/de/translation.toml index cf56fb4d9..bff8dc549 100644 --- a/locale/de/translation.toml +++ b/locale/de/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Interner Fehler, bitte versuche es später erneut" # Internal error, please try again later @@ -225,7 +229,7 @@ INVALID_AMOUNT = "Ungültige Menge!
" # Invalid amount!
TX_SENT = "Transaktion gesendet!" # Transaction sent! TX_FAILED = "Transaktion fehlgeschlagen!" # Transaction Failed! QR_SCANNER_BAD_RECEIVER = "ist kein gültiger Empfänger" # is not a valid payment receiver -VALIDATE_AMOUNT_LOW = "Minimale Menge ist {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Minimale Menge ist {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} Nachkommastellen überschritten" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Staking Adresse gesetzt
Gehe nun über zum Abberufen!" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "Kalte Adresse gesetzt!
Zukünftige Delegierungen benutzen diese Adresse." # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/en/translation.toml b/locale/en/translation.toml index 9dff85d21..cd4860060 100644 --- a/locale/en/translation.toml +++ b/locale/en/translation.toml @@ -208,6 +208,10 @@ 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... +masternodeRestartConfirmation = "Are you sure you want to restart your masternode?" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "Are you sure you want to delete your masternode?" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "Restart Masternode" # Restart Masternode +masternodeDeleteTitle = "Delete Masternode" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Internal error, please try again later" # Internal error, please try again later @@ -225,7 +229,7 @@ QR_SCANNER_BAD_RECEIVER = "is not a valid payment receiver" # is not a valid pay UNSUPPORTED_CHARACTER = "The character '{char}' is unsupported in addresses! (Not Base58 compatible)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets!" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "Invalid PIVX address!
{address}" # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "Minimum amount is {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Minimum amount is {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} decimal limit exceeded" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Staking Address set!
Now go ahead and unstake!" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "Confirm your Unstake
Confirm the TX on your {strHardwareName}" # Confirm your Unstake
Confirm the TX on your {strHardwareName} @@ -258,7 +262,7 @@ MN_BAD_IP = "The IP address is invalid!" # The IP address is invalid! MN_BAD_PRIVKEY = "The private key is invalid" # The private key is invalid MN_NOT_ENOUGH_COLLAT = "You need {amount} more {ticker} to create a Masternode!" # You need {amount} more {ticker} to create a Masternode! MN_ENOUGH_BUT_NO_COLLAT = "You have enough balance for a Masternode, but no valid collateral UTXO of {amount} {ticker}" # You have enough balance for a Masternode, but no valid collateral UTXO of {amount} {ticker} -MN_UNLOCK_WALLET = "Please import your COLLATERAL WALLET first." +MN_UNLOCK_WALLET = "Please import your COLLATERAL WALLET first." # Please import your COLLATERAL WALLET first. MN_COLLAT_NOT_SUITABLE = "This is not a suitable UTXO for a Masternode" # This is not a suitable UTXO for a Masternode MN_CANT_CONNECT = "Unable to connect to RPC node!" # Unable to connect to RPC node! CONTACTS_ENCRYPT_FIRST = "You need to hit \"{button}\" before you can use Contacts!" # You need to hit "{button}" before you can use Contacts! @@ -317,4 +321,4 @@ CONFIRM_LEDGER_TX_OUT = "You will send {value} {ticker} to
Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! -MISSING_FUNDS = "Balance is too small!
Missing {sats} sats!" # Balance is too small!
Missing {sats} sats! +MISSING_FUNDS = "Balance is too small!
Missing {sats} sats!" # Balance is too small!
Missing {sats} sats! diff --git a/locale/es-mx/translation.toml b/locale/es-mx/translation.toml index a31753403..75b76bfe4 100644 --- a/locale/es-mx/translation.toml +++ b/locale/es-mx/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Error interno, vuelve a intentarlo más tarde" # Internal error, please try again later @@ -225,7 +229,7 @@ INVALID_AMOUNT = "¡Cantidad no válida!
" # Invalid amount!
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "¡La cantidad mínima es {minimum Amount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} límite decimal excedido" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "¡Dirección de Staking establecida!
¡Ahora puedes dejar de hacer stake!" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "¡Dirección de Cold Staking establecida!
El Staking futuro usarán esta dirección." # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/fr/translation.toml b/locale/fr/translation.toml index 1bb2829d3..6b28c5f79 100644 --- a/locale/fr/translation.toml +++ b/locale/fr/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Erreur interne, veuillez réessayer plus tard" # Internal error, please try again later @@ -225,7 +229,7 @@ INVALID_AMOUNT = "Valeur non valide!
" # Invalid amount!
TX_SENT = "Transaction envoyée!" # Transaction sent! TX_FAILED = "Échec de la Transaction!" # Transaction Failed! QR_SCANNER_BAD_RECEIVER = "n'est pas un récepteur de paiement valide" # is not a valid payment receiver -VALIDATE_AMOUNT_LOW = "La valeur minimale est de {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "La valeur minimale est de {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} limite décimale dépassée" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Adresse de Staking défini!
Poursuivre avec le unstake!" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "Adresse du Cold Staking défini!
Cette adresse sera utilisée à l'avenir pour la réalisation de Stake.." # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/hi/translation.toml b/locale/hi/translation.toml index 79be479f7..b3d05c713 100644 --- a/locale/hi/translation.toml +++ b/locale/hi/translation.toml @@ -208,6 +208,10 @@ 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... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "आंतरिक त्रुटि, कृपया कुछ समय बाद पुनः प्रयास करें" # Internal error, please try again later @@ -225,7 +229,7 @@ QR_SCANNER_BAD_RECEIVER = "एक मान्य पेमेंट रिस UNSUPPORTED_CHARACTER = "वर्ण '{char}' एड्रेसिस में समर्थित नहीं है! (Base58 संगत नहीं)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "इस ब्राउज़र में वेब वर्कर्स (मल्टी-थ्रेडेड JS) का समर्थन नहीं है, दुर्भाग्यवश आप वैनीटी वॉलेट नहीं बना सकते!" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "अवैध PIVX अमाउन्ट!" # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "न्यूनतम अमाउन्ट {minimumAmount} {coinTicker} है!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "न्यूनतम अमाउन्ट {minimumAmount} {coinTicker} है!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} दशमलव सीमा से अधिक" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "स्टेकिंग एड्रेस सेट हो गया!
अब आगे बढ़ें और अनस्टेक करें!" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "अपने अनस्टेक की कन्फर्म करें
अपने {strHardwareName} पर TX कन्फर्म करें" # Confirm your Unstake
Confirm the TX on your {strHardwareName} @@ -314,6 +318,7 @@ CONFIRM_POPUP_DELETE_ACCOUNT = "यह आपके सभी डेटा क CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "क्या आप सुनिश्चित हैं?" # Are you sure? CONFIRM_LEDGER_TX = "कन्फर्म करें कि यह ट्रांजैक्शन आपके {hardwareWallet} पर जोड़े गए ट्रांजैक्शन से मेल खाता है" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "आप {value} {ticker} को
{address}
भेजेंगे" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "बैलेंस बहुत कम है! {sats} सैट्स की कमी है!" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "बैलेंस बहुत कम है! {sats} सैट्स की कमी है!" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "इस वॉलेट में शील्ड सक्षम नहीं है!" # Shield is not enabled in this wallet! WALLET_HARDWARE_USB_UNSUPPORTED = "" # Firefox doesn't support this!
Unfortunately, Firefox does not support hardware wallets +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/it/translation.toml b/locale/it/translation.toml index ec3f720d9..640b499ed 100644 --- a/locale/it/translation.toml +++ b/locale/it/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Errore interno, rirova più tardi" # Internal error, please try again later @@ -225,7 +229,7 @@ INVALID_AMOUNT = "Importo non valido!
" # Invalid amount!
TX_SENT = "Transazione inviata!" # Transaction sent! TX_FAILED = "Transazione fallita!" # Transaction Failed! QR_SCANNER_BAD_RECEIVER = "Il destinatario del pagamento non è valido" # is not a valid payment receiver -VALIDATE_AMOUNT_LOW = "L'importo minimo è di {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "L'importo minimo è di {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} limite decimale superato" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Indirizzo di staking impostato!
Ora vai avanti e annulla lo staking!" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "Cold Address impostato!
Gli stake futuri utilizzeranno questo indirizzo." # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "Wallet bloccato con successo!" # Wallet successfully Locked! WALLET_UNLOCKED = "Wallet sbloccato con successo!" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "Conferma che questa transazione combacia quella nel tuo {hardwareWallet}" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "Manderai {value} {ticker} a
{address}
" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "Il bilancio non è sufficiente! Mancano {sats} sats!" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "Il bilancio non è sufficiente! Mancano {sats} sats!" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "Lo Shield non è abilitato nel wallet!" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/nl/translation.toml b/locale/nl/translation.toml index 25397cd82..8dadbe5d6 100644 --- a/locale/nl/translation.toml +++ b/locale/nl/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Interne fout, probeer het later opnieuw" # Internal error, please try again later @@ -225,7 +229,7 @@ QR_SCANNER_BAD_RECEIVER = "is geen geldige betalingsontvanger" # is not a valid UNSUPPORTED_CHARACTER = "Het teken '{char}' wordt niet ondersteund in adressen! (Niet compatibel met Base58)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "Deze browser ondersteunt geen web workers (multi-threaded JS), helaas kun je geen Vanity wallets genereren!" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "Ongeldig PIVX-adres!
{address}" # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "Minimale bedrag is {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Minimale bedrag is {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} decimaallimiet overschreden" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Stakingsadres ingesteld!
Ga nu verder en maak de staking ongedaan!" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "Bevestig je ontkoppeling
Bevestig de transactie op je {strHardwareName}" # Confirm your Unstake
Confirm the TX on your {strHardwareName} @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/ph/translation.toml b/locale/ph/translation.toml index f9e11225e..8e215921f 100644 --- a/locale/ph/translation.toml +++ b/locale/ph/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Internal error, Pakiusap uliting muli" # Internal error, please try again later @@ -224,7 +228,7 @@ INVALID_AMOUNT = "Ang halaga ay hindi wasto!
" # Invalid amount!Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Ang pinakamababang halaga ay {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} Ang limitasyon sa decimal ay lumagpas" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Nakatakda na ang Staking address!

Pumunta ka na ngayon at mag unstake" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "Nakatakda na ang Cold Address!

Gagamitin ang address na to sa mga susunod na stakes" # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/pl/translation.toml b/locale/pl/translation.toml index f616ab695..4fbbfba71 100644 --- a/locale/pl/translation.toml +++ b/locale/pl/translation.toml @@ -208,6 +208,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Błąd wewnętrzny, spróbuj ponownie później" # Internal error, please try again later @@ -225,7 +229,7 @@ QR_SCANNER_BAD_RECEIVER = "nie jest prawidłowym odbiorcą" # is not a valid pay UNSUPPORTED_CHARACTER = "Znak '{char}' nie jest obsługiwany w adresach! (Nie jest kompatybilny z Base58)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "Ta przeglądarka nie obsługuje Web Workers (wielowątkowego JS), niestety nie można generować portfeli Vanity!" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "Nieprawidłowy adres PIVX!
{address}" # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "Kwota minimalna to {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Kwota minimalna to {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} Przekroczono limit dziesiętny" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Adres Stakingu ustawiony!
A teraz śmiało,idź i zrób Unstake" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "Potwierdź swój Unstake
Potwierdź TX na urządzeniu {strHardwareName}" # Confirm your Unstake
Confirm the TX on your {strHardwareName} @@ -313,7 +317,8 @@ WALLET_LOCKED = "Portfel pomyślnie zablokowany!" # Wallet successfully Locked! WALLET_UNLOCKED = "Portfel pomyślnie odblokowany!" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/pt-br/translation.toml b/locale/pt-br/translation.toml index 711b9733f..b1317eaf1 100644 --- a/locale/pt-br/translation.toml +++ b/locale/pt-br/translation.toml @@ -84,6 +84,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] STAKE_ADDR_SET = "Endereço de Cold Staking definido!
Ao fazer Stake no futuro este endereço irá ser usado." # Cold Address set!
Future stakes will use this address. @@ -126,7 +130,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/pt-pt/translation.toml b/locale/pt-pt/translation.toml index 6f995e749..6d584132d 100644 --- a/locale/pt-pt/translation.toml +++ b/locale/pt-pt/translation.toml @@ -84,6 +84,10 @@ saveWalletFile = "" # Save Wallet File proposalOverBudget = "" # Over Budget badSaplingRoot = "" # There was an error while syncing. Resyncing from scratch (Bad sapling root) creatingShieldTransaction = "" # Creating SHIELD transaction... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] STAKE_ADDR_SET = "Endereço de Cold Staking definido!
Ao fazer Stake no futuro irá ser usado este endereço." # Cold Address set!
Future stakes will use this address. @@ -126,7 +130,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/locale/pt/translation.toml b/locale/pt/translation.toml index eadcc121e..e4122cb54 100644 --- a/locale/pt/translation.toml +++ b/locale/pt/translation.toml @@ -138,7 +138,7 @@ INVALID_AMOUNT = "Valor inválido!
" # Invalid amount!
TX_SENT = "Transação enviada!" # Transaction sent! TX_FAILED = "Falha na transação!" # Transaction Failed! QR_SCANNER_BAD_RECEIVER = "não é um receptor de pagamento válido" # is not a valid payment receiver -VALIDATE_AMOUNT_LOW = "O valor mínimo é {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "O valor mínimo é {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = "{coinDecimal} limite decimal excedido" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Endereço de Staking definido!
Prossiga com o unstake!" # Staking Address set!
Now go ahead and unstake! CONFIRM_UNSTAKE_H_WALLET = "Confirme o seu Unstake
Confirme a TX no seu {strHardwareName}" # Confirm your Unstake
Confirm the TX on your {strHardwareName} diff --git a/locale/template/translation.toml b/locale/template/translation.toml index e4ff8164f..a74f25929 100644 --- a/locale/template/translation.toml +++ b/locale/template/translation.toml @@ -232,6 +232,10 @@ 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..." +masternodeRestartConfirmation = "Are you sure you want to restart your masternode?" +masternodeRestartTitle = "Restart Masternode" +masternodeDeleteConfirmation = "Are you sure you want to delete your masternode?" +masternodeDeleteTitle = "Delete Masternode" [ALERTS] INTERNAL_ERROR = "Internal error, please try again later" diff --git a/locale/uwu/translation.toml b/locale/uwu/translation.toml index 2dd726edd..8c69aa06d 100644 --- a/locale/uwu/translation.toml +++ b/locale/uwu/translation.toml @@ -208,6 +208,10 @@ 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... +masternodeRestartConfirmation = "" # Are you sure you want to restart your masternode? +masternodeDeleteConfirmation = "" # Are you sure you want to delete your masternode? +masternodeRestartTitle = "" # Restart Masternode +masternodeDeleteTitle = "" # Delete Masternode [ALERTS] INTERNAL_ERROR = "Internal error, pwease try again later" # Internal error, please try again later @@ -224,7 +228,7 @@ QR_SCANNER_BAD_RECEIVER = "is not a valid payment receiver" # is not a valid pay UNSUPPORTED_CHARACTER = "The chawacter '{char}' is unsupurrted in addwesses! (Not Base58 compatible)" # The character '{char}' is unsupported in addresses! (Not Base58 compatible) UNSUPPORTED_WEBWORKERS = "Dis bwowser doesn't suppurrt web workers" # This browser doesn't support Web Workers (multi-threaded JS), unfortunately you cannot generate Vanity wallets! INVALID_ADDRESS = "Invawed PIVX addwess baka
{address} " # Invalid PIVX address!
{address} -VALIDATE_AMOUNT_LOW = "Minimum ameownt is {minimumAmount} {coinTicker}!" #
Minimum amount is {minimumAmount} {coinTicker}! +VALIDATE_AMOUNT_LOW = "Minimum ameownt is {minimumAmount} {coinTicker}!" # Minimum amount is {minimumAmount} {coinTicker}! VALIDATE_AMOUNT_DECIMAL = " decimal wimit exceeded. Yowouve gone too fawr!" # {coinDecimal} decimal limit exceeded SUCCESS_STAKING_ADDR = "Staking Addwess set!
Now go ahead and unstake senpai❣" # Staking Address set!
Now go ahead and unstake! STAKE_ADDR_SET = "Cold Addwess set!
Future stakes will use dis addwess." # Cold Address set!
Future stakes will use this address. @@ -313,7 +317,8 @@ WALLET_LOCKED = "" # Wallet successfully Locked! WALLET_UNLOCKED = "" # Wallet successfully Unlocked! CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet} CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to
{address}
-MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats! +MISSING_FUNDS = "" # Balance is too small!
Missing {sats} sats! MISSING_SHIELD = "" # Shield is not enabled in this wallet! MN_START_FAILED = "" # Masternode failed to start! MN_RESTART_FAILED = "" # Masternode failed to restart! +MN_UNLOCK_WALLET = "" # Please import your COLLATERAL WALLET first. diff --git a/scripts/composables/use_masternode.js b/scripts/composables/use_masternode.js index 9a59bc02b..14cd9c7d1 100644 --- a/scripts/composables/use_masternode.js +++ b/scripts/composables/use_masternode.js @@ -5,9 +5,9 @@ import { getEventEmitter } from '../event_bus.js'; export const useMasternode = defineStore('masternode', () => { /** - * @type{import('vue').Ref} + * @type{import('vue').Ref} */ - const masternode = ref(null); + const masternodes = ref([]); const localProposals = ref([]); watch( localProposals, @@ -32,13 +32,25 @@ export const useMasternode = defineStore('masternode', () => { const fetchMasternodeFromDatabase = async () => { const database = await Database.getInstance(); - masternode.value = await database.getMasternode(); + masternodes.value = await database.getMasternodes(); }; - watch(masternode, async () => { - const database = await Database.getInstance(); - await database.addMasternode(toRaw(masternode.value)); - }); + watch( + masternodes, + async () => { + console.log('Adding mns:'); + console.log(masternodes.value); + debugger; + const database = await Database.getInstance(); + // TODO: Only check the diff and change value accordingly + for (const mn of masternodes.value) { + await database.addMasternode(toRaw(mn)); + } + }, + { + deep: true, + } + ); getEventEmitter().on('wallet-import', () => { fetchProposalsFromDatabase().then(() => {}); @@ -48,5 +60,5 @@ export const useMasternode = defineStore('masternode', () => { fetchProposalsFromDatabase().then(() => {}); fetchMasternodeFromDatabase().then(() => {}); }); - return { masternode, localProposals }; + return { masternodes, localProposals }; }); diff --git a/scripts/database.js b/scripts/database.js index 8ff6ace93..43e2b500b 100644 --- a/scripts/database.js +++ b/scripts/database.js @@ -18,9 +18,11 @@ export class Database { * Version 4 = Tx Refactor (#284) * Version 5 = Tx shield data (#295) * Version 6 = Filter unconfirmed txs (#415) + * Version 8 = Multi MNs (#remembertofill) * @type {number} */ - static version = 6; + // @fail Don't pass lint until PR # has been filled + static version = 8; /** * @type{import('idb').IDBPDatabase} @@ -39,24 +41,22 @@ export class Database { /** * Add masternode to the database * @param {Masternode} masternode - * @param {Masterkey} _masterKey - Masterkey associated to the masternode. Currently unused */ - async addMasternode(masternode, _masterKey) { + async addMasternode(masternode) { const store = this.#db .transaction('masternodes', 'readwrite') .objectStore('masternodes'); - // For now the key is 'masternode' since we don't support multiple masternodes - await store.put(masternode, 'masternode'); + await store.put(masternode); } /** * Removes a masternode - * @param {Masterkey} _masterKey - Masterkey associated to the masternode. Currently unused + * @param {Masternode} mn - Masternode to delete */ - async removeMasternode(_masterKey) { + async removeMasternode(mn) { const store = this.#db .transaction('masternodes', 'readwrite') .objectStore('masternodes'); - await store.delete('masternode'); + await store.delete(mn.walletPrivateKeyPath); } /** @@ -300,14 +300,14 @@ export class Database { } /** - * @returns {Promise} the masternode stored in the db + * @returns {Promise} the masternodes stored in the db */ - async getMasternode(_masterKey) { + async getMasternodes() { const store = this.#db .transaction('masternodes', 'readonly') .objectStore('masternodes'); - const mnData = await store.get('masternode'); - return !mnData ? null : new Masternode(mnData); + const mns = await store.getAll(); + return mns.map((mn) => new Masternode(mn)); } /** @@ -469,6 +469,20 @@ export class Database { } })(); } + if (oldVersion < 8) { + (async () => { + const store = transaction.objectStore('masternodes'); + const mn = await store.get('masternode'); + + db.deleteObjectStore('masternodes'); + const newStore = db.createObjectStore('masternodes', { + keyPath: 'walletPrivateKeyPath', + }); + if (mn) { + await newStore.add(mn); + } + })(); + } }, blocking: () => { // Another instance is waiting to upgrade, and we're preventing it diff --git a/scripts/masternode/Masternode.vue b/scripts/masternode/Masternode.vue index 8a9949d2d..5d68618c3 100644 --- a/scripts/masternode/Masternode.vue +++ b/scripts/masternode/Masternode.vue @@ -1,6 +1,7 @@ From f45699d359d742bbd98c99ae22fa858954b44923 Mon Sep 17 00:00:00 2001 From: Duddino Date: Wed, 8 Jan 2025 10:56:31 +0100 Subject: [PATCH 03/16] Add the ability to create and import masternodes --- assets/icons/icon-trash.svg | 12 + scripts/masternode/CreateMasternodeModal.vue | 276 +++++++++++++++++++ scripts/masternode/Masternode.vue | 37 ++- scripts/masternode/MasternodeRow.vue | 164 +++++++++++ scripts/masternode/NewMasternodeList.vue | 38 ++- 5 files changed, 511 insertions(+), 16 deletions(-) create mode 100644 assets/icons/icon-trash.svg create mode 100644 scripts/masternode/CreateMasternodeModal.vue create mode 100644 scripts/masternode/MasternodeRow.vue diff --git a/assets/icons/icon-trash.svg b/assets/icons/icon-trash.svg new file mode 100644 index 000000000..035fb6d62 --- /dev/null +++ b/assets/icons/icon-trash.svg @@ -0,0 +1,12 @@ + + + diff --git a/scripts/masternode/CreateMasternodeModal.vue b/scripts/masternode/CreateMasternodeModal.vue new file mode 100644 index 000000000..42f9580cc --- /dev/null +++ b/scripts/masternode/CreateMasternodeModal.vue @@ -0,0 +1,276 @@ + + + diff --git a/scripts/masternode/Masternode.vue b/scripts/masternode/Masternode.vue index 5d68618c3..86f367efb 100644 --- a/scripts/masternode/Masternode.vue +++ b/scripts/masternode/Masternode.vue @@ -66,7 +66,7 @@ watch(isSynced, () => { * Start a Masternode via a signed network broadcast * @param {boolean} fRestart - Whether this is a Restart or a first Start */ -async function startMasternode(fRestart = false) { +async function startMasternode(mn, fRestart = false) { if ( !isHardwareWallet.value && isViewOnly.value && @@ -74,20 +74,18 @@ async function startMasternode(fRestart = false) { ) { return; } - for (const masternode of masternodes.value) { - if (await masternode.start()) { - const strMsg = fRestart ? ALERTS.MN_RESTARTED : ALERTS.MN_STARTED; - createAlert('success', strMsg, 4000); - } else { - const strMsg = fRestart - ? ALERTS.MN_RESTART_FAILED - : ALERTS.MN_START_FAILED; - createAlert('warning', strMsg, 4000); - } + if (await mn.start()) { + const strMsg = fRestart ? ALERTS.MN_RESTARTED : ALERTS.MN_STARTED; + createAlert('success', strMsg, 4000); + } else { + const strMsg = fRestart + ? ALERTS.MN_RESTART_FAILED + : ALERTS.MN_START_FAILED; + createAlert('warning', strMsg, 4000); } } -async function destroyMasternode() { +async function destroyMasternode(mn) { // TODO: Only delete 1 masternodes.value = []; } @@ -139,6 +137,7 @@ async function createMasternode({ isVPS }) { // Ensure wallet is unlocked if (!isHardwareWallet.value && isViewOnly.value && !(await restoreWallet())) return; + console.log(cChainParams.current.collateralInSats); const [address] = wallet.getNewAddress(1); const res = await wallet.createAndSendTransaction( getNetwork(), @@ -166,6 +165,7 @@ function openShowPrivKeyModal() { :wallet="wallet" @close="showRestoreWallet = false" /> + - +