mm-sol 0.2.9__py3-none-any.whl → 0.3.0__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_sol/cli/cli.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from enum import Enum
2
+ from pathlib import Path
2
3
  from typing import Annotated
3
4
 
4
5
  import typer
@@ -50,14 +51,14 @@ def balance_command(
50
51
 
51
52
  @app.command(name="balances", help="Print SOL and token balances for accounts")
52
53
  def balances_command(
53
- config_path: str, print_config: Annotated[bool, typer.Option("--config", "-c", help="Print config and exit")] = False
54
+ config_path: Path, print_config: Annotated[bool, typer.Option("--config", "-c", help="Print config and exit")] = False
54
55
  ) -> None:
55
56
  balances_cmd.run(config_path, print_config)
56
57
 
57
58
 
58
59
  @app.command(name="transfer-sol", help="Transfer SOL from one or many accounts")
59
60
  def transfer_sol_command(
60
- config_path: str,
61
+ config_path: Path,
61
62
  print_balances: bool = typer.Option(False, "--balances", "-b", help="Print balances and exit"),
62
63
  print_config: bool = typer.Option(False, "--config", "-c", help="Print config and exit"),
63
64
  emulate: bool = typer.Option(False, "--emulate", "-e", help="Emulate transaction posting"),
@@ -76,7 +77,7 @@ def transfer_sol_command(
76
77
 
77
78
  @app.command(name="transfer-token", help="Transfer token from one or many accounts")
78
79
  def transfer_token_command(
79
- config_path: str,
80
+ config_path: Path,
80
81
  print_balances: bool = typer.Option(False, "--balances", "-b", help="Print balances and exit"),
81
82
  print_config: bool = typer.Option(False, "--config", "-c", help="Print config and exit"),
82
83
  emulate: bool = typer.Option(False, "--emulate", "-e", help="Emulate transaction posting"),
@@ -1,5 +1,6 @@
1
1
  import random
2
2
  from decimal import Decimal
3
+ from pathlib import Path
3
4
  from typing import Annotated, Any
4
5
 
5
6
  from mm_crypto_utils import ConfigValidators
@@ -23,8 +24,8 @@ class Config(BaseConfig):
23
24
  return random.choice(self.nodes)
24
25
 
25
26
 
26
- def run(config_path: str, print_config: bool) -> None:
27
- config = Config.read_config_or_exit(config_path)
27
+ def run(config_path: Path, print_config: bool) -> None:
28
+ config = Config.read_toml_config_or_exit(config_path)
28
29
  if print_config:
29
30
  config.print_and_exit()
30
31
 
@@ -4,5 +4,5 @@ from mm_std import print_plain
4
4
 
5
5
 
6
6
  def run(module: str) -> None:
7
- example_file = Path(Path(__file__).parent.absolute(), "../examples", f"{module}.yml")
7
+ example_file = Path(Path(__file__).parent.absolute(), "../examples", f"{module}.toml")
8
8
  print_plain(example_file.read_text())
@@ -1,13 +1,13 @@
1
1
  import sys
2
2
  import time
3
3
  from pathlib import Path
4
- from typing import Annotated
4
+ from typing import Annotated, Self
5
5
 
6
6
  import mm_crypto_utils
7
7
  from loguru import logger
8
8
  from mm_crypto_utils import AddressToPrivate, TxRoute
9
9
  from mm_std import BaseConfig, Err, utc_now
10
- from pydantic import AfterValidator, BeforeValidator
10
+ from pydantic import AfterValidator, BeforeValidator, model_validator
11
11
 
12
12
  from mm_sol import transfer
13
13
  from mm_sol.cli import calcs, cli_utils
@@ -33,9 +33,16 @@ class Config(BaseConfig):
33
33
  def from_addresses(self) -> list[str]:
34
34
  return [r.from_address for r in self.routes]
35
35
 
36
+ @model_validator(mode="after")
37
+ def final_validator(self) -> Self:
38
+ if not self.private_keys.contains_all_addresses(self.from_addresses):
39
+ raise ValueError("private keys are not set for all addresses")
40
+
41
+ return self
42
+
36
43
 
37
44
  def run(
38
- config_path: str,
45
+ config_path: Path,
39
46
  *,
40
47
  print_balances: bool,
41
48
  print_config: bool,
@@ -43,7 +50,7 @@ def run(
43
50
  no_confirmation: bool,
44
51
  emulate: bool,
45
52
  ) -> None:
46
- config = Config.read_config_or_exit(config_path)
53
+ config = Config.read_toml_config_or_exit(config_path)
47
54
 
48
55
  if print_config:
49
56
  config.print_and_exit({"private_keys"})
@@ -1,14 +1,14 @@
1
1
  import sys
2
2
  import time
3
3
  from pathlib import Path
4
- from typing import Annotated
4
+ from typing import Annotated, Self
5
5
 
6
6
  import mm_crypto_utils
7
7
  import typer
8
8
  from loguru import logger
9
9
  from mm_crypto_utils import AddressToPrivate, TxRoute
10
10
  from mm_std import BaseConfig, Err, fatal, utc_now
11
- from pydantic import AfterValidator, BeforeValidator
11
+ from pydantic import AfterValidator, BeforeValidator, model_validator
12
12
 
13
13
  from mm_sol import transfer
14
14
  from mm_sol.cli import calcs, cli_utils
@@ -35,9 +35,16 @@ class Config(BaseConfig):
35
35
  def from_addresses(self) -> list[str]:
36
36
  return [r.from_address for r in self.routes]
37
37
 
38
+ @model_validator(mode="after")
39
+ def final_validator(self) -> Self:
40
+ if not self.private_keys.contains_all_addresses(self.from_addresses):
41
+ raise ValueError("private keys are not set for all addresses")
42
+
43
+ return self
44
+
38
45
 
39
46
  def run(
40
- config_path: str,
47
+ config_path: Path,
41
48
  *,
42
49
  print_balances: bool,
43
50
  print_config: bool,
@@ -45,7 +52,7 @@ def run(
45
52
  no_confirmation: bool,
46
53
  emulate: bool,
47
54
  ) -> None:
48
- config = Config.read_config_or_exit(config_path)
55
+ config = Config.read_toml_config_or_exit(config_path)
49
56
 
50
57
  if print_config:
51
58
  config.print_and_exit({"private_keys"})
@@ -0,0 +1,9 @@
1
+ accounts = """
2
+ 5BJ9ViMj4gi2BBX3wbCEJ4p4vpVWKpG6ja2aQP2ACBUv
3
+ HbSAUDjzpr44fWzf9Ynj3V1jq3wBsgg88N88P4vzeGPX
4
+ """
5
+ tokens = """
6
+ 7XtmNSHJDHTZdx2K1S8D529kHsBbt3Civxt6vUHrGxBR
7
+ 65FKbLPtrssmc8aVn9DEBY8VTGB85vsgadrmaW9H4nEB
8
+ """
9
+ nodes = "https://api.mainnet-beta.solana.com"
@@ -0,0 +1,8 @@
1
+ routes = """
2
+ Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj
3
+ Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur
4
+ """
5
+ private_keys = "file: ./path/to/privates.txt"
6
+ value = "0.012 sol"
7
+ proxies = "url: https://site.com/api/get-proxies"
8
+ nodes = "https://api.devnet.solana.com"
@@ -0,0 +1,9 @@
1
+ routes = """
2
+ Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj
3
+ Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur
4
+ """
5
+ token = "6VBTMLgv256c7scudNf8T5GoTJcEE8WfgcJhxbGYPQ8G"
6
+ private_keys = "file: ./path/to/privates.txt"
7
+ value = "0.012 t"
8
+ proxies = "https://site.com/api/get-proxies"
9
+ nodes = "https://api.devnet.solana.com"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-sol
3
- Version: 0.2.9
3
+ Version: 0.3.0
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: base58~=2.1.1
6
6
  Requires-Dist: jinja2>=3.1.5
7
- Requires-Dist: mm-crypto-utils>=0.0.19
7
+ Requires-Dist: mm-crypto-utils~=0.1.1
8
8
  Requires-Dist: solana~=0.36.3
9
9
  Requires-Dist: typer>=0.15.1
@@ -12,23 +12,23 @@ mm_sol/transfer.py,sha256=Gu6UYEjY5OECSusKJO-VA8C3B7W6ZJGjegUv67EQdfs,5809
12
12
  mm_sol/utils.py,sha256=NE0G564GiT9d7rW_lPPxUb1eq62WiXh28xtvtzNQIqw,556
13
13
  mm_sol/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  mm_sol/cli/calcs.py,sha256=-r9RlsQyOziTDf84uIsvTgZmsUdNrVeazu3vTj9hhNA,1887
15
- mm_sol/cli/cli.py,sha256=p0urdRiho7Q8DgvUdH79wiujnnf3VIG24uKcFpmF-Yw,4556
15
+ mm_sol/cli/cli.py,sha256=CWzpH96zmODarCm4gfrj6_jXCPdPI-tMmbtqMYdnMqA,4584
16
16
  mm_sol/cli/cli_utils.py,sha256=Skj0SCHPWMHGr2ag-em1JtIK9Qdh7xeJafMzvCgChnc,2254
17
17
  mm_sol/cli/validators.py,sha256=_HEMOG7ojGKNp8AHX9tXpo9ZDCeRJ85coI-5MO3u95s,1209
18
18
  mm_sol/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  mm_sol/cli/cmd/balance_cmd.py,sha256=DfUZY3-Hr-F7Y0xp1faol0yLnPu6iDU3b839VhdwAbw,2587
20
- mm_sol/cli/cmd/balances_cmd.py,sha256=P2WRCqJXKo36Pqfe-ZrpguggVmpXTMXr-hQeji6-Bb0,2184
21
- mm_sol/cli/cmd/example_cmd.py,sha256=bK_z4du0UPGAoiHnYdi6iaZim_kKlYw4NKBbzvyes28,221
20
+ mm_sol/cli/cmd/balances_cmd.py,sha256=mLKulZnmWGixzbzYYvb4dUvJcNPKFHnNyk3WnuAmKio,2215
21
+ mm_sol/cli/cmd/example_cmd.py,sha256=M5dvRg9jvpVUwxvMRiRnO77aKR7c57bMY9booxMAswM,222
22
22
  mm_sol/cli/cmd/node_cmd.py,sha256=2AEAjq2M9f8-RZiI0rif6wITdns9QUb4Kr34QPsI2CA,238
23
- mm_sol/cli/cmd/transfer_sol_cmd.py,sha256=eRLKkr8ur3tNt_OG8pQapFqSLrzW7u9irKIpNbDWFuM,5035
24
- mm_sol/cli/cmd/transfer_token_cmd.py,sha256=8d_cTsMP1NnwdCBgM-hVxDjwXsTe3CHgoL2JEuknvWQ,5633
23
+ mm_sol/cli/cmd/transfer_sol_cmd.py,sha256=ZBdkb7YrR88foT3zobMZGnDYAHWgx8ljkxRKpkWyM0w,5313
24
+ mm_sol/cli/cmd/transfer_token_cmd.py,sha256=NCaSdO-eud-ef7SdWyTwWdSLiBegYAHySvKz22_j1cg,5911
25
25
  mm_sol/cli/cmd/wallet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  mm_sol/cli/cmd/wallet/keypair_cmd.py,sha256=cRHVVTs9zNYmUozZ8ZlJoutn9V6r8I1AEHBrszR7dTE,538
27
27
  mm_sol/cli/cmd/wallet/new_cmd.py,sha256=hcP9NZPkwYkTBEvT5rBntFtCIvx1QnPGn5FUDnvz5sM,425
28
- mm_sol/cli/examples/balances.yml,sha256=SoFcf_IhgA2zrbihrVpqm-ikes80wLFGVzafrjO00UY,290
29
- mm_sol/cli/examples/transfer-sol.yml,sha256=d0kO2FHNEXMD6WSjOk6X7PtDuaGAAQWn098k8z5bgbs,347
30
- mm_sol/cli/examples/transfer-token.yml,sha256=d8-3GE6NeM5zXo9S6WA8OP6pHjoEZvf7mtu9JwS5SZY,392
31
- mm_sol-0.2.9.dist-info/METADATA,sha256=YqSKksvBVs1tF2FlFiGe8rrPjqR3rbaftUHr4NKEtlQ,230
32
- mm_sol-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
- mm_sol-0.2.9.dist-info/entry_points.txt,sha256=MrYnosumy9nsITSAw5TiR3WXDwsdoF0YvUIlZ38TLLs,46
34
- mm_sol-0.2.9.dist-info/RECORD,,
28
+ mm_sol/cli/examples/balances.toml,sha256=8WvnKD1yUz51K1Rd3kkDQI5uOmRwE7DH8paibI-i1uM,262
29
+ mm_sol/cli/examples/transfer-sol.toml,sha256=1LdkhSBC0y5oMJXjm8MVIMyZruIrYSIm3LBDGmcS5Iw,353
30
+ mm_sol/cli/examples/transfer-token.toml,sha256=I_Wof-APv-h6xeYVq0zbWfLbpDny2kz9U0xJifVNEtU,401
31
+ mm_sol-0.3.0.dist-info/METADATA,sha256=RVZeWBCGk30AhpqEFhuXZ8g4DcrmHelApVVa-9PgecY,229
32
+ mm_sol-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
+ mm_sol-0.3.0.dist-info/entry_points.txt,sha256=MrYnosumy9nsITSAw5TiR3WXDwsdoF0YvUIlZ38TLLs,46
34
+ mm_sol-0.3.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- accounts: |
2
- 5BJ9ViMj4gi2BBX3wbCEJ4p4vpVWKpG6ja2aQP2ACBUv
3
- HbSAUDjzpr44fWzf9Ynj3V1jq3wBsgg88N88P4vzeGPX
4
-
5
- tokens: |
6
- 7XtmNSHJDHTZdx2K1S8D529kHsBbt3Civxt6vUHrGxBR
7
- 65FKbLPtrssmc8aVn9DEBY8VTGB85vsgadrmaW9H4nEB
8
-
9
- nodes: |
10
- https://api.mainnet-beta.solana.com
11
- # https://rpc.ankr.com/solana
@@ -1,9 +0,0 @@
1
- routes: |
2
- Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj
3
- Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur
4
- private_keys: "file: ./path/to/privates.txt"
5
- value: 0.012 sol
6
-
7
- proxies: "url: https://site.com/api/get-proxies"
8
- nodes: |
9
- https://api.devnet.solana.com
@@ -1,11 +0,0 @@
1
- routes: |
2
- Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj
3
- Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur
4
- token: 6VBTMLgv256c7scudNf8T5GoTJcEE8WfgcJhxbGYPQ8G
5
-
6
- private_keys_file: ./path/to/privates.txt
7
- value: 0.012 t
8
-
9
- proxies_url: https://site.com/api/get-proxies
10
- nodes: |
11
- https://api.devnet.solana.com
File without changes