Skip to main content

Substrate utility library providing functionality for multi-signature trading.

Project description

substrate-utils

Substrate utility library providing functionality for exchange management and multi-signature trading, originally built for LocalCoinSwap

Python package PyPI pyversions PyPI version shields.io

The focus of this library is on functionality needed to provide an exchange service, including:

  • Account generation
  • Balance checking
  • Making transfers
  • Creating N/M (2/3) escrow addresses
  • Non-custodial trades
  • Cancellation of trades
  • Administration of trade disputes
  • Verification of transactions
  • Diagnostics for common problems
  • Associated cryptography

For complete examples please review the documentation. If there's any exchange functionality you need which we haven't provided, feel free to raise an issue in Github.


Installation

pip install substrate-utils

Quick start

from substrateutils import Kusama, Polkadot, Kulupu
kusama = Kusama()
polkadot = Polkadot()
kulupu = Kulupu()

Documentation

https://localcoinswap.github.io/substrate-utils/

Local development

Pre-requisites

  • Python 3.8.1 (preferred)

We suggest using pyenv to easily manage python versions. Some of the following commands use pyenv. Use pyenv-installer for easy installation. Then add pyenv-virtualenv plugin to it.

Configure local development setup

  • Install and activate python 3.8.1 in the root directory

    • pyenv install 3.8.1
    • pyenv virtualenv 3.8.1 substrateutils
    • pyenv local substrateutils
  • Install project requirements

    • pip install -r requirements.txt
  • Install precommit hook

    • pre-commit install

You're all set to hack!

Before making changes, let's ensure tests run successfully on local.

Running Tests

  • Run all tests with coverage
    • coverage run -m pytest -v
  • Show report in terminal
    • coverage report -m

Notes

Trade storage calls for 2/3 trades cost:

Polkadot - 40.3040 DOT  
Kusama   - 6.71733331304 KSM  

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

substrate-utils-1.0.20.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

substrate_utils-1.0.20-py2.py3-none-any.whl (25.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file substrate-utils-1.0.20.tar.gz.

File metadata

  • Download URL: substrate-utils-1.0.20.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for substrate-utils-1.0.20.tar.gz
Algorithm Hash digest
SHA256 e62965332c2db2a7c431f4c80eec79fcbbfa2d0766e30ea5d879ac0d87124dba
MD5 f10f9a5c950f46aa233bebe39618d936
BLAKE2b-256 8a2fbf18e3c87ee45cf543452e7d3abbfed0a3e4cb139de831e09577cf7aa3f9

See more details on using hashes here.

File details

Details for the file substrate_utils-1.0.20-py2.py3-none-any.whl.

File metadata

  • Download URL: substrate_utils-1.0.20-py2.py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for substrate_utils-1.0.20-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 097caf99e484a0b04ca0a7b5e9f1db9085a297c9b86feff88f7809d5b8dafa90
MD5 12e0e0df85545148ef19fdf365055262
BLAKE2b-256 f86a2878ba84e6fc489c916bd39c31078c1b08f51265e22e76f6e2d9cd8dd2cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page