mm-sol 0.7.1__tar.gz → 0.7.3__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.
Files changed (51) hide show
  1. mm_sol-0.7.3/.pre-commit-config.yaml +10 -0
  2. {mm_sol-0.7.1 → mm_sol-0.7.3}/PKG-INFO +4 -4
  3. {mm_sol-0.7.1 → mm_sol-0.7.3}/README.md +2 -2
  4. {mm_sol-0.7.1 → mm_sol-0.7.3}/justfile +8 -5
  5. {mm_sol-0.7.1 → mm_sol-0.7.3}/pyproject.toml +14 -13
  6. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/balances_cmd.py +1 -1
  7. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/example_cmd.py +1 -1
  8. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/transfer_cmd.py +1 -1
  9. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/examples/balances.toml +1 -1
  10. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/examples/transfer.toml +1 -1
  11. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/rpc.py +1 -1
  12. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/rpc_sync.py +1 -1
  13. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/conftest.py +0 -8
  14. mm_sol-0.7.3/tests/test_client.py +6 -0
  15. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/test_converters.py +1 -1
  16. mm_sol-0.7.3/uv.lock +1595 -0
  17. mm_sol-0.7.1/tests/test_client.py +0 -6
  18. mm_sol-0.7.1/uv.lock +0 -1248
  19. {mm_sol-0.7.1 → mm_sol-0.7.3}/.env.example +0 -0
  20. {mm_sol-0.7.1 → mm_sol-0.7.3}/.gitignore +0 -0
  21. {mm_sol-0.7.1 → mm_sol-0.7.3}/dict.dic +0 -0
  22. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/__init__.py +0 -0
  23. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/account.py +0 -0
  24. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/__init__.py +0 -0
  25. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/calcs.py +0 -0
  26. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cli.py +0 -0
  27. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cli_utils.py +0 -0
  28. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/__init__.py +0 -0
  29. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/balance_cmd.py +0 -0
  30. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/node_cmd.py +0 -0
  31. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/wallet/__init__.py +0 -0
  32. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/wallet/keypair_cmd.py +0 -0
  33. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/cmd/wallet/mnemonic_cmd.py +0 -0
  34. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/cli/validators.py +0 -0
  35. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/constants.py +0 -0
  36. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/converters.py +0 -0
  37. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/py.typed +0 -0
  38. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/retry.py +0 -0
  39. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/spl_token.py +0 -0
  40. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/transfer.py +0 -0
  41. {mm_sol-0.7.1 → mm_sol-0.7.3}/src/mm_sol/utils.py +0 -0
  42. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/__init__.py +0 -0
  43. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/cli/__init__.py +0 -0
  44. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/cli/cmd/__init__.py +0 -0
  45. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/cli/cmd/wallet/__init__.py +0 -0
  46. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/cli/cmd/wallet/test_keypair_cmd.py +0 -0
  47. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/cli/cmd/wallet/test_mnemonic_cmd.py +0 -0
  48. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/test_account.py +0 -0
  49. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/test_rpc.py +0 -0
  50. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/test_rpc_sync.py +0 -0
  51. {mm_sol-0.7.1 → mm_sol-0.7.3}/tests/test_spl_token.py +0 -0
@@ -0,0 +1,10 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: check-json
10
+ - id: check-added-large-files
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-sol
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Requires-Python: >=3.13
5
5
  Requires-Dist: base58~=2.1.1
6
6
  Requires-Dist: jinja2>=3.1.6
7
- Requires-Dist: mm-web3~=0.5.1
7
+ Requires-Dist: mm-web3~=0.5.4
8
8
  Requires-Dist: mnemonic==0.21
9
9
  Requires-Dist: socksio>=1.0.0
10
- Requires-Dist: solana~=0.36.7
11
- Requires-Dist: typer>=0.16.0
10
+ Requires-Dist: solana~=0.36.9
11
+ Requires-Dist: typer>=0.16.1
@@ -1,5 +1,5 @@
1
1
  # mm-sol
