Python
Python installation
Python can be downloaded here.
For further informations on how to install Python on your operating system :
Installation
$ pip install qredit-client
Development setup
If you want to contribute to the code of this package execute the following commands
- Fork the package
- Clone your forked repository
$ git clone https://github.com/<githubusername>/python-client
- Next, move into the fresh cloned directory
$ cd python-client
- The next step would be to create something like a virtual environment and install the dependencies of this package inside it
- Once the previous point done, you can proceed to install the dependencies, these are listed inside the setup.py file
$ pip install requests backoff flake8 flake8-import-order flake8-print flake8-quotes pytest pytest-responses pytest-mock pytest-cov
- Dependencies are now installed, you can now run the tests to see if everything is running like it should
$ pytest
...
Usage
Initialization
from client import QreditClient
client = QreditClient('http://127.0.0.1:4003/api')
API v2.0 Endpoints
Blocks
List all blocks
print(client.blocks.all(page=5, limit=10))
>> {'meta': {'count': 10, ... }}
Retrieve a block
print(client.blocks.get(block_id='1102328654748179318'))
>> {'data': {'id': '11023286547481793189' ... }}
List all transactions of a block
print(client.blocks.transactions(block_id='1596548201794970158', limit=10))
>> {'meta': {'count': 4, ... }}
Search all blocks
print(client.blocks.search({'generatorPublicKey': '0232b96d57ac27f9a99242bc886e433baa89f596d435153c9dae47222c0d1cecc3'}))
>> {'meta': {'count': 100, ... }}
Delegates
List all delegates
print(client.delegates.all(page=5, limit=20))
>> {'meta': {'count': 20, ... }}
Retrieve a delegate
print(client.delegates.get(delegate_id="goose"))
>> {'data': {'username': 'goose', ... }}
Search delegates
print(client.delegates.search(username='goose'))
>> {'meta': {'count': 1, ... }}
List all blocks of a delegate
print(client.delegates.blocks(delegate_id="goose"))
>> {'meta': {'count': 100, ... }}
List all voters of a delegate
print(client.delegates.voters(delegate_id="goose"))
>> {'meta': {'count': 100, ... }}
List voter balances for a delegate
print(client.delegates.voter_balances(delegate_id="goose"))
>> {'data': {'AZpoKsoqHAMWBNqeEf3WNfRCenxLR51pBt': 998386, ... }}
Node
Retrieve the configuration
print(client.node.configuration())
>> {'data': {'nethash': '6e84d08bd299ed97c212c886c98a57e36545c8f5d645ca7eeae63a8bd62d8988', ... }}
Retrieve the status
print(client.node.status())
>> {'data': {'synced': True, 'now': 6897158, 'blocksCount': -1}}
Retrieve the syncing status
print(client.node.syncing())
>> {'data': {'syncing': False, 'blocks': -1, 'height': 6897160, 'id': '12905037940821862953'}}
Peers
List all peers
print(client.peers.all())
>> {'meta': {'count': 100, ...}}
Retrieve a peer
print(client.peers.get(ip='51.255.105.52'))
>> {'data': {'ip': '51.255.105.52', ...}}
Transactions
Create a transaction
print(client.transactions.create([signed_transaction]))
>> {'data': {'accept': ['0bdb41e8fb98a27db2d24ffc33f775e856f9fc9b2e50cabceecb1072eb469cef', ...}}
Retrieve a transaction
print(client.transactions.get(transaction_id='e5f5de5716bffb2fa924d26fcfebaff58c8bfd50d8eac1487b0e981113b482fc'))
>> {'data': {'id': 'e5f5de5716bffb2fa924d26fcfebaff58c8bfd50d8eac1487b0e981113b482fc', ...}}
List all transactions
print(client.transactions.all(limit=5))
>>{'meta': {'count': 5, ...}}
List all unconfirmed transactions
print(client.transactions.all_unconfirmed(limit=5))
>> {'meta': {'count': 5, ...}}
Get unconfirmed transaction
print(client.transactions.get_unconfirmed(transaction_id='18bd569d26047a3379f04dfa6df16fc72387ed7a20a477dd681d980cd794add2'))
>> {'data': {'id': '18bd569d26047a3379f04dfa6df16fc72387ed7a20a477dd681d980cd794add2' ...}}
Search transactions
print(client.transactions.search({'senderId':'AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'},limit=5))
>> {'meta': {'count': 3, ...}}
List transaction types
print(client.transactions.types())
>> {'data': {'TRANSFER': 0, ...}}
List transaction fees (Non-dynamic)
print(client.transactions.fees())
>> {'data': {'transfer': 10000000, ...}}
Votes
List all votes
print(client.votes.all(limit=5))
>> {'meta': {'count': 5, ...}}
Retrieve a vote
print(client.votes.get(vote_id='49a6bdffef623e83087a6fff3f4e7dd6929a6df9abf9f7d0b08a36fcba9512f7'))
>> {'data': {'id': '49a6bdffef623e83087a6fff3f4e7dd6929a6df9abf9f7d0b08a36fcba9512f7', ...}}
Wallets
Retrieve all wallets
print(client.wallets.all(limit=10))
>> {'meta': {'count': 10, ...}}
Retrieve a wallet
print(client.wallets.get(wallet_id='AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'))
>> {'data': {'address': 'AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN', ...}}
List all transactions of a wallet
print(client.wallets.transactions(wallet_id='AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'))
>> {'meta': {'count': 100, ...}}
List all received transactions of a wallet
print(client.wallets.transactions_received(wallet_id='AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'))
>> {'meta': {'count': 100, ...}}
List all sent transactions of a wallet
print(client.wallets.transactions_sent(wallet_id='AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'))
>> {'meta': {'count': 3, ...}}
List all votes of a wallet
print(client.wallets.votes(wallet_id='AQEA7wbPq9obWr2yEXRksanArn6Jyz4UPN'))
>> {'meta': {'count': 3, ...}}
List all top wallets
print(client.wallets.top(limit=10))
>> {'meta': {'count': 10, ...}}
Search all wallets
print(client.wallets.search({'publicKey':'03a3cd9d5095147d7820b39fd697bd6c6831b1d474125e97d38f2f131eede5fa19'},limit=5))
>> {'meta': {'count': 1, ...}}