viz-python-lib 1.0.2__py3-none-any.whl → 1.1.0__py3-none-any.whl

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.
viz/__init__.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from .viz import Client # noqa: F401
3
2
 
4
3
  __all__ = [
viz/account.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from typing import TYPE_CHECKING, Generator, List, Optional, Union
2
2
  from warnings import warn
3
+
3
4
  from graphenecommon.exceptions import AccountDoesNotExistsException
4
5
  from toolz import dissoc
5
6
 
@@ -23,11 +24,16 @@ class Account(dict):
23
24
  instance
24
25
  """
25
26
 
26
- def __init__(self, account_name: str, blockchain_instance: Optional['Client'] = None) -> None:
27
+ def __init__(
28
+ self,
29
+ account_name: str,
30
+ blockchain_instance: Optional["Client"] = None,
31
+ protocol: str = "",
32
+ ) -> None:
27
33
  self.blockchain_instance = blockchain_instance or shared_blockchain_instance()
28
34
  self.name = account_name
29
35
 
30
- self.refresh()
36
+ self.refresh(protocol)
31
37
 
32
38
  @property
33
39
  def balances(self):
@@ -38,18 +44,18 @@ class Account(dict):
38
44
  def energy(self):
39
45
  """Account energy at the moment of last use (stale)"""
40
46
  cfg = self.blockchain_instance.rpc.config
41
- return self['energy'] / cfg['CHAIN_1_PERCENT']
47
+ return self["energy"] / cfg["CHAIN_1_PERCENT"]
42
48
 
43
- def refresh(self):
49
+ def refresh(self, protocol: str = "") -> None:
44
50
  """Loads account object from blockchain."""
45
51
  try:
46
- account = self.blockchain_instance.rpc.get_accounts([self.name])[0]
47
- except IndexError:
48
- raise AccountDoesNotExistsException
52
+ account = self.blockchain_instance.rpc.get_account(self.name, protocol)
53
+ except Exception as err:
54
+ raise AccountDoesNotExistsException from err
49
55
 
50
56
  # load json_metadata
51
57
  account = json_expand(account, "json_metadata")
52
- super(Account, self).__init__(account)
58
+ super().__init__(account)
53
59
 
54
60
  def get_balances(self) -> dict:
55
61
  """
@@ -65,14 +71,14 @@ class Account(dict):
65
71
  def current_energy(self) -> float:
66
72
  """Returns current account energy (actual data, counts regenerated energy)"""
67
73
  self.refresh()
68
- last_vote_time = parse_time(self['last_vote_time'])
74
+ last_vote_time = parse_time(self["last_vote_time"])
69
75
  elapsed_time = time_elapsed(last_vote_time)
70
76
  cfg = self.blockchain_instance.rpc.config
71
77
  regenerated_energy = (
72
- cfg['CHAIN_100_PERCENT'] * elapsed_time.total_seconds() / cfg['CHAIN_ENERGY_REGENERATION_SECONDS']
78
+ cfg["CHAIN_100_PERCENT"] * elapsed_time.total_seconds() / cfg["CHAIN_ENERGY_REGENERATION_SECONDS"]
73
79
  )
74
- current_energy = self['energy'] + regenerated_energy
75
- energy = min(current_energy, cfg['CHAIN_100_PERCENT']) / cfg['CHAIN_1_PERCENT']
80
+ current_energy = self["energy"] + regenerated_energy
81
+ energy = min(current_energy, cfg["CHAIN_100_PERCENT"]) / cfg["CHAIN_1_PERCENT"]
76
82
 
77
83
  return energy
78
84
 
@@ -85,7 +91,7 @@ class Account(dict):
85
91
  else:
86
92
  return last_item
87
93
 
88
- def get_withdraw_routes(self, type_: str = 'all') -> dict:
94
+ def get_withdraw_routes(self, type_: str = "all") -> dict:
89
95
  """
90
96
  Get vesting withdraw routes.
91
97
 
@@ -155,7 +161,7 @@ class Account(dict):
155
161
  # removes specified key from dict
156
162
  block_props = dissoc(event, "op")
157
163
 
158
- def construct_op(account_name):
164
+ def construct_op(account_name, index, op_type, block_props, op, item):
159
165
  # verbatim output from steemd
160
166
  if raw_output:
161
167
  return item
@@ -170,7 +176,7 @@ class Account(dict):
170
176
  return immutable
171
177
 
172
178
  if filter_by is None or op_type in filter_by:
173
- yield construct_op(self.name)
179
+ yield construct_op(self.name, index, op_type, block_props, op, item)
174
180
  op_count += 1
175
181
 
176
182
  return op_count
@@ -186,7 +192,7 @@ class Account(dict):
186
192
  """
187
193
  THIS FUNCTION IS DEPRECATED. PLEASE USE :py:func:`history_reverse` INSTEAD.
188
194
 
189
- Stream account history in chronological order.
195
+ Stream account history in chronological order.
190
196
 
191
197
  This generator yields history items which may be in list or dict form depending on ``raw_output``.
192
198
  Output is similar to :py:func:`history_reverse`.
@@ -200,7 +206,11 @@ class Account(dict):
200
206
  This is a rough limit, actual results could be a bit longer
201
207
  :return: number of ops
202
208
  """
203
- warn("Function `history` is not recommened. Use `history_reverse` instead.", DeprecationWarning, stacklevel=2)
209
+ warn(
210
+ "Function `history` is not recommened. Use `history_reverse` instead.",
211
+ DeprecationWarning,
212
+ stacklevel=2,
213
+ )
204
214
 
205
215
  op_count = 0
206
216
 
@@ -297,7 +307,11 @@ class Account(dict):
297
307
  if i - batch_size < 0:
298
308
  batch_size = i
299
309
  count = yield from self.get_account_history(
300
- index=i, limit=batch_size, order=-1, filter_by=filter_by, raw_output=raw_output,
310
+ index=i,
311
+ limit=batch_size,
312
+ order=-1,
313
+ filter_by=filter_by,
314
+ raw_output=raw_output,
301
315
  )
302
316
  i -= batch_size + 1
303
317
  op_count += count
viz/block.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.block import Block as GrapheneBlock
3
2
  from graphenecommon.block import BlockHeader as GrapheneBlockHeader
4
3
 
viz/blockchain.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import hashlib
3
2
  import json
4
3
  import time
@@ -201,7 +200,6 @@ class Blockchain(GrapheneBlockchain):
201
200
  for op in self.stream_from(
202
201
  full_blocks=False, only_virtual_ops=only_virtual_ops, start_block=start_block, end_block=end_block
203
202
  ):
204
-
205
203
  if not filter_by or op["op"][0] in filter_by:
206
204
  if raw_output:
207
205
  yield op
viz/blockchainobject.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.blockchainobject import BlockchainObject as GrapheneBlockchainObject
3
2
  from graphenecommon.blockchainobject import Object as GrapheneChainObject
4
3
 
viz/converter.py CHANGED
@@ -2,7 +2,7 @@ from .amount import Amount
2
2
  from .instance import shared_blockchain_instance
3
3
 
4
4
 
5
- class Converter(object):
5
+ class Converter:
6
6
  """
7
7
  Converter simplifies the handling of different metrics of the blockchain.
8
8
 
viz/exceptions.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  class BaseException(Exception):
3
2
  """Base excepsion class."""
4
3
 
viz/instance.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.instance import AbstractBlockchainInstanceProvider
3
2
 
4
3
 
viz/memo.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import secrets
3
2
 
4
3
  from graphenecommon.exceptions import KeyNotFound, MissingKeyError
@@ -76,9 +75,9 @@ class Memo(GrapheneMemo):
76
75
  "Memo private key {} for {} could not be found".format(
77
76
  self.from_account["memo_key"], self.from_account["name"]
78
77
  )
79
- )
78
+ ) from None
80
79
  if not memo_wif:
