viz-python-lib 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/PKG-INFO +42 -20
  2. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/README.md +39 -15
  3. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/pyproject.toml +10 -12
  4. viz_python_lib-1.2.0/viz/__init__.py +3 -0
  5. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/account.py +8 -7
  6. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/blockchain.py +6 -6
  7. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/utils.py +5 -3
  8. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/viz.py +35 -37
  9. viz_python_lib-1.1.0/viz/__init__.py +0 -12
  10. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/LICENSE.txt +0 -0
  11. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/amount.py +0 -0
  12. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/block.py +0 -0
  13. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/blockchainobject.py +0 -0
  14. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/converter.py +0 -0
  15. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/exceptions.py +0 -0
  16. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/instance.py +0 -0
  17. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/memo.py +0 -0
  18. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/storage.py +0 -0
  19. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/transactionbuilder.py +0 -0
  20. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/wallet.py +0 -0
  21. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/viz/witness.py +0 -0
  22. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizapi/__init__.py +0 -0
  23. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizapi/consts.py +0 -0
  24. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizapi/exceptions.py +0 -0
  25. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizapi/noderpc.py +0 -0
  26. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/__init__.py +0 -0
  27. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/account.py +0 -0
  28. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/chains.py +0 -0
  29. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/exceptions.py +0 -0
  30. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/memo.py +0 -0
  31. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/objects.py +0 -0
  32. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/operationids.py +0 -0
  33. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/operations.py +0 -0
  34. {viz_python_lib-1.1.0 → viz_python_lib-1.2.0}/vizbase/signedtransactions.py +0 -0
@@ -1,20 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viz-python-lib
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Python library for VIZ blockchain
5
5
  License: MIT
6
6
  License-File: LICENSE.txt
7
7
  Keywords: viz,python,library,blockchain
8
8
  Author: Vladimir Kamarzin
9
9
  Author-email: vvk@vvk.pp.ru
10
- Requires-Python: >=3.8,<4.0
11
- Classifier: Development Status :: 3 - Alpha
10
+ Requires-Python: >=3.10,<4.0
11
+ Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.8
17
- Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
19
17
  Classifier: Programming Language :: Python :: 3.11
20
18
  Classifier: Programming Language :: Python :: 3.12
@@ -32,11 +30,11 @@ Description-Content-Type: text/markdown
32
30
  # Python Library for [VIZ](https://github.com/VIZ-Blockchain)
33
31
 
