hive-nectar 0.0.10__py3-none-any.whl → 0.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.

Potentially problematic release.


This version of hive-nectar might be problematic. Click here for more details.

Files changed (56) hide show
  1. {hive_nectar-0.0.10.dist-info → hive_nectar-0.1.0.dist-info}/METADATA +10 -11
  2. hive_nectar-0.1.0.dist-info/RECORD +88 -0
  3. nectar/__init__.py +1 -4
  4. nectar/account.py +791 -685
  5. nectar/amount.py +82 -21
  6. nectar/asset.py +1 -2
  7. nectar/block.py +34 -22
  8. nectar/blockchain.py +111 -143
  9. nectar/blockchaininstance.py +396 -247
  10. nectar/blockchainobject.py +33 -5
  11. nectar/cli.py +1058 -1349
  12. nectar/comment.py +317 -182
  13. nectar/community.py +39 -43
  14. nectar/constants.py +1 -14
  15. nectar/discussions.py +793 -139
  16. nectar/hive.py +137 -77
  17. nectar/hivesigner.py +106 -68
  18. nectar/imageuploader.py +33 -23
  19. nectar/instance.py +31 -79
  20. nectar/market.py +128 -264
  21. nectar/memo.py +40 -13
  22. nectar/message.py +23 -10
  23. nectar/nodelist.py +118 -82
  24. nectar/price.py +80 -61
  25. nectar/profile.py +6 -3
  26. nectar/rc.py +45 -25
  27. nectar/snapshot.py +285 -163
  28. nectar/storage.py +16 -5
  29. nectar/transactionbuilder.py +132 -41
  30. nectar/utils.py +37 -17
  31. nectar/version.py +1 -1
  32. nectar/vote.py +171 -30
  33. nectar/wallet.py +26 -19
  34. nectar/witness.py +153 -54
  35. nectarapi/graphenerpc.py +147 -133
  36. nectarapi/noderpc.py +12 -6
  37. nectarapi/rpcutils.py +12 -6
  38. nectarapi/version.py +1 -1
  39. nectarbase/ledgertransactions.py +24 -1
  40. nectarbase/objects.py +17 -6
  41. nectarbase/operations.py +160 -90
  42. nectarbase/signedtransactions.py +38 -2
  43. nectarbase/version.py +1 -1
  44. nectargraphenebase/account.py +295 -17
  45. nectargraphenebase/chains.py +0 -135
  46. nectargraphenebase/ecdsasig.py +152 -176
  47. nectargraphenebase/types.py +18 -4
  48. nectargraphenebase/unsignedtransactions.py +1 -1
  49. nectargraphenebase/version.py +1 -1
  50. hive_nectar-0.0.10.dist-info/RECORD +0 -91
  51. nectar/blurt.py +0 -562
  52. nectar/conveyor.py +0 -308
  53. nectar/steem.py +0 -581
  54. {hive_nectar-0.0.10.dist-info → hive_nectar-0.1.0.dist-info}/WHEEL +0 -0
  55. {hive_nectar-0.0.10.dist-info → hive_nectar-0.1.0.dist-info}/entry_points.txt +0 -0
  56. {hive_nectar-0.0.10.dist-info → hive_nectar-0.1.0.dist-info}/licenses/LICENSE.txt +0 -0
nectar/witness.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import json
3
+ import warnings
3
4
  from datetime import date, datetime, timezone
4
5
 
5
6
  from prettytable import PrettyTable
@@ -21,27 +22,54 @@ class Witness(BlockchainObject):
21
22
  :param bool lazy: Use lazy loading
22
23
  :param bool full: Get full data about witness
23
24
  :param nectar.nectar.nectar blockchain_instance: nectar
