A python client SDK for DASH Platform
Project description
A very basic DAPI client. Only supports retrieving from some JSON-RPC and gRPC endpoints. No validation of anything. No submitting of data, tx creation, signing, etc.
Requirements
python3
python3-venv
Quickstart
git clone https://github.com/mayoreee/dapi-client-py.git
cd dapi-client-py
python3 -m venv dapiclient-venv
source dapiclient-venv/bin/activate
pip install -r requirements.txt
python install .
# Check masternode list
python dapiclient/test-mndiscovery.py
# Check DAPI client functionality
python dapiclient/test-dapiclient.py
Examples
Layer 1
from dapiclient.client import DAPIClient
client = DAPIClient()
current_block_hash = client.getBestBlockHash()
print(current_block_hash)
height = 0
genesis_block_hash = client.getBlockHash(height)
print(genesis_block_hash)
Layer 2
from dapiclient.client import DAPIClient
import cbor2
client = DAPIClient()
id = client.getIdentity('C7id2mah2RkiroiTy6h134hLgS6A47jhh5x91tvw16bz')
print(id)
# Retrieve DPNS contract
contract = client.getDataContract('ARQGUnPH3YMK8FZuqwUjnTWEF6Zu4Cf3sT6e1Ruu1RXk')
print(contract)
# Retrieve 5 domain names from DPNS
docs = client.getDocuments(
'ARQGUnPH3YMK8FZuqwUjnTWEF6Zu4Cf3sT6e1Ruu1RXk',
'note',
limit=1
)
print('{} documents retrieved'.format(len(docs)))
for doc in docs:
print('Document:\n\t{}\n'.format(cbor2.loads(doc)))
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
dapiclient-0.0.2.tar.gz
(25.1 kB
view hashes)
Built Distribution
dapiclient-0.0.2-py3-none-any.whl
(30.2 kB
view hashes)
Close
Hashes for dapiclient-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f68444216258158032686f9b84339abe1c0ca75424608e873457fca7592629be |
|
MD5 | a192a93296861ac81c80e6f1b2ac9a64 |
|
BLAKE2b-256 | 7ada4403e00742f576ab366cb1884a10d411c9a899eeb14c07960d7f3eaa1563 |