2
- A Python library and cli tool for interacting with Solana blockchain. It's based on https://github.com/michaelhly/solana-py
2
+ A Python library and cli tool for interacting with Solana blockchain. It's based on https://github.com/michaelhly/solana-py
3
3
 
4
4
  ### Install on Ubuntu
5
5
  ```shell
@@ -10,4 +10,4 @@ uv tool install mm-sol
10
10
  ```
11
11
 
12
12
  ### Notes
13
- - AsyncClient from solana-py with socks5 proxy ignores timeout. Use http proxy.
13
+ - AsyncClient from solana-py with socks5 proxy ignores timeout. Use http proxy.
@@ -15,13 +15,10 @@ format:
15
15
  test:
16
16
  uv run pytest -n auto tests
17
17
 
18
- lint: format
19
- uv run ruff check src tests
18
+ lint *args: format pre-commit
19
+ uv run ruff check {{args}} src tests
20
20
  uv run mypy src
21
21
 
22
- lint-fix: format
23
- uv run ruff check --fix src tests
24
-
25
22
  audit:
26
23
  uv export --no-dev --all-extras --format requirements-txt --no-emit-project > requirements.txt
27
24
  uv run pip-audit -r requirements.txt --disable-pip
@@ -36,3 +33,9 @@ publish: build
36
33
 
37
34
  sync:
38
35
  uv sync
36
+
37
+ pre-commit:
38
+ uv run pre-commit run --all-files
39
+
40
+ pre-commit-autoupdate:
41
+ uv run pre-commit autoupdate
@@ -1,14 +1,14 @@
1
1
  [project]
2
2
  name = "mm-sol"
3
- version = "0.7.1"
3
+ version = "0.7.3"
4
4
  description = ""
5
5
  requires-python = ">=3.13"
6
6
  dependencies = [
7
- "mm-web3~=0.5.1",
8
- "solana~=0.36.7",
7
+ "mm-web3~=0.5.4",
8
+ "solana~=0.36.9",
9
9
  "base58~=2.1.1",
10
10
  "mnemonic==0.21",
11
- "typer>=0.16.0",
11
+ "typer>=0.16.1",
12
12
  "jinja2>=3.1.6",
13
13
  "socksio>=1.0.0",
14
14
  ]
@@ -19,16 +19,17 @@ mm-sol = "mm_sol.cli.cli:app"
19
19
  requires = ["hatchling"]
20
20
  build-backend = "hatchling.build"
21
21
 
