mm-sol 0.3.5__py3-none-any.whl → 0.3.6__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_utils.py +0 -25
- mm_sol/cli/cmd/transfer_sol_cmd.py +21 -1
- mm_sol/cli/cmd/transfer_token_cmd.py +39 -4
- mm_sol/cli/examples/transfer-sol.toml +2 -1
- {mm_sol-0.3.5.dist-info → mm_sol-0.3.6.dist-info}/METADATA +1 -1
- {mm_sol-0.3.5.dist-info → mm_sol-0.3.6.dist-info}/RECORD +8 -8
- {mm_sol-0.3.5.dist-info → mm_sol-0.3.6.dist-info}/WHEEL +0 -0
- {mm_sol-0.3.5.dist-info → mm_sol-0.3.6.dist-info}/entry_points.txt +0 -0
mm_sol/cli/cli_utils.py
CHANGED
|
@@ -4,12 +4,8 @@ import time
|
|
|
4
4
|
import mm_crypto_utils
|
|
5
5
|
from loguru import logger
|
|
6
6
|
from mm_crypto_utils import Nodes, Proxies
|
|
7
|
-
from rich.live import Live
|
|
8
|
-
from rich.table import Table
|
|
9
7
|
from solders.signature import Signature
|
|
10
8
|
|
|
11
|
-
from mm_sol.balance import get_sol_balance_with_retries
|
|
12
|
-
from mm_sol.converters import lamports_to_sol
|
|
13
9
|
from mm_sol.utils import get_client
|
|
14
10
|
|
|
15
11
|
|
|
@@ -32,27 +28,6 @@ def public_rpc_url(url: str | None) -> str:
|
|
|
32
28
|
return url
|
|
33
29
|
|
|
34
30
|
|
|
35
|
-
def print_balances(
|
|
36
|
-
rpc_nodes: list[str],
|
|
37
|
-
addresses: list[str],
|
|
38
|
-
*,
|
|
39
|
-
proxies: Proxies = None,
|
|
40
|
-
round_ndigits: int = 5,
|
|
41
|
-
) -> None:
|
|
42
|
-
table = Table(title="balances")
|
|
43
|
-
table.add_column("n")
|
|
44
|
-
table.add_column("address")
|
|
45
|
-
table.add_column("balance, sol")
|
|
46
|
-
with Live(table, refresh_per_second=0.5):
|
|
47
|
-
for count, address in enumerate(addresses):
|
|
48
|
-
balance = get_sol_balance_with_retries(rpc_nodes, address, proxies=proxies, retries=5).map_or_else(
|
|
49
|
-
lambda err: err,
|
|
50
|
-
lambda ok: str(lamports_to_sol(ok, round_ndigits)),
|
|
51
|
-
)
|
|
52
|
-
row: list[str] = [str(count), address, balance]
|
|
53
|
-
table.add_row(*row)
|
|
54
|
-
|
|
55
|
-
|
|
56
31
|
def wait_confirmation(nodes: Nodes, proxies: Proxies, signature: Signature, log_prefix: str) -> bool:
|
|
57
32
|
count = 0
|
|
58
33
|
while True:
|
|
@@ -8,8 +8,11 @@ from loguru import logger
|
|
|
8
8
|
from mm_crypto_utils import AddressToPrivate, TxRoute
|
|
9
9
|
from mm_std import BaseConfig, Err, utc_now
|
|
10
10
|
from pydantic import AfterValidator, BeforeValidator, Field, model_validator
|
|
11
|
+
from rich.live import Live
|
|
12
|
+
from rich.table import Table
|
|
11
13
|
|
|
12
14
|
from mm_sol import transfer
|
|
15
|
+
from mm_sol.balance import get_sol_balance_with_retries
|
|
13
16
|
from mm_sol.cli import calcs, cli_utils
|
|
14
17
|
from mm_sol.cli.calcs import calc_sol_expression
|
|
15
18
|
from mm_sol.cli.validators import Validators
|
|
@@ -58,7 +61,7 @@ def run(
|
|
|
58
61
|
mm_crypto_utils.init_logger(debug, config.log_debug, config.log_info)
|
|
59
62
|
|
|
60
63
|
if print_balances:
|
|
61
|
-
|
|
64
|
+
_print_balances(config)
|
|
62
65
|
sys.exit(0)
|
|
63
66
|
|
|
64
67
|
_run_transfers(config, no_confirmation=no_confirmation, emulate=emulate)
|
|
@@ -137,3 +140,20 @@ def _transfer(*, from_address: str, to_address: str, config: Config, no_confirma
|
|
|
137
140
|
status = "OK"
|
|
138
141
|
msg = f"{log_prefix}: sig={signature}, value={lamports_to_sol(value, config.round_ndigits)}, status={status}"
|
|
139
142
|
logger.info(msg)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _print_balances(config: Config) -> None:
|
|
146
|
+
table = Table("n", "from_address", "sol", "to_address", "sol", title="balances")
|
|
147
|
+
with Live(table, refresh_per_second=0.5):
|
|
148
|
+
for count, route in enumerate(config.routes):
|
|
149
|
+
from_balance = _get_sol_balance_str(route.from_address, config)
|
|
150
|
+
to_balance = _get_sol_balance_str(route.to_address, config)
|
|
151
|
+
row: list[str] = [str(count), route.from_address, from_balance, route.to_address, to_balance]
|
|
152
|
+
table.add_row(*row)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _get_sol_balance_str(address: str, config: Config) -> str:
|
|
156
|
+
return get_sol_balance_with_retries(config.nodes, address, proxies=config.proxies, retries=5).map_or_else(
|
|
157
|
+
lambda err: err,
|
|
158
|
+
lambda ok: str(lamports_to_sol(ok, config.round_ndigits)),
|
|
159
|
+
)
|
|
@@ -4,16 +4,18 @@ from pathlib import Path
|
|
|
4
4
|
from typing import Annotated, Self
|
|
5
5
|
|
|
6
6
|
import mm_crypto_utils
|
|
7
|
-
import typer
|
|
8
7
|
from loguru import logger
|
|
9
8
|
from mm_crypto_utils import AddressToPrivate, TxRoute
|
|
10
9
|
from mm_std import BaseConfig, Err, fatal, utc_now
|
|
11
10
|
from pydantic import AfterValidator, BeforeValidator, Field, model_validator
|
|
11
|
+
from rich.live import Live
|
|
12
|
+
from rich.table import Table
|
|
12
13
|
|
|
13
14
|
from mm_sol import transfer
|
|
15
|
+
from mm_sol.balance import get_sol_balance_with_retries, get_token_balance_with_retries
|
|
14
16
|
from mm_sol.cli import calcs, cli_utils
|
|
15
17
|
from mm_sol.cli.validators import Validators
|
|
16
|
-
from mm_sol.converters import to_token
|
|
18
|
+
from mm_sol.converters import lamports_to_sol, to_token
|
|
17
19
|
from mm_sol.token import get_decimals_with_retries
|
|
18
20
|
|
|
19
21
|
|
|
@@ -67,8 +69,7 @@ def run(
|
|
|
67
69
|
logger.debug(f"token decimals={token_decimals}")
|
|
68
70
|
|
|
69
71
|
if print_balances:
|
|
70
|
-
|
|
71
|
-
typer.echo("Not implemented yet")
|
|
72
|
+
_print_balances(config, token_decimals)
|
|
72
73
|
sys.exit(0)
|
|
73
74
|
|
|
74
75
|
_run_transfers(config, token_decimals, no_confirmation=no_confirmation, emulate=emulate)
|
|
@@ -151,3 +152,37 @@ def _transfer(*, route: TxRoute, config: Config, token_decimals: int, no_confirm
|
|
|
151
152
|
status = "OK"
|
|
152
153
|
msg = f"{log_prefix}: sig={signature}, value={value_t}, status={status}"
|
|
153
154
|
logger.info(msg)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _print_balances(config: Config, token_decimals: int) -> None:
|
|
158
|
+
table = Table("n", "from_address", "sol", "t", "to_address", "sol", "t", title="balances")
|
|
159
|
+
with Live(table, refresh_per_second=0.5):
|
|
160
|
+
for count, route in enumerate(config.routes):
|
|
161
|
+
from_sol_balance = _get_sol_balance_str(route.from_address, config)
|
|
162
|
+
to_sol_balance = _get_sol_balance_str(route.to_address, config)
|
|
163
|
+
from_t_balance = _get_token_balance_str(route.from_address, config, token_decimals)
|
|
164
|
+
to_t_balance = _get_token_balance_str(route.to_address, config, token_decimals)
|
|
165
|
+
row: list[str] = [
|
|
166
|
+
str(count),
|
|
167
|
+
route.from_address,
|
|
168
|
+
from_sol_balance,
|
|
169
|
+
from_t_balance,
|
|
170
|
+
route.to_address,
|
|
171
|
+
to_sol_balance,
|
|
172
|
+
to_t_balance,
|
|
173
|
+
]
|
|
174
|
+
table.add_row(*row)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _get_sol_balance_str(address: str, config: Config) -> str:
|
|
178
|
+
return get_sol_balance_with_retries(config.nodes, address, proxies=config.proxies, retries=5).map_or_else(
|
|
179
|
+
lambda err: err,
|
|
180
|
+
lambda ok: str(lamports_to_sol(ok, config.round_ndigits)),
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _get_token_balance_str(address: str, config: Config, token_decimals: int) -> str:
|
|
185
|
+
return get_token_balance_with_retries(config.nodes, address, config.token, proxies=config.proxies, retries=5).map_or_else(
|
|
186
|
+
lambda err: err,
|
|
187
|
+
lambda ok: str(to_token(ok, token_decimals, ndigits=config.round_ndigits)),
|
|
188
|
+
)
|
|
@@ -3,6 +3,7 @@ Bd8CxCTLez2ckVTqEJjuZkWjYFSRbo8fA1qYbd7yFVP9 Eaft9xXzfgbRqsHd65WspoaxTtH7pkznM9Y
|
|
|
3
3
|
Fc2TRJVCpFZpRz56mFnQETctib1zwFnwHcS7HoQSgUzZ EVJctTWikt29rUXBf49tyQdK87x837HtvpCwqeSjp1Ur
|
|
4
4
|
"""
|
|
5
5
|
private_keys = "file: ./path/to/privates.txt"
|
|
6
|
-
value = "0.
|
|
6
|
+
value = "0.5balance - 0.012sol"
|
|
7
|
+
delay = "random(5,10)"
|
|
7
8
|
proxies = "url: https://site.com/api/get-proxies"
|
|
8
9
|
nodes = "https://api.devnet.solana.com"
|
|
@@ -13,22 +13,22 @@ 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
15
|
mm_sol/cli/cli.py,sha256=OlgBas-dWWZJ_WCbHJGLX6GxfILvIy7Q0VhgRo_nytE,4945
|
|
16
|
-
mm_sol/cli/cli_utils.py,sha256=
|
|
16
|
+
mm_sol/cli/cli_utils.py,sha256=HCMnOhMSQtAGQpZaA2e5v_li-XNDv4P3LxBcSSTPDoo,1399
|
|
17
17
|
mm_sol/cli/validators.py,sha256=HLCFRrBOdyAMj_ibdAkkP36y9Zm2Dt3gMKoyPOcaiQE,1164
|
|
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
20
|
mm_sol/cli/cmd/balances_cmd.py,sha256=gMRZXAnCOPESsKRqz33ALPzSOqGGeZF225kMRO6sV-c,2876
|
|
21
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=
|
|
24
|
-
mm_sol/cli/cmd/transfer_token_cmd.py,sha256=
|
|
23
|
+
mm_sol/cli/cmd/transfer_sol_cmd.py,sha256=CfCQ3SsXzdd2Yy3awlM2l7D1LuCNnSUg_Y84ttpL9-Q,6155
|
|
24
|
+
mm_sol/cli/cmd/transfer_token_cmd.py,sha256=gepB8dds1xnGMYT1UBwV8EgpKmST3SvWS99lXnc2X3E,7470
|
|
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/mnemonic_cmd.py,sha256=IiON_fJT5AFfIr_E1LR6_iDYZ3c_jWCFc-wSYqk61V8,648
|
|
28
28
|
mm_sol/cli/examples/balances.toml,sha256=jyfUXusAWe6suuuwnPIfqWdU2kfT3hfMjkZ6uYMg8s0,347
|
|
29
|
-
mm_sol/cli/examples/transfer-sol.toml,sha256=
|
|
29
|
+
mm_sol/cli/examples/transfer-sol.toml,sha256=7y_F2Kd-x05zbJ4Uw6NYegIXaZES5v96WQY8JKVpuwY,388
|
|
30
30
|
mm_sol/cli/examples/transfer-token.toml,sha256=I_Wof-APv-h6xeYVq0zbWfLbpDny2kz9U0xJifVNEtU,401
|
|
31
|
-
mm_sol-0.3.
|
|
32
|
-
mm_sol-0.3.
|
|
33
|
-
mm_sol-0.3.
|
|
34
|
-
mm_sol-0.3.
|
|
31
|
+
mm_sol-0.3.6.dist-info/METADATA,sha256=XcbspoW4fU3UlQLdVu6Z9rN-LELguqgfv_U2AGJr9js,259
|
|
32
|
+
mm_sol-0.3.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
33
|
+
mm_sol-0.3.6.dist-info/entry_points.txt,sha256=MrYnosumy9nsITSAw5TiR3WXDwsdoF0YvUIlZ38TLLs,46
|
|
34
|
+
mm_sol-0.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|