Metadata-Version: 2.1
Name: htdfsdk
Version: 0.0.16
Summary: htdf sdk
Home-page: https://github.com/youngqqcn/htdfsdk
Author: youngqqcn
Author-email: youngqqcn@163.com
License: UNKNOWN
Keywords: htdf sdk
Platform: UNKNOWN
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Code Generators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: ecdsa
Requires-Dist: coincurve
Requires-Dist: bech32
Requires-Dist: requests
Requires-Dist: eth-abi (<3.0.0,>=2.0.0b6)
Requires-Dist: eth-account (<0.6.0,>=0.5.3)
Requires-Dist: eth-hash[pycryptodome] (<1.0.0,>=0.2.0)
Requires-Dist: eth-typing (<3.0.0,>=2.0.0)
Requires-Dist: eth-utils (<2.0.0,>=1.9.5)
Requires-Dist: hexbytes (<1.0.0,>=0.1.0)
Requires-Dist: ipfshttpclient (==0.7.0a1)
Requires-Dist: jsonschema (<4.0.0,>=3.2.0)
Requires-Dist: lru-dict (<2.0.0,>=1.1.6)
Requires-Dist: protobuf (<4,>=3.10.0)
Requires-Dist: requests (<3.0.0,>=2.16.0)
Requires-Dist: websockets (<9.0.0,>=8.1.0)
Requires-Dist: pypiwin32 (>=223) ; platform_system == "Windows"
Requires-Dist: typing-extensions (<4,>=3.7.4.1) ; python_version < "3.8"

# HTDF sdk

the sdk of HTDF

require python >= 3.6

# Install

```
pip install htdfsdk
```


# Example

## create address

```python
from htdfsdk import Address, HtdfPrivateKey
privkey = HtdfPrivateKey('')
print(privkey.private_key)
print(privkey.address)
# privkey2 = HtdfPrivateKey(privkey.private_key)
# pk3 = HtdfPrivateKey('279bdcd8dccec91f9e079894da33d6888c0f9ef466c0b200921a1bf1ea7d86e8')
# addr3 = Address('htdf1xwpsq6yqx0zy6grygy7s395e2646wggufqndml')

```




## normal htdf transaction

```python

from pprint import pprint
from htdfsdk import HtdfRPC, HtdfTxBuilder, htdf_to_satoshi, Address, HtdfPrivateKey

htdfrpc = HtdfRPC(chaid_id='testchain', rpc_host='192.168.0.171', rpc_port=1317)

from_addr = Address('htdf1xwpsq6yqx0zy6grygy7s395e2646wggufqndml')
to_addr = Address('htdf1jrh6kxrcr0fd8gfgdwna8yyr9tkt99ggmz9ja2')
private_key = HtdfPrivateKey('279bdcd8dccec91f9e079894da33d6888c0f9ef466c0b200921a1bf1ea7d86e8')
from_acc = htdfrpc.get_account_info(address=from_addr.address)
signed_tx = HtdfTxBuilder(
    from_address=from_addr,
    to_address=to_addr,
    amount_satoshi=htdf_to_satoshi(20.1215),
    sequence=from_acc.sequence,
    account_number=from_acc.account_number,
    chain_id=htdfrpc.chain_id,
    gas_price=100,
    gas_wanted=30000,
    data='',
    memo='htdfsdk test'
).build_and_sign(private_key=private_key)

tx_hash = htdfrpc.broadcast_tx(tx_hex=signed_tx)
print('tx_hash: {}'.format(tx_hash))

mempool =  htdfrpc.get_mempool_trasactions()

memtx = htdfrpc.get_mempool_transaction(transaction_hash=tx_hash)

tx = htdfrpc.get_tranaction_until_timeout(transaction_hash=tx_hash)
pprint(tx)

tx = htdfrpc.get_transaction(transaction_hash=tx_hash)
pprint(tx)

```


