diff options
Diffstat (limited to 'src/wallet.js')
| -rw-r--r-- | src/wallet.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet.js b/src/wallet.js index 519e3e1..b3e3d40 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -401,6 +401,11 @@ export class Wallet { return k ? encodeSilentPaymentAddress(k.scanPub, k.spendPub, { testnet: this.netName !== 'mainnet' }) : null; } + // True if addr is a valid on-chain address for this wallet's network. + isOnchainAddress(addr) { + try { btc.Address(this.netCfg.net).decode((addr || '').trim()); return true; } catch { return false; } + } + // Is SP receiving available here? (we can derive keys AND an indexer is set) silentPaymentsAvailable() { return !!(this.silentPaymentKeys() && spIndexerUrl(this.netName)); |
