Skip to content

Commit 326f61e

Browse files
committed
Update README
1 parent b77555c commit 326f61e

File tree

1 file changed

+61
-27
lines changed

1 file changed

+61
-27
lines changed

README.md

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,60 @@
33
![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
44
[![Documentation Status](https://readthedocs.org/projects/viz-python-lib/badge/?version=latest)](https://viz-python-lib.readthedocs.io/en/latest/?badge=latest)
55

6-
**This library is in alpha state, API unstable**
6+
## Usage examples
77

8-
Built on top of [python-graphenelib](https://github.com/xeroc/python-graphenelib/)
8+
Read dynamic global properties:
99

10-
## Dependencies
10+
```python
11+
from viz import Client
12+
from pprint import pprint
1113

12-
#### Linux dependencies
14+
viz = Client(node='https://api.viz.world/')
15+
pprint(viz.info())
16+
```
1317

14-
```sh
15-
sudo apt-get install libffi-dev libssl-dev python-dev
18+
Award someone:
19+
20+
```python
21+
from viz import Client
22+
23+
node = "https://node.viz.cx/"
24+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
25+
initiator = "your_account"
26+
percent = 10.5
27+
viz.award("id", percent, "with love", None, initiator)
1628
```
1729

18-
#### Windows dependencies
30+
Award someone with fixed reward:
1931

20-
Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
32+
```python
33+
from viz import Client
2134

22-
#### MacOS dependencies
35+
node = "wss://node.viz.cx/ws"
36+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
37+
initiator = "your_account"
38+
reward_amount = 3.5 # "3.50 VIZ"
39+
max_energy = 30 # 30%
40+
viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)
41+
```
2342

24-
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
43+
Send a custom operation:
2544

26-
```sh
27-
brew install openssl
45+
```python
46+
from viz import Client
47+
48+
node = "wss://node.viz.cx/ws"
49+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
50+
account = "your_account"
51+
protocol = "color.place"
52+
json = {"x":35, "y":70, "color":"#e50000"}
53+
viz.custom(protocol, json, None, [account])
2854
```
2955

30-
and then use the following commands:
56+
Any direct RPC call:
3157

32-
```sh
33-
export CFLAGS="-I$(brew --prefix openssl)/include"
34-
export LDFLAGS="-L$(brew --prefix openssl)/lib"
58+
```python
59+
viz.rpc.some_rpc_method()
3560
```
3661

3762
## Installation
@@ -51,22 +76,31 @@ cd viz-python-lib/
5176
poetry install
5277
```
5378

54-
## Usage
79+
## Development
5580

56-
Basic read query example:
81+
### Dependencies
5782

58-
```python
59-
from viz import Client
60-
from pprint import pprint
83+
#### Linux dependencies
6184

62-
node = 'https://api.viz.world/'
85+
```sh
86+
sudo apt-get install libffi-dev libssl-dev python-dev
87+
```
6388

64-
viz = Client(node=node)
65-
pprint(viz.info())
89+
#### Windows dependencies
90+
91+
Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
92+
93+
#### MacOS dependencies
94+
95+
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
96+
97+
```sh
98+
brew install openssl
6699
```
67100

68-
Direct RPC calls:
101+
and then use the following commands:
69102

70-
```python
71-
viz.rpc.some_rpc_method()
103+
```sh
104+
export CFLAGS="-I$(brew --prefix openssl)/include"
105+
export LDFLAGS="-L$(brew --prefix openssl)/lib"
72106
```

0 commit comments

Comments
 (0)