Skip to content

Commit

Permalink
fix: don't allow shield send on a wallet without shield
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Feb 29, 2024
1 parent fee08ca commit 04e8e1a
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions locale/cnr/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ WALLET_UNLOCKED = "Novčanik je uspešno otključan!" # Wallet successfully Unlo
CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet}
CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/de/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/en/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ WALLET_UNLOCKED = "Wallet successfully Unlocked!" # Wallet successfully Unlocked
CONFIRM_LEDGER_TX = "Confirm this transaction matches the one on your {hardwareWallet}" # Confirm this transaction matches the one on your {hardwareWallet}
CONFIRM_LEDGER_TX_OUT = "You will send {value} {ticker} to <div class=\"inline-address\">{address}</div>" # You will send {value} {ticker} to <div class="inline-address">{address}</div>
MISSING_FUNDS = "Balance is too small! Missing {sats} sats!" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "Shield is not enabled in this wallet!" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/es-mx/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/fr/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/it/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/nl/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/ph/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/pl/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ WALLET_UNLOCKED = "Portfel pomyślnie odblokowany!" # Wallet successfully Unlock
CONFIRM_LEDGER_TX = "" # Confirm this transaction matches the one on your {hardwareWallet}
CONFIRM_LEDGER_TX_OUT = "" # You will send {value} {ticker} to <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/pt-br/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
1 change: 1 addition & 0 deletions locale/pt-pt/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
3 changes: 2 additions & 1 deletion locale/template/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,5 @@ CONFIRM_POPUP_DELETE_ACCOUNT = 'This will delete all your data, including master
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = 'Are you sure?'
CONFIRM_LEDGER_TX = 'Confirm this transaction matches the one on your {hardwareWallet}'
CONFIRM_LEDGER_TX_OUT = 'You will send {value} {ticker} to <div class="inline-address">{address}</div>'
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!"
1 change: 1 addition & 0 deletions locale/uwu/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ 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 <div class="inline-address">{address}</div>
MISSING_FUNDS = "" # Balance is too small! Missing {sats} sats!
MISSING_SHIELD = "" # Shield is not enabled in this wallet!
7 changes: 7 additions & 0 deletions scripts/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,13 @@ async function send(address, amount, useShieldInputs) {
// If a Contact were found, we use it's Pubkey
if (cContact) address = cContact.pubkey;
// Make sure wallet has shield enabled
if (!wallet.hasShield.value) {
if (useShieldInputs || isShieldAddress(address)) {
return createAlert('warning', ALERTS.MISSING_SHIELD);
}
}
// If this is an XPub, we'll fetch their last used 'index', and derive a new public key for enhanced privacy
if (isXPub(address)) {
const cNet = getNetwork();
Expand Down
5 changes: 5 additions & 0 deletions scripts/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ export class Wallet {
if (transaction.version !== 3) {
throw new Error('`signShield` was called with a non-shield tx');
}
if (!this.hasShield()) {
throw new Error(
'trying to create a shield transaction without having shield enable'
);
}

const periodicFunction = setInterval(async () => {
const percentage = 5 + (await this.#shield.getTxStatus()) * 95;
Expand Down

0 comments on commit 04e8e1a

Please sign in to comment.