mm-eth 0.1.1__py3-none-any.whl → 0.1.3__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_eth/abi.py +5 -6
- mm_eth/account.py +6 -5
- mm_eth/cli/cli.py +1 -1
- mm_eth/tx.py +3 -3
- mm_eth/utils.py +4 -0
- mm_eth/zksync.py +2 -2
- mm_eth-0.1.3.dist-info/METADATA +9 -0
- {mm_eth-0.1.1.dist-info → mm_eth-0.1.3.dist-info}/RECORD +10 -11
- {mm_eth-0.1.1.dist-info → mm_eth-0.1.3.dist-info}/WHEEL +1 -2
- mm_eth-0.1.1.dist-info/METADATA +0 -10
- mm_eth-0.1.1.dist-info/top_level.txt +0 -1
- {mm_eth-0.1.1.dist-info → mm_eth-0.1.3.dist-info}/entry_points.txt +0 -0
mm_eth/abi.py
CHANGED
|
@@ -6,11 +6,10 @@ from typing import Any, cast
|
|
|
6
6
|
import eth_abi
|
|
7
7
|
import eth_utils
|
|
8
8
|
import pydash
|
|
9
|
-
from eth_typing import HexStr
|
|
9
|
+
from eth_typing import ABI, ABIFunction, HexStr
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
from web3 import Web3
|
|
12
12
|
from web3.auto import w3
|
|
13
|
-
from web3.types import ABI, ABIFunction
|
|
14
13
|
|
|
15
14
|
from mm_eth.utils import hex_to_bytes
|
|
16
15
|
|
|
@@ -85,7 +84,7 @@ def encode_function_input_by_abi(abi: ABI | ABIFunction, fn_name: str, args: lis
|
|
|
85
84
|
else:
|
|
86
85
|
processed_args.append(args[idx])
|
|
87
86
|
|
|
88
|
-
return Web3().eth.contract(abi=[abi]).
|
|
87
|
+
return Web3().eth.contract(abi=[abi]).encode_abi(abi_element_identifier=fn_name, args=processed_args) # type: ignore[no-any-return]
|
|
89
88
|
|
|
90
89
|
|
|
91
90
|
def encode_function_input_by_signature(func_signature: str, args: list[Any]) -> HexStr:
|
|
@@ -100,7 +99,7 @@ def encode_function_input_by_signature(func_signature: str, args: list[Any]) ->
|
|
|
100
99
|
func_abi: ABIFunction = {
|
|
101
100
|
"name": func_name,
|
|
102
101
|
"type": "function",
|
|
103
|
-
"inputs": [{"type": t} for t in arg_types],
|
|
102
|
+
"inputs": [{"type": t} for t in arg_types], # type: ignore[typeddict-item]
|
|
104
103
|
}
|
|
105
104
|
return encode_function_input_by_abi(func_abi, func_name, args)
|
|
106
105
|
|
|
@@ -123,8 +122,8 @@ def parse_function_signatures(contract_abi: ABI) -> dict[str, str]:
|
|
|
123
122
|
result: dict[str, str] = {}
|
|
124
123
|
for item in contract_abi:
|
|
125
124
|
if item.get("type", None) == "function":
|
|
126
|
-
function_name = item["name"]
|
|
127
|
-
types = ",".join([i["type"] for i in item["inputs"]])
|
|
125
|
+
function_name = item["name"] # type: ignore
|
|
126
|
+
types = ",".join([i["type"] for i in item["inputs"]]) # type: ignore
|
|
128
127
|
function_name_and_types = f"{function_name}({types})"
|
|
129
128
|
result[function_name_and_types] = encode_function_signature(function_name_and_types)
|
|
130
129
|
return result
|
mm_eth/account.py
CHANGED
|
@@ -7,7 +7,7 @@ from eth_keys import KeyAPI
|
|
|
7
7
|
from eth_typing import ChecksumAddress
|
|
8
8
|
from eth_utils import decode_hex
|
|
9
9
|
|
|
10
|
-
Account.enable_unaudited_hdwallet_features()
|
|
10
|
+
Account.enable_unaudited_hdwallet_features()
|
|
11
11
|
|
|
12
12
|
key_api = KeyAPI()
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ def to_checksum_address(address: str) -> ChecksumAddress:
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def generate_mnemonic(num_words: int = 24) -> str:
|
|
27
|
-
mnemonic = Mnemonic("english")
|
|
27
|
+
mnemonic = Mnemonic("english")
|
|
28
28
|
return mnemonic.generate(num_words=num_words)
|
|
29
29
|
|
|
30
30
|
|
|
@@ -38,13 +38,15 @@ def generate_accounts( # nosec
|
|
|
38
38
|
for i in range(limit):
|
|
39
39
|
path = f"{path_prefix}/{i}"
|
|
40
40
|
acc = Account.from_mnemonic(mnemonic=mnemonic, account_path=path, passphrase=passphrase)
|
|
41
|
-
|
|
41
|
+
private_key = acc.key.hex().lower()
|
|
42
|
+
if not private_key.startswith("0x"):
|
|
43
|
+
private_key = f"0x{private_key}"
|
|
44
|
+
result.append(NewAccount(path, acc.address, private_key))
|
|
42
45
|
return result
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
def private_to_address(private_key: str) -> str | None:
|
|
46
49
|
"""returns address in lower case"""
|
|
47
|
-
# noinspection PyBroadException
|
|
48
50
|
try:
|
|
49
51
|
return key_api.PrivateKey(decode_hex(private_key)).public_key.to_address().lower()
|
|
50
52
|
except Exception:
|
|
@@ -62,7 +64,6 @@ def create_private_keys_dict(private_keys: list[str]) -> dict[str, str]: # addr
|
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
def is_private_key(private_key: str) -> bool:
|
|
65
|
-
# noinspection PyBroadException
|
|
66
67
|
try:
|
|
67
68
|
key_api.PrivateKey(decode_hex(private_key)).public_key.to_address()
|
|
68
69
|
return True
|
mm_eth/cli/cli.py
CHANGED
|
@@ -61,7 +61,7 @@ def token_command(
|
|
|
61
61
|
def node_command(
|
|
62
62
|
urls: Annotated[list[str], typer.Argument()],
|
|
63
63
|
print_format: Annotated[PrintFormat, typer.Option("--format", "-f", help="Print format")] = PrintFormat.TABLE,
|
|
64
|
-
proxy: Annotated[str, typer.Option("--proxy", "-p", help="Proxy")] =
|
|
64
|
+
proxy: Annotated[str | None, typer.Option("--proxy", "-p", help="Proxy")] = None,
|
|
65
65
|
) -> None:
|
|
66
66
|
node_cmd.run(urls, print_format, proxy)
|
|
67
67
|
|
mm_eth/tx.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
5
|
import rlp
|
|
6
|
-
from eth_utils import keccak
|
|
6
|
+
from eth_utils import keccak, to_hex
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
from rlp.sedes import Binary, big_endian_int, binary
|
|
9
9
|
from web3 import Web3
|
|
@@ -105,7 +105,7 @@ def sign_legacy_tx(
|
|
|
105
105
|
tx["data"] = data
|
|
106
106
|
|
|
107
107
|
signed = w3.eth.account.sign_transaction(tx, private_key)
|
|
108
|
-
return SignedTx(tx_hash=signed.hash
|
|
108
|
+
return SignedTx(tx_hash=to_hex(signed.hash), raw_tx=to_hex(signed.raw_transaction))
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
def sign_tx(
|
|
@@ -136,7 +136,7 @@ def sign_tx(
|
|
|
136
136
|
tx["to"] = Web3.to_checksum_address(to)
|
|
137
137
|
|
|
138
138
|
signed = w3.eth.account.sign_transaction(tx, private_key)
|
|
139
|
-
return SignedTx(tx_hash=signed.hash.hex(), raw_tx=signed.
|
|
139
|
+
return SignedTx(tx_hash=signed.hash.hex(), raw_tx=signed.raw_transaction.hex())
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
def decode_raw_tx(raw_tx: str) -> DecodedRawTx:
|
mm_eth/utils.py
CHANGED
mm_eth/zksync.py
CHANGED
|
@@ -2,12 +2,12 @@ import json
|
|
|
2
2
|
import pkgutil
|
|
3
3
|
from typing import cast
|
|
4
4
|
|
|
5
|
-
from eth_typing import ChecksumAddress, HexStr
|
|
5
|
+
from eth_typing import ABI, ChecksumAddress, HexStr
|
|
6
6
|
from hexbytes import HexBytes
|
|
7
7
|
from mm_std import Err, Ok, Result
|
|
8
8
|
from pydantic import BaseModel, Field
|
|
9
9
|
from web3 import Web3
|
|
10
|
-
from web3.types import
|
|
10
|
+
from web3.types import Nonce, TxParams, Wei
|
|
11
11
|
|
|
12
12
|
from mm_eth import abi, rpc
|
|
13
13
|
from mm_eth.rpc import rpc_call
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mm_eth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mm_eth/abi.py,sha256=
|
|
3
|
-
mm_eth/account.py,sha256=
|
|
2
|
+
mm_eth/abi.py,sha256=_xw2c7Eht3-g-fA6yvakHMcehzsRRK_LqTO7Q8Ppkj4,4794
|
|
3
|
+
mm_eth/account.py,sha256=McY_ceSLMs6lvB2RfDmBfH0dleuVnFh2jopszGkI4HQ,1976
|
|
4
4
|
mm_eth/anvil.py,sha256=9CWXWyK7tVrvs6NeOy7QnVwMTrUke-nBMFwZeJ4VULA,1582
|
|
5
5
|
mm_eth/deploy.py,sha256=SB3ruY808_5UnG8kHR34uVP66P3zOWZu0ImKD7UUv2s,691
|
|
6
6
|
mm_eth/ens.py,sha256=WMxqC1v3zwDDuLH_oWekm22qrNYxCNcvZumQMT7SYds,623
|
|
@@ -9,15 +9,15 @@ mm_eth/ethernodes.py,sha256=9y_poTmFUj6cnWaT9mtfc6S9lAfVXTwLGRqxMQ8hT0Y,3080
|
|
|
9
9
|
mm_eth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
mm_eth/rpc.py,sha256=kQnYllp5ZHGuIUUX2Vw-ejLwL3zXQgka3ukwDndv4AM,13881
|
|
11
11
|
mm_eth/solc.py,sha256=JcBCel-LO-lBvz3_1f7s3pVhECsUittavBvXqxYIP2c,1066
|
|
12
|
-
mm_eth/tx.py,sha256=
|
|
12
|
+
mm_eth/tx.py,sha256=qSkaPgow3QEZR0vbnQouw8X4G-Hw9RedPrDB10aZhU0,4046
|
|
13
13
|
mm_eth/types.py,sha256=w_B1o_XggFz2cHXa36tI-wjfE4r-BFhvKIF9nb2YI5g,154
|
|
14
|
-
mm_eth/utils.py,sha256=
|
|
14
|
+
mm_eth/utils.py,sha256=kjCIsXtRTG0dL6A1bCCuWctqd0Qh8K8N-ZocQRppYj0,7861
|
|
15
15
|
mm_eth/vault.py,sha256=1ahABcgyYAMUlE4ELMGdlG_uV4irmwzrfzUZTpo3rdY,1500
|
|
16
|
-
mm_eth/zksync.py,sha256=
|
|
16
|
+
mm_eth/zksync.py,sha256=u9vnB85LXcZmtsgqsGd7NIDTwZf_U39LQfvVdC4C5I0,5997
|
|
17
17
|
mm_eth/abi/zksync.json,sha256=aHp6-Y5W6wRz0hrC0aPTjAHb-Q2ipDikcAB5FtlxWWA,45503
|
|
18
18
|
mm_eth/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
mm_eth/cli/calcs.py,sha256=nHfn_Q9T_E8_hP7ExMyWlUGvAMzxQs6KgzdNg1CUnvU,3651
|
|
20
|
-
mm_eth/cli/cli.py,sha256=
|
|
20
|
+
mm_eth/cli/cli.py,sha256=lXLf_-oHT0JykSU_CHjVuq0f1EXPCfCq-OK_S6dgtiM,8992
|
|
21
21
|
mm_eth/cli/cli_helpers.py,sha256=0NapwmrRVQ1PWDP6iqwaX1fnzrIdD_TwvcZXIcq5QzM,6572
|
|
22
22
|
mm_eth/cli/cli_utils.py,sha256=4I12cJV0deKfarRpd2wNhW42L_jQab4oxa9DX-WxicM,5041
|
|
23
23
|
mm_eth/cli/validators.py,sha256=bE4G-OL6W6S30P4FK5pVn_LiY2G2w8aeA3R1kQaX0gY,2379
|
|
@@ -43,8 +43,7 @@ mm_eth/cli/config_examples/call_contract.yml,sha256=E0XuWuBnbhyTYfxNqaoxH6Cy7UCY
|
|
|
43
43
|
mm_eth/cli/config_examples/transfer_erc20.yml,sha256=mCUpUfqzZjTvst8kqd3EGzJY0S7cr48ySqS6yZhzLdI,1324
|
|
44
44
|
mm_eth/cli/config_examples/transfer_eth.yml,sha256=i4hh3-LTcpl7JsrSuuM6gDi23B5ZnCeEnaYazQO3bzQ,1181
|
|
45
45
|
mm_eth/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
mm_eth-0.1.
|
|
47
|
-
mm_eth-0.1.
|
|
48
|
-
mm_eth-0.1.
|
|
49
|
-
mm_eth-0.1.
|
|
50
|
-
mm_eth-0.1.1.dist-info/RECORD,,
|
|
46
|
+
mm_eth-0.1.3.dist-info/METADATA,sha256=8RNO36nSl-kmghoYRLQqSRBGVIPBABxccC9vl_Mkueo,227
|
|
47
|
+
mm_eth-0.1.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
48
|
+
mm_eth-0.1.3.dist-info/entry_points.txt,sha256=aGhpsozl8NIrkuUcX5fSgURCcDhr3ShUdeTSIrJq4oc,46
|
|
49
|
+
mm_eth-0.1.3.dist-info/RECORD,,
|
mm_eth-0.1.1.dist-info/METADATA
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
mm_eth
|
|
File without changes
|