81
- raise MissingKeyError("Memo key for %s missing!" % self.from_account["name"])
80
+ raise MissingKeyError("Memo key for {} missing!".format(self.from_account["name"]))
82
81
 
83
82
  if not hasattr(self, "chain_prefix"):
84
83
  self.chain_prefix = self.blockchain.prefix
@@ -105,10 +104,10 @@ class Memo(GrapheneMemo):
105
104
  keys = memo.involved_keys(message)
106
105
  wif = None
107
106
  for key in keys:
108
- try:
107
+ try:
109
108
  wif = self.blockchain.wallet.getPrivateKeyForPublicKey(str(key))
110
109
  break
111
- except:
110
+ except Exception:
112
111
  continue
113
112
  if not wif:
114
113
  raise MissingKeyError("None of the required memo keys are installed!")
viz/storage.py CHANGED
@@ -1,12 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenestorage import (
3
- InRamConfigurationStore,
4
- InRamEncryptedKeyStore,
5
- InRamPlainKeyStore,
6
2
  SqliteConfigurationStore,
7
3
  SqliteEncryptedKeyStore,
8
- SQLiteFile,
9
- SqlitePlainKeyStore,
10
4
  )
11
5
 
12
6
  from vizbase.chains import DEFAULT_PREFIX
viz/transactionbuilder.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # We don't have own Asset class because it is unneeded
3
2
  import struct
4
3
  from binascii import unhexlify
@@ -39,9 +38,9 @@ class ProposalBuilder(GrapheneProposalBuilder):
39
38
  self, author, title, memo, proposal_expiration=None, proposal_review=None, parent=None, *args, **kwargs
40
39
  ):
41
40
  self.define_classes()
42
- assert self.operation_class
43
- assert self.operations
44
- assert self.account_class
41
+ assert self.operation_class is not None
42
+ assert self.operations is not None
43
+ assert self.account_class is not None
45
44
 
46
45
  self.proposal_expiration = proposal_expiration or 2 * 24 * 60 * 60
47
46
  self.proposal_review = proposal_review
@@ -62,12 +61,12 @@ class ProposalBuilder(GrapheneProposalBuilder):
62
61
  return
63
62
  ops = [self.operations.Op_wrapper(op=o) for o in list(self.ops)]
64
63
  data = {
65
- 'author': self.proposer,
66
- 'title': self.title,
67
- 'memo': self.memo,
68
- 'proposed_operations': [o.json() for o in ops],
69
- 'expiration_time': formatTimeFromNow(self.proposal_expiration),
70
- 'extensions': [],
64
+ "author": self.proposer,
65
+ "title": self.title,
66
+ "memo": self.memo,
67
+ "proposed_operations": [o.json() for o in ops],
68
+ "expiration_time": formatTimeFromNow(self.proposal_expiration),
69
+ "extensions": [],
71
70
  }
72
71
  if self.proposal_review:
73
72
  data.update({"review_period_time": formatTimeFromNow(self.proposal_review)})
@@ -123,7 +122,7 @@ class TransactionBuilder(GrapheneTransactionBuilder):
123
122
  else:
124
123
  accountObj = self.account_class(account, blockchain_instance=self.blockchain) # noqa: N806
125
124
  # TODO: method overriden because of _authority
126
- field = "{}_authority".format(permission)
125
+ field = f"{permission}_authority"
127
126
  required_treshold = accountObj[field]["weight_threshold"]
128
127
  keys = self._fetchkeys(accountObj, field, required_treshold=required_treshold)
129
128
  # If we couldn't find an active key, let's try overwrite it
viz/utils.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import json
3
2
  from datetime import datetime
4
3
 
@@ -7,7 +6,7 @@ from toolz import assoc, update_in
7
6
 
8
7
  def json_expand(json_op, key_name="json"):
9
8
  """Convert a string json object to Python dict in an op."""
10
- if type(json_op) == dict and key_name in json_op and json_op[key_name]:
9
+ if type(json_op) is dict and key_name in json_op and json_op[key_name]:
11
10
  try:
12
11
  return update_in(json_op, [key_name], json.loads)
13
12
  except json.JSONDecodeError:
@@ -25,7 +24,7 @@ def time_elapsed(event_time):
25
24
 
26
25
  def parse_time(event_time):
27
26
  """Take a string representation of time from the blockchain, and parse it into datetime object."""
28
- return datetime.strptime(event_time, '%Y-%m-%dT%H:%M:%S')
27
+ return datetime.strptime(event_time, "%Y-%m-%dT%H:%M:%S")
29
28
 
30
29
 
31
30
  def time_diff(time1, time2):
viz/viz.py CHANGED
@@ -1,10 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
1
  import logging
3
2
  from collections import defaultdict
4
3
  from typing import Any, DefaultDict, Dict, List, Optional, Union
5
4
 
6
5
  from graphenecommon.chain import AbstractGrapheneChain
7
- from graphenecommon.exceptions import KeyAlreadyInStoreException, AccountDoesNotExistsException
6
+ from graphenecommon.exceptions import AccountDoesNotExistsException, KeyAlreadyInStoreException
8
7
 
9
8
  from vizapi.noderpc import NodeRPC
10
9
  from vizbase import operations
@@ -89,11 +88,11 @@ class Client(AbstractGrapheneChain):
89
88
  def new_proposal(
90
89
  self,
91
90
  title: str,
92
- memo: str = '',
91
+ memo: str = "",
93
92
  parent: Optional[TransactionBuilder] = None,
94
93
  expiration_time: int = 2 * 24 * 60 * 60,
95
94
  review_period_time: Optional[int] = None,
96
- account: str = None,
95
+ account: Optional[str] = None,
97
96
  **kwargs: Any,
98
97
  ) -> ProposalBuilder:
99
98
  """
@@ -148,11 +147,11 @@ class Client(AbstractGrapheneChain):
148
147
  self,
149
148
  author: str,
150
149
  title: str,
151
- approver: Union[str, list] = None,
152
- keys: Union[str, list] = None,
150
+ approver: Optional[Union[str, list]] = None,
151
+ keys: Optional[Union[str, list]] = None,
153
152
  permission: str = "regular",
154
153
  approve: bool = True,
155
- account: str = None,
154
+ account: Optional[str] = None,
156
155
  ) -> dict:
157
156
  """
158
157
  Update proposal (approve or disapprove)
