Skip to content

Commit f40891b

Browse files
authored
Version 1.14.0.0 (#50)
1 parent 79d4210 commit f40891b

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.coverage
33
.idea/
44
.mypy_cache/
5+
.prettiercache
56
.vscode/
67
__pycache__/
78
backup/

.pre-commit-config.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-merge-conflict
66
- repo: https://github.com/asottile/yesqa
77
rev: v1.5.0
88
hooks:
99
- id: yesqa
1010
- repo: https://github.com/psf/black
11-
rev: 23.7.0
11+
rev: 23.12.1
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/pycqa/isort
15-
rev: 5.12.0
15+
rev: 5.13.2
1616
hooks:
1717
- id: isort
1818
- repo: https://github.com/pycqa/flake8
19-
rev: 6.1.0
19+
rev: 7.0.0
2020
hooks:
2121
- id: flake8
2222
- repo: https://github.com/asottile/pyupgrade
23-
rev: v3.10.1
23+
rev: v3.15.0
2424
hooks:
2525
- id: pyupgrade
2626
args: ["--py38-plus"]
2727
- repo: https://github.com/pre-commit/pre-commit-hooks
28-
rev: v4.4.0
28+
rev: v4.5.0
2929
hooks:
3030
- id: end-of-file-fixer
3131
- id: trailing-whitespace
@@ -48,6 +48,8 @@ repos:
4848
args: ["--remove"]
4949
- id: detect-private-key
5050
- repo: https://github.com/pre-commit/mirrors-prettier
51-
rev: v3.0.1
51+
rev: v4.0.0-alpha.8
5252
hooks:
5353
- id: prettier
54+
require_serial: true
55+
args: ["--cache-location=.prettiercache"]

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Latest changes
44

5+
## 1.14.0.0
6+
7+
Electrums upgrade
8+
9+
**Breaking changes**: `get_config` method no longer has `default` argument, this is determined by electrum. Also it is no longer possible to programmatically disable lightning
10+
511
## 1.12.1.1
612

713
Rename BitcartCC to Bitcart

bitcart/coins/btc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def lightning(f: Callable) -> Callable:
1919
async def wrapper(*args: Any, **kwargs: Any) -> Any:
2020
if len(args) > 0:
2121
obj = args[0]
22-
if not await obj.get_config("lightning"): # pragma: no cover: can't be changed during tests
22+
capabilities = (await obj.spec).get("capabilities", {})
23+
if not capabilities.get("lightning", False): # pragma: no cover: can't be changed during tests
2324
raise LightningDisabledError("Lightning is disabled in current daemon.")
2425
return await f(*args, **kwargs)
2526

@@ -415,10 +416,9 @@ async def set_config(self, key: str, value: Any) -> bool:
415416
"""
416417
return await self.server.setconfig(key, value) # type: ignore
417418

418-
async def get_config(self, key: str, default: Any = None) -> Any:
419+
async def get_config(self, key: str) -> Any:
419420
"""Get config key
420421
421-
If the key doesn't exist, default value is returned.
422422
Keys are stored in electrum's config file, check :meth:`bitcart.coins.btc.BTC.set_config` doc for details.
423423
424424
Example:
@@ -434,7 +434,7 @@ async def get_config(self, key: str, default: Any = None) -> Any:
434434
Returns:
435435
Any: value of the key or default value provided
436436
"""
437-
return await self.server.getconfig(key) or default
437+
return await self.server.getconfig(key)
438438

439439
async def validate_key(self, key: str, *args: Any, **kwargs: Any) -> bool:
440440
"""Validate whether provided key is valid to restore a wallet

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name="bitcart",
55
packages=find_packages(),
6-
version="1.12.1.1",
6+
version="1.14.0.0",
77
license="MIT",
88
description="Bitcart coins support library",
99
long_description=open("README.md").read(),

tests/coins/btc/test_lightning.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ async def test_connect(btc_wallet):
4545
assert await btc_wallet.connect("0214382bdce7750dfcb8126df8e2b12de38536902dc36abcebdaeefdeca1df8284@172.81.181.3")
4646

4747

48-
async def test_lightning_always_enabled(btc_wallet):
49-
await btc_wallet.set_config("lightning", False)
50-
assert await btc_wallet.node_id is not None # env variables can't be overwritten
51-
52-
5348
async def test_wallet_methods_on_non_segwit(lightning_unsupported_wallet):
5449
request = await lightning_unsupported_wallet.add_request(0.5)
5550
assert request["is_lightning"] is False

tests/coins/btc/test_without_wallet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ async def test_get_tx(btc):
9292

9393

9494
async def test_config_methods(btc):
95-
k, v = "x", 1
95+
k, v = "auto_connect", False
9696
await btc.set_config(k, v)
9797
assert await btc.get_config(k) == v
98+
await btc.set_config(k, True)
9899

99100

100101
async def test_get_address(btc):

tests/test_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
def test_spec(btc):
22
assert btc.spec == btc.server.spec
33
assert isinstance(btc.spec, dict)
4-
assert btc.spec.keys() == {"exceptions", "electrum_map", "version"}
4+
assert btc.spec.keys() == {"exceptions", "electrum_map", "version", "capabilities"}

0 commit comments

Comments
 (0)