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.7.tar.gz
(25.0 kB
view details)
Built Distribution
File details
Details for the file dapiclient-0.0.7.tar.gz
.
File metadata
- Download URL: dapiclient-0.0.7.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8212fdb992c47fb975ee939807201929df479ca414b8201806ec772389638d99 |
|
MD5 | 56cc3e2831d951c73f425e24860ec1e5 |
|
BLAKE2b-256 | 6ca28e413c8a4bda8bc9a43a32cdc39c97c93bfd07c924e1fbb8e523c353571e |
File details
Details for the file dapiclient-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: dapiclient-0.0.7-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc4616dfb112015f331b53fbbde155b7a2ba2546405873e1f5dc99be3adff13d |
|
MD5 | d54a1dbe7fdfa936a1c398dab454438d |
|
BLAKE2b-256 | a71de23daee147b8a1d68c610147b5b9ac8580bf5fa55063ad020b651e5cc46e |