mm-btc 0.0.3__py3-none-any.whl → 0.0.4__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/cli/cli.py +3 -1
- mm_btc/cli/cmd/mnemonic_cmd.py +12 -3
- mm_btc/wallet.py +2 -1
- {mm_btc-0.0.3.dist-info → mm_btc-0.0.4.dist-info}/METADATA +1 -1
- mm_btc-0.0.4.dist-info/RECORD +14 -0
- mm_btc-0.0.3.dist-info/RECORD +0 -14
- {mm_btc-0.0.3.dist-info → mm_btc-0.0.4.dist-info}/WHEEL +0 -0
- {mm_btc-0.0.3.dist-info → mm_btc-0.0.4.dist-info}/entry_points.txt +0 -0
- {mm_btc-0.0.3.dist-info → mm_btc-0.0.4.dist-info}/top_level.txt +0 -0
mm_btc/cli/cli.py
CHANGED
|
@@ -12,8 +12,9 @@ app = typer.Typer(no_args_is_help=True, pretty_exceptions_enable=False, add_comp
|
|
|
12
12
|
@app.command(name="mnemonic", help="Generate keys based on a mnemonic")
|
|
13
13
|
def mnemonic_command( # nosec B107:hardcoded_password_default
|
|
14
14
|
mnemonic: Annotated[str, typer.Option("--mnemonic", "-m", help="")] = "",
|
|
15
|
-
passphrase: Annotated[str, typer.Option("--passphrase", "-
|
|
15
|
+
passphrase: Annotated[str, typer.Option("--passphrase", "-p")] = "",
|
|
16
16
|
path: Annotated[str, typer.Option("--path", help="Derivation path. Examples: bip44, bip88, m/44'/0'/0'/0")] = "bip44",
|
|
17
|
+
hex_: Annotated[bool, typer.Option("--hex", help="Print private key in hex format instead of WIF")] = False,
|
|
17
18
|
words: int = typer.Option(12, "--words", "-w", help="Number of mnemonic words"),
|
|
18
19
|
limit: int = typer.Option(10, "--limit", "-l"),
|
|
19
20
|
testnet: bool = typer.Option(False, "--testnet", "-t", help="Testnet network"),
|
|
@@ -25,6 +26,7 @@ def mnemonic_command( # nosec B107:hardcoded_password_default
|
|
|
25
26
|
words=words,
|
|
26
27
|
limit=limit,
|
|
27
28
|
path=path,
|
|
29
|
+
hex=hex_,
|
|
28
30
|
testnet=testnet,
|
|
29
31
|
)
|
|
30
32
|
)
|
mm_btc/cli/cmd/mnemonic_cmd.py
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
+
from enum import Enum
|
|
2
3
|
|
|
3
4
|
from mm_std import print_plain
|
|
4
5
|
|
|
5
6
|
from mm_btc.wallet import derive_accounts, generate_mnemonic
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
class PrivateType(str, Enum):
|
|
10
|
+
hex = "hex"
|
|
11
|
+
wif = "wif"
|
|
12
|
+
|
|
13
|
+
|
|
8
14
|
@dataclass
|
|
9
15
|
class Args:
|
|
10
16
|
mnemonic: str
|
|
11
17
|
passphrase: str
|
|
12
18
|
words: int
|
|
13
19
|
limit: int
|
|
20
|
+
hex: bool # Print private key in hex format instead of WIF
|
|
14
21
|
path: str
|
|
15
22
|
testnet: bool
|
|
16
23
|
|
|
@@ -21,10 +28,12 @@ def run(args: Args) -> None:
|
|
|
21
28
|
path = get_derivation_path_prefix(args.path, args.testnet)
|
|
22
29
|
accounts = derive_accounts(mnemonic, passphrase, path, args.limit)
|
|
23
30
|
|
|
24
|
-
print_plain(f"
|
|
25
|
-
|
|
31
|
+
print_plain(f"{mnemonic}")
|
|
32
|
+
if passphrase:
|
|
33
|
+
print_plain(f"{passphrase}")
|
|
26
34
|
for acc in accounts:
|
|
27
|
-
|
|
35
|
+
private = acc.private if args.hex else acc.wif
|
|
36
|
+
print_plain(f"{acc.path} {acc.address} {private}")
|
|
28
37
|
|
|
29
38
|
|
|
30
39
|
def get_derivation_path_prefix(path: str, testnet: bool) -> str:
|
mm_btc/wallet.py
CHANGED
|
@@ -14,6 +14,7 @@ BIP84_TESTNET_PATH = "m/84'/1'/0'/0"
|
|
|
14
14
|
class Account:
|
|
15
15
|
address: str
|
|
16
16
|
private: str
|
|
17
|
+
wif: str
|
|
17
18
|
path: str
|
|
18
19
|
|
|
19
20
|
|
|
@@ -40,7 +41,7 @@ def derive_accounts(mnemonic: str, passphrase: str, path: str, limit: int) -> li
|
|
|
40
41
|
accounts = []
|
|
41
42
|
for index_path in range(limit):
|
|
42
43
|
w.from_path(path=f"{path}/{index_path}")
|
|
43
|
-
accounts.append(Account(address=w.address(), private=w.wif(), path=f"{path}/{index_path}"))
|
|
44
|
+
accounts.append(Account(address=w.address(), private=w.private_key(), wif=w.wif(), path=f"{path}/{index_path}"))
|
|
44
45
|
w.clean_derivation()
|
|
45
46
|
|
|
46
47
|
return accounts
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
mm_btc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mm_btc/blockstream.py,sha256=HllRQBO1Ezl0ArVH8b-CPRi0f5zdRNXJT_K3oCpAtgg,2159
|
|
3
|
+
mm_btc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
mm_btc/wallet.py,sha256=9gG_jAsDDInHMFhNcC4vToxzzwM8upAw2KncCPiOaZ8,1741
|
|
5
|
+
mm_btc/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
mm_btc/cli/cli.py,sha256=jWWXgBo1qRYnnheYungdt8IHZnG37U0h6oVo_nh_jm4,1581
|
|
7
|
+
mm_btc/cli/cli_utils.py,sha256=g2o5ySLu-Tw8dZm84ZAsx8862yHij4sDfz4z6uLS2hw,102
|
|
8
|
+
mm_btc/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
mm_btc/cli/cmd/mnemonic_cmd.py,sha256=zAAHr9j0SLJX5BXoiMTZj8pIzTPX26aJEOUi7IN40Ug,1192
|
|
10
|
+
mm_btc-0.0.4.dist-info/METADATA,sha256=FK-azr9otf5iyXg85kx29RNJRaCLMwSALIlSDWfP0fA,858
|
|
11
|
+
mm_btc-0.0.4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
12
|
+
mm_btc-0.0.4.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
|
|
13
|
+
mm_btc-0.0.4.dist-info/top_level.txt,sha256=0X0Ppv_QY0ulzgCB5HNezpaHfQ4wvih_B72hn5hHTUE,7
|
|
14
|
+
mm_btc-0.0.4.dist-info/RECORD,,
|
mm_btc-0.0.3.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
mm_btc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mm_btc/blockstream.py,sha256=HllRQBO1Ezl0ArVH8b-CPRi0f5zdRNXJT_K3oCpAtgg,2159
|
|
3
|
-
mm_btc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
mm_btc/wallet.py,sha256=l1oHkAsJRxSHbIrV4waaqFUs3ojS_t3WB-P_pERXpNs,1707
|
|
5
|
-
mm_btc/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
mm_btc/cli/cli.py,sha256=i6idhoBGOKRIOl6H7XP-FmLa11zg_CkHd-NbVDwOsQw,1449
|
|
7
|
-
mm_btc/cli/cli_utils.py,sha256=g2o5ySLu-Tw8dZm84ZAsx8862yHij4sDfz4z6uLS2hw,102
|
|
8
|
-
mm_btc/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
mm_btc/cli/cmd/mnemonic_cmd.py,sha256=PbHVCaw9CzB16k5yrMsijDOvA5CAUb-KbDfVoL9oUBY,990
|
|
10
|
-
mm_btc-0.0.3.dist-info/METADATA,sha256=tUE-Jqu9MWfUu-fl7KuXLlG7YPNuv5GXzNs7NOyH3Os,858
|
|
11
|
-
mm_btc-0.0.3.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
12
|
-
mm_btc-0.0.3.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
|
|
13
|
-
mm_btc-0.0.3.dist-info/top_level.txt,sha256=0X0Ppv_QY0ulzgCB5HNezpaHfQ4wvih_B72hn5hHTUE,7
|
|
14
|
-
mm_btc-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|