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