34
32
  ![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
35
- [![Documentation Status](https://readthedocs.org/projects/viz-python-lib/badge/?version=latest)](https://viz-python-lib.readthedocs.io/en/latest/?badge=latest)
33
+ [![Documentation Status](https://readthedocs.org/projects/viz-python/badge/?version=latest)](https://viz-python.readthedocs.io/en/latest/?badge=latest)
36
34
 
37
35
  ## Usage examples
38
36
 
39
- Award someone:
37
+ ### Award someone
40
38
 
41
39
  ```python
42
40
  from viz import Client
@@ -45,11 +43,12 @@ node = "wss://node.viz.cx/ws"
45
43
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
46
44
 
47
45
  initiator = "your_account"
48
- percent = 10.5
49
- viz.award("id", percent, "with love", None, initiator)
46
+ receiver = "id"
47
+ percent = 10.5 # 10.5%
48
+ viz.award(receiver, percent, "with love", None, initiator)
50
49
  ```
51
50
 
52
- Award someone with fixed reward:
51
+ ### Award someone with fixed reward
53
52
 
54
53
  ```python
55
54
  from viz import Client
@@ -58,12 +57,13 @@ node = "wss://node.viz.cx/ws"
58
57
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
59
58
 
60
59
  initiator = "your_account"
60
+ receiver = "id"
61
61
  reward_amount = 3.5 # "3.50 VIZ"
62
62
  max_energy = 30 # 30%
63
- viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)
63
+ viz.fixed_award(receiver, reward_amount, max_energy, "with fixed reward", None, initiator)
64
64
  ```
65
65
 
66
- Send a custom operation:
66
+ ### Send a custom operation
67
67
 
68
68
  ```python
69
69
  from viz import Client
@@ -72,35 +72,57 @@ node = "wss://node.viz.cx/ws"
72
72
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
73
73
 
74
74
  account = "your_account"
75
+ required_regular_auths = [account]
75
76
  protocol = "color.place"
76
- json = {"x":35, "y":70, "color":"#e50000"}
77
- viz.custom(protocol, json, None, [account])
77
+ custom_json = {"x": 35, "y": 70, "color": "#e50000"}
78
+ viz.custom(protocol, custom_json, None, required_regular_auths)
78
79
  ```
79
80
 
80
- Get account with custom protocol latest block:
81
+ ### Get data from custom protocol
81
82
 
82
83
  ```python
83
84
  from viz import Client
84
85
  from viz.account import Account
85
86
  from viz.block import Block
86
87
  from viz.instance import set_shared_blockchain_instance
88
+ import json
87
89
 
88
- viz = Client('wss://node.viz.cx/ws')
90
+ viz = Client("wss://node.viz.cx/ws")
89
91
  set_shared_blockchain_instance(viz)
90
92
 
93
+ account_name = "id"
91
94
  protocol = "V"
92
- account = Account('id', viz, protocol)
95
+ account = Account(account_name, protocol=protocol)
96
+
93
97
  counter_inside_protocol = account["custom_sequence"]
94
98
  last_used_in_block = account["custom_sequence_block_num"]
99
+
95
100
  block = Block(last_used_in_block)
101
+
102
+ for tx in block["transactions"]:
103
+ for op_type, op_data in tx["operations"]:
104
+ if op_type != "custom":
105
+ continue
106
+ if op_data.get("id") != protocol:
107
+ continue
108
+ if account_name not in op_data.get("required_regular_auths", []):
109
+ continue
110
+
111
+ raw_json = op_data.get("json")
112
+ try:
113
+ json_from_protocol = json.loads(raw_json) if raw_json else None
114
+ except json.JSONDecodeError:
115
+ json_from_protocol = None
116
+
117
+ print(json_from_protocol)
96
118
  ```
97
119
 
98
- Any direct RPC call:
120
+ ### Any direct RPC call
99
121
 
100
122
  ```python
101
123
  from viz import Client
102
124
 
103
- viz = Client('wss://node.viz.cx/ws')
125
+ viz = Client("wss://node.viz.cx/ws")
104
126
  viz.rpc.get_dynamic_global_properties()
105
127
  ```
106
128
 
@@ -128,7 +150,7 @@ poetry install
128
150
  #### Linux dependencies
129
151
 
130
152
  ```sh
131
- sudo apt-get install libffi-dev libssl-dev python-dev
153
+ sudo apt-get install libffi-dev libssl-dev python3-dev
132
154
  ```
133
155
 
134
156
  #### Windows dependencies
@@ -1,11 +1,11 @@
1
1
  # Python Library for [VIZ](https://github.com/VIZ-Blockchain)
2
2
 
3
3
  ![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
4
- [![Documentation Status](https://readthedocs.org/projects/viz-python-lib/badge/?version=latest)](https://viz-python-lib.readthedocs.io/en/latest/?badge=latest)
4
+ [![Documentation Status](https://readthedocs.org/projects/viz-python/badge/?version=latest)](https://viz-python.readthedocs.io/en/latest/?badge=latest)
5
5
 
6
6
  ## Usage examples
7
7
 
8
- Award someone:
8
+ ### Award someone
9
9
 
10
10
  ```python
11
11
  from viz import Client
@@ -14,11 +14,12 @@ node = "wss://node.viz.cx/ws"
14
14
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
15
15
 
16
16
  initiator = "your_account"
17
- percent = 10.5
18
- viz.award("id", percent, "with love", None, initiator)
17
+ receiver = "id"
18
+ percent = 10.5 # 10.5%
19
+ viz.award(receiver, percent, "with love", None, initiator)
19
20
  ```
20
21
 
21
- Award someone with fixed reward:
22
+ ### Award someone with fixed reward
22
23
 
23
24
  ```python
24
25
  from viz import Client
@@ -27,12 +28,13 @@ node = "wss://node.viz.cx/ws"
27
28
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
28
29
 
29
30
  initiator = "your_account"
31
+ receiver = "id"
30
32
  reward_amount = 3.5 # "3.50 VIZ"
31
33
  max_energy = 30 # 30%
32
- viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)
34
+ viz.fixed_award(receiver, reward_amount, max_energy, "with fixed reward", None, initiator)
33
35
  ```
34
36
 
35
- Send a custom operation:
37
+ ### Send a custom operation
36
38
 
37
39
  ```python
38
40
  from viz import Client
@@ -41,35 +43,57 @@ node = "wss://node.viz.cx/ws"
41
43
  viz = Client(node=node, keys=["5...your_private_regular_key..."])
42
44
 
43
45
  account = "your_account"
46
+ required_regular_auths = [account]
44
47
  protocol = "color.place"
45
- json = {"x":35, "y":70, "color":"#e50000"}
46
- viz.custom(protocol, json, None, [account])
48
+ custom_json = {"x": 35, "y": 70, "color": "#e50000"}
49
+ viz.custom(protocol, custom_json, None, required_regular_auths)
47
50
  ```
48
51
 
49
- Get account with custom protocol latest block:
52
+ ### Get data from custom protocol
50
53
 
51
54
  ```python
52
55
  from viz import Client
53
56
  from viz.account import Account
54
57
  from viz.block import Block
55
58
  from viz.instance import set_shared_blockchain_instance
59
+ import json
56
60
 
57
- viz = Client('wss://node.viz.cx/ws')
61
+ viz = Client("wss://node.viz.cx/ws")
58
62
  set_shared_blockchain_instance(viz)
59
63
 
64
+ account_name = "id"
60
65
  protocol = "V"
61
- account = Account('id', viz, protocol)
66
+ account = Account(account_name, protocol=protocol)
67
+
62
68
  counter_inside_protocol = account["custom_sequence"]
63
69
  last_used_in_block = account["custom_sequence_block_num"]
70
+
64
71
  block = Block(last_used_in_block)
72
+
73
+ for tx in block["transactions"]:
74
+ for op_type, op_data in tx["operations"]:
75
+ if op_type != "custom":
76
+ continue
77
+ if op_data.get("id") != protocol:
78
+ continue
79
+ if account_name not in op_data.get("required_regular_auths", []):
80
+ continue
81
+
82
+ raw_json = op_data.get("json")
83
+ try:
84
+ json_from_protocol = json.loads(raw_json) if raw_json else None
85
+ except json.JSONDecodeError:
86
+ json_from_protocol = None
87
+
88
+ print(json_from_protocol)
65
89
  ```
66
90
 
67
- Any direct RPC call:
91
+ ### Any direct RPC call
68
92
 
69
93
  ```python
70
94
  from viz import Client
71
95
 
72
- viz = Client('wss://node.viz.cx/ws')
96
+ viz = Client("wss://node.viz.cx/ws")
73
97
  viz.rpc.get_dynamic_global_properties()
74
98
  ```
75
99
 
@@ -97,7 +121,7 @@ poetry install
97
121
  #### Linux dependencies
98
122
 
99
123
  ```sh
100
- sudo apt-get install libffi-dev libssl-dev python-dev
124
+ sudo apt-get install libffi-dev libssl-dev python3-dev
101
125
  ```
102
126
 
103
127
  #### Windows dependencies
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "viz-python-lib"
7
- version = "1.1.0"
7
+ version = "1.2.0"
8
8
  description = "Python library for VIZ blockchain"
9
9
  authors = ["Vladimir Kamarzin <vvk@vvk.pp.ru>", "Vladimir Babin <vovababin@gmail.com>"]
10
10
  license = "MIT"
@@ -19,13 +19,11 @@ packages = [
19
19
  keywords = ['viz', 'python', 'library', 'blockchain']
20
20
 
21
21
  classifiers = [
22
- "Development Status :: 3 - Alpha",
22
+ "Development Status :: 4 - Beta",
23
23
  "Intended Audience :: Developers",
24
24
  "Operating System :: OS Independent",
25
25
  "Topic :: Software Development :: Libraries :: Python Modules",
26
26
  "Programming Language :: Python :: 3",
27
- "Programming Language :: Python :: 3.8",
28
- "Programming Language :: Python :: 3.9",
29
27
  "Programming Language :: Python :: 3.10",
30
28
  "Programming Language :: Python :: 3.11",
31
29
  "Programming Language :: Python :: 3.12",
@@ -35,7 +33,7 @@ classifiers = [
35
33
 
36
34
 
37
35
  [tool.poetry.dependencies]
38
- python = "^3.8"
36
+ python = "^3.10"
39
37
  graphenelib = "^1.6.0"
40
38
  toolz = "^0.12.0"
41
39
  funcy = "^2.0"
@@ -44,16 +42,16 @@ docker = "^7.1.0"
44
42
 
45
43
 
46
44
  [tool.poetry.group.dev.dependencies]
47
- pre-commit = { version = "^3.6", python = ">=3.9" }
45
+ pre-commit = "^3.6"
48
46
  ruff = "^0.1"
49
47
  mypy = "^1.8"
50
- pytest = "^8.0"
48
+ pytest = "^9.0"
51
49
  pytest-cov = "^5.0"
52
50
 
53
- sphinx = "^2.2"
54
- sphinx-autoapi = "^1.4.0"
51
+ sphinx = ">=4.0,<7.0"
52
+ sphinx-autoapi = "^1.8.0"
55
53
  # used in docs to include markdown files
56
- m2r = "^0.3.1"
54
+ m2r2 = "^0.3.2"
57
55
  # used in docs to parse pyproject.toml
58
56
  tomlkit = "^0.11.8"
59
57
 
@@ -73,12 +71,12 @@ addopts = [
73
71
 
74
72
 
75
73
  [tool.mypy]
76
- ignore_missing_imports = false
74
+ ignore_missing_imports = true
77
75
 
78
76
 
79
77
  [tool.ruff]
80
78
  line-length = 120
81
- target-version = "py38"
79
+ target-version = "py310"
82
80
 
83
81
 
84
82
  [tool.ruff.lint]
@@ -0,0 +1,3 @@
1
+ from .viz import Client
2
+
3
+ __all__ = ["Client"]
@@ -1,4 +1,5 @@
1
- from typing import TYPE_CHECKING, Generator, List, Optional, Union
1
+ from collections.abc import Generator
2
+ from typing import TYPE_CHECKING, Optional
2
3
  from warnings import warn
3
4
 
4
5
  from graphenecommon.exceptions import AccountDoesNotExistsException
@@ -12,7 +13,7 @@ from .utils import json_expand, parse_time, time_elapsed
12
13
  if TYPE_CHECKING:
13
14
  from .viz import Client # noqa: F401
14
15
 
15
- HistoryGenerator = Generator[Union[dict, list], None, int]
16
+ HistoryGenerator = Generator[dict | list, None, int]
16
17
 
17
18
 
18
19
  class Account(dict):
@@ -117,10 +118,10 @@ class Account(dict):
117
118
  self,
118
119
  index: int,
119
120
  limit: int,
120
- start: Optional[int] = None,
121
- stop: Optional[int] = None,
121
+ start: int | None = None,
122
+ stop: int | None = None,
122
123
  order: int = -1,
123
- filter_by: Optional[Union[str, List[str]]] = None,
124
+ filter_by: str | list[str] | None = None,
124
125
  raw_output: bool = False,
125
126
  ) -> HistoryGenerator:
126
127
  """
@@ -183,7 +184,7 @@ class Account(dict):
183
184
 
184
185
  def history(
185
186
  self,
186
- filter_by: Optional[Union[str, List[str]]] = None,
187
+ filter_by: str | list[str] | None = None,
187
188
  start: int = 0,
188
189
  batch_size: int = 1000,
189
190
  raw_output: bool = False,
@@ -240,7 +241,7 @@ class Account(dict):
240
241
 
241
242
  def history_reverse(
242
243
  self,
243
- filter_by: Optional[Union[str, List[str]]] = None,
244
+ filter_by: str | list[str] | None = None,
244
245
  batch_size: int = 1000,
245
246
  raw_output: bool = False,
246
247
  limit: int = -1,
@@ -1,7 +1,7 @@
1
1
  import hashlib
2
2
  import json
3
3
  import time
4
- from typing import Iterator, List, Optional, Union
4
+ from collections.abc import Iterator
5
5
 
6
6
  from graphenecommon.blockchain import Blockchain as GrapheneBlockchain
7
7
 
@@ -42,8 +42,8 @@ class Blockchain(GrapheneBlockchain):
42
42
 
43
43
  def stream_from(
44
44
  self,
45
- start_block: Optional[int] = None,
46
- end_block: Optional[int] = None,
45
+ start_block: int | None = None,
46
+ end_block: int | None = None,
47
47
  batch_operations: bool = False,
48
48
  full_blocks: bool = False,
49
49
  only_virtual_ops: bool = False,
@@ -108,9 +108,9 @@ class Blockchain(GrapheneBlockchain):
108
108
 
109
109
  def stream(
110
110
  self,
111
- filter_by: Optional[Union[str, List[str]]] = None,
112
- start_block: Optional[int] = None,
113
- end_block: Optional[int] = None,
111
+ filter_by: str | list[str] | None = None,
112
+ start_block: int | None = None,
113
+ end_block: int | None = None,
114
114
  raw_output: bool = False,
115
115
  ) -> Iterator[dict]:
116
116
  """
@@ -1,12 +1,12 @@
1
1
  import json
2
- from datetime import datetime
2
+ from datetime import datetime, timezone
3
3
 
4
4
  from toolz import assoc, update_in
5
5
 
6
6
 
7
7
  def json_expand(json_op, key_name="json"):
8
8
  """Convert a string json object to Python dict in an op."""
9
- if type(json_op) is dict and key_name in json_op and json_op[key_name]:
9
+ if isinstance(json_op, dict) and key_name in json_op and json_op[key_name]:
10
10
  try:
11
11
  return update_in(json_op, [key_name], json.loads)
12
12
  except json.JSONDecodeError:
@@ -19,7 +19,9 @@ def time_elapsed(event_time):
19
19
  """Takes a string time from blockchain event, and returns a time delta from now."""
20
20
  if isinstance(event_time, str):
21
21
  event_time = parse_time(event_time)
22
- return datetime.utcnow() - event_time
22
+ if event_time.tzinfo is None:
23
+ event_time = event_time.replace(tzinfo=timezone.utc)
24
+ return datetime.now(timezone.utc) - event_time
23
25
 
24
26
 
25
27
  def parse_time(event_time):
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from collections import defaultdict
3
- from typing import Any, DefaultDict, Dict, List, Optional, Union
3
+ from typing import Any
4
4
 
5
5
  from graphenecommon.chain import AbstractGrapheneChain
6
6
  from graphenecommon.exceptions import AccountDoesNotExistsException, KeyAlreadyInStoreException
@@ -17,8 +17,6 @@ from .exceptions import AccountExistsException
17
17
  from .transactionbuilder import ProposalBuilder, TransactionBuilder
18
18
  from .wallet import Wallet
19
19
 
20
- # from .utils import formatTime
21
-
22
20
  log = logging.getLogger(__name__)
23
21
 
24
22
 
@@ -89,10 +87,10 @@ class Client(AbstractGrapheneChain):
89
87
  self,
90
88
  title: str,
91
89
  memo: str = "",
92
- parent: Optional[TransactionBuilder] = None,
90
+ parent: TransactionBuilder | None = None,
93
91
  expiration_time: int = 2 * 24 * 60 * 60,
94
- review_period_time: Optional[int] = None,
95
- account: Optional[str] = None,
92
+ review_period_time: int | None = None,
93
+ account: str | None = None,
96
94
  **kwargs: Any,
97
95
  ) -> ProposalBuilder:
98
96
  """
@@ -147,11 +145,11 @@ class Client(AbstractGrapheneChain):
147
145
  self,
148
146
  author: str,
149
147
  title: str,
150
- approver: Optional[Union[str, list]] = None,
151
- keys: Optional[Union[str, list]] = None,
148
+ approver: str | list | None = None,
149
+ keys: str | list | None = None,
152
150
  permission: str = "regular",
153
151
  approve: bool = True,
154
- account: Optional[str] = None,
152
+ account: str | None = None,
155
153
  ) -> dict:
156
154
  """
157
155
  Update proposal (approve or disapprove)
@@ -194,7 +192,7 @@ class Client(AbstractGrapheneChain):
194
192
  return self.finalizeOp(op, account, permission)
195
193
 
196
194
  def transfer(
197
- self, to: str, amount: float, asset: str, memo: str = "", account: Optional[str] = None, **kwargs: Any
195
+ self, to: str, amount: float, asset: str, memo: str = "", account: str | None = None, **kwargs: Any
198
196
  ) -> dict:
199
197
  """
200
198
  Transfer an asset to another account.
@@ -230,8 +228,8 @@ class Client(AbstractGrapheneChain):
230
228
  receiver: str,
231
229
  energy: float,
232
230
  memo: str = "",
233
- beneficiaries: Optional[List[Dict[str, Union[str, int]]]] = None,
234
- account: Optional[str] = None,
231
+ beneficiaries: list[dict[str, str | int]] | None = None,
232
+ account: str | None = None,
235
233
  **kwargs: Any,
236
234
  ) -> dict:
237
235
  """
@@ -271,8 +269,8 @@ class Client(AbstractGrapheneChain):
271
269
  reward_amount: float,
272
270
  max_energy: float,
273
271
  memo: str = "",
274
- beneficiaries: Optional[List[Dict[str, Union[str, int]]]] = None,
275
- account: Optional[str] = None,
272
+ beneficiaries: list[dict[str, str | int]] | None = None,
273
+ account: str | None = None,
276
274
  **kwargs: Any,
277
275
  ) -> dict:
278
276
  """
@@ -313,9 +311,9 @@ class Client(AbstractGrapheneChain):
313
311
  def custom(
314
312
  self,
315
313
  id_: str,
316
- json: Union[Dict, List],
317
- required_active_auths: Optional[List[str]] = None,
318
- required_regular_auths: Optional[List[str]] = None,
314
+ json: dict | list,
315
+ required_active_auths: list[str] | None = None,
316
+ required_regular_auths: list[str] | None = None,
319
317
  ) -> dict:
320
318
  """
321
319
  Create a custom operation.
@@ -355,7 +353,7 @@ class Client(AbstractGrapheneChain):
355
353
  )
356
354
  return self.finalizeOp(op, account, required_key_type)
357
355
 
358
- def withdraw_vesting(self, amount: float, account: Optional[str] = None) -> dict:
356
+ def withdraw_vesting(self, amount: float, account: str | None = None) -> dict:
359
357
  """
360
358
  Withdraw SHARES from the vesting account.
361
359
 
@@ -381,7 +379,7 @@ class Client(AbstractGrapheneChain):
381
379
 
382
380
  return self.finalizeOp(op, account, "active")
383
381
 
384
- def transfer_to_vesting(self, amount: float, to: Optional[str] = None, account: Optional[str] = None) -> dict:
382
+ def transfer_to_vesting(self, amount: float, to: str | None = None, account: str | None = None) -> dict:
385
383
  """
386
384
  Vest free VIZ into vesting.
387
385
 
@@ -413,7 +411,7 @@ class Client(AbstractGrapheneChain):
413
411
  return self.finalizeOp(op, account, "active")
414
412
 
415
413
  def set_withdraw_vesting_route(
416
- self, to: str, percentage: float = 100, account: Optional[str] = None, auto_vest: bool = False
414
+ self, to: str, percentage: float = 100, account: str | None = None, auto_vest: bool = False
417
415
  ) -> dict:
418
416
  """
419
417
  Set up a vesting withdraw route. When vesting shares are withdrawn, they will be routed to these accounts based
@@ -467,22 +465,22 @@ class Client(AbstractGrapheneChain):
467
465
  def create_account(
468
466
  self,
469
467
  account_name: str,
470
- json_meta: Optional[Dict[str, Any]] = None,
471
- password: Optional[str] = None,
472
- master_key: Optional[str] = None,
473
- active_key: Optional[str] = None,
474
- regular_key: Optional[str] = None,
475
- memo_key: Optional[str] = None,
476
- additional_master_keys: Optional[List[str]] = None,
477
- additional_active_keys: Optional[List[str]] = None,
478
- additional_regular_keys: Optional[List[str]] = None,
479
- additional_master_accounts: Optional[List[str]] = None,
480
- additional_active_accounts: Optional[List[str]] = None,
481
- additional_regular_accounts: Optional[List[str]] = None,
468
+ json_meta: dict[str, Any] | None = None,
469
+ password: str | None = None,
470
+ master_key: str | None = None,
471
+ active_key: str | None = None,
472
+ regular_key: str | None = None,
473
+ memo_key: str | None = None,
474
+ additional_master_keys: list[str] | None = None,
475
+ additional_active_keys: list[str] | None = None,
476
+ additional_regular_keys: list[str] | None = None,
477
+ additional_master_accounts: list[str] | None = None,
478
+ additional_active_accounts: list[str] | None = None,
479
+ additional_regular_accounts: list[str] | None = None,
482
480
  store_keys: bool = True,
483
481
  fee: float = 0,
484
- delegation: Optional[float] = None,
485
- creator: Optional[str] = None,
482
+ delegation: float | None = None,
483
+ creator: str | None = None,
486
484
  referrer: str = "",
487
485
  ) -> dict:
488
486
  """
@@ -571,7 +569,7 @@ class Client(AbstractGrapheneChain):
571
569
  from vizbase.account import PasswordKey, PublicKey
572
570
 
573
571
  key_roles = ["regular", "active", "master", "memo"]
574
- keys: DefaultDict[str, Union[PasswordKey, Dict]] = defaultdict(dict)
572
+ keys: defaultdict[str, PasswordKey | dict] = defaultdict(dict)
575
573
 
576
574
  if password:
577
575
  for role in key_roles:
@@ -590,7 +588,7 @@ class Client(AbstractGrapheneChain):
590
588
  raise ValueError("Call incomplete! Provide either a password or public keys!")
591
589
 
592
590
  # main key authorities
593
- authority: Union[str, List] = ""
591
+ authority: str | list = ""
594
592
  for role in key_roles:
595
593
  if role == "memo":
596
594
  authority = format(keys["pubkeys"][role], self.prefix)
@@ -673,7 +671,7 @@ class Client(AbstractGrapheneChain):
673
671
  self,
674
672
  account_name: str,
675
673
  memo_key: str,
676
- json_meta: Optional[Dict[str, Any]] = None,
674
+ json_meta: dict[str, Any] | None = None,
677
675
  ) -> dict:
678
676
  """
679
677
  Update account profile.
@@ -1,12 +0,0 @@
1
- from .viz import Client # noqa: F401
2
-
3
- __all__ = [
4
- "viz",
5
- "account",
6
- "amount",
7
- "block",
8
- "blockchain",
9
- "storage",
10
- "utils",
11
- "wallet",
12
- ]