Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow non-shield wallets to send to shield addresses #307

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading