Skip to content

Commit

Permalink
Prepare release 0.7.0a0 (#3)
Browse files Browse the repository at this point in the history
- [x] Update nostr_sdk rust-nostr/nostr#453 ,
which is possible
rust-nostr/nostr@0c4e345
with the nest release
  • Loading branch information
andreasgriffin authored Jun 14, 2024
1 parent 89502b6 commit 568ec57
Show file tree
Hide file tree
Showing 91 changed files with 1,604 additions and 1,276 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ repos:
args:
- --check-untyped-defs
# - --disallow-untyped-defs
- --strict-optional
# - --strict-optional
# - --no-implicit-optional
# - --warn-return-any
- --warn-redundant-casts
# - --warn-unreachable
additional_dependencies:
- types-requests
- types-PyYAML
Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@
#### Features

- **Easy** Bitcoin wallet for long-term cold storage
- **Best practices** built into the wallet setup
- **Easier** address labels by using categories (e.g. "KYC", "Non-KYC", "Work", "Friends", ...)
- **Easy** Multisig-Wallet Setup
- Step-by-Step instructions
- including transactions to test every hardware signer
- **Simpler** address labels by using categories (e.g. "KYC", "Non-KYC", "Work", "Friends", ...)
- Automatic coin selection within categories
- **Easier** fee selection for non-technical users
- Automatic UTXO management as much as possible to prevent uneconomical UTXOs in the future
- Opportunistic merging of small utxos when fees are low
- **Sending** for non-technical users
- 1-click fee selection
- Automatic merging of small utxos when fees are low
- **Collaborative**:
- Wallet chat and sharing of PSBTs (via nostr)
- Label synchronization between trusted devices (via nostr)
- **Multi-Language**:
- 🇺🇸 English, 🇨🇳 Chinese - 简体中文, 🇪🇸 Spanish - español de España, 🇯🇵 Japanese - 日本語, 🇷🇺 Russian - русский, 🇵🇹 Portuguese - português europeu, 🇮🇳 Hindi - हिन्दी, Arabic - العربية, (more upon request)
- **Fast**: Electrum server and upgrade to **Compact Block Filters** for the Bitcoin Safe 2.0 release
- **Fast**: Electrum server connectivity and planned upgrade to **Compact Block Filters** for the Bitcoin Safe 2.0 release
- **Secure**: No seed generation or storage (on mainnet).
- A hardware signer/signing device for safe seed storage is needed (storing seeds on a computer is reckless)
- Powered by **[BDK](https://github.com/bitcoindevkit/bdk)**
- Powered by **[BDK](https://github.com/bitcoindevkit/bdk)**

## Installation from Git repository

Expand Down Expand Up @@ -79,23 +81,25 @@

#### More features

* Import export
* csv export of every list
* Label import and export in [BIP329](https://github.com/bitcoin/bips/blob/master/bip-0329.mediawiki)
* Many Import and Export options
* CSV export of every list
* Label import and export in [BIP329](https://bip329.org/)
* Label import of Electrum wallet

* Animated [Coldcard Q - QR code](https://bbqr.org/) and Legacy QR codes
* Connectivity to Electrum Servers, Esplora Server, RPC Bitcoin Node (like on [Umbrel](https://umbrel.com/))


#### TODOs for beta release

- [ ] Add more pytests


#### Goals (for the 2.0 Release)

- **Compact Block Filters** by default
- Compact Block Filters are **fast** and **private**
- Compact Block Filters (bdk) are being [worked on](https://github.com/bitcoindevkit/bdk/issues/679), and will be included in bdk 1.1. For now RPC, Electrum and Esplora are available, but will be replaced completely with Compact Block Filters.

#### TODOs for beta release

- [ ] Add more pytests
- [ ] [bbqr code](https://bbqr.org/)

## Development

* Run the precommit manually for debugging
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_safe/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.2a0"
__version__ = "0.7.0a0"
4 changes: 2 additions & 2 deletions bitcoin_safe/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .gui.qt.util import custom_exception_handler


def parse_args():
def parse_args() -> argparse.Namespace:

parser = argparse.ArgumentParser(description="Bitcoin Safe")
parser.add_argument("--network", help="Choose the network: bitcoin, regtest, testnet, signet ")
Expand All @@ -27,7 +27,7 @@ def parse_args():
return parser.parse_args()


def main():
def main() -> None:
args = parse_args()

sys.excepthook = custom_exception_handler
Expand Down
22 changes: 11 additions & 11 deletions bitcoin_safe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
logger = logging.getLogger(__name__)

import os
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional

import appdirs
import bdkpython as bdk
Expand Down Expand Up @@ -72,19 +72,19 @@ class UserConfig(BaseSaveableClass):
bdk.Network.TESTNET: [0, 1000],
}

def __init__(self):
def __init__(self) -> None:
self.network_configs = NetworkConfigs()
self.network = bdk.Network.BITCOIN if DEFAULT_MAINNET else bdk.Network.TESTNET
self.last_wallet_files: Dict[str, List[str]] = {} # network:[file_path0]
self.opened_txlike: Dict[str, List[str]] = {} # network:[serializedtx, serialized psbt]
self.data_dir = appdirs.user_data_dir(self.app_name)
self.is_maximized = False
self.recently_open_wallets: Dict[bdk.Network, deque] = {
self.recently_open_wallets: Dict[bdk.Network, deque[str]] = {
network: deque(maxlen=5) for network in bdk.Network
}
self.language_code = None
self.language_code: Optional[str] = None

def add_recently_open_wallet(self, file_path: str):
def add_recently_open_wallet(self, file_path: str) -> None:
# ensure that the newest open file moves to the top of the queue, but isn't added multiple times
recent_wallets = self.recently_open_wallets[self.network]
if file_path in recent_wallets:
Expand All @@ -96,17 +96,17 @@ def network_config(self) -> NetworkConfig:
return self.network_configs.configs[self.network.name]

@property
def wallet_dir(self):
def wallet_dir(self) -> str:
return os.path.join(self.config_dir, self.network.name)

def get(self, key, default=None):
def get(self, key: str, default=None) -> Any:
"For legacy reasons"
if hasattr(self, key):
return getattr(self, key)
else:
return default

def dump(self):
def dump(self) -> Dict[str, Any]:
d = super().dump()
d.update(self.__dict__.copy())

Expand Down Expand Up @@ -172,19 +172,19 @@ def from_dump_migration(cls, dct: Dict[str, Any]) -> Dict[str, Any]:
return dct

@classmethod
def exists(cls, password=None, file_path=None):
def exists(cls, password=None, file_path=None) -> bool:
if file_path is None:
file_path = cls.config_file
return os.path.isfile(file_path)

@classmethod
def from_file(cls, password=None, file_path=None):
def from_file(cls, password=None, file_path=None) -> "UserConfig":
if file_path is None:
file_path = cls.config_file
if os.path.isfile(file_path):
return super()._from_file(file_path, password=password)
else:
return UserConfig()

def save(self):
def save(self) -> None: # type: ignore
super().save(self.config_file)
2 changes: 1 addition & 1 deletion bitcoin_safe/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from typing import Sequence

import bdkpython as bdk
from bitcoin_qrreader.multipath_descriptor import (
from bitcoin_qr_tools.multipath_descriptor import (
MultipathDescriptor as BitcoinQRMultipathDescriptor,
)
from bitcoin_usb.address_types import (
Expand Down
14 changes: 8 additions & 6 deletions bitcoin_safe/dynamic_lib_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import os
import platform
import sys
from importlib.metadata import PackageMetadata
from typing import Optional

import bitcoin_usb
import bitcointx
Expand All @@ -46,15 +48,15 @@


# Function to show the warning dialog before starting the QApplication
def show_message_before_quit(msg: str):
def show_message_before_quit(msg: str) -> None:
# Initialize QApplication first
app = QApplication(sys.argv)
# Without an application instance, some features might not work as expected
QMessageBox.warning(None, "Warning", msg, QMessageBox.StandardButton.Ok)
sys.exit(app.exec())


def _get_binary_lib_path():
def _get_binary_lib_path() -> str:
# Get the platform-specific path to the binary library
if platform.system() == "Windows":
# On Windows, construct the path to the DLL
Expand All @@ -66,7 +68,7 @@ def _get_binary_lib_path():
return lib_path


def setup_libsecp256k1():
def setup_libsecp256k1() -> None:
"""The operating system might, or might not provide libsecp256k1 needed for bitcointx
Therefore we require https://pypi.org/project/electrumsv-secp256k1/ in the build process as additional_requires
Expand All @@ -92,7 +94,7 @@ def setup_libsecp256k1():
print(f"use libsecp256k1 from os")


def ensure_pyzbar_works():
def ensure_pyzbar_works() -> None:
"Ensure Visual C++ Redistributable Packages for Visual Studio 2013"
# Get the platform-specific path to the binary library
logger.info(f"Platform: {platform.system()}")
Expand Down Expand Up @@ -120,14 +122,14 @@ def ensure_pyzbar_works():
pass


def get_briefcase_meta_data():
def get_briefcase_meta_data() -> Optional[PackageMetadata]:
import sys
from importlib import metadata as importlib_metadata

# Find the name of the module that was used to start the app
app_module = sys.modules["__main__"].__package__
if not app_module:
return
return None
# Retrieve the app's metadata
metadata = importlib_metadata.metadata(app_module)

Expand Down
4 changes: 2 additions & 2 deletions bitcoin_safe/fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def __init__(self, signals_min: SignalsMin) -> None:
self.update()
logger.debug(f"initialized {self}")

def update(self):
def on_success(data):
def update(self) -> None:
def on_success(data) -> None:
if not data:
logger.debug(f"empty result of https://api.coingecko.com/api/v3/exchange_rates")
return
Expand Down
8 changes: 4 additions & 4 deletions bitcoin_safe/gui/qt/address_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@

import logging

from bitcoin_qr_tools.qr_widgets import QRCodeWidgetSVG

from bitcoin_safe.config import UserConfig
from bitcoin_safe.gui.qt.buttonedit import ButtonEdit
from bitcoin_safe.mempool import MempoolData
from bitcoin_safe.util import serialized_to_hex

from .qr_components.image_widget import QRCodeWidgetSVG

logger = logging.getLogger(__name__)

import bdkpython as bdk
Expand Down Expand Up @@ -66,7 +66,7 @@ def __init__(
address: str,
mempool_data: MempoolData,
parent=None,
):
) -> None:
super().__init__(parent, Qt.WindowType.Window)
self.setWindowTitle(self.tr("Address"))
self.mempool_data = mempool_data
Expand Down Expand Up @@ -160,6 +160,6 @@ def __init__(
vbox.addLayout(Buttons(CloseButton(self)))
self.setupUi()

def setupUi(self):
def setupUi(self) -> None:
self.tabs.setTabText(self.tabs.indexOf(self.tab_details), self.tr("Details"))
self.tabs.setTabText(self.tabs.indexOf(self.tab_advanced), self.tr("Advanced"))
Loading

0 comments on commit 568ec57

Please sign in to comment.