24
- instance to use when accesing a RPC
25
+ instance to use when accessing the RPC
25
26
  """
26
27
 
27
28
  type_id = 3
28
29
 
29
30
  def __init__(self, owner, full=False, lazy=False, blockchain_instance=None, **kwargs):
31
+ # Warn about any unused kwargs to maintain backward compatibility
32
+ """
33
+ Initialize a Witness object representing a blockchain witness.
34
+
35
+ Parameters:
36
+ owner (str | dict): Witness owner account name or a dictionary of witness fields. If a dict is provided, it will be parsed into the internal witness representation.
37
+ full (bool): If True, load full witness data when available; otherwise keep a lighter representation.
38
+ lazy (bool): If True, defer network loading until data is accessed.
39
+
40
+ Notes:
41
+ - `blockchain_instance` defaults to the shared blockchain instance when not provided.
42
+ - Any unexpected keyword arguments are accepted for backward compatibility but will trigger a DeprecationWarning and be ignored.
43
+ """
44
+ if kwargs:
45
+ for key in kwargs:
46
+ warnings.warn(
47
+ f"Unexpected keyword argument '{key}' passed to Witness.__init__. "
48
+ "This may be a deprecated parameter and will be ignored.",
49
+ DeprecationWarning,
50
+ stacklevel=2,
51
+ )
30
52
  self.full = full
31
53
  self.lazy = lazy
32
- if blockchain_instance is None:
33
- if kwargs.get("steem_instance"):
34
- blockchain_instance = kwargs["steem_instance"]
35
- elif kwargs.get("hive_instance"):
36
- blockchain_instance = kwargs["hive_instance"]
37
54
  self.blockchain = blockchain_instance or shared_blockchain_instance()
38
55
  if isinstance(owner, dict):
39
56
  owner = self._parse_json_data(owner)
40
57
  super(Witness, self).__init__(
41
- owner, lazy=lazy, full=full, id_item="owner", blockchain_instance=blockchain_instance
58
+ owner, lazy=lazy, full=full, id_item="owner", blockchain_instance=self.blockchain
42
59
  )
43
60
 
44
61
  def refresh(self):
62
+ """
63
+ Refresh the witness data from the blockchain and reinitialize this object.
64
+
65
+ If the witness identifier is empty or the blockchain is not connected, the method returns early.
66
+ Fetches witness data via the configured RPC (supports both appbase and legacy RPC paths), parses
67
+ timestamps and numeric fields via _parse_json_data, and reinitializes the Witness instance with the
68
+ retrieved data (respecting this object's lazy/full flags and blockchain instance).
69
+
70
+ Raises:
71
+ WitnessDoesNotExistsException: If no witness information is found for the current identifier.
72
+ """
45
73
  if not self.identifier:
46
74
  return
47
75
  if not self.blockchain.is_connected():
@@ -125,13 +153,25 @@ class Witness(BlockchainObject):
125
153
  )
126
154
 
127
155
  def feed_publish(self, base, quote=None, account=None):
128
- """Publish a feed price as a witness.
156
+ """
157
+ Publish a witness feed price (exchange rate) to the blockchain.
158
+
159
+ Accepts the base and quote as Amount objects, strings, or numeric values and submits a Feed_publish operation using the provided account (defaults to the witness owner).
160
+
161
+ Parameters:
162
+ base: Amount | str | number
163
+ The base side of the exchange_rate (must use the blockchain's backed token symbol).
164
+ quote: Amount | str | number, optional
165
+ The quote side of the exchange_rate. Defaults to "1.000 <TOKEN>" where <TOKEN> is the blockchain token_symbol.
166
+ account: str | Account, optional
167
+ Account name or Account object used to sign and publish the feed. If omitted, the witness owner is used.
129
168
 
130
- :param float base: USD Price of STEEM in SBD (implied price)
131
- :param float quote: (optional) Quote Price. Should be 1.000 (default), unless
132
- we are adjusting the feed to support the peg.
133
- :param str account: (optional) the source account for the transfer
134
- if not self["owner"]
169
+ Returns:
170
+ The result returned by blockchain.finalizeOp (typically the broadcast/transaction result).
171
+
172
+ Raises:
173
+ ValueError: If no account is provided and the witness has no owner.
174
+ AssertionError: If the resolved base or quote symbols do not match the blockchain's expected backed_token_symbol and token_symbol, respectively.
135
175
  """
136
176
  quote = quote if quote is not None else "1.000 %s" % (self.blockchain.token_symbol)
137
177
  if not account:
@@ -349,8 +389,8 @@ class GetWitnesses(WitnessesObject):
349
389
  :param list name_list: list of witneses to fetch
350
390
  :param int batch_limit: (optional) maximum number of witnesses
351
391
  to fetch per call, defaults to 100
352
- :param Steem steem_instance: Steem() instance to use when
353
- accessing a RPCcreator = Witness(creator, steem_instance=self)
392
+ :param nectar.nectar.nectar blockchain_instance: nectar instance to use when
393
+ accessing the RPC
354
394
 
355
395
  .. code-block:: python
356
396
 
@@ -362,13 +402,24 @@ class GetWitnesses(WitnessesObject):
362
402
  """
363
403
 
364
404
  def __init__(
365
- self, name_list, batch_limit=100, lazy=False, full=True, blockchain_instance=None, **kwargs
405
+ self,
406
+ name_list,
407
+ batch_limit=100,
408
+ lazy=False,
409
+ full=True,
410
+ blockchain_instance=None,
366
411
  ):
367
- if blockchain_instance is None:
368
- if kwargs.get("steem_instance"):
369
- blockchain_instance = kwargs["steem_instance"]
370
- elif kwargs.get("hive_instance"):
371
- blockchain_instance = kwargs["hive_instance"]
412
+ """
413
+ Initialize the GetWitnesses collection by fetching witness objects for the given list of account names.
414
+
415
+ If the connected RPC backend uses appbase, names are fetched in batches (size controlled by `batch_limit`); otherwise each name is queried individually. If no blockchain connection is available the initializer returns early and the collection remains empty.
416
+
417
+ Parameters:
418
+ name_list (Iterable[str]): Account names of witnesses to retrieve.
419
+ batch_limit (int): Maximum number of names to request per batch when using appbase RPC.
420
+ lazy (bool): If True, create Witness objects in lazy-loading mode.
421
+ full (bool): If True, create Witness objects with full data loaded.
422
+ """
372
423
  self.blockchain = blockchain_instance or shared_blockchain_instance()
373
424
  if not self.blockchain.is_connected():
374
425
  return
@@ -396,8 +447,8 @@ class GetWitnesses(WitnessesObject):
396
447
  class Witnesses(WitnessesObject):
397
448
  """Obtain a list of **active** witnesses and the current schedule
398
449
 
399
- :param Steem steem_instance: Steem instance to use when
400
- accesing a RPC
450
+ :param nectar.nectar.nectar blockchain_instance: nectar instance to use when
451
+ accessing the RPC
401
452
 
402
453
  .. code-block:: python
403
454
 
@@ -407,12 +458,17 @@ class Witnesses(WitnessesObject):
407
458
 
408
459
  """
409
460
 
410
- def __init__(self, lazy=False, full=True, blockchain_instance=None, **kwargs):
411
- if blockchain_instance is None:
412
- if kwargs.get("steem_instance"):
413
- blockchain_instance = kwargs["steem_instance"]
414
- elif kwargs.get("hive_instance"):
415
- blockchain_instance = kwargs["hive_instance"]
461
+ def __init__(self, lazy=False, full=True, blockchain_instance=None):
462
+ """
463
+ Initialize a Witnesses collection and load active witnesses from the configured blockchain.
464
+
465
+ Parameters:
466
+ lazy (bool): If True, create Witness objects without fetching full data (deferred loading).
467
+ full (bool): If True, eager-load full witness data when constructing each Witness.
468
+
469
+ Notes:
470
+ Resolves the blockchain instance from `blockchain_instance` or the shared default and immediately calls `refresh()` to populate the list of active witnesses.
471
+ """
416
472
  self.blockchain = blockchain_instance or shared_blockchain_instance()
417
473
  self.lazy = lazy
418
474
  self.full = full
@@ -449,8 +505,8 @@ class WitnessesVotedByAccount(WitnessesObject):
449
505
  """Obtain a list of witnesses which have been voted by an account
450
506
 
451
507
  :param str account: Account name
452
- :param Steem steem_instance: Steem instance to use when
453
- accesing a RPC
508
+ :param nectar.nectar.nectar blockchain_instance: nectar instance to use when
509
+ accessing the RPC
454
510
 
455
511
  .. code-block:: python
456
512
 
@@ -460,12 +516,20 @@ class WitnessesVotedByAccount(WitnessesObject):
460
516
 
461
517
  """
462
518
 
463
- def __init__(self, account, lazy=False, full=True, blockchain_instance=None, **kwargs):
464
- if blockchain_instance is None:
465
- if kwargs.get("steem_instance"):
466
- blockchain_instance = kwargs["steem_instance"]
467
- elif kwargs.get("hive_instance"):
468
- blockchain_instance = kwargs["hive_instance"]
519
+ def __init__(self, account, lazy=False, full=True, blockchain_instance=None):
520
+ """
521
+ Initialize a WitnessesVotedByAccount collection for the given account.
522
+
523
+ Resolves the provided account to a full Account object, reads the list of witnesses that the account voted for (using appbase or legacy RPC paths as appropriate), and populates the list with Witness objects created with the specified loading flags. If the account has no witness votes recorded the constructor returns early and the collection remains empty. The instance identifier is set to the account name.
524
+
525
+ Parameters:
526
+ account (str|Account): Account name or Account-like object to inspect for witness votes.
527
+ lazy (bool): If True, create Witness objects in lazy-loading mode. Defaults to False.
528
+ full (bool): If True, request full witness data when constructing Witness objects. Defaults to True.
529
+
530
+ Note:
531
+ The blockchain instance is taken from the optional `blockchain_instance` argument or the shared default; it is not documented here as a parameter.
532
+ """
469
533
  self.blockchain = blockchain_instance or shared_blockchain_instance()
470
534
  self.account = Account(account, full=True, blockchain_instance=self.blockchain)
471
535
  account_name = self.account["name"]
@@ -500,8 +564,8 @@ class WitnessesRankedByVote(WitnessesObject):
500
564
 
501
565
  :param str from_account: Witness name from which the lists starts (default = "")
502
566
  :param int limit: Limits the number of shown witnesses (default = 100)
503
- :param Steem steem_instance: Steem instance to use when
504
- accesing a RPC
567
+ :param nectar.nectar.nectar blockchain_instance: nectar instance to use when
568
+ accessing the RPC
505
569
 
506
570
  .. code-block:: python
507
571
 
@@ -512,13 +576,34 @@ class WitnessesRankedByVote(WitnessesObject):
512
576
  """
513
577
 
514
578
  def __init__(
515
- self, from_account="", limit=100, lazy=False, full=False, blockchain_instance=None, **kwargs
579
+ self,
580
+ from_account="",
581
+ limit=100,
582
+ lazy=False,
583
+ full=False,
584
+ blockchain_instance=None,
516
585
  ):
517
- if blockchain_instance is None:
518
- if kwargs.get("steem_instance"):
519
- blockchain_instance = kwargs["steem_instance"]
520
- elif kwargs.get("hive_instance"):
521
- blockchain_instance = kwargs["hive_instance"]
586
+ """
587
+ Initialize a list of witnesses ranked by vote, with optional pagination.
588
+
589
+ Builds a WitnessesRankedByVote list starting at `from_account` and returning up to `limit`
590
+ entries. The constructor transparently pages RPC calls when the requested `limit`
591
+ exceeds the per-call query limit, handles appbase vs legacy RPC paths and condenser
592
+ mode, and wraps returned witness entries as Witness objects.
593
+
594
+ Parameters:
595
+ from_account (str): Account name to start ranking from (inclusive). When empty, ranking starts from the top.
596
+ limit (int): Maximum number of witnesses to return.
597
+ lazy (bool): If True, create Witness objects in lazy-loading mode.
598
+ full (bool): If True, fully load each Witness on creation.
599
+
600
+ Notes:
601
+ - `blockchain_instance` is taken from the shared instance when not provided.
602
+ - The method uses different RPC endpoints depending on the node configuration
603
+ (appbase vs non-appbase, and condenser mode) and automatically pages results
604
+ to satisfy `limit`.
605
+ - Returns early (no list created) if no witnesses are found.
606
+ """
522
607
  self.blockchain = blockchain_instance or shared_blockchain_instance()
523
608
  witnessList = []
524
609
  last_limit = limit
@@ -577,10 +662,10 @@ class WitnessesRankedByVote(WitnessesObject):
577
662
  class ListWitnesses(WitnessesObject):
578
663
  """List witnesses ranked by name
579
664
 
580
- :param str from_account: Witness name from which the lists starts (default = "")
665
+ :param str from_account: Witness name from which the list starts (default = "")
581
666
  :param int limit: Limits the number of shown witnesses (default = 100)
582
- :param Steem steem_instance: Steem instance to use when
583
- accesing a RPC
667
+ :param nectar.nectar.nectar blockchain_instance: nectar instance to use when
668
+ accessing the RPC
584
669
 
585
670
  .. code-block:: python
586
671
 
@@ -591,13 +676,27 @@ class ListWitnesses(WitnessesObject):
591
676
  """
592
677
 
593
678
  def __init__(
594
- self, from_account="", limit=100, lazy=False, full=False, blockchain_instance=None, **kwargs
679
+ self,
680
+ from_account="",
681
+ limit=100,
682
+ lazy=False,
683
+ full=False,
684
+ blockchain_instance=None,
595
685
  ):
596
- if blockchain_instance is None:
597
- if kwargs.get("steem_instance"):
598
- blockchain_instance = kwargs["steem_instance"]
599
- elif kwargs.get("hive_instance"):
600
- blockchain_instance = kwargs["hive_instance"]
686
+ """
687
+ Initialize a ListWitnesses collection starting from a given account name.
688
+
689
+ Creates a list of Witness objects beginning at `from_account` (lexicographic start)
690
+ up to `limit` entries. If no witnesses are found the constructor returns early
691
+ leaving the instance empty. The object uses the provided blockchain instance
692
+ (or the shared default) to query the node and sets `identifier` to `from_account`.
693
+
694
+ Parameters:
695
+ from_account (str): Account name to start listing witnesses from (inclusive).
696
+ limit (int): Maximum number of witness entries to retrieve.
697
+ lazy (bool): If True, construct Witness objects in lazy mode (defer full data load).
698
+ full (bool): If True, request full witness data when constructing Witness objects.
699
+ """
601
700
  self.blockchain = blockchain_instance or shared_blockchain_instance()
602
701
  self.identifier = from_account
603
702
  self.blockchain.rpc.set_next_node_on_empty_reply(False)