Metadata-Version: 2.1
Name: mesc
Version: 0.1.4
Summary: MESC is the Multiple Endpoint Shared Configuration Standard
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Dist: typing-extensions >=4.9.0
Project-URL: Documentation, https://github.com/paradigmxyz/mesc
Project-URL: Source, https://github.com/paradigmxyz/mesc


# Python MESC Implementation

This is a reference implementation of the Python MESC Standard

It has no external dependencies.

- [Installation](#installation)
- [Example Usage](#example-usage)
- [Reference](#reference)

## Installation

### From PyPI
`pip install mesc`

### From Source
```
git clone https://github/paradigmxyz/mesc
cd mesc
pip install ./
```

## Example Usage

```python
import mesc

# get the default endpoint
endpoint = mesc.get_default_endpoint()

# get the default endpoint of a network
endpoint = mesc.get_endpoint_by_network(5)

# get the default endpoint for a particular tool
endpoint = mesc.get_default_endpoint(profile='xyz_tool')

# get the default endpoint of a network for a particular tool
endpoint = mesc.get_endpoint_by_network(5, profile='xyz_tool')

# get an endpoint by name
endpoint = 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 = mesc.get_endpoint_by_query(user_str, profile='xyz_tool')

# find all endpoints matching given criteria
endpoints = mesc.find_endpoints(chain_id=5)
```

## Reference

```python
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]
```

