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/rc.py CHANGED
@@ -1,5 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
- from binascii import hexlify
3
2
 
4
3
  from nectar.constants import (
5
4
  EXEC_FOLLOW_CUSTOM_OP_SCALE,
@@ -15,17 +14,29 @@ from .instance import shared_blockchain_instance
15
14
 
16
15
  class RC(object):
17
16
  def __init__(self, blockchain_instance=None, **kwargs):
18
- if blockchain_instance is None:
19
- if kwargs.get("steem_instance"):
20
- blockchain_instance = kwargs["steem_instance"]
21
- elif kwargs.get("hive_instance"):
22
- blockchain_instance = kwargs["hive_instance"]
17
+ """
18
+ Initialize the RC helper with a blockchain instance.
19
+
20
+ If `blockchain_instance` is provided it will be used for RC lookups and broadcasts;
21
+ otherwise the module-wide shared_blockchain_instance() is used. Extra keyword
22
+ arguments are accepted for compatibility but ignored.
23
+ """
23
24
  self.blockchain = blockchain_instance or shared_blockchain_instance()
24
25
 
25
26
  def get_tx_size(self, op):
26
- """Returns the tx size of an operation"""
27
+ """
28
+ Estimate the serialized size (in bytes) of a signed transaction containing the given operation.
29
+
30
+ This constructs a dummy Signed_Transaction using fixed reference fields and a hard-coded private key, signs it on the "HIVE" chain, and returns the length of the resulting serialized transaction in bytes. The value is an estimate useful for RC sizing and does not represent a real broadcastable transaction.
31
+
32
+ Parameters:
33
+ op: Operation or dict-like operation payload to include in the transaction.
34
+
35
+ Returns:
36
+ int: Number of bytes in the serialized, signed transaction.
37
+ """
27
38
  ops = [Operation(op)]
28
- prefix = "STEEM"
39
+ prefix = "HIVE"
29
40
  wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
30
41
  ref_block_num = 34294
31
42
  ref_block_prefix = 3707022213
@@ -37,8 +48,7 @@ class RC(object):
37
48
  operations=ops,
38
49
  )
39
50
  tx = tx.sign([wif], chain=prefix)
40
- txWire = hexlify(bytes(tx)).decode("ascii")
41
- tx_size = len(txWire)
51
+ tx_size = len(bytes(tx))
42
52
  return tx_size
43
53
 
44
54
  def get_resource_count(
@@ -49,7 +59,24 @@ class RC(object):
49
59
  new_account_op_count=0,
50
60
  market_op_count=0,
51
61
  ):
52
- """Creates the resource_count dictionary based on tx_size, state_bytes_count, new_account_op_count and market_op_count"""
62
+ """
63
+ Build and return a resource_count mapping for RC cost calculation.
64
+
65
+ Parameters:
66
+ tx_size (int): Transaction size in bytes; used for history bytes and for market bytes when applicable.
67
+ execution_time_count (int): Execution time units for the operation.
68
+ state_bytes_count (int, optional): Additional state bytes contributed by the operation (default 0).
69
+ new_account_op_count (int, optional): Number of new-account operations included (default 0).
70
+ market_op_count (int, optional): If > 0, marks the transaction as a market operation and sets market bytes to tx_size (default 0).
71
+
72
+ Returns:
73
+ dict: A dictionary containing keys used by the RC pricing engine, including:
74
+ - resource_history_bytes
75
+ - resource_state_bytes
76
+ - resource_new_accounts
77
+ - resource_execution_time
78
+ - resource_market_bytes (only present if market_op_count > 0)
79
+ """
53
80
  resource_count = {"resource_history_bytes": tx_size}
54
81
  resource_count["resource_state_bytes"] = state_object_size_info[
55
82
  "transaction_object_base_size"
@@ -136,23 +163,16 @@ class RC(object):
136
163
  return self.blockchain.get_rc_cost(resource_count)
137
164
 
138
165
  def transfer_dict(self, transfer_dict):
139
- """Calc RC costs for a transfer dict object
140
-
141
- Example for calculating RC costs
142
-
143
- .. code-block:: python
166
+ """
167
+ Calculate Resource Credit (RC) cost for a transfer operation represented as a dict.
144
168
 
145
- from nectar.rc import RC
146
- from nectar.amount import Amount
147
- transfer_dict = {
148
- "from": "foo", "to": "baar",
149
- "amount": Amount("111.110 STEEM"),
150
- "memo": "Fooo"
151
- }
169
+ The input dict must contain the fields required by a Transfer operation (for example: "from", "to", "amount", "memo"). This function builds a Transfer operation, estimates the signed transaction size, marks the operation as a market operation (market_op_count=1), and returns the RC cost computed by the blockchain instance.
152
170
 
153
- rc = RC()
154
- print(rc.comment(transfer_dict))
171
+ Parameters:
172
+ transfer_dict (dict): Fields for a Transfer operation compatible with operations.Transfer.
155
173
 
174
+ Returns:
175
+ dict: RC cost structure as returned by the blockchain's get_rc_cost.
156
176
  """
157
177
  market_op_count = 1
158
178
  op = operations.Transfer(**transfer_dict)