MESC is the Multiple Endpoint Shared Configuration Standard
Project description
Python MESC Implementation
This is a reference implementation of the Python MESC Standard
It has no external dependencies.
Installation
From PyPI
pip install mesc
From Source
git clone https://github/paradigmxyz/mesc
cd mesc
pip install ./
Example Usage
from typing import Any, Mapping, Sequence
import mesc
# check whether mesc is enabled
enabled: bool = mesc.is_mesc_enabled()
# get the default endpoint
endpoint: Endpoint | None = mesc.get_default_endpoint()
# get the default endpoint of a network
endpoint: Endpoint | None = mesc.get_endpoint_by_network(5)
# get the default endpoint for a particular tool
endpoint: Endpoint | None = mesc.get_default_endpoint(profile='xyz_tool')
# get the default endpoint of a network for a particular tool
endpoint: Endpoint | None = mesc.get_endpoint_by_network(5, profile='xyz_tool')
# get an endpoint by name
endpoint: Endpoint | None = mesc.get_endpoint_by_name('local_goerli')
# parse a user-provided string into a matching endpoint
# (first try 1. endpoint name, then 2. chain id, then 3. network name)
endpoint: Endpoint | None = mesc.get_endpoint_by_query(user_str, profile='xyz_tool')
# find all endpoints matching given criteria
endpoints: Sequence[Endpoint] = mesc.find_endpoints(chain_id=5)
# get non-endpoint metadata
metadata: Mapping[str, Any] = mesc.get_global_metadata(profile='xyz_tool')
Reference
from typing import Any, MutableMapping, TypedDict, Literal, Sequence
class RpcConfig(TypedDict):
mesc_version: str
default_endpoint: str | None
endpoints: MutableMapping[str, Endpoint]
network_defaults: MutableMapping[str, str]
network_names: MutableMapping[str, str]
profiles: MutableMapping[str, Profile]
global_metadata: MutableMapping[str, Any]
class Endpoint(TypedDict):
name: str
url: str
chain_id: str | None
endpoint_metadata: MutableMapping[str, Any]
class Profile(TypedDict):
name: str
default_endpoint: str | None
network_defaults: MutableMapping[str, str]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mesc-0.2.0.tar.gz
(21.8 kB
view details)
Built Distribution
mesc-0.2.0-py3-none-any.whl
(21.8 kB
view details)
File details
Details for the file mesc-0.2.0.tar.gz
.
File metadata
- Download URL: mesc-0.2.0.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36fc3fb69d8690a220ced060ac49b14b85e16ed169e13f4551d9e96a61d554d |
|
MD5 | 03eeaabc0b588f6f17efe925affcee1d |
|
BLAKE2b-256 | 2f253d6f1c754ab3b37d9b79497c358b5d3767d7c8cf5583850fb92ccf5716ec |
File details
Details for the file mesc-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: mesc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0bf35a917b28d0d6704b596ced87391666c1590a5ba2e34cd1e6b5918e6877c |
|
MD5 | 0bee8adfe53365e7709f02178cffd6fb |
|
BLAKE2b-256 | 6898204e47c612bad215f2d3ed0eb5ffff4592a62b72abe537f6b9886d62bc31 |