@@ -214,7 +213,7 @@ class Client(AbstractGrapheneChain):
214
213
  if not account:
215
214
  raise ValueError("You need to provide an account")
216
215
 
217
- _amount = Amount("{} {}".format(amount, asset))
216
+ _amount = Amount(f"{amount} {asset}")
218
217
 
219
218
  if memo and memo[0] == "#":
220
219
  from .memo import Memo
@@ -222,7 +221,7 @@ class Client(AbstractGrapheneChain):
222
221
  memo_obj = Memo(from_account=account, to_account=to, blockchain_instance=self)
223
222
  memo = memo_obj.encrypt(memo)
224
223
 
225
- op = operations.Transfer(**{"from": account, "to": to, "amount": "{}".format(str(_amount)), "memo": memo})
224
+ op = operations.Transfer(**{"from": account, "to": to, "amount": f"{str(_amount)}", "memo": memo})
226
225
 
227
226
  return self.finalizeOp(op, account, "active", **kwargs)
228
227
 
@@ -232,7 +231,7 @@ class Client(AbstractGrapheneChain):
232
231
  energy: float,
233
232
  memo: str = "",
234
233
  beneficiaries: Optional[List[Dict[str, Union[str, int]]]] = None,
235
- account: str = None,
234
+ account: Optional[str] = None,
236
235
  **kwargs: Any,
237
236
  ) -> dict:
238
237
  """
@@ -257,7 +256,7 @@ class Client(AbstractGrapheneChain):
257
256
  **{
258
257
  "initiator": account,
259
258
  "receiver": receiver,
260
- "energy": int(energy * self.rpc.config['CHAIN_1_PERCENT']),
259
+ "energy": int(energy * self.rpc.config["CHAIN_1_PERCENT"]),
261
260
  "custom_sequence": kwargs.get("custom_sequence", 0),
262
261
  "memo": memo,
263
262
  "beneficiaries": beneficiaries,
@@ -273,7 +272,7 @@ class Client(AbstractGrapheneChain):
273
272
  max_energy: float,
274
273
  memo: str = "",
275
274
  beneficiaries: Optional[List[Dict[str, Union[str, int]]]] = None,
276
- account: str = None,
275
+ account: Optional[str] = None,
277
276
  **kwargs: Any,
278
277
  ) -> dict:
279
278
  """
@@ -301,8 +300,8 @@ class Client(AbstractGrapheneChain):
301
300
  **{
302
301
  "initiator": account,
303
302
  "receiver": receiver,
304
- "reward_amount": "{}".format(str(_amount)),
305
- "max_energy": int(max_energy * self.rpc.config['CHAIN_1_PERCENT']),
303
+ "reward_amount": f"{str(_amount)}",
304
+ "max_energy": int(max_energy * self.rpc.config["CHAIN_1_PERCENT"]),
306
305
  "custom_sequence": kwargs.get("custom_sequence", 0),
307
306
  "memo": memo,
308
307
  "beneficiaries": beneficiaries,
@@ -356,7 +355,7 @@ class Client(AbstractGrapheneChain):
356
355
  )
357
356
  return self.finalizeOp(op, account, required_key_type)
358
357
 
359
- def withdraw_vesting(self, amount: float, account: str = None) -> dict:
358
+ def withdraw_vesting(self, amount: float, account: Optional[str] = None) -> dict:
360
359
  """
361
360
  Withdraw SHARES from the vesting account.
362
361
 
@@ -382,7 +381,7 @@ class Client(AbstractGrapheneChain):
382
381
 
383
382
  return self.finalizeOp(op, account, "active")
384
383
 
385
- def transfer_to_vesting(self, amount: float, to: str = None, account: str = None) -> dict:
384
+ def transfer_to_vesting(self, amount: float, to: Optional[str] = None, account: Optional[str] = None) -> dict:
386
385
  """
387
386
  Vest free VIZ into vesting.
388
387
 
@@ -414,7 +413,7 @@ class Client(AbstractGrapheneChain):
414
413
  return self.finalizeOp(op, account, "active")
415
414
 
416
415
  def set_withdraw_vesting_route(
417
- self, to: str, percentage: float = 100, account: str = None, auto_vest: bool = False
416
+ self, to: str, percentage: float = 100, account: Optional[str] = None, auto_vest: bool = False
418
417
  ) -> dict:
419
418
  """
420
419
  Set up a vesting withdraw route. When vesting shares are withdrawn, they will be routed to these accounts based
@@ -445,7 +444,7 @@ class Client(AbstractGrapheneChain):
445
444
  **{
446
445
  "from_account": account,
447
446
  "to_account": to,
448
- "percent": int(percentage * self.rpc.config['CHAIN_1_PERCENT']),
447
+ "percent": int(percentage * self.rpc.config["CHAIN_1_PERCENT"]),
449
448
  "auto_vest": auto_vest,
450
449
  }
451
450
  )
@@ -469,11 +468,11 @@ class Client(AbstractGrapheneChain):
469
468
  self,
470
469
  account_name: str,
471
470
  json_meta: Optional[Dict[str, Any]] = None,
472
- password: str = None,
473
- master_key: str = None,
474
- active_key: str = None,
475
- regular_key: str = None,
476
- memo_key: str = 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,
477
476
  additional_master_keys: Optional[List[str]] = None,
478
477
  additional_active_keys: Optional[List[str]] = None,
479
478
  additional_regular_keys: Optional[List[str]] = None,
@@ -482,9 +481,9 @@ class Client(AbstractGrapheneChain):
482
481
  additional_regular_accounts: Optional[List[str]] = None,
483
482
  store_keys: bool = True,
484
483
  fee: float = 0,
485
- delegation: float = None,
486
- creator: str = None,
487
- referrer: str = '',
484
+ delegation: Optional[float] = None,
485
+ creator: Optional[str] = None,
486
+ referrer: str = "",
488
487
  ) -> dict:
489
488
  """
490
489
  Create new account.
@@ -535,9 +534,9 @@ class Client(AbstractGrapheneChain):
535
534
  :param str referrer: account who will be set as referrer, defaults to creator
536
535
  :raises AccountExistsException: if the account already exists on the blockchain
