Skip to main content

Tools for Hdac wallet management and offline transaction signing

Project description

Build Status codecov

hdacpy

Tools for Hdac wallet management and offline transaction signing Forked from hukkinj1/cosmospy

Version 0.1.0

Tools for Hdac wallet management and offline transaction signing

Installing

Installing from PyPI repository (https://pypi.org/project/hdacpy):

pip install hdacpy

Usage

Prerequisite

Run node & rest-server in following step: (https://docs.hdac.io/installation/build) This library runs on RESTful API

Generating a wallet

from hdacpy.wallet import generate_wallet
wallet = generate_wallet()

The value assigned to wallet will be a dictionary just like:

{
    'private_key': '6dcd05d7ac71e09d3cf7da666709ebd59362486ff9e99db0e8bc663570515afa',
    'public_key': '03e8005aad74da5a053602f86e3151d4f3214937863a11299c960c28d3609c4775',
    'address': 'friday1r5v5srda7xfth3hn2s26txvrcrntldjuv7dedk'
}

Signing transactions

from hdacpy.transaction import Transaction
tx = Transaction(
        host="http://localhost:1317",
        privkey="26d167d549a4b2b66f766b0d3f2bdbe1cd92708818c338ff453abde316a2bd59",
        account_num=11335,
        sequence=0,
        gas_price=37000,
        chain_id="friday-devtest",
    )
tx.transfer(
        sender_address="friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
        recipient_address="friday1z47ev5u5ujmc7kwv49tut7raesg55tjyk2wvhd",
        amount=amount, gas_price=2000000
    )
res = tx.send_tx()

transfer() executes POST to organize tx, and send_tx() signs & broadcast the tx.

Contributing

  1. Fork/clone the repository.

  2. Install dependencies (you'll probably want to create a virtual environment, using your preferred method, first).

    pip install -r requirements.txt
    
  3. Install pre-commit hooks

    pre-commit install
    
  4. After making changes and having written tests, make sure tests pass:

    pytest
    
  5. Commit, push, and make a PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

hdacpy-0.1.0-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

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