mm-btc 0.0.4__tar.gz → 0.0.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mm-btc
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: mm-std~=0.1.0
6
6
  Requires-Dist: hdwallet~=2.2.1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mm-btc"
3
- version = "0.0.4"
3
+ version = "0.0.5"
4
4
  description = ""
5
5
  dependencies = [
6
6
  "mm-std~=0.1.0",
@@ -1,15 +1,17 @@
1
1
  from typing import Annotated
2
2
 
3
3
  import typer
4
+ import typer.core
4
5
  from mm_std import print_plain
5
6
 
6
7
  from mm_btc.cli import cli_utils
7
- from mm_btc.cli.cmd import mnemonic_cmd
8
+ from mm_btc.cli.cmd import address_cmd, mnemonic_cmd
8
9
 
9
10
  app = typer.Typer(no_args_is_help=True, pretty_exceptions_enable=False, add_completion=False)
10
11
 
11
12
 
12
- @app.command(name="mnemonic", help="Generate keys based on a mnemonic")
13
+ @app.command("mnemonic")
14
+ @app.command(name="m", hidden=True)
13
15
  def mnemonic_command( # nosec B107:hardcoded_password_default
14
16
  mnemonic: Annotated[str, typer.Option("--mnemonic", "-m", help="")] = "",
15
17
  passphrase: Annotated[str, typer.Option("--passphrase", "-p")] = "",
@@ -19,6 +21,7 @@ def mnemonic_command( # nosec B107:hardcoded_password_default
19
21
  limit: int = typer.Option(10, "--limit", "-l"),
20
22
  testnet: bool = typer.Option(False, "--testnet", "-t", help="Testnet network"),
21
23
  ) -> None:
24
+ """Generate keys based on a mnemonic"""
22
25
  mnemonic_cmd.run(
23
26
  mnemonic_cmd.Args(
24
27
  mnemonic=mnemonic,
@@ -32,9 +35,16 @@ def mnemonic_command( # nosec B107:hardcoded_password_default
32
35
  )
33
36
 
34
37
 
38
+ @app.command(name="address")
39
+ @app.command(name="a", hidden=True)
40
+ def address_command(address: str) -> None:
41
+ """Get address info from Blockstream API"""
42
+ address_cmd.run(address)
43
+
44
+
35
45
  def version_callback(value: bool) -> None:
36
46
  if value:
37
- print_plain(f"mm-eth version: {cli_utils.get_version()}")
47
+ print_plain(f"mm-btc: v{cli_utils.get_version()}")
38
48
  raise typer.Exit()
39
49
 
40
50
 
@@ -0,0 +1,10 @@
1
+ from mm_std import print_json
2
+
3
+ from mm_btc import blockstream
4
+ from mm_btc.wallet import is_testnet_address
5
+
6
+
7
+ def run(address: str) -> None:
8
+ testnet = is_testnet_address(address)
9
+ res = blockstream.get_address(address, testnet=testnet)
10
+ print_json(res)
@@ -60,3 +60,7 @@ def mnemonic_words_to_strenght(words: int) -> int:
60
60
  return 256
61
61
 
62
62
  raise ValueError("Invalid words")
63
+
64
+
65
+ def is_testnet_address(address: str) -> bool:
66
+ return address.startswith(("m", "n", "tb1"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mm-btc
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: mm-std~=0.1.0
6
6
  Requires-Dist: hdwallet~=2.2.1
@@ -14,6 +14,7 @@ src/mm_btc/cli/__init__.py
14
14
  src/mm_btc/cli/cli.py
15
15
  src/mm_btc/cli/cli_utils.py
16
16
  src/mm_btc/cli/cmd/__init__.py
17
+ src/mm_btc/cli/cmd/address_cmd.py
17
18
  src/mm_btc/cli/cmd/mnemonic_cmd.py
18
19
  tests/test_blockstream.py
19
20
  tests/test_wallet.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes