Giter Club home page Giter Club logo

hdacpy's Introduction

Build Status codecov

hdacpy

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

Version 0.3.2

Tools for Hdac wallet management and offline transaction signing

Version matching

Hdac hdacpy
<= 0.4.0 0.3.2

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': '367360433d797cabd35361abdb3f6d0b94d27d7222d3af22a49028b7f4beb85d',
    'public_key': '0320a9b30c5fbbba3ffc34a1732c69365bc2a7de143f970318f8f1a2a38018dc6a',
    'address': 'friday1jg8n39n2m93aavjnxl7snnvt4q6n50g9alxgkl',
    'mnemonic': 'often day image remove film awful art satisfy stable honey provide cactus example flock vacuum adult cool install erase able pencil cancel retreat win'}

Signing transactions

from hdacpy.transaction import Transaction
tx = Transaction(
        host="http://localhost:1317",
        privkey="26d167d549a4b2b66f766b0d3f2bdbe1cd92708818c338ff453abde316a2bd59",
        chain_id="friday-devtest",
    )
tx.transfer(
        token_contract_address="friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
        sender_address="friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
        recipient_address="friday1z47ev5u5ujmc7kwv49tut7raesg55tjyk2wvhd",
        amount=amount, gas_price=2000000, fee=10000
    )
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.

hdacpy's People

Contributors

hukkinj1 avatar psy2848048 avatar joowonyun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.