537
536
  """
538
- max_length = self.rpc.config['CHAIN_MAX_ACCOUNT_NAME_LENGTH']
537
+ max_length = self.rpc.config["CHAIN_MAX_ACCOUNT_NAME_LENGTH"]
539
538
  if len(account_name) > max_length:
540
- raise ValueError("Account name must be at most {} chars long".format(max_length))
539
+ raise ValueError(f"Account name must be at most {max_length} chars long")
541
540
 
542
541
  if not creator and self.config["default_account"]:
543
542
  creator = self.config["default_account"]
@@ -571,41 +570,41 @@ class Client(AbstractGrapheneChain):
571
570
  # Generate new keys from password
572
571
  from vizbase.account import PasswordKey, PublicKey
573
572
 
574
- key_roles = ['regular', 'active', 'master', 'memo']
573
+ key_roles = ["regular", "active", "master", "memo"]
575
574
  keys: DefaultDict[str, Union[PasswordKey, Dict]] = defaultdict(dict)
576
575
 
577
576
  if password:
578
577
  for role in key_roles:
579
578
  passkey = PasswordKey(account_name, password, role=role)
580
- keys['pubkeys'][role] = passkey.get_public_key()
581
- keys['privkeys'][role] = passkey.get_private_key()
579
+ keys["pubkeys"][role] = passkey.get_public_key()
580
+ keys["privkeys"][role] = passkey.get_private_key()
582
581
  # store private keys
583
582
  if store_keys:
584
- self._store_keys(keys['privkeys'][role])
583
+ self._store_keys(keys["privkeys"][role])
585
584
  elif master_key and regular_key and active_key and memo_key:
586
- keys['pubkeys']['regular'] = PublicKey(regular_key, prefix=self.prefix)
587
- keys['pubkeys']['active'] = PublicKey(active_key, prefix=self.prefix)
588
- keys['pubkeys']['master'] = PublicKey(master_key, prefix=self.prefix)
589
- keys['pubkeys']['memo'] = PublicKey(memo_key, prefix=self.prefix)
585
+ keys["pubkeys"]["regular"] = PublicKey(regular_key, prefix=self.prefix)
586
+ keys["pubkeys"]["active"] = PublicKey(active_key, prefix=self.prefix)
587
+ keys["pubkeys"]["master"] = PublicKey(master_key, prefix=self.prefix)
588
+ keys["pubkeys"]["memo"] = PublicKey(memo_key, prefix=self.prefix)
590
589
  else:
591
590
  raise ValueError("Call incomplete! Provide either a password or public keys!")
592
591
 
593
592
  # main key authorities
594
- authority: Union[str, List] = ''
593
+ authority: Union[str, List] = ""
595
594
  for role in key_roles:
596
- if role == 'memo':
597
- authority = format(keys['pubkeys'][role], self.prefix)
595
+ if role == "memo":
596
+ authority = format(keys["pubkeys"][role], self.prefix)
598
597
  else:
599
- authority = [[format(keys['pubkeys'][role], self.prefix), 1]]
600
- keys['authorities'][role] = authority
598
+ authority = [[format(keys["pubkeys"][role], self.prefix), 1]]
599
+ keys["authorities"][role] = authority
601
600
 
602
601
  # additional key authorities
603
602
  for key in additional_master_keys:
604
- keys['authorities']['master'].append([key, 1])
603
+ keys["authorities"]["master"].append([key, 1])
605
604
  for key in additional_active_keys:
606
- keys['authorities']['active'].append([key, 1])
605
+ keys["authorities"]["active"].append([key, 1])
607
606
  for key in additional_regular_keys:
608
- keys['authorities']['regular'].append([key, 1])
607
+ keys["authorities"]["regular"].append([key, 1])
609
608
 
610
609
  # account authorities
611
610
  owner_accounts_authority = []
@@ -622,12 +621,12 @@ class Client(AbstractGrapheneChain):
622
621
  props = self.rpc.get_chain_properties()
623
622
 
624
623
  if not fee:
625
- required_fee = Amount(props['account_creation_fee']).amount
624
+ required_fee = Amount(props["account_creation_fee"]).amount
626
625
  else:
627
626
  required_fee = fee
628
627
 
629
628
  if delegation is None:
630
- delegation_ratio = props['create_account_delegation_ratio']
629
+ delegation_ratio = props["create_account_delegation_ratio"]
631
630
  cv = Converter(blockchain_instance=self)
632
631
  shares_price = cv.core_per_share()
633
632
  delegation = required_fee * delegation_ratio * shares_price
@@ -647,20 +646,20 @@ class Client(AbstractGrapheneChain):
647
646
  "new_account_name": account_name,
648
647
  "master": {
649
648
  "account_auths": owner_accounts_authority,
650
- "key_auths": keys['authorities']['master'],
649
+ "key_auths": keys["authorities"]["master"],
651
650
  "weight_threshold": 1,
652
651
  },
653
652
  "active": {
654
653
  "account_auths": active_accounts_authority,
655
- "key_auths": keys['authorities']['active'],
654
+ "key_auths": keys["authorities"]["active"],
656
655
  "weight_threshold": 1,
657
656
  },
658
657
  "regular": {
659
658
  "account_auths": posting_accounts_authority,
660
- "key_auths": keys['authorities']['regular'],
659
+ "key_auths": keys["authorities"]["regular"],
661
660
  "weight_threshold": 1,
662
661
  },
663
- "memo_key": keys['authorities']['memo'],
662
+ "memo_key": keys["authorities"]["memo"],
664
663
  "json_metadata": json_meta or {},
665
664
  "referrer": referrer,
666
665
  "prefix": self.prefix,
@@ -692,8 +691,8 @@ class Client(AbstractGrapheneChain):
692
691
  # check if the account does not exist
693
692
  try:
694
693
  Account(account_name, blockchain_instance=self)
695
- except Exception:
696
- raise AccountDoesNotExistsException
694
+ except Exception as err:
695
+ raise AccountDoesNotExistsException from err
697
696
 
698
697
  op = {
699
698
  "account": account_name,
@@ -719,8 +718,8 @@ class Client(AbstractGrapheneChain):
719
718
  # check if the account does not exist
720
719
  try:
721
720
  Account(delegatee, blockchain_instance=self)
722
- except Exception:
723
- raise AccountDoesNotExistsException
721
+ except Exception as err:
722
+ raise AccountDoesNotExistsException from err
724
723
 
725
724
  op = {
726
725
  "delegator": delegator,
viz/wallet.py CHANGED
@@ -1,13 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- from graphenecommon.exceptions import (
3
- InvalidWifError,
4
- KeyAlreadyInStoreException,
5
- KeyNotFound,
6
- NoWalletException,
7
- OfflineHasNoRPCException,
8
- WalletExists,
9
- WalletLocked,
10
- )
11
1
  from graphenecommon.wallet import Wallet as GrapheneWallet
12
2
 
13
3
  from vizbase.account import PrivateKey
viz/witness.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.witness import Witness as GrapheneWitness
3
2
  from graphenecommon.witness import Witnesses as GrapheneWitnesses
4
3
 
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: viz-python-lib
3
- Version: 1.0.2
3
+ Version: 1.1.0
4
4
  Summary: Python library for VIZ blockchain
5
- Home-page: https://github.com/VIZ-Blockchain/viz-python-lib
6
5
  License: MIT
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
@@ -18,9 +18,11 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
21
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
- Requires-Dist: aiohttp (>=3.9.0b0) ; python_version >= "3.12"
23
- Requires-Dist: docker (>=6.1.3,<7.0.0)
24
+ Requires-Dist: aiohttp (>=3.8,<4)
25
+ Requires-Dist: docker (>=7.1.0,<8.0.0)
24
26
  Requires-Dist: funcy (>=2.0,<3.0)
25
27
  Requires-Dist: graphenelib (>=1.6.0,<2.0.0)
26
28
  Requires-Dist: toolz (>=0.12.0,<0.13.0)
@@ -29,37 +31,77 @@ Description-Content-Type: text/markdown
29
31
 
30
32
  # Python Library for [VIZ](https://github.com/VIZ-Blockchain)
31
33
 
32
- ![tests](https://github.com/VIZ-Blockchain/viz-python-lib/workflows/tests/badge.svg)
34
+ ![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
33
35
  [![Documentation Status](https://readthedocs.org/projects/viz-python-lib/badge/?version=latest)](https://viz-python-lib.readthedocs.io/en/latest/?badge=latest)
34
36
 
35
- **This library is in alpha state, API unstable**
37
+ ## Usage examples
36
38
 
37
- Built on top of [python-graphenelib](https://github.com/xeroc/python-graphenelib/)
39
+ Award someone:
38
40
 
39
- ## Dependencies
41
+ ```python
42
+ from viz import Client
40
43
 
41
- #### Linux dependencies
44
+ node = "wss://node.viz.cx/ws"
45
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
42
46
 
43
- ```sh
44
- sudo apt-get install libffi-dev libssl-dev python-dev
47
+ initiator = "your_account"
48
+ percent = 10.5
49
+ viz.award("id", percent, "with love", None, initiator)
45
50
  ```
46
51
 
47
- #### Windows dependencies
52
+ Award someone with fixed reward:
48
53
 
49
- Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
54
+ ```python
55
+ from viz import Client
50
56
 
51
- #### MacOS dependencies
57
+ node = "wss://node.viz.cx/ws"
58
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
52
59
 
53
- 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:
60
+ initiator = "your_account"
61
+ reward_amount = 3.5 # "3.50 VIZ"
62
+ max_energy = 30 # 30%
63
+ viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)
64
+ ```
54
65
 
55
- ```sh
56
- brew install openssl
66
+ Send a custom operation:
67
+
68
+ ```python
69
+ from viz import Client
70
+
71
+ node = "wss://node.viz.cx/ws"
72
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
73
+
74
+ account = "your_account"
75
+ protocol = "color.place"
76
+ json = {"x":35, "y":70, "color":"#e50000"}
77
+ viz.custom(protocol, json, None, [account])
57
78
  ```
58
79
 
59
- and then use the following commands
60
- ```sh
61
- export CFLAGS="-I$(brew --prefix openssl)/include"
62
- export LDFLAGS="-L$(brew --prefix openssl)/lib"
80
+ Get account with custom protocol latest block:
81
+
82
+ ```python
83
+ from viz import Client
84
+ from viz.account import Account
85
+ from viz.block import Block
86
+ from viz.instance import set_shared_blockchain_instance
87
+
88
+ viz = Client('wss://node.viz.cx/ws')
89
+ set_shared_blockchain_instance(viz)
90
+
91
+ protocol = "V"
92
+ account = Account('id', viz, protocol)
93
+ counter_inside_protocol = account["custom_sequence"]
94
+ last_used_in_block = account["custom_sequence_block_num"]
95
+ block = Block(last_used_in_block)
96
+ ```
97
+
98
+ Any direct RPC call:
99
+
100
+ ```python
101
+ from viz import Client
102
+
103
+ viz = Client('wss://node.viz.cx/ws')
104
+ viz.rpc.get_dynamic_global_properties()
63
105
  ```
64
106
 
65
107
  ## Installation
@@ -79,21 +121,32 @@ cd viz-python-lib/
79
121
  poetry install
80
122
  ```
81
123
 
82
- ## Usage
124
+ ## Development
83
125
 
84
- Basic read query example:
85
- ```python
86
- from viz import Client
87
- from pprint import pprint
126
+ ### Dependencies
88
127
 
89
- node = 'wss://node.viz.cx/ws'
128
+ #### Linux dependencies
90
129
 
91
- viz = Client(node=node)
92
- pprint(viz.info())
130
+ ```sh
131
+ sudo apt-get install libffi-dev libssl-dev python-dev
93
132
  ```
94
133
 
95
- Direct RPC calls:
96
- ```python
97
- viz.rpc.some_rpc_method()
134
+ #### Windows dependencies
135
+
136
+ Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
137
+
138
+ #### MacOS dependencies
139
+
140
+ 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:
141
+
142
+ ```sh
143
+ brew install openssl
144
+ ```
145
+
146
+ and then use the following commands:
147
+
148
+ ```sh
149
+ export CFLAGS="-I$(brew --prefix openssl)/include"
150
+ export LDFLAGS="-L$(brew --prefix openssl)/lib"
98
151
  ```
99
152
 
@@ -0,0 +1,33 @@
1
+ viz/__init__.py,sha256=ch41BTwvgLZNa06SgZsyx9DnvSLXbH6uGw9A-os7CYc,166
2
+ viz/account.py,sha256=PBh23Ec7Ej-cIj6mjfkImAlXQdQDruui5UH0F-1x8dM,10890
3
+ viz/amount.py,sha256=6LoUfr4E9mOmWlRC0Smy9vKfUt0Hhdx7qH1C7mlEF70,5683
4
+ viz/block.py,sha256=aoCq3zOYyoI_6OmW4imQKVk0Tcn32YrrIOJJZfcGqY0,1093
5
+ viz/blockchain.py,sha256=nWTFqKn4lBu-0FpFw4CL6jqMKcXSMQuuldTxswZZO3Q,8861
6
+ viz/blockchainobject.py,sha256=_pwnJMDj6wmPGdxgc43iu2t_4yNozY7i0c_IeIgooUU,386
7
+ viz/converter.py,sha256=Bty4Av7k-fAhHZZA54M5cDYO4c3ufgl0cnjklp1G5pk,1101
8
+ viz/exceptions.py,sha256=yMJ0-TxS0bn2vkH8P4Mkd33CDbKqrioqwYogOfWtORI,428
9
+ viz/instance.py,sha256=zsBIqm2x979J2NaJmfXN5ZBGYrdm6hHjAsAo0c1Huv0,1224
10
+ viz/memo.py,sha256=8EsbCw99m2GAR6D7wW8l4em6RpKoF4cKJ-FO3fN12E8,3831
11
+ viz/storage.py,sha256=EMPZmUirQ2m8ZMxMcCKTS7kIxqcezCAdl92E6TyGGv0,600
12
+ viz/transactionbuilder.py,sha256=m42aPGkCHGlMmVCv8tR3AE5pz1uuYZWt8K_S33up7ng,6164
13
+ viz/utils.py,sha256=wW3gechN3REFCZawXDIKM67P2prFeLkZvNgwgBqc0qI,960
14
+ viz/viz.py,sha256=3ekcsBdsb6JyNxn1lHkleVZKBZd0IKWCNASFwuLop8M,29160
15
+ viz/wallet.py,sha256=rD1L2LSdP0GaDn4UY13fQP-gyswIzsOnWP2O6rT5Fic,361
16
+ viz/witness.py,sha256=WkeZ38411gIQd4ObLWDqz-R2tLMFZ0n_34flOJuI1Do,1007
17
+ vizapi/__init__.py,sha256=1mfkBk0riiobfZ00LKex4r8dDlCv4rU9kX7VMAUzQY4,49
18
+ vizapi/consts.py,sha256=4oSWiQlxOf4kX2iSTVThQB6WriaFpxZXPbyQBc3oS9k,4825
19
+ vizapi/exceptions.py,sha256=1qiuiUJ39rYKHnctEpHpoJGgYwXzgq6Oi2IbmRBewHk,853
20
+ vizapi/noderpc.py,sha256=VBOR_CSYm0JHQVA-5Bw2gYeXneMVti2qYI1axjOQnao,5171
21
+ vizbase/__init__.py,sha256=TyuPogcL9AGGSDrJq_iIcKclvsn0ZoPhBpXFMjbGsH4,186
22
+ vizbase/account.py,sha256=QTu8WukItc_HN6G76MMO6IfS0iY18NWXmamXzt3AG5g,3183
23
+ vizbase/chains.py,sha256=3_JFSb7C453G-r80SKjELEbuqyqBe-lgfr3D7hvu9nY,480
24
+ vizbase/exceptions.py,sha256=dm76Hj5tMoaKOTPJvTue1y8LuP3zfI8P_1BDBFyJVwM,87
25
+ vizbase/memo.py,sha256=artQmLtKp-b_ZtoUj02GGd1_IaLPbWEJyHw2OWC008U,3929
26
+ vizbase/objects.py,sha256=fAlUlVd8QojITrXAf2BwAAiim8iAzHcA9cXkwGKA_Bk,7499
27
+ vizbase/operationids.py,sha256=BdlxJAl96JpbvW7OBhvAoTkO3-C216MFn41unIaIwsY,2452
28
+ vizbase/operations.py,sha256=fgzeBF-RsxI7PT6VB3y0n21bgmSVscIjfUwuE4ObHoc,16975
29
+ vizbase/signedtransactions.py,sha256=KZuWGmzA-Lamq6VadEESDTsRl7ECpscThj6wIu47d78,665
30
+ viz_python_lib-1.1.0.dist-info/METADATA,sha256=ZgwsFi37tbeXAlBA4Obdo4VZAaD8SRtYNnSDvqPpbu0,3996
31
+ viz_python_lib-1.1.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
32
+ viz_python_lib-1.1.0.dist-info/licenses/LICENSE.txt,sha256=Nl1SGZTRwbvAko1uTG4FLQMol_feVwxCWnqCTQtf8No,1211
33
+ viz_python_lib-1.1.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
vizapi/consts.py CHANGED
@@ -30,6 +30,12 @@ API = {
30
30
  "verify_account_authority": "database_api",
31
31
  "get_database_info": "database_api",
32
32
  "get_proposed_transactions": "database_api",
33
+ "get_irreversible_block_header": "database_api",
34
+ "get_irreversible_block": "database_api",
35
+ "get_proposed_transaction": "database_api",
36
+ "get_accounts_on_sale": "database_api",
37
+ "get_accounts_on_auction": "database_api",
38
+ "get_subaccounts_on_sale": "database_api",
33
39
  "check_authority_signature": "auth_util",
34
40
  "broadcast_transaction": "network_broadcast_api",
35
41
  "broadcast_transaction_synchronous": "network_broadcast_api",
@@ -91,6 +97,8 @@ API = {
91
97
  "get_blog_authors": "follow",
92
98
  "get_inbox": "private_message",
93
99
  "get_outbox": "private_message",
100
+ "get_miner_queue": "witness_api",
101
+ "get_witnesses_by_counted_vote": "witness_api",
94
102
  "get_active_witnesses": "witness_api",
95
103
  "get_witness_schedule": "witness_api",
96
104
  "get_witnesses": "witness_api",
@@ -98,6 +106,7 @@ API = {
98
106
  "get_witnesses_by_vote": "witness_api",
99
107
  "get_witness_count": "witness_api",
100
108
  "lookup_witness_accounts": "witness_api",
109
+ "get_account": "custom_protocol_api",
101
110
  "test_api_a": "test_api",
102
111
  "test_api_b": "test_api",
103
112
  "api_name": "json_rpc",
vizapi/noderpc.py CHANGED
@@ -106,7 +106,7 @@ class Rpc(GrapheneRpc):
106
106
  """
