hive-nectar 0.0.2__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 (86) hide show
  1. hive_nectar-0.0.2.dist-info/METADATA +182 -0
  2. hive_nectar-0.0.2.dist-info/RECORD +86 -0
  3. hive_nectar-0.0.2.dist-info/WHEEL +4 -0
  4. hive_nectar-0.0.2.dist-info/entry_points.txt +2 -0
  5. hive_nectar-0.0.2.dist-info/licenses/LICENSE.txt +23 -0
  6. nectar/__init__.py +32 -0
  7. nectar/account.py +4371 -0
  8. nectar/amount.py +475 -0
  9. nectar/asciichart.py +270 -0
  10. nectar/asset.py +82 -0
  11. nectar/block.py +446 -0
  12. nectar/blockchain.py +1178 -0
  13. nectar/blockchaininstance.py +2284 -0
  14. nectar/blockchainobject.py +221 -0
  15. nectar/blurt.py +563 -0
  16. nectar/cli.py +6285 -0
  17. nectar/comment.py +1217 -0
  18. nectar/community.py +513 -0
  19. nectar/constants.py +111 -0
  20. nectar/conveyor.py +309 -0
  21. nectar/discussions.py +1709 -0
  22. nectar/exceptions.py +149 -0
  23. nectar/hive.py +546 -0
  24. nectar/hivesigner.py +420 -0
  25. nectar/imageuploader.py +72 -0
  26. nectar/instance.py +129 -0
  27. nectar/market.py +1013 -0
  28. nectar/memo.py +449 -0
  29. nectar/message.py +357 -0
  30. nectar/nodelist.py +444 -0
  31. nectar/price.py +557 -0
  32. nectar/profile.py +65 -0
  33. nectar/rc.py +308 -0
  34. nectar/snapshot.py +726 -0
  35. nectar/steem.py +582 -0
  36. nectar/storage.py +53 -0
  37. nectar/transactionbuilder.py +622 -0
  38. nectar/utils.py +545 -0
  39. nectar/version.py +2 -0
  40. nectar/vote.py +557 -0
  41. nectar/wallet.py +472 -0
  42. nectar/witness.py +617 -0
  43. nectarapi/__init__.py +11 -0
  44. nectarapi/exceptions.py +123 -0
  45. nectarapi/graphenerpc.py +589 -0
  46. nectarapi/node.py +178 -0
  47. nectarapi/noderpc.py +229 -0
  48. nectarapi/rpcutils.py +97 -0
  49. nectarapi/version.py +2 -0
  50. nectarbase/__init__.py +14 -0
  51. nectarbase/ledgertransactions.py +75 -0
  52. nectarbase/memo.py +243 -0
  53. nectarbase/objects.py +429 -0
  54. nectarbase/objecttypes.py +22 -0
  55. nectarbase/operationids.py +102 -0
  56. nectarbase/operations.py +1297 -0
  57. nectarbase/signedtransactions.py +48 -0
  58. nectarbase/transactions.py +11 -0
  59. nectarbase/version.py +2 -0
  60. nectargrapheneapi/__init__.py +6 -0
  61. nectargraphenebase/__init__.py +27 -0
  62. nectargraphenebase/account.py +846 -0
  63. nectargraphenebase/aes.py +52 -0
  64. nectargraphenebase/base58.py +192 -0
  65. nectargraphenebase/bip32.py +494 -0
  66. nectargraphenebase/bip38.py +134 -0
  67. nectargraphenebase/chains.py +149 -0
  68. nectargraphenebase/dictionary.py +3 -0
  69. nectargraphenebase/ecdsasig.py +326 -0
  70. nectargraphenebase/objects.py +123 -0
  71. nectargraphenebase/objecttypes.py +6 -0
  72. nectargraphenebase/operationids.py +3 -0
  73. nectargraphenebase/operations.py +23 -0
  74. nectargraphenebase/prefix.py +11 -0
  75. nectargraphenebase/py23.py +38 -0
  76. nectargraphenebase/signedtransactions.py +201 -0
  77. nectargraphenebase/types.py +419 -0
  78. nectargraphenebase/unsignedtransactions.py +283 -0
  79. nectargraphenebase/version.py +2 -0
  80. nectarstorage/__init__.py +38 -0
  81. nectarstorage/base.py +306 -0
  82. nectarstorage/exceptions.py +16 -0
  83. nectarstorage/interfaces.py +237 -0
  84. nectarstorage/masterpassword.py +239 -0
  85. nectarstorage/ram.py +30 -0
  86. nectarstorage/sqlite.py +334 -0
