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
nectarbase/operations.py CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import json
3
3
  import re
4
+ import warnings
4
5
  from binascii import hexlify
5
6
  from collections import OrderedDict
6
7
 
@@ -467,11 +468,24 @@ class Update_proposal_votes(GrapheneObject):
467
468
 
468
469
  class Remove_proposal(GrapheneObject):
469
470
  def __init__(self, *args, **kwargs):
471
+ """
472
+ Initialize a Remove_proposal operation.
473
+
474
+ Creates the internal OrderedDict for a remove_proposal operation with:
475
+ - proposal_owner: account name (String)
476
+ - proposal_ids: list of Uint64-wrapped proposal IDs
477
+ - extensions: empty Array
478
+
479
+ If initialized with a single existing GrapheneObject instance, initialization returns early after copying that instance's data (handled by check_for_class).
480
+
481
+ Required kwargs:
482
+ - proposal_owner: str
483
+ - proposal_ids: iterable of integers (each converted to Uint64)
484
+ """
470
485
  if check_for_class(self, args):
471
486
  return
472
487
  if len(args) == 1 and len(kwargs) == 0:
473
488
  kwargs = args[0]
474
- prefix = kwargs.get("prefix", default_prefix)
475
489
  extensions = Array([])
476
490
  proposal_ids = []
477
491
  for e in kwargs["proposal_ids"]:
@@ -490,12 +504,26 @@ class Remove_proposal(GrapheneObject):
490
504
 
491
505
  class Update_proposal(GrapheneObject):
492
506
  def __init__(self, *args, **kwargs):
507
+ """
508
+ Initialize an Update_proposal operation.
509
+
510
+ Accepts either an existing Update_proposal instance (handled by check_for_class), a single positional dict, or keyword arguments. Required fields: `proposal_id`, `creator`, `daily_pay`, `subject`, and `permlink`. Optional `end_date` will be converted into an `update_proposal_end_date` extension. The `daily_pay` Amount uses the provided `prefix` kwarg if present, otherwise `default_prefix` is used.
511
+
512
+ Accepted kwargs:
513
+ - proposal_id: numeric id of the proposal (converted to Uint64)
514
+ - creator: account name string (converted to String)
515
+ - daily_pay: amount specifier (converted to Amount; honors `prefix`)
516
+ - subject: short subject string (converted to String)
517
+ - permlink: permlink string (converted to String)
518
+ - end_date: optional datetime/string; if provided, added as an extension
519
+ - prefix: optional asset/account prefix for Amount conversion (defaults to module `default_prefix`)
520
+
521
+ No return value; constructs the internal OrderedDict representing the operation.
522
+ """
493
523
  if check_for_class(self, args):
494
524
  return
495
525
  if len(args) == 1 and len(kwargs) == 0:
496
526
  kwargs = args[0]
497
-
498
- prefix = kwargs.get("prefix", default_prefix)
499
527
  extensions = Array([])
500
528
  if "end_date" in kwargs and kwargs["end_date"]:
