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
@@ -0,0 +1,1297 @@
1
+ # -*- coding: utf-8 -*-
2
+ import json
3
+ import re
4
+ from binascii import hexlify
5
+ from collections import OrderedDict
6
+
7
+ from nectargraphenebase.account import PublicKey
8
+ from nectargraphenebase.py23 import PY2, PY3, string_types
9
+ from nectargraphenebase.types import (
10
+ Array,
11
+ Bool,
12
+ HexString,
13
+ Int16,
14
+ Map,
15
+ Optional,
16
+ PointInTime,
17
+ String,
18
+ Uint16,
19
+ Uint32,
20
+ Uint64,
21
+ )
22
+
23
+ from .objects import (
24
+ Amount,
25
+ CommentOptionExtensions,
26
+ ExchangeRate,
27
+ GrapheneObject,
28
+ Memo,
29
+ Operation,
30
+ Permission,
31
+ UpdateProposalExtensions,
32
+ WitnessProps,
33
+ isArgsThisClass,
34
+ )
35
+
36
+ default_prefix = "STM"
37
+
38
+
39
+ def check_for_class(self, args):
40
+ if isArgsThisClass(self, args):
41
+ self.data = args[0].data
42
+ return True
43
+ else:
44
+ return False
45
+
46
+
47
+ class Transfer(GrapheneObject):
48
+ def __init__(self, *args, **kwargs):
49
+ # Allow for overwrite of prefix
50
+ if check_for_class(self, args):
51
+ return
52
+ if len(args) == 1 and len(kwargs) == 0:
53
+ kwargs = args[0]
54
+ prefix = kwargs.get("prefix", default_prefix)
55
+ json_str = kwargs.get("json_str", False)
56
+ if "memo" not in kwargs:
57
+ kwargs["memo"] = ""
58
+ if isinstance(kwargs["memo"], dict):
59
+ kwargs["memo"]["prefix"] = prefix
60
+ memo = Optional(Memo(**kwargs["memo"]))
61
+ elif isinstance(kwargs["memo"], string_types):
62
+ memo = String(kwargs["memo"])
63
+ else:
64
+ memo = Optional(Memo(kwargs["memo"]))
65
+
66
+ super(Transfer, self).__init__(
67
+ OrderedDict(
68
+ [
69
+ ("from", String(kwargs["from"])),
70
+ ("to", String(kwargs["to"])),
71
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
72
+ ("memo", memo),
73
+ ]
74
+ )
75
+ )
76
+
77
+
78
+ # Added recurring transfer support for HF25
79
+ class Recurring_transfer(GrapheneObject):
80
+ def __init__(self, *args, **kwargs):
81
+ # Allow for overwrite of prefix
82
+ if check_for_class(self, args):
83
+ return
84
+ if len(args) == 1 and len(kwargs) == 0:
85
+ kwargs = args[0]
86
+ prefix = kwargs.get("prefix", default_prefix)
87
+ json_str = kwargs.get("json_str", False)
88
+ if "memo" not in kwargs:
89
+ kwargs["memo"] = ""
90
+ if isinstance(kwargs["memo"], dict):
91
+ kwargs["memo"]["prefix"] = prefix
92
+ memo = Optional(Memo(**kwargs["memo"]))
93
+ elif isinstance(kwargs["memo"], string_types):
94
+ memo = String(kwargs["memo"])
95
+ else:
96
+ memo = Optional(Memo(kwargs["memo"]))
97
+
98
+ super(Recurring_transfer, self).__init__(
99
+ OrderedDict(
100
+ [
101
+ ("from", String(kwargs["from"])),
102
+ ("to", String(kwargs["to"])),
103
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
104
+ ("memo", memo),
105
+ ("recurrence", Int16(kwargs["recurrence"])),
106
+ ("executions", Int16(kwargs["executions"])),
107
+ ]
108
+ )
109
+ )
110
+
111
+
112
+ class Vote(GrapheneObject):
113
+ def __init__(self, *args, **kwargs):
114
+ if check_for_class(self, args):
115
+ return
116
+ if len(args) == 1 and len(kwargs) == 0:
117
+ kwargs = args[0]
118
+ super(Vote, self).__init__(
119
+ OrderedDict(
120
+ [
121
+ ("voter", String(kwargs["voter"])),
122
+ ("author", String(kwargs["author"])),
123
+ ("permlink", String(kwargs["permlink"])),
124
+ ("weight", Int16(kwargs["weight"])),
125
+ ]
126
+ )
127
+ )
128
+
129
+
130
+ class Transfer_to_vesting(GrapheneObject):
131
+ def __init__(self, *args, **kwargs):
132
+ if check_for_class(self, args):
133
+ return
134
+ if len(args) == 1 and len(kwargs) == 0:
135
+ kwargs = args[0]
136
+ prefix = kwargs.get("prefix", default_prefix)
137
+ json_str = kwargs.get("json_str", False)
138
+ super(Transfer_to_vesting, self).__init__(
139
+ OrderedDict(
140
+ [
141
+ ("from", String(kwargs["from"])),
142
+ ("to", String(kwargs["to"])),
143
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
144
+ ]
145
+ )
146
+ )
147
+
148
+
149
+ class Withdraw_vesting(GrapheneObject):
150
+ def __init__(self, *args, **kwargs):
151
+ if check_for_class(self, args):
152
+ return
153
+ if len(args) == 1 and len(kwargs) == 0:
154
+ kwargs = args[0]
155
+ prefix = kwargs.get("prefix", default_prefix)
156
+ super(Withdraw_vesting, self).__init__(
157
+ OrderedDict(
158
+ [
159
+ ("account", String(kwargs["account"])),
160
+ ("vesting_shares", Amount(kwargs["vesting_shares"], prefix=prefix)),
161
+ ]
162
+ )
163
+ )
164
+
165
+
166
+ class Account_witness_vote(GrapheneObject):
167
+ def __init__(self, *args, **kwargs):
168
+ if check_for_class(self, args):
169
+ return
170
+ if len(args) == 1 and len(kwargs) == 0:
171
+ kwargs = args[0]
172
+ super(Account_witness_vote, self).__init__(
173
+ OrderedDict(
174
+ [
175
+ ("account", String(kwargs["account"])),
176
+ ("witness", String(kwargs["witness"])),
177
+ ("approve", Bool(bool(kwargs["approve"]))),
178
+ ]
179
+ )
180
+ )
181
+
182
+
183
+ class Account_witness_proxy(GrapheneObject):
184
+ def __init__(self, *args, **kwargs):
185
+ if check_for_class(self, args):
186
+ return
187
+ if len(args) == 1 and len(kwargs) == 0:
188
+ kwargs = args[0]
189
+ super(Account_witness_proxy, self).__init__(
190
+ OrderedDict(
191
+ [
192
+ ("account", String(kwargs["account"])),
193
+ ("proxy", String(kwargs["proxy"])),
194
+ ]
195
+ )
196
+ )
197
+
198
+
199
+ class Custom(GrapheneObject):
200
+ def __init__(self, *args, **kwargs):
201
+ if check_for_class(self, args):
202
+ return
203
+ if len(args) == 1 and len(kwargs) == 0:
204
+ kwargs = args[0]
205
+ super(Custom, self).__init__(
206
+ OrderedDict(
207
+ [
208
+ ("required_auths", Array([String(o) for o in kwargs["required_auths"]])),
209
+ ("id", Uint16(int(kwargs["id"]))),
210
+ ("data", String(kwargs["data"])),
211
+ ]
212
+ )
213
+ )
214
+
215
+
216
+ class Custom_binary(GrapheneObject):
217
+ def __init__(self, *args, **kwargs):
218
+ if check_for_class(self, args):
219
+ return
220
+ if len(args) == 1 and len(kwargs) == 0:
221
+ kwargs = args[0]
222
+ super(Custom_binary, self).__init__(
223
+ OrderedDict(
224
+ [
225
+ ("id", Uint16(int(kwargs["id"]))),
226
+ ("data", String(kwargs["data"])),
227
+ ]
228
+ )
229
+ )
230
+
231
+
232
+ class Op_wrapper(GrapheneObject):
233
+ def __init__(self, *args, **kwargs):
234
+ if check_for_class(self, args):
235
+ return
236
+ if len(args) == 1 and len(kwargs) == 0:
237
+ kwargs = args[0]
238
+ prefix = kwargs.get("prefix", default_prefix)
239
+ super(Op_wrapper, self).__init__(
240
+ OrderedDict(
241
+ [
242
+ ("op", Operation(kwargs["op"], prefix=prefix)),
243
+ ]
244
+ )
245
+ )
246
+
247
+
248
+ class Account_create(GrapheneObject):
249
+ def __init__(self, *args, **kwargs):
250
+ if check_for_class(self, args):
251
+ return
252
+ if len(args) == 1 and len(kwargs) == 0:
253
+ kwargs = args[0]
254
+ prefix = kwargs.get("prefix", default_prefix)
255
+ json_str = kwargs.get("json_str", False)
256
+ if not len(kwargs["new_account_name"]) <= 16:
257
+ raise AssertionError("Account name must be at most 16 chars long")
258
+
259
+ meta = ""
260
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
261
+ if isinstance(kwargs["json_metadata"], dict):
262
+ meta = json.dumps(kwargs["json_metadata"])
263
+ else:
264
+ meta = kwargs["json_metadata"]
265
+
266
+ super(Account_create, self).__init__(
267
+ OrderedDict(
268
+ [
269
+ ("fee", Amount(kwargs["fee"], prefix=prefix, json_str=json_str)),
270
+ ("creator", String(kwargs["creator"])),
271
+ ("new_account_name", String(kwargs["new_account_name"])),
272
+ ("owner", Permission(kwargs["owner"], prefix=prefix)),
273
+ ("active", Permission(kwargs["active"], prefix=prefix)),
274
+ ("posting", Permission(kwargs["posting"], prefix=prefix)),
275
+ ("memo_key", PublicKey(kwargs["memo_key"], prefix=prefix)),
276
+ ("json_metadata", String(meta)),
277
+ ]
278
+ )
279
+ )
280
+
281
+
282
+ class Account_create_with_delegation(GrapheneObject):
283
+ def __init__(self, *args, **kwargs):
284
+ if check_for_class(self, args):
285
+ return
286
+ if len(args) == 1 and len(kwargs) == 0:
287
+ kwargs = args[0]
288
+ prefix = kwargs.get("prefix", default_prefix)
289
+ json_str = kwargs.get("json_str", False)
290
+ if not len(kwargs["new_account_name"]) <= 16:
291
+ raise AssertionError("Account name must be at most 16 chars long")
292
+
293
+ meta = ""
294
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
295
+ if isinstance(kwargs["json_metadata"], dict):
296
+ meta = json.dumps(kwargs["json_metadata"])
297
+ else:
298
+ meta = kwargs["json_metadata"]
299
+
300
+ super(Account_create_with_delegation, self).__init__(
301
+ OrderedDict(
302
+ [
303
+ ("fee", Amount(kwargs["fee"], prefix=prefix, json_str=json_str)),
304
+ ("delegation", Amount(kwargs["delegation"], prefix=prefix, json_str=json_str)),
305
+ ("creator", String(kwargs["creator"])),
306
+ ("new_account_name", String(kwargs["new_account_name"])),
307
+ ("owner", Permission(kwargs["owner"], prefix=prefix)),
308
+ ("active", Permission(kwargs["active"], prefix=prefix)),
309
+ ("posting", Permission(kwargs["posting"], prefix=prefix)),
310
+ ("memo_key", PublicKey(kwargs["memo_key"], prefix=prefix)),
311
+ ("json_metadata", String(meta)),
312
+ ("extensions", Array([])),
313
+ ]
314
+ )
315
+ )
316
+
317
+
318
+ class Account_update(GrapheneObject):
319
+ def __init__(self, *args, **kwargs):
320
+ if check_for_class(self, args):
321
+ return
322
+ if len(args) == 1 and len(kwargs) == 0:
323
+ kwargs = args[0]
324
+ prefix = kwargs.get("prefix", default_prefix)
325
+
326
+ if "owner" in kwargs:
327
+ owner = Optional(Permission(kwargs["owner"], prefix=prefix))
328
+ else:
329
+ owner = Optional(None)
330
+
331
+ if "active" in kwargs:
332
+ active = Optional(Permission(kwargs["active"], prefix=prefix))
333
+ else:
334
+ active = Optional(None)
335
+
336
+ if "posting" in kwargs:
337
+ posting = Optional(Permission(kwargs["posting"], prefix=prefix))
338
+ else:
339
+ posting = Optional(None)
340
+
341
+ meta = ""
342
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
343
+ if isinstance(kwargs["json_metadata"], dict):
344
+ meta = json.dumps(kwargs["json_metadata"])
345
+ else:
346
+ meta = kwargs["json_metadata"]
347
+
348
+ super(Account_update, self).__init__(
349
+ OrderedDict(
350
+ [
351
+ ("account", String(kwargs["account"])),
352
+ ("owner", owner),
353
+ ("active", active),
354
+ ("posting", posting),
355
+ ("memo_key", PublicKey(kwargs["memo_key"], prefix=prefix)),
356
+ ("json_metadata", String(meta)),
357
+ ]
358
+ )
359
+ )
360
+
361
+
362
+ class Account_update2(GrapheneObject):
363
+ def __init__(self, *args, **kwargs):
364
+ if check_for_class(self, args):
365
+ return
366
+ if len(args) == 1 and len(kwargs) == 0:
367
+ kwargs = args[0]
368
+ prefix = kwargs.get("prefix", default_prefix)
369
+ extensions = Array([])
370
+
371
+ if "owner" in kwargs:
372
+ owner = Optional(Permission(kwargs["owner"], prefix=prefix))
373
+ else:
374
+ owner = Optional(None)
375
+
376
+ if "active" in kwargs:
377
+ active = Optional(Permission(kwargs["active"], prefix=prefix))
378
+ else:
379
+ active = Optional(None)
380
+
381
+ if "posting" in kwargs:
382
+ posting = Optional(Permission(kwargs["posting"], prefix=prefix))
383
+ else:
384
+ posting = Optional(None)
385
+
386
+ if "memo_key" in kwargs:
387
+ memo_key = Optional(PublicKey(kwargs["memo_key"], prefix=prefix))
388
+ else:
389
+ memo_key = Optional(None)
390
+
391
+ meta = ""
392
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
393
+ if isinstance(kwargs["json_metadata"], dict):
394
+ meta = json.dumps(kwargs["json_metadata"])
395
+ else:
396
+ meta = kwargs["json_metadata"]
397
+ posting_meta = ""
398
+ if "posting_json_metadata" in kwargs and kwargs["posting_json_metadata"]:
399
+ if isinstance(kwargs["posting_json_metadata"], dict):
400
+ posting_meta = json.dumps(kwargs["posting_json_metadata"])
401
+ else:
402
+ posting_meta = kwargs["posting_json_metadata"]
403
+
404
+ super(Account_update2, self).__init__(
405
+ OrderedDict(
406
+ [
407
+ ("account", String(kwargs["account"])),
408
+ ("owner", owner),
409
+ ("active", active),
410
+ ("posting", posting),
411
+ ("memo_key", memo_key),
412
+ ("json_metadata", String(meta)),
413
+ ("posting_json_metadata", String(posting_meta)),
414
+ ("extensions", extensions),
415
+ ]
416
+ )
417
+ )
418
+
419
+
420
+ class Create_proposal(GrapheneObject):
421
+ def __init__(self, *args, **kwargs):
422
+ if check_for_class(self, args):
423
+ return
424
+ if len(args) == 1 and len(kwargs) == 0:
425
+ kwargs = args[0]
426
+ prefix = kwargs.get("prefix", default_prefix)
427
+ json_str = kwargs.get("json_str", False)
428
+ extensions = Array([])
429
+
430
+ super(Create_proposal, self).__init__(
431
+ OrderedDict(
432
+ [
433
+ ("creator", String(kwargs["creator"])),
434
+ ("receiver", String(kwargs["receiver"])),
435
+ ("start_date", PointInTime(kwargs["start_date"])),
436
+ ("end_date", PointInTime(kwargs["end_date"])),
437
+ ("daily_pay", Amount(kwargs["daily_pay"], prefix=prefix, json_str=json_str)),
438
+ ("subject", String(kwargs["subject"])),
439
+ ("permlink", String(kwargs["permlink"])),
440
+ ("extensions", extensions),
441
+ ]
442
+ )
443
+ )
444
+
445
+
446
+ class Update_proposal_votes(GrapheneObject):
447
+ def __init__(self, *args, **kwargs):
448
+ if check_for_class(self, args):
449
+ return
450
+ if len(args) == 1 and len(kwargs) == 0:
451
+ kwargs = args[0]
452
+ extensions = Array([])
453
+ proposal_ids = []
454
+ for e in kwargs["proposal_ids"]:
455
+ proposal_ids.append(Uint64(e))
456
+
457
+ super(Update_proposal_votes, self).__init__(
458
+ OrderedDict(
459
+ [
460
+ ("voter", String(kwargs["voter"])),
461
+ ("proposal_ids", Array(proposal_ids)),
462
+ ("approve", Bool(kwargs["approve"])),
463
+ ("extensions", extensions),
464
+ ]
465
+ )
466
+ )
467
+
468
+
469
+ class Remove_proposal(GrapheneObject):
470
+ def __init__(self, *args, **kwargs):
471
+ if check_for_class(self, args):
472
+ return
473
+ if len(args) == 1 and len(kwargs) == 0:
474
+ kwargs = args[0]
475
+ prefix = kwargs.get("prefix", default_prefix)
476
+ extensions = Array([])
477
+ proposal_ids = []
478
+ for e in kwargs["proposal_ids"]:
479
+ proposal_ids.append(Uint64(e))
480
+
481
+ super(Remove_proposal, self).__init__(
482
+ OrderedDict(
483
+ [
484
+ ("proposal_owner", String(kwargs["proposal_owner"])),
485
+ ("proposal_ids", Array(proposal_ids)),
486
+ ("extensions", extensions),
487
+ ]
488
+ )
489
+ )
490
+
491
+
492
+ class Update_proposal(GrapheneObject):
493
+ def __init__(self, *args, **kwargs):
494
+ if check_for_class(self, args):
495
+ return
496
+ if len(args) == 1 and len(kwargs) == 0:
497
+ kwargs = args[0]
498
+
499
+ prefix = kwargs.get("prefix", default_prefix)
500
+ extensions = Array([])
501
+ if "end_date" in kwargs and kwargs["end_date"]:
502
+ extension = {
503
+ "type": "update_proposal_end_date",
504
+ "value": {"end_date": kwargs["end_date"]},
505
+ }
506
+ extensions = Array([UpdateProposalExtensions(extension)])
507
+
508
+ super(Update_proposal, self).__init__(
509
+ OrderedDict(
510
+ [
511
+ ("proposal_id", Uint64(kwargs["proposal_id"])),
512
+ ("creator", String(kwargs["creator"])),
513
+ ("daily_pay", Amount(kwargs["daily_pay"], prefix=prefix)),
514
+ ("subject", String(kwargs["subject"])),
515
+ ("permlink", String(kwargs["permlink"])),
516
+ ("extensions", extensions),
517
+ ]
518
+ )
519
+ )
520
+
521
+
522
+ class Witness_set_properties(GrapheneObject):
523
+ def __init__(self, *args, **kwargs):
524
+ if check_for_class(self, args):
525
+ return
526
+ if len(args) == 1 and len(kwargs) == 0:
527
+ kwargs = args[0]
528
+ prefix = kwargs.pop("prefix", default_prefix)
529
+ json_str = kwargs.get("json_str", False)
530
+ extensions = Array([])
531
+ props = {}
532
+ for k in kwargs["props"]:
533
+ if "key" == k[0]:
534
+ block_signing_key = PublicKey(k[1], prefix=prefix)
535
+ props["key"] = repr(block_signing_key)
536
+ elif "new_signing_key" == k[0]:
537
+ new_signing_key = PublicKey(k[1], prefix=prefix)
538
+ props["new_signing_key"] = repr(new_signing_key)
539
+ for k in kwargs["props"]:
540
+ if k[0] in ["key", "new_signing_key"]:
541
+ continue
542
+ if isinstance(k[1], str) and PY3:
543
+ is_hex = re.fullmatch(r"[0-9a-fA-F]+", k[1] or "") is not None
544
+ elif isinstance(k[1], str) and PY2:
545
+ is_hex = re.match(r"[0-9a-fA-F]+", k[1] or "") is not None
546
+ else:
547
+ is_hex = False
548
+ if isinstance(k[1], int) and k[0] in [
549
+ "account_subsidy_budget",
550
+ "account_subsidy_decay",
551
+ "maximum_block_size",
552
+ ]:
553
+ props[k[0]] = (hexlify(Uint32(k[1]).__bytes__())).decode()
554
+ elif isinstance(k[1], int) and k[0] in ["sbd_interest_rate", "hbd_interest_rate"]:
555
+ props[k[0]] = (hexlify(Uint16(k[1]).__bytes__())).decode()
556
+ elif not isinstance(k[1], str) and k[0] in ["account_creation_fee"]:
557
+ props[k[0]] = (
558
+ hexlify(Amount(k[1], prefix=prefix, json_str=json_str).__bytes__())
559
+ ).decode()
560
+ elif not is_hex and isinstance(k[1], str) and k[0] in ["account_creation_fee"]:
561
+ props[k[0]] = (
562
+ hexlify(Amount(k[1], prefix=prefix, json_str=json_str).__bytes__())
563
+ ).decode()
564
+ elif not isinstance(k[1], str) and k[0] in ["sbd_exchange_rate", "hbd_exchange_rate"]:
565
+ if "prefix" not in k[1]:
566
+ k[1]["prefix"] = prefix
567
+ props[k[0]] = (hexlify(ExchangeRate(k[1]).__bytes__())).decode()
568
+ elif not is_hex and k[0] in ["url"]:
569
+ props[k[0]] = (hexlify(String(k[1]).__bytes__())).decode()
570
+ else:
571
+ props[k[0]] = k[1]
572
+ props_list = []
573
+ for k in props:
574
+ props_list.append(([String(k), HexString(props[k])]))
575
+ props_list = sorted(
576
+ props_list,
577
+ key=lambda x: str(x[0]),
578
+ reverse=False,
579
+ )
580
+ map_props = Map(props_list)
581
+
582
+ super(Witness_set_properties, self).__init__(
583
+ OrderedDict(
584
+ [
585
+ ("owner", String(kwargs["owner"])),
586
+ ("props", map_props),
587
+ ("extensions", extensions),
588
+ ]
589
+ )
590
+ )
591
+
592
+
593
+ class Witness_update(GrapheneObject):
594
+ def __init__(self, *args, **kwargs):
595
+ if check_for_class(self, args):
596
+ return
597
+ if len(args) == 1 and len(kwargs) == 0:
598
+ kwargs = args[0]
599
+ prefix = kwargs.pop("prefix", default_prefix)
600
+ json_str = kwargs.get("json_str", False)
601
+ if "block_signing_key" in kwargs and kwargs["block_signing_key"]:
602
+ block_signing_key = PublicKey(kwargs["block_signing_key"], prefix=prefix)
603
+ else:
604
+ block_signing_key = PublicKey(
605
+ prefix + "1111111111111111111111111111111114T1Anm", prefix=prefix
606
+ )
607
+ if "prefix" not in kwargs["props"]:
608
+ kwargs["props"]["prefix"] = prefix
609
+
610
+ super(Witness_update, self).__init__(
611
+ OrderedDict(
612
+ [
613
+ ("owner", String(kwargs["owner"])),
614
+ ("url", String(kwargs["url"])),
615
+ ("block_signing_key", block_signing_key),
616
+ ("props", WitnessProps(kwargs["props"])),
617
+ ("fee", Amount(kwargs["fee"], prefix=prefix, json_str=json_str)),
618
+ ]
619
+ )
620
+ )
621
+
622
+
623
+ class Comment(GrapheneObject):
624
+ def __init__(self, *args, **kwargs):
625
+ if check_for_class(self, args):
626
+ return
627
+ if len(args) == 1 and len(kwargs) == 0:
628
+ kwargs = args[0]
629
+ meta = ""
630
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
631
+ if isinstance(kwargs["json_metadata"], dict) or isinstance(
632
+ kwargs["json_metadata"], list
633
+ ):
634
+ meta = json.dumps(kwargs["json_metadata"])
635
+ else:
636
+ meta = kwargs["json_metadata"]
637
+
638
+ super(Comment, self).__init__(
639
+ OrderedDict(
640
+ [
641
+ ("parent_author", String(kwargs["parent_author"])),
642
+ ("parent_permlink", String(kwargs["parent_permlink"])),
643
+ ("author", String(kwargs["author"])),
644
+ ("permlink", String(kwargs["permlink"])),
645
+ ("title", String(kwargs["title"])),
646
+ ("body", String(kwargs["body"])),
647
+ ("json_metadata", String(meta)),
648
+ ]
649
+ )
650
+ )
651
+
652
+
653
+ class Custom_json(GrapheneObject):
654
+ def __init__(self, *args, **kwargs):
655
+ if check_for_class(self, args):
656
+ return
657
+ if len(args) == 1 and len(kwargs) == 0:
658
+ kwargs = args[0]
659
+ if "json" in kwargs and kwargs["json"]:
660
+ if isinstance(kwargs["json"], dict) or isinstance(kwargs["json"], list):
661
+ js = json.dumps(kwargs["json"], separators=(",", ":"))
662
+ else:
663
+ js = kwargs["json"]
664
+
665
+ if len(kwargs["id"]) > 32:
666
+ raise Exception("'id' too long")
667
+
668
+ super(Custom_json, self).__init__(
669
+ OrderedDict(
670
+ [
671
+ ("required_auths", Array([String(o) for o in kwargs["required_auths"]])),
672
+ (
673
+ "required_posting_auths",
674
+ Array([String(o) for o in kwargs["required_posting_auths"]]),
675
+ ),
676
+ ("id", String(kwargs["id"])),
677
+ ("json", String(js)),
678
+ ]
679
+ )
680
+ )
681
+
682
+
683
+ class Comment_options(GrapheneObject):
684
+ def __init__(self, *args, **kwargs):
685
+ if check_for_class(self, args):
686
+ return
687
+ if len(args) == 1 and len(kwargs) == 0:
688
+ kwargs = args[0]
689
+ prefix = kwargs.get("prefix", default_prefix)
690
+ json_str = kwargs.get("json_str", False)
691
+ # handle beneficiaries
692
+ if "beneficiaries" in kwargs and kwargs["beneficiaries"]:
693
+ kwargs["extensions"] = [[0, {"beneficiaries": kwargs["beneficiaries"]}]]
694
+ extensions = Array([])
695
+ if "extensions" in kwargs and kwargs["extensions"]:
696
+ extensions = Array([CommentOptionExtensions(o) for o in kwargs["extensions"]])
697
+ if "percent_hbd" in kwargs:
698
+ super(Comment_options, self).__init__(
699
+ OrderedDict(
700
+ [
701
+ ("author", String(kwargs["author"])),
702
+ ("permlink", String(kwargs["permlink"])),
703
+ (
704
+ "max_accepted_payout",
705
+ Amount(kwargs["max_accepted_payout"], prefix=prefix, json_str=json_str),
706
+ ),
707
+ ("percent_hbd", Uint16(int(kwargs["percent_hbd"]))),
708
+ ("allow_votes", Bool(bool(kwargs["allow_votes"]))),
709
+ ("allow_curation_rewards", Bool(bool(kwargs["allow_curation_rewards"]))),
710
+ ("extensions", extensions),
711
+ ]
712
+ )
713
+ )
714
+ else:
715
+ super(Comment_options, self).__init__(
716
+ OrderedDict(
717
+ [
718
+ ("author", String(kwargs["author"])),
719
+ ("permlink", String(kwargs["permlink"])),
720
+ (
721
+ "max_accepted_payout",
722
+ Amount(kwargs["max_accepted_payout"], prefix=prefix),
723
+ ),
724
+ ("percent_steem_dollars", Uint16(int(kwargs["percent_steem_dollars"]))),
725
+ ("allow_votes", Bool(bool(kwargs["allow_votes"]))),
726
+ ("allow_curation_rewards", Bool(bool(kwargs["allow_curation_rewards"]))),
727
+ ("extensions", extensions),
728
+ ]
729
+ )
730
+ )
731
+
732
+
733
+ class Delete_comment(GrapheneObject):
734
+ def __init__(self, *args, **kwargs):
735
+ if check_for_class(self, args):
736
+ return
737
+ if len(args) == 1 and len(kwargs) == 0:
738
+ kwargs = args[0]
739
+ super(Delete_comment, self).__init__(
740
+ OrderedDict(
741
+ [
742
+ ("author", String(kwargs["author"])),
743
+ ("permlink", String(kwargs["permlink"])),
744
+ ]
745
+ )
746
+ )
747
+
748
+
749
+ class Feed_publish(GrapheneObject):
750
+ def __init__(self, *args, **kwargs):
751
+ if check_for_class(self, args):
752
+ return
753
+ if len(args) == 1 and len(kwargs) == 0:
754
+ kwargs = args[0]
755
+ prefix = kwargs.get("prefix", default_prefix)
756
+ if "prefix" not in kwargs["exchange_rate"]:
757
+ kwargs["exchange_rate"]["prefix"] = prefix
758
+ super(Feed_publish, self).__init__(
759
+ OrderedDict(
760
+ [
761
+ ("publisher", String(kwargs["publisher"])),
762
+ ("exchange_rate", ExchangeRate(kwargs["exchange_rate"])),
763
+ ]
764
+ )
765
+ )
766
+
767
+
768
+ class Convert(GrapheneObject):
769
+ def __init__(self, *args, **kwargs):
770
+ if check_for_class(self, args):
771
+ return
772
+ if len(args) == 1 and len(kwargs) == 0:
773
+ kwargs = args[0]
774
+ prefix = kwargs.get("prefix", default_prefix)
775
+ json_str = kwargs.get("json_str", False)
776
+ super(Convert, self).__init__(
777
+ OrderedDict(
778
+ [
779
+ ("owner", String(kwargs["owner"])),
780
+ ("requestid", Uint32(kwargs["requestid"])),
781
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
782
+ ]
783
+ )
784
+ )
785
+
786
+
787
+ # Operation added for HF25 for the new HBD/Hive conversion operation
788
+ class Collateralized_convert(GrapheneObject):
789
+ def __init__(self, *args, **kwargs):
790
+ if check_for_class(self, args):
791
+ return
792
+ if len(args) == 1 and len(kwargs) == 0:
793
+ kwargs = args[0]
794
+ prefix = kwargs.get("prefix", default_prefix)
795
+ json_str = kwargs.get("json_str", False)
796
+ super(Collateralized_convert, self).__init__(
797
+ OrderedDict(
798
+ [
799
+ ("owner", String(kwargs["owner"])),
800
+ ("requestid", Uint32(kwargs["requestid"])),
801
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
802
+ ]
803
+ )
804
+ )
805
+
806
+
807
+ class Set_withdraw_vesting_route(GrapheneObject):
808
+ def __init__(self, *args, **kwargs):
809
+ if check_for_class(self, args):
810
+ return
811
+ if len(args) == 1 and len(kwargs) == 0:
812
+ kwargs = args[0]
813
+ super(Set_withdraw_vesting_route, self).__init__(
814
+ OrderedDict(
815
+ [
816
+ ("from_account", String(kwargs["from_account"])),
817
+ ("to_account", String(kwargs["to_account"])),
818
+ ("percent", Uint16((kwargs["percent"]))),
819
+ ("auto_vest", Bool(kwargs["auto_vest"])),
820
+ ]
821
+ )
822
+ )
823
+
824
+
825
+ class Limit_order_cancel(GrapheneObject):
826
+ def __init__(self, *args, **kwargs):
827
+ if check_for_class(self, args):
828
+ return
829
+ if len(args) == 1 and len(kwargs) == 0:
830
+ kwargs = args[0]
831
+ super(Limit_order_cancel, self).__init__(
832
+ OrderedDict(
833
+ [
834
+ ("owner", String(kwargs["owner"])),
835
+ ("orderid", Uint32(kwargs["orderid"])),
836
+ ]
837
+ )
838
+ )
839
+
840
+
841
+ class Claim_account(GrapheneObject):
842
+ def __init__(self, *args, **kwargs):
843
+ if check_for_class(self, args):
844
+ return
845
+ if len(args) == 1 and len(kwargs) == 0:
846
+ kwargs = args[0]
847
+ prefix = kwargs.get("prefix", default_prefix)
848
+ json_str = kwargs.get("json_str", False)
849
+ super(Claim_account, self).__init__(
850
+ OrderedDict(
851
+ [
852
+ ("creator", String(kwargs["creator"])),
853
+ ("fee", Amount(kwargs["fee"], prefix=prefix, json_str=json_str)),
854
+ ("extensions", Array([])),
855
+ ]
856
+ )
857
+ )
858
+
859
+
860
+ class Create_claimed_account(GrapheneObject):
861
+ def __init__(self, *args, **kwargs):
862
+ if check_for_class(self, args):
863
+ return
864
+ if len(args) == 1 and len(kwargs) == 0:
865
+ kwargs = args[0]
866
+ prefix = kwargs.get("prefix", default_prefix)
867
+
868
+ if not len(kwargs["new_account_name"]) <= 16:
869
+ raise AssertionError("Account name must be at most 16 chars long")
870
+
871
+ meta = ""
872
+ if "json_metadata" in kwargs and kwargs["json_metadata"]:
873
+ if isinstance(kwargs["json_metadata"], dict):
874
+ meta = json.dumps(kwargs["json_metadata"])
875
+ else:
876
+ meta = kwargs["json_metadata"]
877
+
878
+ super(Create_claimed_account, self).__init__(
879
+ OrderedDict(
880
+ [
881
+ ("creator", String(kwargs["creator"])),
882
+ ("new_account_name", String(kwargs["new_account_name"])),
883
+ ("owner", Permission(kwargs["owner"], prefix=prefix)),
884
+ ("active", Permission(kwargs["active"], prefix=prefix)),
885
+ ("posting", Permission(kwargs["posting"], prefix=prefix)),
886
+ ("memo_key", PublicKey(kwargs["memo_key"], prefix=prefix)),
887
+ ("json_metadata", String(meta)),
888
+ ("extensions", Array([])),
889
+ ]
890
+ )
891
+ )
892
+
893
+
894
+ class Delegate_vesting_shares(GrapheneObject):
895
+ def __init__(self, *args, **kwargs):
896
+ if check_for_class(self, args):
897
+ return
898
+ if len(args) == 1 and len(kwargs) == 0:
899
+ kwargs = args[0]
900
+ prefix = kwargs.get("prefix", default_prefix)
901
+ super(Delegate_vesting_shares, self).__init__(
902
+ OrderedDict(
903
+ [
904
+ ("delegator", String(kwargs["delegator"])),
905
+ ("delegatee", String(kwargs["delegatee"])),
906
+ ("vesting_shares", Amount(kwargs["vesting_shares"], prefix=prefix)),
907
+ ]
908
+ )
909
+ )
910
+
911
+
912
+ class Limit_order_create(GrapheneObject):
913
+ def __init__(self, *args, **kwargs):
914
+ if check_for_class(self, args):
915
+ return
916
+ if len(args) == 1 and len(kwargs) == 0:
917
+ kwargs = args[0]
918
+ prefix = kwargs.get("prefix", default_prefix)
919
+ json_str = kwargs.get("json_str", False)
920
+ super(Limit_order_create, self).__init__(
921
+ OrderedDict(
922
+ [
923
+ ("owner", String(kwargs["owner"])),
924
+ ("orderid", Uint32(kwargs["orderid"])),
925
+ (
926
+ "amount_to_sell",
927
+ Amount(kwargs["amount_to_sell"], prefix=prefix, json_str=json_str),
928
+ ),
929
+ (
930
+ "min_to_receive",
931
+ Amount(kwargs["min_to_receive"], prefix=prefix, json_str=json_str),
932
+ ),
933
+ ("fill_or_kill", Bool(kwargs["fill_or_kill"])),
934
+ ("expiration", PointInTime(kwargs["expiration"])),
935
+ ]
936
+ )
937
+ )
938
+
939
+
940
+ class Limit_order_create2(GrapheneObject):
941
+ def __init__(self, *args, **kwargs):
942
+ if check_for_class(self, args):
943
+ return
944
+ if len(args) == 1 and len(kwargs) == 0:
945
+ kwargs = args[0]
946
+ prefix = kwargs.get("prefix", default_prefix)
947
+ json_str = kwargs.get("json_str", False)
948
+ if "prefix" not in kwargs["exchange_rate"]:
949
+ kwargs["exchange_rate"]["prefix"] = prefix
950
+ super(Limit_order_create2, self).__init__(
951
+ OrderedDict(
952
+ [
953
+ ("owner", String(kwargs["owner"])),
954
+ ("orderid", Uint32(kwargs["orderid"])),
955
+ (
956
+ "amount_to_sell",
957
+ Amount(kwargs["amount_to_sell"], prefix=prefix, json_str=json_str),
958
+ ),
959
+ ("fill_or_kill", Bool(kwargs["fill_or_kill"])),
960
+ ("exchange_rate", ExchangeRate(kwargs["exchange_rate"])),
961
+ ("expiration", PointInTime(kwargs["expiration"])),
962
+ ]
963
+ )
964
+ )
965
+
966
+
967
+ class Change_recovery_account(GrapheneObject):
968
+ def __init__(self, *args, **kwargs):
969
+ if check_for_class(self, args):
970
+ return
971
+ if len(args) == 1 and len(kwargs) == 0:
972
+ kwargs = args[0]
973
+ super(Change_recovery_account, self).__init__(
974
+ OrderedDict(
975
+ [
976
+ ("account_to_recover", String(kwargs["account_to_recover"])),
977
+ ("new_recovery_account", String(kwargs["new_recovery_account"])),
978
+ ("extensions", Array([])),
979
+ ]
980
+ )
981
+ )
982
+
983
+
984
+ class Transfer_from_savings(GrapheneObject):
985
+ def __init__(self, *args, **kwargs):
986
+ if check_for_class(self, args):
987
+ return
988
+ if len(args) == 1 and len(kwargs) == 0:
989
+ kwargs = args[0]
990
+ prefix = kwargs.get("prefix", default_prefix)
991
+ json_str = kwargs.get("json_str", False)
992
+ if "memo" not in kwargs:
993
+ kwargs["memo"] = ""
994
+
995
+ super(Transfer_from_savings, self).__init__(
996
+ OrderedDict(
997
+ [
998
+ ("from", String(kwargs["from"])),
999
+ ("request_id", Uint32(kwargs["request_id"])),
1000
+ ("to", String(kwargs["to"])),
1001
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
1002
+ ("memo", String(kwargs["memo"])),
1003
+ ]
1004
+ )
1005
+ )
1006
+
1007
+
1008
+ class Cancel_transfer_from_savings(GrapheneObject):
1009
+ def __init__(self, *args, **kwargs):
1010
+ if check_for_class(self, args):
1011
+ return
1012
+ if len(args) == 1 and len(kwargs) == 0:
1013
+ kwargs = args[0]
1014
+ super(Cancel_transfer_from_savings, self).__init__(
1015
+ OrderedDict(
1016
+ [
1017
+ ("from", String(kwargs["from"])),
1018
+ ("request_id", Uint32(kwargs["request_id"])),
1019
+ ]
1020
+ )
1021
+ )
1022
+
1023
+
1024
+ class Claim_reward_balance(GrapheneObject):
1025
+ def __init__(self, *args, **kwargs):
1026
+ if check_for_class(self, args):
1027
+ return
1028
+ if len(args) == 1 and len(kwargs) == 0:
1029
+ kwargs = args[0]
1030
+ prefix = kwargs.get("prefix", default_prefix)
1031
+ json_str = kwargs.get("json_str", False)
1032
+ if "reward_sbd" in kwargs and "reward_steem" in kwargs:
1033
+ super(Claim_reward_balance, self).__init__(
1034
+ OrderedDict(
1035
+ [
1036
+ ("account", String(kwargs["account"])),
1037
+ (
1038
+ "reward_steem",
1039
+ Amount(kwargs["reward_steem"], prefix=prefix, json_str=json_str),
1040
+ ),
1041
+ (
1042
+ "reward_sbd",
1043
+ Amount(kwargs["reward_sbd"], prefix=prefix, json_str=json_str),
1044
+ ),
1045
+ ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1046
+ ]
1047
+ )
1048
+ )
1049
+ elif "reward_hbd" in kwargs and "reward_hive" in kwargs:
1050
+ super(Claim_reward_balance, self).__init__(
1051
+ OrderedDict(
1052
+ [
1053
+ ("account", String(kwargs["account"])),
1054
+ ("reward_hive", Amount(kwargs["reward_hive"], prefix=prefix)),
1055
+ ("reward_hbd", Amount(kwargs["reward_hbd"], prefix=prefix)),
1056
+ ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1057
+ ]
1058
+ )
1059
+ )
1060
+ elif "reward_hive" in kwargs:
1061
+ super(Claim_reward_balance, self).__init__(
1062
+ OrderedDict(
1063
+ [
1064
+ ("account", String(kwargs["account"])),
1065
+ (
1066
+ "reward_hive",
1067
+ Amount(kwargs["reward_hive"], prefix=prefix, json_str=json_str),
1068
+ ),
1069
+ ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1070
+ ]
1071
+ )
1072
+ )
1073
+ else:
1074
+ super(Claim_reward_balance, self).__init__(
1075
+ OrderedDict(
1076
+ [
1077
+ ("account", String(kwargs["account"])),
1078
+ ("reward_steem", Amount(kwargs["reward_steem"], prefix=prefix)),
1079
+ ("reward_vests", Amount(kwargs["reward_vests"], prefix=prefix)),
1080
+ ]
1081
+ )
1082
+ )
1083
+
1084
+
1085
+ class Transfer_to_savings(GrapheneObject):
1086
+ def __init__(self, *args, **kwargs):
1087
+ if check_for_class(self, args):
1088
+ return
1089
+ if len(args) == 1 and len(kwargs) == 0:
1090
+ kwargs = args[0]
1091
+ prefix = kwargs.get("prefix", default_prefix)
1092
+ json_str = kwargs.get("json_str", False)
1093
+ if "memo" not in kwargs:
1094
+ kwargs["memo"] = ""
1095
+ super(Transfer_to_savings, self).__init__(
1096
+ OrderedDict(
1097
+ [
1098
+ ("from", String(kwargs["from"])),
1099
+ ("to", String(kwargs["to"])),
1100
+ ("amount", Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
1101
+ ("memo", String(kwargs["memo"])),
1102
+ ]
1103
+ )
1104
+ )
1105
+
1106
+
1107
+ class Request_account_recovery(GrapheneObject):
1108
+ def __init__(self, *args, **kwargs):
1109
+ if check_for_class(self, args):
1110
+ return
1111
+ if len(args) == 1 and len(kwargs) == 0:
1112
+ kwargs = args[0]
1113
+ prefix = kwargs.get("prefix", default_prefix)
1114
+ new_owner = Permission(kwargs["new_owner_authority"], prefix=prefix)
1115
+ super(Request_account_recovery, self).__init__(
1116
+ OrderedDict(
1117
+ [
1118
+ ("recovery_account", String(kwargs["recovery_account"])),
1119
+ ("account_to_recover", String(kwargs["account_to_recover"])),
1120
+ ("new_owner_authority", new_owner),
1121
+ ("extensions", Array([])),
1122
+ ]
1123
+ )
1124
+ )
1125
+
1126
+
1127
+ class Recover_account(GrapheneObject):
1128
+ def __init__(self, *args, **kwargs):
1129
+ if check_for_class(self, args):
1130
+ return
1131
+ if len(args) == 1 and len(kwargs) == 0:
1132
+ kwargs = args[0]
1133
+ prefix = kwargs.get("prefix", default_prefix)
1134
+ new_owner = Permission(kwargs["new_owner_authority"], prefix=prefix)
1135
+ recent_owner = Permission(kwargs["recent_owner_authority"], prefix=prefix)
1136
+ super(Recover_account, self).__init__(
1137
+ OrderedDict(
1138
+ [
1139
+ ("account_to_recover", String(kwargs["account_to_recover"])),
1140
+ ("new_owner_authority", new_owner),
1141
+ ("recent_owner_authority", recent_owner),
1142
+ ("extensions", Array([])),
1143
+ ]
1144
+ )
1145
+ )
1146
+
1147
+
1148
+ class Escrow_transfer(GrapheneObject):
1149
+ def __init__(self, *args, **kwargs):
1150
+ if check_for_class(self, args):
1151
+ return
1152
+ if len(args) == 1 and len(kwargs) == 0:
1153
+ kwargs = args[0]
1154
+ prefix = kwargs.get("prefix", default_prefix)
1155
+ json_str = kwargs.get("json_str", False)
1156
+ meta = ""
1157
+ if "json_meta" in kwargs and kwargs["json_meta"]:
1158
+ if isinstance(kwargs["json_meta"], dict) or isinstance(kwargs["json_meta"], list):
1159
+ meta = json.dumps(kwargs["json_meta"])
1160
+ else:
1161
+ meta = kwargs["json_meta"]
1162
+ if "hbd_amount" in kwargs and "hive_amount" in kwargs:
1163
+ super(Escrow_transfer, self).__init__(
1164
+ OrderedDict(
1165
+ [
1166
+ ("from", String(kwargs["from"])),
1167
+ ("to", String(kwargs["to"])),
1168
+ ("agent", String(kwargs["agent"])),
1169
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1170
+ (
1171
+ "hbd_amount",
1172
+ Amount(kwargs["hbd_amount"], prefix=prefix, json_str=json_str),
1173
+ ),
1174
+ (
1175
+ "hive_amount",
1176
+ Amount(kwargs["hive_amount"], prefix=prefix, json_str=json_str),
1177
+ ),
1178
+ ("fee", Amount(kwargs["fee"], prefix=prefix, json_str=json_str)),
1179
+ ("ratification_deadline", PointInTime(kwargs["ratification_deadline"])),
1180
+ ("escrow_expiration", PointInTime(kwargs["escrow_expiration"])),
1181
+ ("json_meta", String(meta)),
1182
+ ]
1183
+ )
1184
+ )
1185
+ else:
1186
+ super(Escrow_transfer, self).__init__(
1187
+ OrderedDict(
1188
+ [
1189
+ ("from", String(kwargs["from"])),
1190
+ ("to", String(kwargs["to"])),
1191
+ ("agent", String(kwargs["agent"])),
1192
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1193
+ ("sbd_amount", Amount(kwargs["sbd_amount"], prefix=prefix)),
1194
+ ("steem_amount", Amount(kwargs["steem_amount"], prefix=prefix)),
1195
+ ("fee", Amount(kwargs["fee"], prefix=prefix)),
1196
+ ("ratification_deadline", PointInTime(kwargs["ratification_deadline"])),
1197
+ ("escrow_expiration", PointInTime(kwargs["escrow_expiration"])),
1198
+ ("json_meta", String(meta)),
1199
+ ]
1200
+ )
1201
+ )
1202
+
1203
+
1204
+ class Escrow_dispute(GrapheneObject):
1205
+ def __init__(self, *args, **kwargs):
1206
+ if check_for_class(self, args):
1207
+ return
1208
+ if len(args) == 1 and len(kwargs) == 0:
1209
+ kwargs = args[0]
1210
+ super(Escrow_dispute, self).__init__(
1211
+ OrderedDict(
1212
+ [
1213
+ ("from", String(kwargs["from"])),
1214
+ ("to", String(kwargs["to"])),
1215
+ ("who", String(kwargs["who"])),
1216
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1217
+ ]
1218
+ )
1219
+ )
1220
+
1221
+
1222
+ class Escrow_release(GrapheneObject):
1223
+ def __init__(self, *args, **kwargs):
1224
+ if check_for_class(self, args):
1225
+ return
1226
+ if len(args) == 1 and len(kwargs) == 0:
1227
+ kwargs = args[0]
1228
+ prefix = kwargs.get("prefix", default_prefix)
1229
+ json_str = kwargs.get("json_str", False)
1230
+ if "hive_amount" in kwargs and "hbd_amount" in kwargs:
1231
+ super(Escrow_release, self).__init__(
1232
+ OrderedDict(
1233
+ [
1234
+ ("from", String(kwargs["from"])),
1235
+ ("to", String(kwargs["to"])),
1236
+ ("who", String(kwargs["who"])),
1237
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1238
+ (
1239
+ "hbd_amount",
1240
+ Amount(kwargs["hbd_amount"], prefix=prefix, json_str=json_str),
1241
+ ),
1242
+ (
1243
+ "hive_amount",
1244
+ Amount(kwargs["hive_amount"], prefix=prefix, json_str=json_str),
1245
+ ),
1246
+ ]
1247
+ )
1248
+ )
1249
+ else:
1250
+ super(Escrow_release, self).__init__(
1251
+ OrderedDict(
1252
+ [
1253
+ ("from", String(kwargs["from"])),
1254
+ ("to", String(kwargs["to"])),
1255
+ ("who", String(kwargs["who"])),
1256
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1257
+ ("sbd_amount", Amount(kwargs["sbd_amount"], prefix=prefix)),
1258
+ ("steem_amount", Amount(kwargs["steem_amount"], prefix=prefix)),
1259
+ ]
1260
+ )
1261
+ )
1262
+
1263
+
1264
+ class Escrow_approve(GrapheneObject):
1265
+ def __init__(self, *args, **kwargs):
1266
+ if check_for_class(self, args):
1267
+ return
1268
+ if len(args) == 1 and len(kwargs) == 0:
1269
+ kwargs = args[0]
1270
+ super(Escrow_approve, self).__init__(
1271
+ OrderedDict(
1272
+ [
1273
+ ("from", String(kwargs["from"])),
1274
+ ("to", String(kwargs["to"])),
1275
+ ("agent", String(kwargs["agent"])),
1276
+ ("who", String(kwargs["who"])),
1277
+ ("escrow_id", Uint32(kwargs["escrow_id"])),
1278
+ ("approve", Bool(kwargs["approve"])),
1279
+ ]
1280
+ )
1281
+ )
1282
+
1283
+
1284
+ class Decline_voting_rights(GrapheneObject):
1285
+ def __init__(self, *args, **kwargs):
1286
+ if check_for_class(self, args):
1287
+ return
1288
+ if len(args) == 1 and len(kwargs) == 0:
1289
+ kwargs = args[0]
1290
+ super(Decline_voting_rights, self).__init__(
1291
+ OrderedDict(
1292
+ [
1293
+ ("account", String(kwargs["account"])),
1294
+ ("decline", Bool(kwargs["decline"])),
1295
+ ]
1296
+ )
1297
+ )