mm-eth 0.5.16__py3-none-any.whl → 0.5.17__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/rpc_async.py
CHANGED
|
@@ -49,14 +49,14 @@ async def _ws_call(node: str, data: dict[str, object], timeout: float) -> DataRe
|
|
|
49
49
|
|
|
50
50
|
err = response.get("error", {}).get("message", "")
|
|
51
51
|
if err:
|
|
52
|
-
return DataResult(
|
|
52
|
+
return DataResult.err(f"service_error: {err}", response)
|
|
53
53
|
if "result" in response:
|
|
54
|
-
return DataResult(
|
|
55
|
-
return DataResult(
|
|
54
|
+
return DataResult.ok(response["result"], response)
|
|
55
|
+
return DataResult.err("unknown_response", response)
|
|
56
56
|
except TimeoutError:
|
|
57
|
-
return DataResult(
|
|
57
|
+
return DataResult.err("timeout")
|
|
58
58
|
except Exception as err:
|
|
59
|
-
return DataResult(err
|
|
59
|
+
return DataResult.exception(err)
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
async def eth_block_number(node: str, timeout: float = DEFAULT_TIMEOUT, proxy: str | None = None) -> DataResult[int]:
|
|
@@ -98,12 +98,12 @@ async def erc20_decimals(
|
|
|
98
98
|
return res
|
|
99
99
|
try:
|
|
100
100
|
if res.unwrap() == "0x":
|
|
101
|
-
return DataResult(
|
|
101
|
+
return DataResult.err("no_decimals", res.data)
|
|
102
102
|
value = res.unwrap()
|
|
103
103
|
result = eth_utils.to_int(hexstr=value[0:66]) if len(value) > 66 else eth_utils.to_int(hexstr=value)
|
|
104
|
-
return DataResult(
|
|
105
|
-
except Exception as
|
|
106
|
-
return DataResult(err
|
|
104
|
+
return DataResult.ok(result, res.data)
|
|
105
|
+
except Exception as err:
|
|
106
|
+
return DataResult.exception(err, data=res.data)
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
ENS_REGISTRY_ADDRESS: str = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
|
@@ -125,7 +125,7 @@ async def ens_name(node: str, address: str, timeout: float = DEFAULT_TIMEOUT, pr
|
|
|
125
125
|
return resolver_res
|
|
126
126
|
|
|
127
127
|
if resolver_res.is_ok() and len(resolver_res.unwrap()) != 66:
|
|
128
|
-
return DataResult(
|
|
128
|
+
return DataResult.ok(None, {"revolver_response": resolver_res.dict()})
|
|
129
129
|
|
|
130
130
|
resolver_address = eth_utils.to_checksum_address("0x" + resolver_res.unwrap()[-40:])
|
|
131
131
|
|
|
@@ -135,31 +135,21 @@ async def ens_name(node: str, address: str, timeout: float = DEFAULT_TIMEOUT, pr
|
|
|
135
135
|
name_res: DataResult[str] = await rpc_call(node, "eth_call", name_params, timeout=timeout, proxy=proxy)
|
|
136
136
|
|
|
137
137
|
if name_res.is_err():
|
|
138
|
-
return DataResult(
|
|
139
|
-
err=name_res.unwrap_err(), data={"resolver_response": resolver_res.dict(), "name_response": name_res.dict()}
|
|
140
|
-
)
|
|
138
|
+
return DataResult.err(name_res.unwrap_err(), {"resolver_response": resolver_res.dict(), "name_response": name_res.dict()})
|
|
141
139
|
|
|
142
140
|
if name_res.unwrap() == "0x":
|
|
143
|
-
return DataResult(
|
|
144
|
-
ok=None,
|
|
145
|
-
data={"resolver_response": resolver_res.dict(), "name_response": name_res.dict()},
|
|
146
|
-
ok_is_none=True,
|
|
147
|
-
)
|
|
141
|
+
return DataResult.ok(None, {"resolver_response": resolver_res.dict(), "name_response": name_res.dict()})
|
|
148
142
|
|
|
149
143
|
try:
|
|
150
144
|
hex_data = name_res.unwrap()
|
|
151
145
|
length_hex = hex_data[66:130]
|
|
152
146
|
str_len = int(length_hex, 16) * 2
|
|
153
147
|
name_hex = hex_data[130 : 130 + str_len]
|
|
154
|
-
return DataResult(
|
|
155
|
-
|
|
156
|
-
data={"resolver_response": resolver_res.dict(), "name_response": name_res.dict()},
|
|
157
|
-
)
|
|
158
|
-
except Exception as e:
|
|
159
|
-
return DataResult(
|
|
160
|
-
err="exception",
|
|
161
|
-
data={"resolver_response": resolver_res.dict(), "name_response": name_res.dict(), "exception": str(e)},
|
|
148
|
+
return DataResult.ok(
|
|
149
|
+
bytes.fromhex(name_hex).decode("utf-8"), {"resolver_response": resolver_res.dict(), "name_response": name_res.dict()}
|
|
162
150
|
)
|
|
151
|
+
except Exception as err:
|
|
152
|
+
return DataResult.exception(err, data={"resolver_response": resolver_res.dict(), "name_response": name_res.dict()})
|
|
163
153
|
|
|
164
154
|
|
|
165
155
|
def _hex_str_to_int(value: str) -> int:
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mm-eth
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.17
|
|
4
4
|
Requires-Python: >=3.12
|
|
5
5
|
Requires-Dist: aiohttp-socks~=0.10.1
|
|
6
|
-
Requires-Dist: mm-crypto-utils>=0.2.
|
|
7
|
-
Requires-Dist: mm-std~=0.3.29
|
|
6
|
+
Requires-Dist: mm-crypto-utils>=0.2.15
|
|
8
7
|
Requires-Dist: typer>=0.15.2
|
|
9
8
|
Requires-Dist: web3~=7.10.0
|
|
10
9
|
Requires-Dist: websocket-client~=1.8.0
|
|
@@ -11,7 +11,7 @@ mm_eth/ethernodes.py,sha256=V4VVbC6Nr9jhwT7blxtLugXC5KfXqE8n-kP0VvGHbqo,3070
|
|
|
11
11
|
mm_eth/json_encoder.py,sha256=S4oD-qfTVztMb4sRpY1puhBQwOBofTyQXWszmdXk4og,433
|
|
12
12
|
mm_eth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
mm_eth/rpc.py,sha256=k0eHxo_Dp6G0fHQ_rD-QbwOJz5ngC6kxBjl5NEHnyw8,13832
|
|
14
|
-
mm_eth/rpc_async.py,sha256=
|
|
14
|
+
mm_eth/rpc_async.py,sha256=PU19G9_tJSa4vfmaFUowjRCRy8dvfyJh9Lpkpe4FR4k,6462
|
|
15
15
|
mm_eth/solc.py,sha256=dYRvT8PjZlLDZhNsc_-0790Eug_ZwU2G-iBfIdGj6wQ,1071
|
|
16
16
|
mm_eth/tx.py,sha256=efSoMCoWkenbGdHo1_LX66_Edz1HvED5-J_i3wrHwMw,4051
|
|
17
17
|
mm_eth/utils.py,sha256=FytG3U6h80mnUaKP8W2mPZ77EuOp4U7pVbPuoKI3wW4,8215
|
|
@@ -43,7 +43,7 @@ mm_eth/cli/cmd/wallet/private_key_cmd.py,sha256=Fv_2OLog1h32pIP7PJITwl_pHdy3BXva
|
|
|
43
43
|
mm_eth/cli/examples/balances.toml,sha256=i_ALpiEcf8-0TFiUg1cgJhxxfHYeBl9x0b3tnUWjswU,421
|
|
44
44
|
mm_eth/cli/examples/call_contract.toml,sha256=ZQWK-409V_vLIZ2bsRD5RCWPPzShPz2KJTTRQY4YaGw,248
|
|
45
45
|
mm_eth/cli/examples/transfer.toml,sha256=8mWuphDquoSDJw-hb9VJqtonjmv3kJ5Ip8jJ4t5YnfM,1810
|
|
46
|
-
mm_eth-0.5.
|
|
47
|
-
mm_eth-0.5.
|
|
48
|
-
mm_eth-0.5.
|
|
49
|
-
mm_eth-0.5.
|
|
46
|
+
mm_eth-0.5.17.dist-info/METADATA,sha256=lWZylDIZ_1vZg3w6UCDqE7Dx-vvxRrJSPCnYUD9np2o,247
|
|
47
|
+
mm_eth-0.5.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
48
|
+
mm_eth-0.5.17.dist-info/entry_points.txt,sha256=aGhpsozl8NIrkuUcX5fSgURCcDhr3ShUdeTSIrJq4oc,46
|
|
49
|
+
mm_eth-0.5.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|