# mach-client-py
A (mostly) strongly typed Python client for the Mach exchange, including multichain abstractions for interacting with each network.
## Getting Started
Create a copy of the `template.config.yaml` file:
```bash
cp template.config.yaml config.yaml
```
Edit the config to add the credentials for the account you wish to run the example with:
```yaml
mach_client:
secrets:
ethereum: "YOUR PRIVATE KEY"
# ...
```
Then look at the notebook in the `examples/` directory.
## Adding a Chain
**Case 1:** The chain is an L2/testnet of a chain that's already supported
The code is roughly broken up into different networks, so adding an L2 or testnet of a network that is already supported just means updating the `chains/constants.py` file:
- [ ] Add the chain to the `SupportedChain` enum
- [ ] Add the chain's name (ie. what you want to be displayed by `str()`) to `CHAIN_NAMES`
- [ ] Add the chain's LayerZero EID to `LAYERZERO_IDS`. Refer to the [deployments](https://github.com/tristeroresearch/cache-half-full/blob/tron-test/config/deployments.json) file. Note that at the time of writing, only Tron uses LayerZero V2, and all other chains use V1.
- [ ] Add the name the chain is referred to with in the Mach backend to the `MACH_NAME_TO_CHAIN` dict. Refer to the [deployments](https://github.com/tristeroresearch/cache-half-full/blob/tron-test/config/deployments.json) file.
- [ ] Add the chain's scanner to `scanners/`. If the scanner is [EIP-3091](https://eips.ethereum.org/EIPS/eip-3091) compliant, just add the chain and the base URL of its scanner to the `chains/eip3091.py:SCANNER_URLS` dict.
- [ ] Add an entry in `template.config.yaml` for the endpoint URI of the chain
- [ ] Add tests
**Case 2:** The chain is on a brand new network
- [ ] Subclass `Chain` under `chain/` to represent the new chain. Then update the `Chain.from_id()` factory method.
- [ ] Do all the steps from Case 1
- [ ] Subclass the `AccountID` and `Account` classes under `account/` to create a proxy for the chain's public and private keys. Then update the factory functions in `account/__init__.py`.
- [ ] Subclass the `ChainClient` class to create a proxy for the client/connection to the chain. Then update the `_create` factory function in `chain_client/__init__.py`.
- [ ] Subclass the `Transaction` and `SentTransaction` classes under `transaction/` to create a proxy for the chain's transactions and sent/broadcasted transactions.
- [ ] Subclass the `Token` or `ApprovableToken` classes undero `asset/` to create a proxy for the chain's fungible token standard. Then update the `register_token` function in `asset/__init__.py`.
- [ ] Update the `client/order_book.py:create_place_order_transaction` function
Raw data
{
"_id": null,
"home_page": null,
"name": "mach-client",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13.0",
"maintainer_email": null,
"keywords": "crypto, cryptocurrencies, cryptocurrency, defi, exchange, liquidity, mach, pool, swap, tristero",
"author": null,
"author_email": "Richard Dong <richard@tristero.xyz>",
"download_url": "https://files.pythonhosted.org/packages/5c/fd/2e92eefffaa0fc852180c2cbdc9cfafde5ff2a1b4fefa8bd3533f0c24c3c/mach_client-0.1.8.tar.gz",
"platform": null,
"description": "# mach-client-py\n\nA (mostly) strongly typed Python client for the Mach exchange, including multichain abstractions for interacting with each network.\n\n## Getting Started\n\nCreate a copy of the `template.config.yaml` file:\n\n```bash\ncp template.config.yaml config.yaml\n```\n\nEdit the config to add the credentials for the account you wish to run the example with:\n\n```yaml\nmach_client:\n secrets:\n ethereum: \"YOUR PRIVATE KEY\"\n# ...\n```\n\nThen look at the notebook in the `examples/` directory.\n\n## Adding a Chain\n\n**Case 1:** The chain is an L2/testnet of a chain that's already supported\n\nThe code is roughly broken up into different networks, so adding an L2 or testnet of a network that is already supported just means updating the `chains/constants.py` file:\n\n- [ ] Add the chain to the `SupportedChain` enum\n- [ ] Add the chain's name (ie. what you want to be displayed by `str()`) to `CHAIN_NAMES`\n- [ ] Add the chain's LayerZero EID to `LAYERZERO_IDS`. Refer to the [deployments](https://github.com/tristeroresearch/cache-half-full/blob/tron-test/config/deployments.json) file. Note that at the time of writing, only Tron uses LayerZero V2, and all other chains use V1.\n- [ ] Add the name the chain is referred to with in the Mach backend to the `MACH_NAME_TO_CHAIN` dict. Refer to the [deployments](https://github.com/tristeroresearch/cache-half-full/blob/tron-test/config/deployments.json) file.\n- [ ] Add the chain's scanner to `scanners/`. If the scanner is [EIP-3091](https://eips.ethereum.org/EIPS/eip-3091) compliant, just add the chain and the base URL of its scanner to the `chains/eip3091.py:SCANNER_URLS` dict.\n- [ ] Add an entry in `template.config.yaml` for the endpoint URI of the chain\n- [ ] Add tests\n\n**Case 2:** The chain is on a brand new network\n\n- [ ] Subclass `Chain` under `chain/` to represent the new chain. Then update the `Chain.from_id()` factory method.\n- [ ] Do all the steps from Case 1\n- [ ] Subclass the `AccountID` and `Account` classes under `account/` to create a proxy for the chain's public and private keys. Then update the factory functions in `account/__init__.py`.\n- [ ] Subclass the `ChainClient` class to create a proxy for the client/connection to the chain. Then update the `_create` factory function in `chain_client/__init__.py`.\n- [ ] Subclass the `Transaction` and `SentTransaction` classes under `transaction/` to create a proxy for the chain's transactions and sent/broadcasted transactions.\n- [ ] Subclass the `Token` or `ApprovableToken` classes undero `asset/` to create a proxy for the chain's fungible token standard. Then update the `register_token` function in `asset/__init__.py`.\n- [ ] Update the `client/order_book.py:create_place_order_transaction` function\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python client for the Mach exchange.",
"version": "0.1.8",
"project_urls": {
"Homepage": "https://github.com/tristeroresearch/mach-client-py",
"Issues": "https://github.com/tristeroresearch/mach-client-py/issues"
},
"split_keywords": [
"crypto",
" cryptocurrencies",
" cryptocurrency",
" defi",
" exchange",
" liquidity",
" mach",
" pool",
" swap",
" tristero"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "63094133a4b006fc3c1f900a3bba80c0cfedabd4192a07803836fb0fb57036f5",
"md5": "d67c2a4e53839ed18170abbd3cd9fced",
"sha256": "15671cc2e0539b1cb2962f7207cd98dbb2d963e96ac4af2f51525d822a82e526"
},
"downloads": -1,
"filename": "mach_client-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d67c2a4e53839ed18170abbd3cd9fced",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13.0",
"size": 54677,
"upload_time": "2024-12-10T20:42:14",
"upload_time_iso_8601": "2024-12-10T20:42:14.317239Z",
"url": "https://files.pythonhosted.org/packages/63/09/4133a4b006fc3c1f900a3bba80c0cfedabd4192a07803836fb0fb57036f5/mach_client-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5cfd2e92eefffaa0fc852180c2cbdc9cfafde5ff2a1b4fefa8bd3533f0c24c3c",
"md5": "117871140371adb7828bed303824ffd7",
"sha256": "92094169df96d1ffae855a8cb6f13dc6a78293cc607f474f786f3cbb7d913207"
},
"downloads": -1,
"filename": "mach_client-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "117871140371adb7828bed303824ffd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13.0",
"size": 35421,
"upload_time": "2024-12-10T20:42:16",
"upload_time_iso_8601": "2024-12-10T20:42:16.417573Z",
"url": "https://files.pythonhosted.org/packages/5c/fd/2e92eefffaa0fc852180c2cbdc9cfafde5ff2a1b4fefa8bd3533f0c24c3c/mach_client-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 20:42:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tristeroresearch",
"github_project": "mach-client-py",
"github_not_found": true,
"lcname": "mach-client"
}