Python library to create and submit Ethereum transactions to custodians connected with MetaMask Institutional; the most trusted DeFi wallet and Web3 gateway for organizations.
Project description
MMI Custodian SDK (Beta)
Python library to create and submit Ethereum transactions to custodians connected with MetaMask Institutional; the most trusted DeFi wallet and Web3 gateway for organizations.
BETA DISCLAIMER. By using this library, you acknowledge the technology is still in Beta access and for internal testing purposes only. You are responsible for your use of the Beta access to Open Source SDK and ConsenSys is not responsible for any bugs, deficiencies or issues that may occur.
Contents
Usage
Use this SDK to programmatically create Ethereum transactions, and submit them to custodians connected with MetaMask Institutional. Automate trading strategies on your wallets under custody, and still benefit from the institutional-grade security of your favorite qualified custodian and custody provider.
Getting started
$ pip install mmisdk
>>> from mmisdk import CustodianFactory
>>> factory = CustodianFactory()
>>> custodian = factory.create_for("qredo", "YOUR-TOKEN")
>>> transaction = custodian.create_transaction(qredo_tx_details, tx_params)
>>> custodian.get_transaction(transaction.id)
For a complete documentation on how to use the library, visit the page MetaMask Institutional SDK, or check the GitLab repository.
Supported custodians
Custodian | Supported | As of version | Factory name param |
---|---|---|---|
Bitgo | ✅ | 0.3.0 |
"bitgo" |
Bitgo Test | ✅ | 0.3.0 |
"bitgo-test" |
Cactus | ✅ | 0.2.0 |
"cactus" |
Cactus Dev | ✅ | 0.2.0 |
"cactus-dev" |
Gnosis Safe | ✅ | 0.4.0 |
"gnosis-safe" |
Gnosis Safe Dev | ✅ | 0.4.0 |
"gnosis-safe-dev" |
Qredo | ✅ | 0.2.0 |
"qredo" |
Qredo Dev | ✅ | 0.1.0 |
"qredo-dev" |
Saturn | ✅ | 0.4.0 |
"saturn" |
Saturn Dev | ✅ | 0.4.0 |
"saturn-dev" |
All others | ❌ |
Running the examples
You can also explore various usage examples in the directory ./examples
.
To run them, first export your custodian's token in the expected environment variable, then run the example file. For instance:
$ export MMISDK_TOKEN_BITGO_TEST=xxxx
$ python examples/getting_a_transaction_bitgo.py
Note: Each example file expects to find to token under a specific environment variable name, that depends on the custodian and the environment (dev/test/prod) you're addressing. Read each example's code to figure out the right variable.
Developer documentation
The commands we list below use python
and pip
. Depending on your local setup, you might need to replace them by python3
and pip3
.
Requirements
- Python 3.7 or above
Installing dependencies
To install mmisdk
, along with the tools you need to develop and run tests, run the following:
$ pip install -e .[dev]
Unit tests
Run all unit tests with your default Python version:
$ pytest src
# or
$ python3.8 -m pytest src # Testing against a specific Python version
End to end tests
A good way to test the library is also to run the various examples scripts.
Copy the file .env.sample
to .env
, then replace the values whith your tokens
$ cp .env.sample .env
Then run all examples at once like so:
$ python e2e/run_examples.py
Releasing automatically
To release a new version, follow these steps:
-
Make sur you're on branch
main
-
This template provides a basic bumpversion configuration. To bump the version, run:
bumpversion patch
to increase version from1.0.0
to1.0.1
.bumpversion minor
to increase version from1.0.0
to1.1.0
.bumpversion major
to increase version from1.0.0
to2.0.0
.
Use Semantic Versioning 2.0.0 standard to bump versions.
-
Push the changes and the tags:
git push --tags
Releasing manually
Building
Before building dists make sure you got a clean build area:
rm -rf build
rm -rf src/*.egg-info
Note:
Dirty
build
oregg-info
dirs can cause problems: missing or stale files in the resulting dist or strange and confusing errors. Avoid having them around.
Then you should check that you got no packaging issues:
tox -e check
When checking with tox -e check
, you might receive warnings from isort
that imports are not properly ordered. To automatically sort your imports with isort
, run the following:
pip install isort
isort .
To run a complete QA analysis, including unit tests again multiple Python versions, manifest check, and imports order check, run:
tox
And then you can build the sdist
, and if possible, the bdist_wheel
too:
python setup.py clean --all sdist bdist_wheel
Publishing to PyPI
To make a release of the project on PyPI, assuming you got some distributions in dist/
, the most simple usage is:
twine upload --skip-existing dist/*.whl dist/*.gz dist/*.zip
In ZSH you can use this to upload everything in dist/
that ain't a linux-specific wheel (you may need setopt extended_glob
):
twine upload --skip-existing dist/*.(whl|gz|zip)~dist/*linux*.whl
Contributing
See CONTRIBUTING.rst.
Changelog
See CHANGELOG.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mmisdk-0.4.0.tar.gz
.
File metadata
- Download URL: mmisdk-0.4.0.tar.gz
- Upload date:
- Size: 232.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a51bac5fc916518df90e4209ce27e3889c003e2028f838a48c57278d43dfa08 |
|
MD5 | 0266265a2d417a6ce074ceb04c2ab132 |
|
BLAKE2b-256 | 2489c0037818a0424769647e9a62f34f7da294b5a086099188e07178e754d692 |
File details
Details for the file mmisdk-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: mmisdk-0.4.0-py3-none-any.whl
- Upload date:
- Size: 58.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9fcd3c5b2657d15e0fc45516e063d510530289542d6c26e6f6f5d30a3c6c784 |
|
MD5 | b51bd9d41f9bbdff58938073d7633759 |
|
BLAKE2b-256 | 6bfe89e6f7a71915d3c144adab11d802f53ed4ba12f315faf77d4f19ba9c9723 |