107
107
 
108
108
  def __init__(self, *args, **kwargs):
109
- super(Rpc, self).__init__(*args, **kwargs)
109
+ super().__init__(*args, **kwargs)
110
110
 
111
111
  def __getattr__(self, name):
112
112
  """Map all methods to RPC calls and pass through the arguments."""
@@ -114,7 +114,7 @@ class Rpc(GrapheneRpc):
114
114
  def method(*args, **kwargs):
115
115
  api = kwargs.get("api", API.get(name))
116
116
  if not api:
117
- raise exceptions.NoSuchAPI('Cannot find API for you request "{}"'.format(name))
117
+ raise exceptions.NoSuchAPI(f'Cannot find API for you request "{name}"')
118
118
 
119
119
  # Fix wrong api name hardcoded in graphenecommon.TransactionBuilder
120
120
  if api == "network_broadcast":
vizbase/account.py CHANGED
@@ -1,6 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
-
4
1
  from graphenebase.account import Address as GPHAddress
5
2
  from graphenebase.account import BrainKey as GPHBrainKey
6
3
  from graphenebase.account import PasswordKey as GPHPasswordKey
vizbase/chains.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  DEFAULT_PREFIX = "VIZ"
3
2
  KNOWN_CHAINS = {
4
3
  "VIZ": {
vizbase/memo.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import hashlib
3
2
  import struct
4
3
  from binascii import hexlify, unhexlify
@@ -110,8 +109,8 @@ def decode_memo(priv, message):
110
109
  message = aes.decrypt(unhexlify(bytes(message, "ascii")))
111
110
  try:
112
111
  return _unpad(message.decode("utf8"), 16)
113
- except Exception:
114
- raise ValueError(message)
112
+ except Exception as err:
113
+ raise ValueError(message) from err
115
114
 
116
115
 
117
116
  def involved_keys(message):
vizbase/objects.py CHANGED
@@ -1,27 +1,17 @@
1
- # -*- coding: utf-8 -*-
2
1
  import struct
3
2
  from collections import OrderedDict
4
3
 
5
- from graphenebase.objects import GrapheneObject
4
+ from graphenebase.objects import GrapheneObject, isArgsThisClass
6
5
  from graphenebase.objects import Operation as GrapheneOperation
7
- from graphenebase.objects import isArgsThisClass
8
6
  from graphenebase.types import (
9
7
  Bytes,
10
8
  Int16,
11
9
  Map,
12
- Optional,
13
- PointInTime,
14
- Set,
15
- Signature,
16
10
  Static_variant,
17
11
  String,
18
- Uint8,
19
12
  Uint16,
20
13
  Uint32,
21
14
  Uint64,
22
- Varint32,
23
- Void,
24
- VoteId,
25
15
  )
26
16
 
27
17
  from .account import PublicKey
@@ -50,7 +40,7 @@ class Amount:
50
40
  def __bytes__(self):
51
41
  # padding
52
42
  asset = self.asset + "\x00" * (7 - len(self.asset))
53
- amount = round(float(self.amount) * 10 ** self.precision)
43
+ amount = round(float(self.amount) * 10**self.precision)
54
44
  return struct.pack("<q", amount) + struct.pack("<b", self.precision) + bytes(asset, "ascii")
55
45
 
56
46
  def __str__(self):
@@ -65,7 +55,12 @@ class Beneficiary(GrapheneObject):
65
55
  if len(args) == 1 and len(kwargs) == 0:
66
56
  kwargs = args[0]
67
57
  super().__init__(
68
- OrderedDict([("account", String(kwargs["account"])), ("weight", Int16(kwargs["weight"])),])
58
+ OrderedDict(
59
+ [
60
+ ("account", String(kwargs["account"])),
61
+ ("weight", Int16(kwargs["weight"])),
62
+ ]
63
+ )
69
64
  )
70
65
 
71
66
 
@@ -101,7 +96,11 @@ class Permission(GrapheneObject):
101
96
 
102
97
  if len(args) == 1 and len(kwargs) == 0:
103
98
  kwargs = args[0]
104
- kwargs["key_auths"] = sorted(kwargs["key_auths"], key=lambda x: x[0], reverse=False,)
99
+ kwargs["key_auths"] = sorted(
100
+ kwargs["key_auths"],
101
+ key=lambda x: x[0],
102
+ reverse=False,
103
+ )
105
104
  accountAuths = Map([[String(e[0]), Uint16(e[1])] for e in kwargs["account_auths"]])
106
105
  keyAuths = Map([[PublicKey(e[0], prefix=prefix), Uint16(e[1])] for e in kwargs["key_auths"]])
107
106
  super().__init__(
@@ -117,7 +116,6 @@ class Permission(GrapheneObject):
117
116
 
118
117
  class ChainPropertiesVariant(Static_variant):
119
118
  def __init__(self, props):
120
-
121
119
  version = 3
122
120
  data = ChainProperties(**props)
123
121
 
vizbase/operationids.py CHANGED
@@ -65,7 +65,7 @@ OPS = [
65
65
  "fixed_award",
66
66
  "target_account_sale",
67
67
  "bid",
68
- "outbid"
68
+ "outbid",
69
69
  ]
70
70
  operations = {o: OPS.index(o) for o in OPS}
71
71
 
@@ -91,5 +91,5 @@ VIRTUAL_OPS = [
91
91
  "cancel_paid_subscription",
92
92
  "expire_escrow_ratification",
93
93
  "bid",
94
- "outbid"
94
+ "outbid",
95
95
  ]
vizbase/operations.py CHANGED
@@ -1,32 +1,14 @@
1
- # -*- coding: utf-8 -*-
2
1
  import json
3
2
  from collections import OrderedDict
4
3
 
5
4
  from graphenebase.types import (
6
5
  Array,
7
6
  Bool,
8
- Bytes,
9
- Fixed_array,
10
- Id,
11
- Int16,
12
- Int64,
13
- Map,
14
7
  Optional,
15
8
  PointInTime,
16
- Ripemd160,
17
- Set,
18
- Sha1,
19
- Sha256,
20
- Signature,
21
- Static_variant,
22
9
  String,
23
- Uint8,
24
10
  Uint16,
25
- Uint32,
26
11
  Uint64,
27
- Varint32,
28
- Void,
29
- VoteId,
30
12
  )
31
13
 
32
14
  from .account import PublicKey
@@ -37,7 +19,6 @@ from .objects import (
37
19
  ChainPropertiesVariant,
38
20
  GrapheneObject,
39
21
  Op_wrapper,
40
- Operation,
41
22
  Permission,
42
23
  isArgsThisClass,
43
24
  )
@@ -129,7 +110,14 @@ class Account_metadata(GrapheneObject):
129
110
  else:
130
111
  meta = kwargs["json_metadata"]
131
112
 
132
- super().__init__(OrderedDict([("account", String(kwargs["account"])), ("json_metadata", String(meta)),]))
113
+ super().__init__(
114
+ OrderedDict(
115
+ [
116
+ ("account", String(kwargs["account"])),
117
+ ("json_metadata", String(meta)),
118
+ ]
119
+ )
120
+ )
133
121
 
134
122
 
135
123
  class Award(GrapheneObject):
@@ -150,7 +138,10 @@ class Award(GrapheneObject):
150
138
  ("energy", Uint16(kwargs["energy"])),
151
139
  ("custom_sequence", Uint64(kwargs["custom_sequence"])),
152
140
  ("memo", String(kwargs["memo"])),
153
- ("beneficiaries", Array([Beneficiary(o) for o in kwargs["beneficiaries"]]),),
141
+ (
142
+ "beneficiaries",
143
+ Array([Beneficiary(o) for o in kwargs["beneficiaries"]]),
144
+ ),
154
145
  ]
155
146
  )
156
147
  )