22
- [tool.uv]
23
- dev-dependencies = [
24
- "pytest~=8.4.0",
25
- "pytest-asyncio~=1.0.0",
26
- "pytest-xdist~=3.7.0",
27
- "ruff~=0.11.13",
22
+ [dependency-groups]
23
+ dev = [
24
+ "pytest~=8.4.2",
25
+ "pytest-asyncio~=1.2.0",
26
+ "pytest-xdist~=3.8.0",
27
+ "ruff~=0.14.2",
28
28
  "pip-audit~=2.9.0",
29
- "bandit~=1.8.3",
30
- "mypy~=1.16.0",
31
- "python-dotenv>=1.1.0",
29
+ "bandit~=1.8.6",
30
+ "mypy~=1.18.2",
31
+ "pre-commit~=4.3.0",
32
+ "python-dotenv~=1.2.1",
32
33
  ]
33
34
 
34
35
  [tool.mypy]
@@ -35,7 +35,7 @@ async def run(config_path: Path, print_config: bool) -> None:
35
35
  for token_address in config.tokens:
36
36
  res = await mm_sol.retry.get_token_decimals(3, config.nodes, config.proxies, token=token_address)
37
37
  if res.is_err():
38
- mm_print.fatal(f"Failed to get decimals for token {token_address}: {res.unwrap_err()}")
38
+ mm_print.exit_with_error(f"Failed to get decimals for token {token_address}: {res.unwrap_err()}")
39
39
 
40
40
  token_decimals = res.unwrap()
41
41
  result[token_address] = await _get_token_balances(token_address, token_decimals, config.accounts, config)
@@ -5,4 +5,4 @@ import mm_print
5
5
 
6
6
  def run(module: str) -> None:
7
7
  example_file = Path(Path(__file__).parent.absolute(), "../examples", f"{module}.toml")
8
- mm_print.toml(toml=example_file.read_text())
8
+ mm_print.toml(example_file.read_text())
@@ -69,7 +69,7 @@ class Config(Web3CliConfig):
69
69
  if self.token:
70
70
  res = await mm_sol.retry.get_token_decimals(3, self.nodes, self.proxies, token=self.token)
71
71
  if res.is_err():
72
- mm_print.fatal(f"can't get decimals for token={self.token}, error={res.unwrap_err()}")
72
+ mm_print.exit_with_error(f"can't get decimals for token={self.token}, error={res.unwrap_err()}")
73
73
  self.token_decimals = res.unwrap()
74
74
 
75
75
  return self
@@ -9,4 +9,4 @@ JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN # JUP
9
9
  """
10
10
 
11
11
  nodes = "https://api.mainnet-beta.solana.com"
12
- # proxies = "env_url: MM_SOL_PROXIES_URL"
12
+ # proxies = "env_url: MM_SOL_PROXIES_URL"
@@ -3,7 +3,7 @@
3
3
  # value is an expression that can contain variable 'balance' and 'random' function
4
4
  transfers = """
5
5
  # for sol transfer use 'sol' suffix, example: 1.2sol. For other tokens use 't' suffix, example: 1.2t
6
- Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj 1.2t
6
+ Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9YA8tsDKGwj 1.2t
7
7
  Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur 0.6balance-random(1t,2.50t)-100
8
8
  6TW4WswDgGmEB5HELBtEdwC1tQJq9Xa1msDjPw94sgai GGb7gb5EzW8GZZWX552eiC9r1SY4Pqtgbqf9UMrBrEzy # default_value will be used
9
9
  file: /path/to/other/transfers.txt # transfers from this file will be added
@@ -26,7 +26,7 @@ async def _http_call(node: str, data: dict[str, object], timeout: float, proxy:
26
26
  if res.is_err():
27
27
  return res.to_result_err()
28
28
  try:
29
- parsed_body = res.parse_json_body()
29
+ parsed_body = res.parse_json()
30
30
  err = parsed_body.get("error", {}).get("message", "")
31
31
  if err:
32
32
  return res.to_result_err(f"service_error: {err}")
@@ -95,7 +95,7 @@ def _http_call(node: str, data: dict[str, object], timeout: float, proxy: str |
95
95
  if res.is_err():
96
96
  return res.to_result_err()
97
97
 
98
- json_body = res.parse_json_body()
98
+ json_body = res.parse_json()
99
99
  err = pydash.get(json_body, "error.message")
100
100
  if err:
101
101
  return res.to_result_err(f"service_error: {err}")
@@ -99,14 +99,6 @@ def binance_wallet():
99
99
  return "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"
100
100
 
101
101
 
102
- @pytest.fixture
103
- def proxy() -> str:
104
- value = os.getenv("PROXY")
105
- if value is None:
106
- pytest.skip("PROXY environment variable not set")
107
- return value
108
-
109
-
110
102
  @pytest.fixture(scope="session")
111
103
  def proxies() -> list[str]:
112
104
  proxies_url = os.getenv("PROXIES_URL")
@@ -0,0 +1,6 @@
1
+ from mm_sol.utils import get_client
2
+
3
+
4
+ def test_proxy_client(mainnet_node, random_proxy):
5
+ client = get_client(mainnet_node, proxy=random_proxy)
6
+ assert client.get_block_height().value > 10_000_000
@@ -17,7 +17,7 @@ def test_sol_to_lamports():
17
17
 
18
18
  def test_to_lamports():
19
19
  assert to_lamports(123) == 123
20
- assert to_lamports(Decimal("123")) == 123
20
+ assert to_lamports(Decimal(123)) == 123
21
21
  assert to_lamports("123") == 123
22
22
  assert to_lamports("123.1 sol") == 123.1 * 10**9
23
23
  assert to_lamports("123.1sol") == 123.1 * 10**9