nectar/community.py ADDED
@@ -0,0 +1,513 @@
1
+ # -*- coding: utf-8 -*-
2
+ import json
3
+ import logging
4
+ from datetime import date, datetime, time
5
+
6
+ from prettytable import PrettyTable
7
+
8
+ from nectar.instance import shared_blockchain_instance
9
+ from nectargraphenebase.py23 import integer_types, string_types
10
+
11
+ from .blockchainobject import BlockchainObject
12
+ from .exceptions import AccountDoesNotExistsException, OfflineHasNoRPCException
13
+ from .utils import (
14
+ addTzInfo,
15
+ formatTimeString,
16
+ )
17
+
18
+ log = logging.getLogger(__name__)
19
+
20
+
21
+ class Community(BlockchainObject):
22
+ """This class allows to easily access Community data
23
+
24
+ :param str account: Name of the account
25
+ :param Steem/Hive blockchain_instance: Hive or Steem
26
+ instance
27
+ :param bool lazy: Use lazy loading
28
+ :param bool full: Obtain all account data including orders, positions,
29
+ etc.
30
+ :param Hive hive_instance: Hive instance
31
+ :param Steem steem_instance: Steem instance
32
+ :returns: Account data
33
+ :rtype: dictionary
34
+ :raises nectar.exceptions.AccountDoesNotExistsException: if account
35
+ does not exist
36
+
37
+ Instances of this class are dictionaries that come with additional
38
+ methods (see below) that allow dealing with an community and its
39
+ corresponding functions.
40
+
41
+ .. code-block:: python
42
+
43
+ >>> from nectar.community import Community
44
+ >>> from nectar import Hive
45
+ >>> from nectar.nodelist import NodeList
46
+ >>> nodelist = NodeList()
47
+ >>> nodelist.update_nodes()
48
+ >>> stm = Hive(node=nodelist.get_hive_nodes())
49
+ >>> community = Community("hive-139531", blockchain_instance=stm)
50
+ >>> print(community)
51
+ <Community hive-139531>
52
+ >>> print(community.balances) # doctest: +SKIP
53
+
54
+ .. note:: This class comes with its own caching function to reduce the
55
+ load on the API server. Instances of this class can be
56
+ refreshed with ``Community.refresh()``. The cache can be
57
+ cleared with ``Community.clear_cache()``
58
+
59
+ """
60
+
61
+ type_id = 2
62
+
63
+ def __init__(
64
+ self, community, observer="", full=True, lazy=False, blockchain_instance=None, **kwargs
65
+ ):
66
+ """Initialize an community
67
+
68
+ :param str community: Name of the community
69
+ :param Hive/Steem blockchain_instance: Hive/Steem
70
+ instance
71
+ :param bool lazy: Use lazy loading
72
+ :param bool full: Obtain all community data including orders, positions,
73
+ etc.
74
+ """
75
+ self.full = full
76
+ self.lazy = lazy
77
+ self.observer = observer
78
+ if blockchain_instance is None:
79
+ if kwargs.get("steem_instance"):
80
+ blockchain_instance = kwargs["steem_instance"]
81
+ elif kwargs.get("hive_instance"):
82
+ blockchain_instance = kwargs["hive_instance"]
83
+ self.blockchain = blockchain_instance or shared_blockchain_instance()
84
+ if isinstance(community, dict):
85
+ community = self._parse_json_data(community)
86
+ super(Community, self).__init__(
87
+ community, lazy=lazy, full=full, id_item="name", blockchain_instance=blockchain_instance
88
+ )
89
+
90
+ def refresh(self):
91
+ """Refresh/Obtain an community's data from the API server"""
92
+ if not self.blockchain.is_connected():
93
+ return
94
+ self.blockchain.rpc.set_next_node_on_empty_reply(True)
95
+ community = self.blockchain.rpc.get_community(
96
+ {"name": self.identifier, "observer": self.observer}, api="bridge"
97
+ )
98
+
99
+ if not community:
100
+ raise AccountDoesNotExistsException(self.identifier)
101
+ community = self._parse_json_data(community)
102
+ self.identifier = community["name"]
103
+ # self.blockchain.refresh_data()
104
+
105
+ super(Community, self).__init__(
106
+ community,
107
+ id_item="name",
108
+ lazy=self.lazy,
109
+ full=self.full,
110
+ blockchain_instance=self.blockchain,
111
+ )
112
+
113
+ def _parse_json_data(self, community):
114
+ parse_int = [
115
+ "sum_pending",
116
+ "subscribers",
117
+ "num_pending",
118
+ "num_authors",
119
+ ]
120
+ for p in parse_int:
121
+ if p in community and isinstance(community.get(p), string_types):
122
+ community[p] = int(community.get(p, 0))
123
+ parse_times = ["created_at"]
124
+ for p in parse_times:
125
+ if p in community and isinstance(community.get(p), string_types):
126
+ community[p] = addTzInfo(
127
+ datetime.strptime(community.get(p, "1970-01-01 00:00:00"), "%Y-%m-%d %H:%M:%S")
128
+ )
129
+ return community
130
+
131
+ def json(self):
132
+ output = self.copy()
133
+ parse_int = [
134
+ "sum_pending",
135
+ "subscribers",
136
+ "num_pending",
137
+ "num_authors",
138
+ ]
139
+ parse_int_without_zero = []
140
+ for p in parse_int:
141
+ if p in output and isinstance(output[p], integer_types):
142
+ output[p] = str(output[p])
143
+ for p in parse_int_without_zero:
144
+ if p in output and isinstance(output[p], integer_types) and output[p] != 0:
145
+ output[p] = str(output[p])
146
+
147
+ parse_times = [
148
+ "created_at",
149
+ ]
150
+ for p in parse_times:
151
+ if p in output:
152
+ p_date = output.get(p, datetime(1970, 1, 1, 0, 0))
153
+ if isinstance(p_date, (datetime, date, time)):
154
+ output[p] = formatTimeString(p_date).replace("T", " ")
155
+ else:
156
+ output[p] = p_date
157
+ return json.loads(str(json.dumps(output)))
158
+
159
+ def get_community_roles(self):
160
+ """Lists community roles"""
161
+ community = self["name"]
162
+ if not self.blockchain.is_connected():
163
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
164
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
165
+ return self.blockchain.rpc.list_community_roles({"community": community}, api="bridge")
166
+
167
+ def get_subscribers(self):
168
+ """Returns subscribers"""
169
+ community = self["name"]
170
+ if not self.blockchain.is_connected():
171
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
172
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
173
+ return self.blockchain.rpc.list_subscribers({"community": community}, api="bridge")
174
+
175
+ def get_activities(self, limit=100, last_id=None):
176
+ """Returns community activity"""
177
+ community = self["name"]
178
+ if not self.blockchain.is_connected():
179
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
180
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
181
+ return self.blockchain.rpc.account_notifications(
182
+ {"account": community, "limit": limit, "last_id": last_id}, api="bridge"
183
+ )
184
+
185
+ def get_ranked_posts(
186
+ self, observer=None, limit=100, start_author=None, start_permlink=None, sort="created"
187
+ ):
188
+ """Returns community post"""
189
+ community = self["name"]
190
+ if not self.blockchain.is_connected():
191
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
192
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
193
+ return self.blockchain.rpc.get_ranked_posts(
194
+ {
195
+ "tag": community,
196
+ "observer": observer,
197
+ "limit": limit,
198
+ "start_author": start_author,
199
+ "start_permlink": start_permlink,
200
+ "sort": sort,
201
+ },
202
+ api="bridge",
203
+ )
204
+
205
+ def set_role(self, account, role, mod_account):
206
+ """Set role for a given account
207
+
208
+ :param str account: Set role of this account
209
+ :param str role: Can be member, mod, admin, owner, guest
210
+ :param str mod_account: Account who broadcast this, (mods or higher)
211
+
212
+ """
213
+ community = self["name"]
214
+ if not self.blockchain.is_connected():
215
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
216
+ json_body = [
217
+ "setRole",
218
+ {
219
+ "community": community,
220
+ "account": account,
221
+ "role": role,
222
+ },
223
+ ]
224
+ return self.blockchain.custom_json(
225
+ "community", json_body, required_posting_auths=[mod_account]
226
+ )
227
+
228
+ def set_user_title(self, account, title, mod_account):
229
+ """Set title for a given account
230
+
231
+ :param str account: Set role of this account
232
+ :param str title: Title
233
+ :param str mod_account: Account who broadcast this, (mods or higher)
234
+
235
+ """
236
+ community = self["name"]
237
+ if not self.blockchain.is_connected():
238
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
239
+ json_body = [
240
+ "setUserTitle",
241
+ {
242
+ "community": community,
243
+ "account": account,
244
+ "title": title,
245
+ },
246
+ ]
247
+ return self.blockchain.custom_json(
248
+ "community", json_body, required_posting_auths=[mod_account]
249
+ )
250
+
251
+ def mute_post(self, account, permlink, notes, mod_account):
252
+ """Mutes a post
253
+
254
+ :param str account: Set role of this account
255
+ :param str permlink: permlink
256
+ :param str notes: permlink
257
+ :param str mod_account: Account who broadcast this, (mods or higher)
258
+
259
+ """
260
+ community = self["name"]
261
+ if not self.blockchain.is_connected():
262
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
263
+ json_body = [
264
+ "mutePost",
265
+ {"community": community, "account": account, "permlink": permlink, "notes": notes},
266
+ ]
267
+ return self.blockchain.custom_json(
268
+ "community", json_body, required_posting_auths=[mod_account]
269
+ )
270
+
271
+ def unmute_post(self, account, permlink, notes, mod_account):
272
+ """Unmute a post
273
+
274
+ :param str account: post author
275
+ :param str permlink: permlink
276
+ :param str notes: notes
277
+ :param str mod_account: Account who broadcast this, (mods or higher)
278
+
279
+ """
280
+ community = self["name"]
281
+ if not self.blockchain.is_connected():
282
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
283
+ json_body = [
284
+ "unmutePost",
285
+ {"community": community, "account": account, "permlink": permlink, "notes": notes},
286
+ ]
287
+ return self.blockchain.custom_json(
288
+ "community", json_body, required_posting_auths=[mod_account]
289
+ )
290
+
291
+ def update_props(self, title, about, is_nsfw, description, flag_text, admin_account):
292
+ """Updates the community properties
293
+
294
+ :param str title: Community title
295
+ :param str about: about
296
+ :param bool is_nsfw: is_nsfw
297
+ :param str description: description
298
+ :param str flag_text: flag_text
299
+ :param str admin_account: Account who broadcast this, (admin or higher)
300
+
301
+ """
302
+ community = self["name"]
303
+ if not self.blockchain.is_connected():
304
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
305
+ json_body = [
306
+ "updateProps",
307
+ {
308
+ "community": community,
309
+ "props": {
310
+ "title": title,
311
+ "about": about,
312
+ "is_nsfw": is_nsfw,
313
+ "description": description,
314
+ "flag_text": flag_text,
315
+ },
316
+ },
317
+ ]
318
+ return self.blockchain.custom_json(
319
+ "community", json_body, required_posting_auths=[admin_account]
320
+ )
321
+
322
+ def subscribe(self, account):
323
+ """subscribe to a community
324
+
325
+ :param str account: account who suscribe to the community (is also broadcasting the custom_json)
326
+
327
+ """
328
+ community = self["name"]
329
+ if not self.blockchain.is_connected():
330
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
331
+ json_body = [
332
+ "subscribe",
333
+ {
334
+ "community": community,
335
+ },
336
+ ]
337
+ return self.blockchain.custom_json("community", json_body, required_posting_auths=[account])
338
+
339
+ def pin_post(self, account, permlink, mod_account):
340
+ """Stickes a post to the top of a community
341
+
342
+ :param str account: post author
343
+ :param str permlink: permlink
344
+ :param str mod_account: Account who broadcast this, (mods or higher)
345
+
346
+ """
347
+ community = self["name"]
348
+ if not self.blockchain.is_connected():
349
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
350
+ json_body = [
351
+ "pinPost",
352
+ {
353
+ "community": community,
354
+ "account": account,
355
+ "permlink": permlink,
356
+ },
357
+ ]
358
+ return self.blockchain.custom_json(
359
+ "community", json_body, required_posting_auths=[mod_account]
360
+ )
361
+
362
+ def unsubscribe(self, account):
363
+ """unsubscribe a community
364
+
365
+ :param str account: account who unsuscribe to the community (is also broadcasting the custom_json)
366
+
367
+ """
368
+ community = self["name"]
369
+ if not self.blockchain.is_connected():
370
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
371
+ json_body = [
372
+ "unsubscribe",
373
+ {
374
+ "community": community,
375
+ },
376
+ ]
377
+ return self.blockchain.custom_json("community", json_body, required_posting_auths=[account])
378
+
379
+ def unpin_post(self, account, permlink, mod_account):
380
+ """Removes a post from the top of a community
381
+
382
+ :param str account: post author
383
+ :param str permlink: permlink
384
+ :param str mod_account: Account who broadcast this, (mods or higher)
385
+
386
+ """
387
+ community = self["name"]
388
+ if not self.blockchain.is_connected():
389
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
390
+ json_body = [
391
+ "unpinPost",
392
+ {
393
+ "community": community,
394
+ "account": account,
395
+ "permlink": permlink,
396
+ },
397
+ ]
398
+ return self.blockchain.custom_json(
399
+ "community", json_body, required_posting_auths=[mod_account]
400
+ )
401
+
402
+ def flag_post(self, account, permlink, notes, reporter):
403
+ """Suggest a post for the review queue
404
+
405
+ :param str account: post author
406
+ :param str permlink: permlink
407
+ :param str notes: notes
408
+ :param str reporter: Account who broadcast this
409
+ """
410
+ community = self["name"]
411
+ if not self.blockchain.is_connected():
412
+ raise OfflineHasNoRPCException("No RPC available in offline mode!")
413
+ json_body = [
414
+ "flagPost",
415
+ {"community": community, "account": account, "permlink": permlink, "notes": notes},
416
+ ]
417
+ return self.blockchain.custom_json(
418
+ "community", json_body, required_posting_auths=[reporter]
419
+ )
420
+
421
+
422
+ class CommunityObject(list):
423
+ def printAsTable(self):
424
+ t = PrettyTable(
425
+ [
426
+ "Nr.",
427
+ "Name",
428
+ "Title",
429
+ "lang",
430
+ "subscribers",
431
+ "sum_pending",
432
+ "num_pending",
433
+ "num_authors",
434
+ ]
435
+ )
436
+ t.align = "l"
437
+ count = 0
438
+ for community in self:
439
+ count += 1
440
+ t.add_row(
441
+ [
442
+ str(count),
443
+ community["name"],
444
+ community["title"],
445
+ community["lang"],
446
+ community["subscribers"],
447
+ community["sum_pending"],
448
+ community["num_pending"],
449
+ community["num_authors"],
450
+ ]
451
+ )
452
+ print(t)
453
+
454
+
455
+ class Communities(CommunityObject):
456
+ """Obtain a list of communities
457
+
458
+ :param list name_list: list of accounts to fetch
459
+ :param int batch_limit: (optional) maximum number of accounts
460
+ to fetch per call, defaults to 100
461
+ :param Steem/Hive blockchain_instance: Steem() or Hive() instance to use when
462
+ accessing a RPCcreator = Account(creator, blockchain_instance=self)
463
+ """
464
+
465
+ def __init__(
466
+ self,
467
+ sort="rank",
468
+ observer=None,
469
+ last=None,
470
+ limit=100,
471
+ lazy=False,
472
+ full=True,
473
+ blockchain_instance=None,
474
+ **kwargs,
475
+ ):
476
+ if blockchain_instance is None:
477
+ if kwargs.get("steem_instance"):
478
+ blockchain_instance = kwargs["steem_instance"]
479
+ elif kwargs.get("hive_instance"):
480
+ blockchain_instance = kwargs["hive_instance"]
481
+ self.blockchain = blockchain_instance or shared_blockchain_instance()
482
+
483
+ if not self.blockchain.is_connected():
484
+ return
485
+ communities = []
486
+ community_cnt = 0
487
+ batch_limit = 100
488
+ if batch_limit > limit:
489
+ batch_limit = limit
490
+
491
+ while community_cnt < limit:
492
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
493
+ communities += self.blockchain.rpc.list_communities(
494
+ {"sort": sort, "observer": observer, "last": last, "limit": batch_limit},
495
+ api="bridge",
496
+ )
497
+ community_cnt += batch_limit
498
+ last = communities[-1]["name"]
499
+
500
+ super(Communities, self).__init__(
501
+ [
502
+ Community(x, lazy=lazy, full=full, blockchain_instance=self.blockchain)
503
+ for x in communities
504
+ ]
505
+ )
506
+
507
+ def search_title(self, title):
508
+ """Returns all communites which have a title similar to title"""
509
+ ret = CommunityObject()
510
+ for community in self:
511
+ if title.lower() in community["title"].lower():
512
+ ret.append(community)
513
+ return ret
nectar/constants.py ADDED
@@ -0,0 +1,111 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ STEEM_100_PERCENT = 10000
5
+ STEEM_1_PERCENT = 100
6
+ STEEM_REVERSE_AUCTION_WINDOW_SECONDS_HF21 = 300
7
+ STEEM_REVERSE_AUCTION_WINDOW_SECONDS_HF20 = 900
8
+ STEEM_REVERSE_AUCTION_WINDOW_SECONDS_HF6 = 1800
9
+ STEEM_CONTENT_REWARD_PERCENT_HF16 = 7500
10
+ STEEM_CONTENT_REWARD_PERCENT_HF21 = 6500
11
+ STEEM_DOWNVOTE_POOL_PERCENT_HF21 = 2500
12
+ STEEM_VOTE_REGENERATION_SECONDS = 432000
13
+ STEEM_VOTING_MANA_REGENERATION_SECONDS = 432000
14
+ STEEM_VOTE_DUST_THRESHOLD = 50000000
15
+ STEEM_ROOT_POST_PARENT = ""
16
+ STEEM_RC_REGEN_TIME = 60 * 60 * 24 * 5
17
+
18
+ HIVE_100_PERCENT = 10000
19
+ HIVE_1_PERCENT = 100
20
+ HIVE_REVERSE_AUCTION_WINDOW_SECONDS_HF21 = 300
21
+ HIVE_REVERSE_AUCTION_WINDOW_SECONDS_HF20 = 900
22
+ HIVE_REVERSE_AUCTION_WINDOW_SECONDS_HF6 = 1800
23
+ HIVE_CONTENT_REWARD_PERCENT_HF16 = 7500
24
+ HIVE_CONTENT_REWARD_PERCENT_HF21 = 6500
25
+ HIVE_DOWNVOTE_POOL_PERCENT_HF21 = 2500
26
+ HIVE_VOTE_REGENERATION_SECONDS = 432000
27
+ HIVE_VOTING_MANA_REGENERATION_SECONDS = 432000
28
+ HIVE_VOTE_DUST_THRESHOLD = 50000000
29
+ HIVE_ROOT_POST_PARENT = ""
30
+ HIVE_RC_REGEN_TIME = 60 * 60 * 24 * 5
31
+
32
+ STATE_BYTES_SCALE = 10000
33
+ STATE_TRANSACTION_BYTE_SIZE = 174
34
+ STATE_TRANSFER_FROM_SAVINGS_BYTE_SIZE = 229
35
+ STATE_LIMIT_ORDER_BYTE_SIZE = 1940
36
+ EXEC_FOLLOW_CUSTOM_OP_SCALE = 20
37
+ RC_DEFAULT_EXEC_COST = 100000
38
+ STATE_COMMENT_VOTE_BYTE_SIZE = 525
39
+
40
+ CURVE_CONSTANT = 2000000000000
41
+ CURVE_CONSTANT_X4 = 4 * CURVE_CONSTANT
42
+ SQUARED_CURVE_CONSTANT = CURVE_CONSTANT * CURVE_CONSTANT
43
+
44
+ state_object_size_info = {
45
+ "authority_base_size": 4 * STATE_BYTES_SCALE,
46
+ "authority_account_member_size": 18 * STATE_BYTES_SCALE,
47
+ "authority_key_member_size": 35 * STATE_BYTES_SCALE,
48
+ "account_object_base_size": 480 * STATE_BYTES_SCALE,
49
+ "account_authority_object_base_size": 40 * STATE_BYTES_SCALE,
50
+ "account_recovery_request_object_base_size": 32 * STATE_BYTES_SCALE,
51
+ "comment_object_base_size": 201 * STATE_BYTES_SCALE,
52
+ "comment_object_permlink_char_size": 1 * STATE_BYTES_SCALE,
53
+ "comment_object_parent_permlink_char_size": 2 * STATE_BYTES_SCALE,
54
+ "comment_object_beneficiaries_member_size": 18 * STATE_BYTES_SCALE,
55
+ "comment_vote_object_base_size": 47 * STATE_COMMENT_VOTE_BYTE_SIZE,
56
+ "convert_request_object_base_size": 48 * STATE_BYTES_SCALE,
57
+ "decline_voting_rights_request_object_base_size": 28 * STATE_BYTES_SCALE,
58
+ "escrow_object_base_size": 119 * STATE_BYTES_SCALE,
59
+ "limit_order_object_base_size": 76 * STATE_LIMIT_ORDER_BYTE_SIZE,
60
+ "savings_withdraw_object_byte_size": 64 * STATE_TRANSFER_FROM_SAVINGS_BYTE_SIZE,
61
+ "transaction_object_base_size": 35 * STATE_TRANSACTION_BYTE_SIZE,
62
+ "transaction_object_byte_size": 1 * STATE_TRANSACTION_BYTE_SIZE,
63
+ "vesting_delegation_object_base_size": 60 * STATE_BYTES_SCALE,
64
+ "vesting_delegation_expiration_object_base_size": 44 * STATE_BYTES_SCALE,
65
+ "withdraw_vesting_route_object_base_size": 43 * STATE_BYTES_SCALE,
66
+ "witness_object_base_size": 266 * STATE_BYTES_SCALE,
67
+ "witness_object_url_char_size": 1 * STATE_BYTES_SCALE,
68
+ "witness_vote_object_base_size": 40 * STATE_BYTES_SCALE,
69
+ }
70
+
71
+ resource_execution_time = {
72
+ "account_create_operation_exec_time": 57700,
73
+ "account_create_with_delegation_operation_exec_time": 57700,
74
+ "account_update_operation_exec_time": 14000,
75
+ "account_witness_proxy_operation_exec_time": 117000,
76
+ "account_witness_vote_operation_exec_time": 23000,
77
+ "cancel_transfer_from_savings_operation_exec_time": 11500,
78
+ "change_recovery_account_operation_exec_time": 12000,
79
+ "claim_account_operation_exec_time": 10000,
80
+ "claim_reward_balance_operation_exec_time": 50300,
81
+ "comment_operation_exec_time": 114100,
82
+ "comment_options_operation_exec_time": 13200,
83
+ "convert_operation_exec_time": 15700,
84
+ "create_claimed_account_operation_exec_time": 57700,
85
+ "custom_operation_exec_time": 11400,
86
+ "custom_json_operation_exec_time": 11400,
87
+ "custom_binary_operation_exec_time": 11400,
88
+ "decline_voting_rights_operation_exec_time": 5300,
89
+ "delegate_vesting_shares_operation_exec_time": 19900,
90
+ "delete_comment_operation_exec_time": 51100,
91
+ "escrow_approve_operation_exec_time": 9900,
92
+ "escrow_dispute_operation_exec_time": 11500,
93
+ "escrow_release_operation_exec_time": 17200,
94
+ "escrow_transfer_operation_exec_time": 19100,
95
+ "feed_publish_operation_exec_time": 6200,
96
+ "limit_order_cancel_operation_exec_time": 9600,
97
+ "limit_order_create_operation_exec_time": 31700,
98
+ "limit_order_create2_operation_exec_time": 31700,
99
+ "request_account_recovery_operation_exec_time": 54400,
100
+ "set_withdraw_vesting_route_operation_exec_time": 17900,
101
+ "transfer_from_savings_operation_exec_time": 17500,
102
+ "transfer_operation_exec_time": 9600,
103
+ "transfer_to_savings_operation_exec_time": 6400,
104
+ "transfer_to_vesting_operation_exec_time": 44400,
105
+ "vote_operation_exec_time": 26500,
106
+ "withdraw_vesting_operation_exec_time": 10400,
107
+ "witness_set_properties_operation_exec_time": 9500,
108
+ "witness_update_operation_exec_time": 9500,
109
+ }
110
+
111
+ operation_exec_info = {}