@@ -175,7 +166,10 @@ class Fixed_award(GrapheneObject):
175
166
  ("max_energy", Uint16(kwargs["max_energy"])),
176
167
  ("custom_sequence", Uint64(kwargs["custom_sequence"])),
177
168
  ("memo", String(kwargs["memo"])),
178
- ("beneficiaries", Array([Beneficiary(o) for o in kwargs["beneficiaries"]]),),
169
+ (
170
+ "beneficiaries",
171
+ Array([Beneficiary(o) for o in kwargs["beneficiaries"]]),
172
+ ),
179
173
  ]
180
174
  )
181
175
  )
@@ -229,7 +223,10 @@ class Withdraw_vesting(GrapheneObject):
229
223
  kwargs = args[0]
230
224
  super().__init__(
231
225
  OrderedDict(
232
- [("account", String(kwargs["account"])), ("vesting_shares", Amount(kwargs["vesting_shares"])),]
226
+ [
227
+ ("account", String(kwargs["account"])),
228
+ ("vesting_shares", Amount(kwargs["vesting_shares"])),
229
+ ]
233
230
  )
234
231
  )
235
232
 
@@ -264,7 +261,7 @@ class Set_withdraw_vesting_route(GrapheneObject):
264
261
  [
265
262
  ("from_account", String(kwargs["from_account"])),
266
263
  ("to_account", String(kwargs["to_account"])),
267
- ("percent", Uint16((kwargs["percent"]))),
264
+ ("percent", Uint16(kwargs["percent"])),
268
265
  ("auto_vest", Bool(kwargs["auto_vest"])),
269
266
  ]