501
529
  extension = {
@@ -509,7 +537,10 @@ class Update_proposal(GrapheneObject):
509
537
  [
510
538
  ("proposal_id", Uint64(kwargs["proposal_id"])),
511
539
  ("creator", String(kwargs["creator"])),
512
- ("daily_pay", Amount(kwargs["daily_pay"], prefix=prefix)),
540
+ (
541
+ "daily_pay",
542
+ Amount(kwargs["daily_pay"], prefix=kwargs.get("prefix", default_prefix)),
543
+ ),
513
544
  ("subject", String(kwargs["subject"])),
514
545
  ("permlink", String(kwargs["permlink"])),
515
546
  ("extensions", extensions),
@@ -679,6 +710,30 @@ class Custom_json(GrapheneObject):
679
710
 
680
711
  class Comment_options(GrapheneObject):
681
712
  def __init__(self, *args, **kwargs):
713
+ """
714
+ Initialize a Comment_options operation.
715
+
716
+ This constructor builds the serialized fields for a comment options operation from provided keyword arguments or a single dict positional argument. It converts and validates inputs into the expected Graphene types and handles backward compatibility and extensions.
717
+
718
+ Expected kwargs:
719
+ - author (str): post author.
720
+ - permlink (str): post permlink.
721
+ - max_accepted_payout (str|Amount): payout limit; converted to Amount using optional `prefix` and `json_str`.
722
+ - percent_hbd (int|str): required percent value (primary source) stored as Uint16.
723
+ - percent_steem_dollars (int|str, optional, deprecated): fallback for `percent_hbd`; using it emits a DeprecationWarning.
724
+ - allow_votes (bool): whether voting is allowed.
725
+ - allow_curation_rewards (bool): whether curation rewards are allowed.
726
+ - beneficiaries (list, optional): if provided, placed into extensions as a beneficiaries extension.
727
+ - extensions (iterable, optional): explicit extensions; each entry is wrapped with CommentOptionExtensions.
728
+ - prefix (str, optional): asset/account prefix used when constructing Amount (defaults to module default_prefix).
729
+ - json_str (bool, optional): if true, construct Amount with json string mode.
730
+
731
+ Behavior and side effects:
732
+ - If initialized from an existing GrapheneObject (via check_for_class), initialization returns early after copying.
733
+ - If `beneficiaries` is present and non-empty, it is converted into an extensions entry.
734
+ - If neither `percent_hbd` nor `percent_steem_dollars` is provided, raises ValueError.
735
+ - If `percent_steem_dollars` is used, emits a DeprecationWarning.
736
+ """
682
737
  if check_for_class(self, args):
683
738
  return
684
739
  if len(args) == 1 and len(kwargs) == 0:
@@ -691,40 +746,34 @@ class Comment_options(GrapheneObject):
691
746
  extensions = Array([])
692
747
  if "extensions" in kwargs and kwargs["extensions"]:
693
748
  extensions = Array([CommentOptionExtensions(o) for o in kwargs["extensions"]])
694
- if "percent_hbd" in kwargs:
695
- super(Comment_options, self).__init__(
696
- OrderedDict(
697
- [
698
- ("author", String(kwargs["author"])),
699
- ("permlink", String(kwargs["permlink"])),
700
- (
701
- "max_accepted_payout",
702
- Amount(kwargs["max_accepted_payout"], prefix=prefix, json_str=json_str),
703
- ),
704
- ("percent_hbd", Uint16(int(kwargs["percent_hbd"]))),
705
- ("allow_votes", Bool(bool(kwargs["allow_votes"]))),
706
- ("allow_curation_rewards", Bool(bool(kwargs["allow_curation_rewards"]))),
707
- ("extensions", extensions),
708
- ]
709
- )
710
- )
711
- else:
712
- super(Comment_options, self).__init__(
713
- OrderedDict(
714
- [
715
- ("author", String(kwargs["author"])),
716
- ("permlink", String(kwargs["permlink"])),
717
- (
718
- "max_accepted_payout",
719
- Amount(kwargs["max_accepted_payout"], prefix=prefix),
720
- ),
721
- ("percent_steem_dollars", Uint16(int(kwargs["percent_steem_dollars"]))),
722
- ("allow_votes", Bool(bool(kwargs["allow_votes"]))),
723
- ("allow_curation_rewards", Bool(bool(kwargs["allow_curation_rewards"]))),
724
- ("extensions", extensions),
725
- ]
749
+ percent_value = kwargs.get("percent_hbd")
750
+ if percent_value is None:
751
+ # Backward compatibility: fall back to percent_steem_dollars
752
+ percent_value = kwargs.get("percent_steem_dollars")
753
+ if percent_value is not None:
754
+ warnings.warn(
755
+ "Parameter 'percent_steem_dollars' is deprecated. Use 'percent_hbd' instead.",
756
+ DeprecationWarning,
757
+ stacklevel=2,
726
758
  )
759
+ else:
760
+ raise ValueError("Comment_options requires 'percent_hbd'")
761
+ super(Comment_options, self).__init__(
762
+ OrderedDict(
763
+ [
764
+ ("author", String(kwargs["author"])),
765
+ ("permlink", String(kwargs["permlink"])),
766
+ (
767
+ "max_accepted_payout",
768
+ Amount(kwargs["max_accepted_payout"], prefix=prefix, json_str=json_str),
769
+ ),
770
+ ("percent_hbd", Uint16(int(percent_value))),
771
+ ("allow_votes", Bool(bool(kwargs["allow_votes"]))),
772
+ ("allow_curation_rewards", Bool(bool(kwargs["allow_curation_rewards"]))),
773
+ ("extensions", extensions),
774
+ ]
727
775
  )
776
+ )
728
777
 
729
778
 
730
779
  class Delete_comment(GrapheneObject):
@@ -1019,63 +1068,52 @@ class Cancel_transfer_from_savings(GrapheneObject):
1019
1068
 
1020
1069
  class Claim_reward_balance(GrapheneObject):
1021
1070
  def __init__(self, *args, **kwargs):
1071
+ """
1072
+ Initialize a Claim_reward_balance operation.
1073
+
1074
+ Constructs the serialized fields for claiming reward balances. Requires
1075
+ account, reward_hive, reward_hbd, and reward_vests in the canonical order.
1076
+ All reward fields are required asset strings - use "0.000 HIVE" or "0.000 HBD"
1077
+ when nothing to claim for that asset.
1078
+
1079
+ Behavior:
1080
+ - Always serializes ("account", "reward_hive", "reward_hbd", "reward_vests")
1081
+ - Converts provided values to Amount objects, respecting prefix/json_str behavior
1082
+ - Uses zero-asset strings ("0.000 HIVE"/"0.000 HBD") for any missing reward fields
1083
+
1084
+ Recognized kwargs:
1085
+ - account (str): account name claiming rewards.
1086
+ - reward_hive (str|Amount): HIVE amount to claim (required, use "0.000 HIVE" if none).
1087
+ - reward_hbd (str|Amount): HBD amount to claim (required, use "0.000 HBD" if none).
1088
+ - reward_vests (str|Amount): VESTS amount to claim.
1089
+ - prefix (str): asset prefix to use (defaults to module default_prefix).
1090
+ - json_str (bool): if True, pass amounts as JSON-string form to Amount.
1091
+
1092
+ Also supports initialization from an existing instance via the module's check_for_class helper.
1093
+ """
1022
1094
  if check_for_class(self, args):
1023
1095
  return
1024
1096
  if len(args) == 1 and len(kwargs) == 0:
1025
1097
  kwargs = args[0]
1026
1098
  prefix = kwargs.get("prefix", default_prefix)
1027
1099
  json_str = kwargs.get("json_str", False)
1028
- if "reward_sbd" in kwargs and "reward_steem" in kwargs:
1029
- super(Claim_reward_balance, self).__init__(
1030
- OrderedDict(
1031
- [
1032
- ("account", String(kwargs["account"])),
1033
- (
1034
- "reward_steem",
1035
- Amount(kwargs["reward_steem"], prefix=prefix, json_str=json_str),
1036
- ),
1037
- (
1038
- "reward_sbd",
1039
- Amount(kwargs["reward_sbd"], prefix=prefix, json_str=json_str),
1040
- ),
1041
- ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1042
- ]
1043
- )
1044
- )
1045
- elif "reward_hbd" in kwargs and "reward_hive" in kwargs:
1046
- super(Claim_reward_balance, self).__init__(
1047
- OrderedDict(
1048
- [
1049
- ("account", String(kwargs["account"])),
1050
- ("reward_hive", Amount(kwargs["reward_hive"], prefix=prefix)),
1051
- ("reward_hbd", Amount(kwargs["reward_hbd"], prefix=prefix)),
1052
- ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1053
- ]
1054
- )
1055
- )
1056
- elif "reward_hive" in kwargs:
1057
- super(Claim_reward_balance, self).__init__(
1058
- OrderedDict(
1059
- [
1060
- ("account", String(kwargs["account"])),
1061
- (
1062
- "reward_hive",
1063
- Amount(kwargs["reward_hive"], prefix=prefix, json_str=json_str),
1064
- ),
1065
- ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1066
- ]
1067
- )
1068
- )
1069
- else:
1070
- super(Claim_reward_balance, self).__init__(
1071
- OrderedDict(
1072
- [
1073
- ("account", String(kwargs["account"])),
1074
- ("reward_steem", Amount(kwargs["reward_steem"], prefix=prefix)),
1075
- ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1076
- ]
1077
- )
1100
+
1101
+ # Ensure all required fields are present, using zero amounts for missing rewards
1102
+ account = kwargs["account"]
1103
+ reward_hive = kwargs.get("reward_hive", "0.000 HIVE")
1104
+ reward_hbd = kwargs.get("reward_hbd", "0.000 HBD")
1105
+ reward_vests = kwargs["reward_vests"]
1106
+
1107
+ super(Claim_reward_balance, self).__init__(
1108
+ OrderedDict(
1109
+ [
1110
+ ("account", String(account)),
1111
+ ("reward_hive", Amount(reward_hive, prefix=prefix, json_str=json_str)),
1112
+ ("reward_hbd", Amount(reward_hbd, prefix=prefix, json_str=json_str)),
1113
+ ("reward_vests", Amount(reward_vests, prefix=prefix, json_str=json_str)),
1114
+ ]
1078
1115
  )
1116
+ )
1079
1117
 
1080
1118
 
1081
1119
  class Transfer_to_savings(GrapheneObject):
@@ -1143,6 +1181,23 @@ class Recover_account(GrapheneObject):
1143
1181
 
1144
1182
  class Escrow_transfer(GrapheneObject):
1145
1183
  def __init__(self, *args, **kwargs):
1184
+ """
1185
+ Initialize an Escrow_transfer operation object.
1186
+
1187
+ If constructed from an existing GrapheneObject instance (detected via check_for_class), the initializer returns early after copying data.
1188
+
1189
+ Accepts either a single dict positional argument or keyword arguments. Expected fields:
1190
+ - from, to, agent (str): account names involved.
1191
+ - escrow_id (int): escrow identifier.
1192
+ - hbd_amount, hive_amount, fee: amounts; when both `hbd_amount` and `hive_amount` are provided, amounts are wrapped with the `json_str` option; otherwise amounts are wrapped without `json_str`.
1193
+ - ratification_deadline, escrow_expiration: datetime-like values for deadlines.
1194
+ - json_meta: optional metadata — if a dict or list it will be JSON-serialized; otherwise used as-is.
1195
+ Optional kwargs:
1196
+ - prefix (str): asset prefix (default "STM").
1197
+ - json_str (bool): whether to force JSON string representation for Amount fields when the branch requires it.
1198
+
1199
+ No return value; constructs and initializes the underlying ordered field mapping for the operation.
1200
+ """
1146
1201
  if check_for_class(self, args):
1147
1202
  return
1148
1203
  if len(args) == 1 and len(kwargs) == 0:
@@ -1186,8 +1241,8 @@ class Escrow_transfer(GrapheneObject):
1186
1241
  ("to", String(kwargs["to"])),
1187
1242
  ("agent", String(kwargs["agent"])),
1188
1243
  ("escrow_id", Uint32(kwargs["escrow_id"])),
1189
- ("sbd_amount", Amount(kwargs["sbd_amount"], prefix=prefix)),
1190
- ("steem_amount", Amount(kwargs["steem_amount"], prefix=prefix)),
1244
+ ("hbd_amount", Amount(kwargs["hbd_amount"], prefix=prefix)),
1245
+ ("hive_amount", Amount(kwargs["hive_amount"], prefix=prefix)),
1191
1246
  ("fee", Amount(kwargs["fee"], prefix=prefix)),
1192
1247
  ("ratification_deadline", PointInTime(kwargs["ratification_deadline"])),
1193
1248
  ("escrow_expiration", PointInTime(kwargs["escrow_expiration"])),
@@ -1217,6 +1272,21 @@ class Escrow_dispute(GrapheneObject):
1217
1272
 
1218
1273
  class Escrow_release(GrapheneObject):
1219
1274
  def __init__(self, *args, **kwargs):
1275
+ """
1276
+ Initialize an Escrow_release operation.
1277
+
1278
+ Constructs the operation fields required to release escrowed funds: from, to, who, escrow_id, hbd_amount, and hive_amount. Accepts either a single dict positional argument or keyword arguments. If initialized from an existing GrapheneObject instance (detected by check_for_class), initialization returns early after cloning.
1279
+
1280
+ Key kwargs:
1281
+ - from, to, who (str): account names involved in the escrow release.
1282
+ - escrow_id (int): escrow identifier.
1283
+ - hbd_amount, hive_amount (str|Amount): amounts to release; wrapped as Amount objects using the provided prefix.
1284
+ - prefix (str, optional): asset/account prefix passed to Amount (defaults to default_prefix).
1285
+ - json_str (bool, optional): when True and both amount keys are present, amounts are wrapped with json_str enabled.
1286
+
1287
+ Raises:
1288
+ - KeyError if any required field is missing.
1289
+ """
1220
1290
  if check_for_class(self, args):
1221
1291
  return
1222
1292
  if len(args) == 1 and len(kwargs) == 0:
@@ -1250,8 +1320,8 @@ class Escrow_release(GrapheneObject):
1250
1320
  ("to", String(kwargs["to"])),
1251
1321
  ("who", String(kwargs["who"])),
1252
1322
  ("escrow_id", Uint32(kwargs["escrow_id"])),
1253
- ("sbd_amount", Amount(kwargs["sbd_amount"], prefix=prefix)),
1254
- ("steem_amount", Amount(kwargs["steem_amount"], prefix=prefix)),
1323
+ ("hbd_amount", Amount(kwargs["hbd_amount"], prefix=prefix)),
1324
+ ("hive_amount", Amount(kwargs["hive_amount"], prefix=prefix)),
1255
1325
  ]
1256
1326
  )
1257
1327
  )
@@ -30,18 +30,54 @@ class Signed_Transaction(GrapheneSigned_Transaction):
30
30
  super(Signed_Transaction, self).__init__(*args, **kwargs)
31
31
 
32
32
  def add_custom_chains(self, custom_chain):
33
+ """
34
+ Add entries from custom_chain into this transaction's known chains without overwriting existing entries.
35
+
36
+ Accepts a mapping of chain identifiers to chain configuration values and merges any keys not already present into self.known_chains. Existing known chains are left unchanged.
37
+ Parameters:
38
+ custom_chain (Mapping): Mapping of chain name -> chain data (e.g., RPC URL or chain parameters); keys present in self.known_chains are not replaced.
39
+ """
33
40
  if len(custom_chain) > 0:
34
41
  for c in custom_chain:
35
42
  if c not in self.known_chains:
36
43
  self.known_chains[c] = custom_chain[c]
37
44
 
38
- def sign(self, wifkeys, chain="STEEM"):
45
+ def sign(self, wifkeys, chain="HIVE"):
46
+ """
47
+ Sign the transaction using one or more WIF-format private keys.
48
+
49
+ wifkeys: Single WIF string or iterable of WIF private key strings used to produce signatures.
50
+ chain: Chain identifier to use for signing (defaults to "HIVE").
51
+
52
+ Returns:
53
+ The value returned by the superclass `sign` implementation.
54
+ """
39
55
  return super(Signed_Transaction, self).sign(wifkeys, chain)
40
56
 
41
- def verify(self, pubkeys=[], chain="STEEM", recover_parameter=False):
57
+ def verify(self, pubkeys=None, chain="HIVE", recover_parameter=False):
58
+ """
59
+ Verify this transaction's signatures.
60
+
61
+ Parameters:
62
+ pubkeys (list[str] | None): Public keys to verify against. If None, an empty list is used (all signatures will be checked
63
+ without restricting expected pubkeys).
64
+ chain (str): Chain identifier to use for verification (defaults to "HIVE").
65
+ recover_parameter (bool): If True, return signature recovery parameters alongside verification results.
66
+
67
+ Returns:
68
+ Any: The result returned by the superclass verify method (verification outcome as defined by the base implementation).
69
+ """
70
+ if pubkeys is None:
71
+ pubkeys = []
42
72
  return super(Signed_Transaction, self).verify(pubkeys, chain, recover_parameter)
43
73
 
44
74
  def getOperationKlass(self):
75
+ """
76
+ Return the Operation class used to construct operations for this transaction.
77
+
78
+ Returns:
79
+ type: The Operation class used by this Signed_Transaction.
80
+ """
45
81
  return Operation
46
82
 
47
83
  def getKnownChains(self):
nectarbase/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """THIS FILE IS GENERATED FROM nectar PYPROJECT.TOML."""
2
2
 
3
- version = "0.0.10"
3
+ version = "0.1.0"