mm-btc 0.5.0__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mm_btc/blockstream.py +8 -8
- mm_btc/cli/cli.py +1 -2
- mm_btc/cli/cmd/address_cmd.py +1 -1
- mm_btc/cli/cmd/create_tx_cmd.py +4 -4
- mm_btc/cli/cmd/decode_tx_cmd.py +1 -1
- mm_btc/cli/cmd/mnemonic_cmd.py +3 -3
- mm_btc/cli/cmd/utxo_cmd.py +1 -1
- {mm_btc-0.5.0.dist-info → mm_btc-0.5.2.dist-info}/METADATA +2 -3
- mm_btc-0.5.2.dist-info/RECORD +17 -0
- mm_btc-0.5.0.dist-info/RECORD +0 -17
- {mm_btc-0.5.0.dist-info → mm_btc-0.5.2.dist-info}/WHEEL +0 -0
- {mm_btc-0.5.0.dist-info → mm_btc-0.5.2.dist-info}/entry_points.txt +0 -0
mm_btc/blockstream.py
CHANGED
|
@@ -69,14 +69,14 @@ class BlockstreamClient:
|
|
|
69
69
|
res = await self._request(f"/address/{address}")
|
|
70
70
|
try:
|
|
71
71
|
if res.status_code == 400:
|
|
72
|
-
return res.
|
|
73
|
-
return res.
|
|
72
|
+
return res.to_result_err("400 Bad Request")
|
|
73
|
+
return res.to_result_ok(Address(**res.parse_json_body()))
|
|
74
74
|
except Exception as e:
|
|
75
|
-
result = res.
|
|
75
|
+
result = res.to_result_err(e)
|
|
76
76
|
return result
|
|
77
77
|
|
|
78
78
|
async def get_confirmed_balance(self, address: str) -> Result[int]:
|
|
79
|
-
return (await self.get_address(address)).
|
|
79
|
+
return (await self.get_address(address)).chain(
|
|
80
80
|
lambda a: Result.ok(a.chain_stats.funded_txo_sum - a.chain_stats.spent_txo_sum)
|
|
81
81
|
)
|
|
82
82
|
|
|
@@ -85,9 +85,9 @@ class BlockstreamClient:
|
|
|
85
85
|
for _ in range(self.attempts):
|
|
86
86
|
res = await self._request(f"/address/{address}/utxo")
|
|
87
87
|
try:
|
|
88
|
-
return res.
|
|
88
|
+
return res.to_result_ok([Utxo(**out) for out in res.parse_json_body()])
|
|
89
89
|
except Exception as e:
|
|
90
|
-
result = res.
|
|
90
|
+
result = res.to_result_err(e)
|
|
91
91
|
return result
|
|
92
92
|
|
|
93
93
|
async def get_mempool(self) -> Result[Mempool]:
|
|
@@ -95,9 +95,9 @@ class BlockstreamClient:
|
|
|
95
95
|
for _ in range(self.attempts):
|
|
96
96
|
res = await self._request("/mempool")
|
|
97
97
|
try:
|
|
98
|
-
return res.
|
|
98
|
+
return res.to_result_ok(Mempool(**res.parse_json_body()))
|
|
99
99
|
except Exception as e:
|
|
100
|
-
result = res.
|
|
100
|
+
result = res.to_result_err(e)
|
|
101
101
|
return result
|
|
102
102
|
|
|
103
103
|
async def _request(self, url: str) -> HttpResponse:
|
mm_btc/cli/cli.py
CHANGED
|
@@ -5,7 +5,6 @@ from typing import Annotated
|
|
|
5
5
|
|
|
6
6
|
import mm_print
|
|
7
7
|
import typer
|
|
8
|
-
import typer.core
|
|
9
8
|
|
|
10
9
|
from mm_btc.wallet import AddressType
|
|
11
10
|
|
|
@@ -68,7 +67,7 @@ def utxo_command(address: str) -> None:
|
|
|
68
67
|
|
|
69
68
|
def version_callback(value: bool) -> None:
|
|
70
69
|
if value:
|
|
71
|
-
mm_print.
|
|
70
|
+
mm_print.plain(f"mm-btc: v{importlib.metadata.version('mm-btc')}")
|
|
72
71
|
raise typer.Exit
|
|
73
72
|
|
|
74
73
|
|
mm_btc/cli/cmd/address_cmd.py
CHANGED
|
@@ -7,4 +7,4 @@ from mm_btc.wallet import is_testnet_address
|
|
|
7
7
|
async def run(address: str) -> None:
|
|
8
8
|
client = BlockstreamClient(testnet=is_testnet_address(address))
|
|
9
9
|
res = await client.get_address(address)
|
|
10
|
-
mm_print.
|
|
10
|
+
mm_print.json(res.value_or_error())
|
mm_btc/cli/cmd/create_tx_cmd.py
CHANGED
|
@@ -2,13 +2,13 @@ from pathlib import Path
|
|
|
2
2
|
|
|
3
3
|
import mm_print
|
|
4
4
|
from bit import PrivateKey, PrivateKeyTestnet
|
|
5
|
-
from mm_cryptocurrency import
|
|
5
|
+
from mm_cryptocurrency import CryptocurrencyConfig
|
|
6
6
|
|
|
7
7
|
from mm_btc.wallet import is_testnet_address
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class Config(
|
|
11
|
-
class Output(
|
|
10
|
+
class Config(CryptocurrencyConfig):
|
|
11
|
+
class Output(CryptocurrencyConfig):
|
|
12
12
|
address: str
|
|
13
13
|
amount: int
|
|
14
14
|
|
|
@@ -25,4 +25,4 @@ def run(config_path: Path) -> None:
|
|
|
25
25
|
outputs = [(o.address, o.amount, "satoshi") for o in config.outputs]
|
|
26
26
|
|
|
27
27
|
tx = key.create_transaction(outputs)
|
|
28
|
-
mm_print.
|
|
28
|
+
mm_print.json(tx)
|
mm_btc/cli/cmd/decode_tx_cmd.py
CHANGED
mm_btc/cli/cmd/mnemonic_cmd.py
CHANGED
|
@@ -29,12 +29,12 @@ def run(args: Args) -> None:
|
|
|
29
29
|
path = get_derivation_path_prefix(args.path, args.testnet)
|
|
30
30
|
accounts = derive_accounts(mnemonic, passphrase, path, args.address_type, args.limit)
|
|
31
31
|
|
|
32
|
-
mm_print.
|
|
32
|
+
mm_print.plain(f"{mnemonic}")
|
|
33
33
|
if passphrase:
|
|
34
|
-
mm_print.
|
|
34
|
+
mm_print.plain(f"{passphrase}")
|
|
35
35
|
for acc in accounts:
|
|
36
36
|
private = acc.private if args.hex else acc.wif
|
|
37
|
-
mm_print.
|
|
37
|
+
mm_print.plain(f"{acc.path} {acc.address} {private}")
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def get_derivation_path_prefix(path: str, testnet: bool) -> str:
|
mm_btc/cli/cmd/utxo_cmd.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mm-btc
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Requires-Python: >=3.13
|
|
5
5
|
Requires-Dist: bitcoinlib~=0.7.4
|
|
6
6
|
Requires-Dist: bit~=0.8.0
|
|
7
7
|
Requires-Dist: hdwallet~=3.4.0
|
|
8
|
-
Requires-Dist: mm-cryptocurrency~=0.4.
|
|
9
|
-
Requires-Dist: mm-print>=0.0.1
|
|
8
|
+
Requires-Dist: mm-cryptocurrency~=0.4.7
|
|
10
9
|
Requires-Dist: mnemonic~=0.21
|
|
11
10
|
Requires-Dist: typer~=0.16.0
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
mm_btc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mm_btc/blockstream.py,sha256=-8-h07gld3GAOMXb7DcZaBJMzaxmKSWEdkdn55wIA5A,3361
|
|
3
|
+
mm_btc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
mm_btc/tx.py,sha256=7KTMNuL1n8rRj_245BV1bH9M2_PctNvlvPsLEsRTYx4,245
|
|
5
|
+
mm_btc/wallet.py,sha256=_pGTuAf6Y9KzaWTTSg_tn6WEoRsGqhxJuPof0_xyrmM,2333
|
|
6
|
+
mm_btc/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
mm_btc/cli/cli.py,sha256=vmrvmOxjyl6mSkz-OUOTn5pmJ_emRS_pCM1ZAaF6SsA,2626
|
|
8
|
+
mm_btc/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
mm_btc/cli/cmd/address_cmd.py,sha256=8gzARLHv7wVg30SAgK9JDiZbJK0e0YFus4b2Y5NGey0,302
|
|
10
|
+
mm_btc/cli/cmd/create_tx_cmd.py,sha256=vjLfDQX0q6HPoQ0w6SCPXrqaMte5EI0n2U4EV9Hn8jU,745
|
|
11
|
+
mm_btc/cli/cmd/decode_tx_cmd.py,sha256=oNOVX1_XIBdj0rY7ZMiwdNLVBvBHdnK0niJsXSulxXo,164
|
|
12
|
+
mm_btc/cli/cmd/mnemonic_cmd.py,sha256=N3qaQfoivODj4EQIFn4fN0ULZon7rmoETqJPy3YnKbg,1248
|
|
13
|
+
mm_btc/cli/cmd/utxo_cmd.py,sha256=6xGzi6RhXXUOgvNAFNWMWmO9AIDRWOVh_0X-jaCdeM4,299
|
|
14
|
+
mm_btc-0.5.2.dist-info/METADATA,sha256=FJo7dLqAtKA1_86FZ5RSEUOkKORFGJ4zkYR3B98K4zY,263
|
|
15
|
+
mm_btc-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
mm_btc-0.5.2.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
|
|
17
|
+
mm_btc-0.5.2.dist-info/RECORD,,
|
mm_btc-0.5.0.dist-info/RECORD
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
mm_btc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mm_btc/blockstream.py,sha256=OGhJAlBoI_oPEJUdzsLKENF29nFGhrVdWp0o4APaDXQ,3315
|
|
3
|
-
mm_btc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
mm_btc/tx.py,sha256=7KTMNuL1n8rRj_245BV1bH9M2_PctNvlvPsLEsRTYx4,245
|
|
5
|
-
mm_btc/wallet.py,sha256=_pGTuAf6Y9KzaWTTSg_tn6WEoRsGqhxJuPof0_xyrmM,2333
|
|
6
|
-
mm_btc/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
mm_btc/cli/cli.py,sha256=PU93remvTcn_uguET2gf9-vgGZ_zZduHbqvvQHH_2Zw,2650
|
|
8
|
-
mm_btc/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
mm_btc/cli/cmd/address_cmd.py,sha256=UlthdplJKAH1sC7MHtM4-rGS0MKftaaCdg_u-2tgwE0,308
|
|
10
|
-
mm_btc/cli/cmd/create_tx_cmd.py,sha256=4NvPa7uT7eJcoBo_oVOLLudCpKvNIB_ScK8ko57MOXE,721
|
|
11
|
-
mm_btc/cli/cmd/decode_tx_cmd.py,sha256=OwSdxIA8GViABb1JbbZTLi5HIRIA5Tpp_dBkh9x3GQQ,170
|
|
12
|
-
mm_btc/cli/cmd/mnemonic_cmd.py,sha256=-qWo8AXMdSSYUwyvx4jP54buRuidJM-1q3O8UwnJCF0,1266
|
|
13
|
-
mm_btc/cli/cmd/utxo_cmd.py,sha256=531bTIsgeQYmwJ17Jyn5jYlDDChOGlrvkJ31EIFIdF4,305
|
|
14
|
-
mm_btc-0.5.0.dist-info/METADATA,sha256=ciB5k1Ts4VNXpaeK9yKntdm55zllNatRiay-SVN_nGM,294
|
|
15
|
-
mm_btc-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
-
mm_btc-0.5.0.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
|
|
17
|
-
mm_btc-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|