270
267
  )
@@ -281,7 +278,7 @@ class Witness_update(GrapheneObject):
281
278
  prefix = kwargs.pop("prefix", DEFAULT_PREFIX)
282
279
 
283
280
  if not kwargs["block_signing_key"]:
284
- kwargs["block_signing_key"] = "{}1111111111111111111111111111111114T1Anm".format(prefix)
281
+ kwargs["block_signing_key"] = f"{prefix}1111111111111111111111111111111114T1Anm"
285
282
  super().__init__(
286
283
  OrderedDict(
287
284
  [
@@ -383,11 +380,17 @@ class Proposal_update(GrapheneObject):
383
380
  ("author", String(kwargs["author"])),
384
381
  ("title", String(kwargs["title"])),
385
382
  ("active_approvals_to_add", Array(active_approvals_to_add)),
386
- ("active_approvals_to_remove", Array(active_approvals_to_remove),),
383
+ (
384
+ "active_approvals_to_remove",
385
+ Array(active_approvals_to_remove),
386
+ ),
387
387
  ("master_approvals_to_add", Array(master_approvals_to_add)),
388
388
  ("master_approvals_to_remove", Array(master_approvals_to_remove)),
389
389
  ("regular_approvals_to_add", Array(regular_approvals_to_add)),
390
- ("regular_approvals_to_remove", Array(regular_approvals_to_remove),),
390
+ (
391
+ "regular_approvals_to_remove",
392
+ Array(regular_approvals_to_remove),
393
+ ),
391
394
  ("key_approvals_to_add", Array(key_approvals_to_add)),
392
395
  ("key_approvals_to_remove", Array(key_approvals_to_remove)),
393
396
  ("extensions", Array(kwargs.get("extensions") or [])),
@@ -434,8 +437,14 @@ class Custom(GrapheneObject):
434
437
  super().__init__(
435
438
  OrderedDict(
436
439
  [
437
- ("required_active_auths", Array([String(o) for o in kwargs["required_active_auths"]]),),
438
- ("required_regular_auths", Array([String(o) for o in kwargs["required_regular_auths"]]),),
440
+ (
441
+ "required_active_auths",
442
+ Array([String(o) for o in kwargs["required_active_auths"]]),
443
+ ),
444
+ (
445
+ "required_regular_auths",
446
+ Array([String(o) for o in kwargs["required_regular_auths"]]),
447
+ ),
439
448
  ("id", String(kwargs["id"])),
440
449
  ("json", String(js)),
441
450
  ]
@@ -1,8 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenebase.signedtransactions import Signed_Transaction as GrapheneSigned_Transaction
3
2
 
4
3
  from .chains import DEFAULT_PREFIX, KNOWN_CHAINS
5
- from .operations import Operation
4
+ from .objects import Operation
6
5
 
7
6
 
8
7
  class Signed_Transaction(GrapheneSigned_Transaction):
@@ -1,33 +0,0 @@
1
- viz/__init__.py,sha256=ARIwTTGC_2h4_yK4OTucCGNFe49FVUwJR4CfJGrDAJI,190
2
- viz/account.py,sha256=4dtsk2luTbI97AqQS-1E3SNEUMibnq-5ja7MQo2hgHk,10600
3
- viz/amount.py,sha256=6LoUfr4E9mOmWlRC0Smy9vKfUt0Hhdx7qH1C7mlEF70,5683
4
- viz/block.py,sha256=A0Kr5l_O_qD_VuvKrSw-ZCbfWWnS9TboA4qom570kLc,1117
5
- viz/blockchain.py,sha256=0GnP0vjpF8M5NqpjYkyikgKv3WD9AFZKA890DjfPLG4,8886
6
- viz/blockchainobject.py,sha256=9lfPuX2lfxXW_Gs4fFl0-RGB93g8OBcBTCADJB5fcYM,410
7
- viz/converter.py,sha256=w03bvh5042VUyDZKLLycJHcf-Fawh50KXZycozcv8Bk,1109
8
- viz/exceptions.py,sha256=LqFQSiPmfWb6ZxvaSjiBKTNXXuvCoyy7ay_-yidnIjI,452
9
- viz/instance.py,sha256=p9NSAeE61tMPLYBOCRUBiZ1uThCjAWg9tHjsM5RYTpc,1248
10
- viz/memo.py,sha256=KdVf3WtJhneuFBlL-vevVgbjMSnd_cFywJw3m5NnH6c,3831
11
- viz/storage.py,sha256=JMHwA1OELlwRFUY-HxeJUh2cowEvb8zWWvlueZcCzQE,746
12
- viz/transactionbuilder.py,sha256=aQp_q8PzzqdefeXP3F3OeAyQAwglsAqTWX8yCz-o9Jo,6160
13
- viz/utils.py,sha256=V7lcKGHTcM3fpaNADV76RPiUZcsfFSOILo0RDACG-4U,984
14
- viz/viz.py,sha256=msZ4g6VtZvLkChEww7FMBgPJiXe7nyffOkGiTwD6X7U,29016
15
- viz/wallet.py,sha256=TH8e8lKoYFzOMMUktI9ZWA2EmYTd5JttcNcTKQfXjt8,586
16
- viz/witness.py,sha256=PLobp_alomqHpVcB2yUFysMHSh3OxxqQ0dGRfwRfAko,1031
17
- vizapi/__init__.py,sha256=1mfkBk0riiobfZ00LKex4r8dDlCv4rU9kX7VMAUzQY4,49
18
- vizapi/consts.py,sha256=2M805JsnCIVKIJZLWSsAT4QhQOJoaTKxYX3egB76wV0,4408
19
- vizapi/exceptions.py,sha256=1qiuiUJ39rYKHnctEpHpoJGgYwXzgq6Oi2IbmRBewHk,853
20
- vizapi/noderpc.py,sha256=TuRmZ5VTEOT1-yU305q9Icp1RKtbANsUIzvbNeeLmrI,5188
21
- vizbase/__init__.py,sha256=TyuPogcL9AGGSDrJq_iIcKclvsn0ZoPhBpXFMjbGsH4,186
22
- vizbase/account.py,sha256=jiC2rwGqUxmbHFp41wRS1_FbPFL7FH_WghirYguQhns,3209
23
- vizbase/chains.py,sha256=j3Gky8pzHTFG17bqJNu3joyG3n7S6YeOyv9TO2WNGEY,504
24
- vizbase/exceptions.py,sha256=dm76Hj5tMoaKOTPJvTue1y8LuP3zfI8P_1BDBFyJVwM,87
25
- vizbase/memo.py,sha256=Uw5mKltcMSyUe8t8UPCHLgqDGZOkuID3b-5fytsRXUA,3937
26
- vizbase/objects.py,sha256=atEecCrDFDjIz8XR8q1IWZ1-o3IjFKOBev_ffr9Tts4,7490
27
- vizbase/operationids.py,sha256=yNrCZv7V6hQs4hfMWKORPCDiIGF3yKKopTlUuv5OiQc,2450
28
- vizbase/operations.py,sha256=DWJVSqgi8Q1R4xK9WuC7LCDR3yJuHpgoD4c64IrXNkY,16531
29
- vizbase/signedtransactions.py,sha256=gzqCdxfgWKkIYjzbaEiMYeFr-TsccGmuwmTqrNCAh00,692
30
- viz_python_lib-1.0.2.dist-info/LICENSE.txt,sha256=Nl1SGZTRwbvAko1uTG4FLQMol_feVwxCWnqCTQtf8No,1211
31
- viz_python_lib-1.0.2.dist-info/METADATA,sha256=CUnfdMIhaeWfxe_JkWcWA0PAbuq6k4fESJgd3_yMH9I,2766
32
- viz_python_lib-1.0.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
33
- viz_python_lib-1.0.2.dist-info/RECORD,,